Does get_bounds return the x1,y1,x2,y2 of the item/group?

On Tue, Jun 17, 2008 at 3:01 PM, Damon Chaplin <damon@karuna.eclipse.co.uk> wrote:

On Mon, 2008-06-16 at 22:57 -0500, Jamie Lahowetz wrote:
> I'm trying to get the bounds of grouped items using the perl bindings:
> 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,
> $easting,$northing);
>         print " ($latitude, $longitude)";
>
>         #Drop waypoint icon
>         my $tgroup = Goo::Canvas::Group->new ($root);
>         Goo::Canvas::Ellipse->new($tgroup,$event->x,$event->y,7.5,7.5,
>             fill_color => 'purple',
>             stroke_color => 'black');
>         Goo::Canvas::Text->new ($tgroup,$count,$event->x,
> $event->y,-1,'GTK_ANCHOR_CENTER',
>             font => 'Sans Bold 15',
>             fill_color => 'pink',
>         );
>         print " $count\n";
>
>         $waypoints{$count } = {'x' => $event->x,'y' => $event->y,
> 'lat' => $latitude, 'long' => $longitude};
>         $count++;
>         push(@drop,$tgroup);
>     }
>
>     #remove waypoints
>     if ($event->type eq "button-press" && $event->button == 3){
>         print "right click\n";
>     foreach (@drop){
>         #    my ($x1, $y1, $x2, $y2) = $_->get_bounds;
>             print $_->get_bounds,"\n";
>     }
>
> The idea is that the user can add a waypoint by double clicking, then
> remove that waypoint by right clicking over thepoint. The thing is
> that I dont quite understand how to get the x and y bounds of the
> item. Any ideas?

get_bounds() should return the bounds of the item, in device space (as
long as the item has been added to the canvas). Is that not working?

You could also use goo_canvas_get_items_at() or
goo_canvas_get_items_in_area() to get the items in a particular
point/area.

Damon



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Goocanvas-devel mailing list
Goocanvas-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/goocanvas-devel



--
Jamie Ryan Lahowetz
University of Nebraska - Lincoln
Graduate Student - Geosciences
402.304.0766
jlahowe2@bigred.unl.edu