NAME
Gtk2::Ex::Geo::Overlay - A Gtk2 widget for a visual overlay of spatial data
SYNOPSIS
my $overlay = Gtk2::Ex::Geo::Overlay->new();
$overlay->my_inits();
DESCRIPTION
Gtk2::Ex::Geo::Overlay is a subclass of Gtk2::ScrolledWindow
ATTRIBUTES
public:
bg_color = ($red, $green, $blue) # a color for the background for the overlay
rubberbanding = FALSE, /line/, /rect/, /circle/
private:
image event_box zoom_factor step
METHODS
my_inits
some initializations which cannot be done automagically (for some reason unknown to me...)
add_layer($layer,$do_not_zoom_to);
adds a spatial data layer to the top of the overlay, the default behavior is to zoom to the new layer
zoom_to($layer) or zoom_to($minx,$miny,$maxx,$maxy)
sets the given bounding box as the world
zoom_to_all
sets the bounding box which bounds all layers as the world
set_event_handler($event_handler,$user_param)
sets a subroutine which gets called when something happens in the widget, the sub is called like this: $event_handler->($user_param,$event,@xy);
set_draw_on($draw_on,$user_param)
sets a subroutine which gets called whenever a new pixmap is drawn for the widget, the sub is called like this: $draw_on->($user_param,$pixmap);
visible_area
returns ($minx,$maxy,$maxx,$miny), the visible area of the world
render
does the actual rendering by calling (creating) a new Gtk2::Ex::Geo::Renderer object
zoom($w_offset,$h_offset,$pixel_width)
select a part of the world into the visible area
zoom_in($event,$center_x,$center_y)
zooms in a zoom_factor amount
zoom_out($event,$center_x,$center_y)
zooms out a zoom_factor amount
note: may enlarge the world
pan($w_move,$h_move,$event)
pans the viewport
internal handling of key and button events
+ => zoom_in - => zoom_out arrow keys => pan
the attribute rubberbanding defines what is done with button press, move and release
coordinate transforms
event_pixel2point => returns event coordinates stored in a private attribute as world coordinates
point2pixmap_pixel => returns world coordinates as pixmap pixel coordinates