Geoinformatica  0.90
Geo.pm
Go to the documentation of this file.
1 #** @file Geo.pm
2 #*
3 
4 package Gtk2::Ex::Geo;
5 
6 use strict;
7 use warnings;
8 use XSLoader;
9 
10 use Carp;
11 use Glib qw/TRUE FALSE/;
12 use Gtk2;
13 use Gtk2::Gdk::Keysyms; # in Overlay
14 
15 use Gtk2::GladeXML;
17 
19 
20 BEGIN {
21  use Exporter 'import';
22  our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
23  our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
24  our @EXPORT = qw( );
25  our $VERSION = '0.66';
26  XSLoader::load( 'Gtk2::Ex::Geo', $VERSION );
27 }
28 
29 sub exception_handler {
30  my($msg) = @_;
31  print STDERR "$msg\n";
32 }
33 
34 =head1 NAME
35 
36 Gtk2::Ex::Geo - The main module to use for geospatial applications
37 
38 =head1 USAGE
39 
40  use Glib qw/TRUE FALSE/;
41  use Gtk2;
42  use Gtk2::Ex::Geo;
43  # use any layer classes you may need/have
44 
45  Gtk2->init;
46 
47  # construct the main window
48  my $window = Gtk2::Window->new;
49 
50  # construct the glue object (contains some widgets)
51  my $gis = Gtk2::Ex::Geo::Glue->new( main_window => $window );
52 
53  # register layer classes
54  $gis->register_class('Gtk2::Ex::Geo::Layer');
55 
56  # continue with the main window
57  # the layer list and the map will be next to each other
58  my $hbox = Gtk2::HBox->new(FALSE, 0);
59 
60  # layer list
61  my $list = Gtk2::ScrolledWindow->new();
62  $list->set_policy("never", "automatic");
63  $list->add($gis->{tree_view});
64  $hbox->pack_start($list, FALSE, FALSE, 0);
65 
66  # add the map
67  $hbox->pack_start($gis->{overlay}, TRUE, TRUE, 0);
68 
69  # the toolbar (menu), the layer list + map, the command line entry,
70  # and the statusbar will be on top of each other
71  my $vbox = Gtk2::VBox->new(FALSE, 0);
72  $vbox->pack_start($gis->{toolbar}, FALSE, FALSE, 0);
73  $vbox->pack_start($hbox, TRUE, TRUE, 0);
74  $vbox->pack_start($gis->{entry}, FALSE, FALSE, 0);
75  $vbox->pack_start($gis->{statusbar}, FALSE, FALSE, 0);
76 
77  $window->add($vbox);
78  $window->signal_connect("destroy", \&close_the_app, [$window, $gis]);
79  $window->set_default_size(600,600);
80  $window->show_all;
81 
82  Gtk2->main;
83 
84  sub close_the_app {
85  my($window, $gis) = @{$_[1]};
86  $gis->close();
87  Gtk2->main_quit;
88  exit(0);
89  }
90 
91 =head1 DESCRIPTION
92 
93 Gtk2::Ex::Geo is a namespace for modules, classes, and widgets for
94 geospatial applications. The idea is to provide a canvas for
95 geospatial data, a set of dialogs, and glue code. This package
96 contains the modules:
97 
98 B<Gtk2::Ex::Geo>
99 
100 The main module to 'use'.
101 
102 B<Gtk2::Ex::Geo::Canvas>
103 
104 A subclass of Gtk2::Gdk::Pixbuf. Constructs a pixbuf with a map from a
105 stack of geospatial layer objects by calling the 'render' method for
106 each $layer.
107 
108 B<Gtk2::Ex::Geo::Overlay>
109 
110 A subclass of Gtk2::ScrolledWindow. A canvas in a scrolled
111 window. Contains a list of layer objects. Functionality includes
112 redraw, support for selections (point, line, path, rectangle, polygon,
113 or many of them), zoom, pan, and conversion between event and world
114 (layer) coordinates.
115 
116 B<Gtk2::Ex::Geo::Layer>
117 
118 The root class for geospatial layers. A geospatial layer is a
119 typically a subclass of a geospatial data (raster, vector features, or
120 something else) and of this class. The idea is that this class
121 contains visualization information (transparency, palette, colors,
122 symbology, label placement, etc) for the data. Contains many callbacks
123 that are fired as a result of user using context menu, making a
124 selection, etc. Uses layer dialogs.
125 
126 B<Gtk2::Ex::Geo::DialogMaster>
128 A class which maintains a set of Glade dialogs taken from XML in DATA
129 section.
130 
131 B<Gtk2::Ex::Geo::Dialogs>
132 
133 A subclass of Gtk2::Ex::Geo::DialogMaster. Contains dialogs for
135 
136 B<Gtk2::Ex::Geo::Glue>
137 
138 Typically a singleton class for an object, which manages a
139 Gtk2::Ex::Geo::Overlay widget, a Gtk2::TreeView widgets, and other
140 widgets of a geospatial application. The object also takes care of
141 popping up context menus and other things.
142 
143 B<Gtk2::Ex::Geo::History>
144 
145 Input history for the command line entry a'la (at least attempting)
146 GNU history. The command line entry is managed by Glue object with
147 Gtk2::Entry.
148 
149 B<Gtk2::Ex::Geo::TreeDumper>
150 
151 From http://www.asofyet.org/muppet/software/gtk2-perl/treedumper.pl-txt
152 For inspecting layer and other objects.
153 
154 =head1 DOCUMENTATION
155 
156 The documentation of Gtk2::Ex::Geo is included into the source code in
157 doxygen format. The documentation can be generated in HTML, LaTeX, and
158 other formats using the doxygen executable and the perl doxygen
159 filter.
160 
161 1) http://www.stack.nl/~dimitri/doxygen
162 2) http://search.cpan.org/~jordan/Doxygen-Filter-Perl/
163 3) http://arijolma.org/
164 
165 =cut
166 
167 1;
public scalar new(hash params)