I C. Its good to know for future development but right now neither saving or zooming are that important right now. Right now I have it so that the user can click and hold to pan, double click to add a waypoint, and when the waypoints are more than one they are connected by a line in sequence. But there are a few more things to do. Right now when there are three waypoints, a line connecting points 1 and 3 making it a circuit but when you add a fourth the previous line stays and then you get two circuits. Its hard to explain so you can get a screenshot here . The line from 3 to 1 should not be there. Any ideas on how to stop this from happening? Also I want the user to be able to remove the waypoints. Is it possible to drop the lines and waypoints into a hash and have canvas draw them after every event? This allows me to manipulate the objects with ease.
sub event_handler { my ( $widget, $event ) = @_; # print $widget ,' ',$event->type,"\n"; #on 2 mouse presses, place waypoint if ( $event->type eq "2button-press" ) { print 'x->',$event->x,' ','y->',$event->y; #convert UTM to Lat and Long my $easting = $ps[0] * $event->x + 0.0 * $event->y + $mtp[3]; my $northing = (-$ps[1]) * $event->y + 0.0 * $event->x + $mtp[ +4]; my ($latitude,$longitude)=utm_to_latlon($ellipsoid,$zone,$east +ing,$northing); print " ($latitude, $longitude)\n"; #Drop icon my $tgroup = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas +::Group', x => $event->x, y => $event->y); Gnome2::Canvas::Item->new($tgroup, 'Gnome2::Canvas::Ellipse', x1 => -7.5, y1 => -7.5, x2 => 7.5, y2 => 7.5, fill_color => 'purple', outline_color => 'black'); Gnome2::Canvas::Item->new ($tgroup, 'Gnome2::Canvas::Text', "text", "$count", "x", 0.0, "y", 0.0, "font", "Sans Bold", "anchor", 'GTK_ANCHOR_NW', "weight", 100, "fill_color", 'red', "size_points", 20); #add waypoints $waypoints{$count } = {'x' => $event->x,'y' => $event->y, 'lat +' => $latitude, 'long' => $longitude}; print "size of hash: " . keys( %waypoints ) . ".\n"; #foreach my $num (sort keys %waypoints){ # print "$num = $waypoints{$num}\n"; # foreach my $subkey (sort keys %{$waypoints{$num}}){ # print "$subkey = $waypoints{$num}{$subkey}\n"; # } #} #draw lines to the waypoints if ($count >= 2){ my @points; foreach my $key (sort keys %waypoints){ foreach my $subkey (sort keys %{$waypoints{$key}}){ if ($subkey eq 'x' || $subkey eq 'y'){ push(@points, $waypoints{$key}{$subkey}); print "$key $subkey = $waypoints{$key}{$subkey +}\n"; } } } if ($count >= 3){ push(@points, $waypoints{1}{'x'}); push(@points, $waypoints{1}{'y'}); } my $lgroup = Gnome2::Canvas::Item->new ($root, 'Gnome2::Ca +nvas::Group'); Gnome2::Canvas::Item->new ($lgroup, 'Gnome2::Canvas::Line', points => [@points], fill_color => 'black', width_units => 4.0); foreach (@points){ print $_, "\n"; } } #print $count, "\n"; $tgroup->raise_to_top(); $count++; } }

In reply to Re^6: geoTiff Application Building by deadpickle
in thread geoTiff Application Building by deadpickle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.