Geocanvas Reference Manual |
---|
GeoCanvasGeoCanvas — the main widget for the geographic canvas. |
enum GeoFunctionState; #define GEO_TYPE_FUNCTION_STATE GeoCanvasPrivate; GeoCanvas; GeoCanvasClass; GType geo_canvas_get_type (void); void geo_canvas_center_on (GeoCanvas *canvas, double lon, double lat); void geo_canvas_set_viewport_g (GeoCanvas *canvas, double lon1, double lat1, double lon2, double lat2); void geo_canvas_set_viewport_w (GeoCanvas *canvas, double wx1, double wy1, double wx2, double wy2); void geo_canvas_get_viewport_w (GeoCanvas *canvas, double *wx1, double *wy1, double *wx2, double *wy2); void geo_canvas_zoom (GeoCanvas *canvas, double z); void geo_canvas_max_extents (GeoCanvas *canvas); void geo_canvas_set_max_extents (GeoCanvas *canvas, double lon1, double lat1, double lon2, double lat2); void geo_canvas_activate_reference (GeoCanvas *canvas, int button, gboolean onetime); void geo_canvas_deactivate_reference (GeoCanvas *canvas); void geo_canvas_activate_pan (GeoCanvas *canvas, int button, gboolean onetime); void geo_canvas_deactivate_pan (GeoCanvas *canvas); void geo_canvas_activate_zoombox (GeoCanvas *canvas, int button, gboolean onetime); void geo_canvas_deactivate_zoombox (GeoCanvas *canvas); void geo_canvas_activate_center (GeoCanvas *canvas, int button, gboolean onetime); void geo_canvas_deactivate_center (GeoCanvas *canvas); GeoCanvas* geo_canvas_new_replace (GtkWidget *window, const gchar *canvas_name);
GObject +----GtkObject +----GtkWidget +----GtkContainer +----GtkLayout +----FooCanvas +----GeoCanvas
"center-button" gint : Read / Write "center-cursor" gint : Read / Write "center-state" GeoFunctionState : Read / Write "extents-level" gint : Read "pan-button" gint : Read / Write "pan-cursor" gint : Read / Write "pan-state" GeoFunctionState : Read / Write "projection" GeoProjection : Read / Write "reference-button" gint : Read / Write "reference-cursor" gint : Read / Write "reference-state" GeoFunctionState : Read / Write "zoombox-button" gint : Read / Write "zoombox-cursor" gint : Read / Write "zoombox-fill-color-rgba" gulong : Read / Write "zoombox-outline-color-rgba" gulong : Read / Write "zoombox-state" GeoFunctionState : Read / Write
"before-update" void user_function (GeoCanvas *geocanvas, gpointer user_data); "projection-changed" void user_function (GeoCanvas *geocanvas, gpointer user_data); "scroll-region-changed" void user_function (GeoCanvas *geocanvas, gpointer user_data); "viewport-changed" void user_function (GeoCanvas *geocanvas, gpointer user_data);
The GeoCanvas widget adds scroll area and viewport area management functionality to the GnomeCanvas. Such functionality becomes relevant when dealing with geography because the 'geo' view is bounded by longitude and latitude coordinates. Any stock GnomeCanvasItem can be represented on the GeoCanvas; however, all items should be made aware of the additional mapping between GnomeCanvas 'world' coordinates and GeoCanvas 'geo' coordinates. The GeoCanvasLnarr and GeoCanvasPlace items have this awareness built-in.
Creating the canvas is essentially the same as creating a
GnomeCanvas
.
GtkWidget *canvas, *scrolledwindow; scrolledwindow = gtk_scrolled_window_new (NULL, NULL); canvas = GTK_WIDGET(g_object_new(GEO_TYPE_CANVAS, NULL)); gtk_widget_show (canvas); gtk_container_add (GTK_CONTAINER (scrolledwindow), canvas);
typedef enum { GEO_INACTIVE, GEO_SINGLE_ACTIVE, GEO_CONTINUOUS_ACTIVE } GeoFunctionState;
typedef struct _GeoCanvasPrivate GeoCanvasPrivate;
This implementation has been hidden from global view.
typedef struct { FooCanvasClass parent_class; /* Signals go here */ /** * projection_changed: * @canvas: * * This indicates either that the canvas is using a new projection * object or that some property of the existing projection object has * changed. Canvas items should use this signal instead of the signal * that comes directly from the projection. **/ void (*projection_changed)(GeoCanvas *canvas); /** * viewport_changed: * @canvas: * * This signal is emitted one second after the user stops manipulating * the zoom, pan, horizontal, or vertical adjustments. **/ void (*viewport_changed)(GeoCanvas *canvas); /** * scroll_region_changed: * @canvas: * * This signal is emitted whenever the GeoCanvas automatically modifies * the scrolling region. As the user zooms in, the GeoCanvas * automatically shrinks the scrolling region so that it is not * unreasonably large and to prevent recursion issues during the render * phase of the AA canvas. As the user zooms out the GeoCanvas will * increase the scrolling region. **/ void (*scroll_region_changed)(GeoCanvas *canvas); /** * before_update: * @canvas: * * This signal is emitted just prior to a canvas update. It is an idle * handler on a higher priority than the canvas. This is a good * time to add or remove canvas items that may be queued up. **/ void (*before_update)(GeoCanvas *canvas); } GeoCanvasClass;
void geo_canvas_center_on (GeoCanvas *canvas, double lon, double lat);
Centers around a geographic point. This does not change the projection reference point, so unless you are zoomed in and using a cylyndrical projection, this routine is really of little use.
canvas : |
|
lon : |
Longitude in degrees. |
lat : |
Latitude in degrees. |
void geo_canvas_set_viewport_g (GeoCanvas *canvas, double lon1, double lat1, double lon2, double lat2);
Sets the canvas viewport in geographic coordinates. This will reset the reference point for the projection to the center of the viewport.
canvas : |
|
lon1 : |
Longitude in degrees. |
lat1 : |
Latitude in degrees. |
lon2 : |
Longitude in degrees. |
lat2 : |
Latitude in degrees. |
void geo_canvas_set_viewport_w (GeoCanvas *canvas, double wx1, double wy1, double wx2, double wy2);
Sets the screen viewport in canvas world coordinates. This will reset the reference point for the projection to the center of the viewport.
canvas : |
|
wx1 : |
Canvas world coordinate left. |
wy1 : |
Canvas world coordinate top. |
wx2 : |
Canvas world coordinate right. |
wy2 : |
Canvas world coordinate bottom. |
void geo_canvas_get_viewport_w (GeoCanvas *canvas, double *wx1, double *wy1, double *wx2, double *wy2);
Gets the screen viewport in canvas world coordinates.
canvas : |
|
wx1 : |
Canvas world coordinate left. |
wy1 : |
Canvas world coordinate top. |
wx2 : |
Canvas world coordinate right. |
wy2 : |
Canvas world coordinate bottom. |
void geo_canvas_zoom (GeoCanvas *canvas, double z);
Zooms in or out around the present center point. For example a z value of 2 will zoom reduce the viewed area by 2. A z value of 0.5 will increase the viewed area by 2.
canvas : |
|
z : |
The percentage to zoom in or out. |
void geo_canvas_max_extents (GeoCanvas *canvas);
Sets the viewport to show the most optimum view of the whole world.
canvas : |
void geo_canvas_set_max_extents (GeoCanvas *canvas, double lon1, double lat1, double lon2, double lat2);
Forces the boundaries of the map to fixed locations. Scrolling and zooming will not allow the map to show more than this area. Calling this function overrides the canvas automatic extent setting mechanism. WARNING: If map data is provided that covers an area much larger than this, then things can get really messed up. Be careful with what you try to draw after calling this.
canvas : |
|
lon1 : |
Longitude in degrees. |
lat1 : |
Latitude in degrees. |
lon2 : |
Longitude in degrees. |
lat2 : |
Latitude in degrees. |
void geo_canvas_activate_reference (GeoCanvas *canvas, int button, gboolean onetime);
Activates a reference select from the cursor. When the user clicks on the canvas, that reference point will be selected. This function is also available via the reference-state property.
canvas : |
|
button : |
Which mouse button to use (left = 1, middle = 2, right = 3). |
onetime : |
FALSE cause this to remain activated when the action is complete. |
void geo_canvas_deactivate_reference (GeoCanvas *canvas);
Deactivates the reference select function. This function is also available via the reference-state property.
canvas : |
void geo_canvas_activate_pan (GeoCanvas *canvas, int button, gboolean onetime);
Activates a pan select from the cursor. When the user clicks and drags on the canvas, the canvas will pan to the cursor motion. This function is also available via the pan-state property.
canvas : |
|
button : |
Which mouse button to use (left = 1, middle = 2, right = 3). |
onetime : |
FALSE cause this to remain activated when the action is complete. |
void geo_canvas_deactivate_pan (GeoCanvas *canvas);
Deactivates the panning function. This function is also available via the pan-state property.
canvas : |
void geo_canvas_activate_zoombox (GeoCanvas *canvas, int button, gboolean onetime);
Activates a zoom box select from the cursor. When the user clicks and drags on the canvas, a zoom box will appear around the click center point. This function is also available via the zoombox-state property.
canvas : |
|
button : |
Which mouse button to use (left = 1, middle = 2, right = 3). |
onetime : |
FALSE cause this to remain activated when the action is complete. |
void geo_canvas_deactivate_zoombox (GeoCanvas *canvas);
Deactivates the zoombox function. This function is also available via the zoombox-state property.
canvas : |
void geo_canvas_activate_center (GeoCanvas *canvas, int button, gboolean onetime);
Activates a center point select from the cursor. When the user clicks on the canvas, the canvas will center around the cursor point without changing zoom scale. This function is also available via the center-state property.
canvas : |
|
button : |
Which mouse button to use (left = 1, middle = 2, right = 3). |
onetime : |
FALSE cause this to remain activated when the action is complete. |
void geo_canvas_deactivate_center (GeoCanvas *canvas);
Deactivates the center select function. This function is also available via the center-state property.
canvas : |
GeoCanvas* geo_canvas_new_replace (GtkWidget *window, const gchar *canvas_name);
This is a hack to destroy a regular FooCanvas object and replaces it with a GeoCanvas. It is here as a convenience to facilitate development using glade. i.e., Use glade to create the GUI with one or more FooCanvas widgets, then call this function to replace each FooCanvas widget with a GeoCanvas widget. Someday a nice Glade module would eliminate the need for this function.
If you are not using glade, then just use g_object_new to create the GeoCanvas.
window : |
The applications main window. |
canvas_name : |
The name of the canvas that was specified using glade. |
Returns : | The newly created GeoCanvas. |
center-button
" property"center-button" gint : Read / Write
Left button=1, middle = 2, right = 3.
Allowed values: [0,5]
Default value: 1
center-cursor
" property"center-cursor" gint : Read / Write
GDK Cursor to use when center is selected.
Allowed values: [0,153]
Default value: 24
center-state
" property"center-state" GeoFunctionState : Read / Write
Activates a center point select from the cursor. When the user clicks on the
canvas, the canvas will center around the cursor point without changing zoom
scale. This function is also available via geo_canvas_activate_center()
.
Default value: GEO_INACTIVE
extents-level
" property"extents-level" gint : Read
This is an integer representation of the scroll region where zero represents the whole world and 4 represents a scroll area that is only 10 miles or so across. I doubt it will ever be larger than 5 or 6. Right now there are no zooming limitations.
Allowed values: [0,10]
Default value: 0
pan-button
" property"pan-button" gint : Read / Write
Left button=1, middle = 2, right = 3.
Allowed values: [0,5]
Default value: 2
pan-cursor
" property"pan-cursor" gint : Read / Write
GDK Cursor to use when pan is selected.
Allowed values: [0,153]
Default value: 56
pan-state
" property"pan-state" GeoFunctionState : Read / Write
Activates a reference select from the cursor. When the user clicks on the
canvas, that reference point will be selected. This function is also available
via geo_canvas_activate_reference()
.
Default value: GEO_INACTIVE
projection
" property"projection" GeoProjection : Read / Write
This property holds a reference to the GeoProjection that is currently in use by this canvas. It is feasible that an application may hold greater than one canvas, each with its own projection reference. It is also feasible that a particular canvas's projection reference could be changed dynamically.
reference-button
" property"reference-button" gint : Read / Write
Left button=1, middle = 2, right = 3.
Allowed values: [0,5]
Default value: 1
reference-cursor
" property"reference-cursor" gint : Read / Write
GDK Cursor to use when reference is selected.
Allowed values: [0,153]
Default value: 24
reference-state
" property"reference-state" GeoFunctionState : Read / Write
Activates a reference select from the cursor. When the user clicks on the
canvas, that reference point will be selected. This function is also available
via geo_canvas_activate_reference()
.
Default value: GEO_INACTIVE
zoombox-button
" property"zoombox-button" gint : Read / Write
Left button=1, middle = 2, right = 3.
Allowed values: [0,5]
Default value: 2
zoombox-cursor
" property"zoombox-cursor" gint : Read / Write
GDK Cursor to use when zoombox is selected.
Allowed values: [0,153]
Default value: 52
zoombox-fill-color-rgba
" property"zoombox-fill-color-rgba" gulong : Read / Write
Zoombox Fill Color RGBA.
zoombox-outline-color-rgba
" property"zoombox-outline-color-rgba" gulong : Read / Write
Zoombox Outline Color RGBA.
zoombox-state
" property"zoombox-state" GeoFunctionState : Read / Write
Activates a zoom box select from the cursor. When the user clicks and drags on
the canvas, a zoom box will appear around the click center point. This function
is also available via geo_canvas_activate_zoombox()
.
Default value: GEO_INACTIVE
void user_function (GeoCanvas *geocanvas, gpointer user_data);
This signal is emitted just prior to a canvas update. It is an idle handler on a higher priority than the canvas. This is a good time to add or remove canvas items that may be queued up.
geocanvas : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GeoCanvas *geocanvas, gpointer user_data);
This indicates either that the canvas is using a new projection object or that some property of the existing projection object has changed. Canvas items should use this signal instead of the signal that comes directly from the projection.
geocanvas : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GeoCanvas *geocanvas, gpointer user_data);
This signal is emitted whenever the GeoCanvas automatically modifies the scrolling region. As the user zooms in, the GeoCanvas automatically shrinks the scrolling region so that it is not unreasonably large and to prevent recursion issues during the render phase of the AA canvas. As the user zooms out the GeoCanvas will increase the scrolling region.
geocanvas : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GeoCanvas *geocanvas, gpointer user_data);
This signal is emitted one second after the user stops manipulating the zoom, pan, horizontal, or vertical adjustments.
geocanvas : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |
<< GeoProjection | GeoCanvasGroup >> |