NAME

Gtk2::Ex::Geo::Overlay - A Gtk2 widget for a visual overlay of geospatial 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/, /ellipse/

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

layer_count

get_layer_by_index($index)

get_layer_by_name($name)

returns a layer by its index (top = 0) or name

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);

get_focus

Returns the visible area or the selection, if one exists, as ($minx, $miny, $maxx, $maxy).

render(key=>value,..)

Does the actual rendering by calling (creating) a new Gtk2::Ex::Geo::Renderer object. Creates the pixmap for the image. Deletes the backup pixmap if one exists. Currently used parameters:

filename=>filename, type=>type

if filename is set, calls pixbuf->save with given options

create_backup_pixmap

Creates a backup pixmap unless one already exists.

restore_pixmap

Restores the pixmap to the state it was right after last call to create_backup_pixmap that actually had an effect.

update_image

Updates the image on the screen to show the changes in pixmap.

zoom($w_offset, $h_offset, $pixel_size)

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 as world coordinates

point2pixmap_pixel => returns world coordinates as pixmap pixel coordinates

SEE ALSO

Gtk2::Ex::Geo

AUTHOR

Ari Jolma, <ajolma at tkk.fi>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Ari Jolma

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.