Geocanvas Reference Manual |
---|
GeoCanvasGroupGeoCanvasGroup — A homogenous group of canvas items. |
GeoCanvasGroupPrivate; GeoCanvasGroup; GeoCanvasGroupClass; GeoCanvasGroup* geo_canvas_group_new (FooCanvasGroup *parent, GType type, const gchar *first_arg_name, ...); void geo_canvas_group_request_g2w (GeoCanvasGroup *group); void geo_canvas_group_begin (GeoCanvasGroup *group); GObject* geo_canvas_group_add_point (GeoCanvasGroup *group, double lon, double lat); GObject* geo_canvas_group_end_segment (GeoCanvasGroup *group); void geo_canvas_group_end (GeoCanvasGroup *group);
GObject +----GtkObject +----FooCanvasItem +----FooCanvasGroup +----GeoCanvasGroup +----GeoCanvasLines +----GeoCanvasPlaces +----GeoCanvasShapes
"itemtype" guint : Read / Write "maxx" gdouble : Read "maxy" gdouble : Read "minx" gdouble : Read "miny" gdouble : Read
The GeoCanvasGroup is an abstract class used to hold multiple canvas items having of the same type and having the same properties. The items in the group may be polygons, polylines, text, pixbufs, or canvas groups. This interface is useful when plotting map data because the properties for all of the objects can be controlled via the properties of the group. There are presently three concrete class that implement this interface GeoCanvasLines, GeoCanvasPlaces, and GeoCanvasShapes.
This example draws a rectangle onto the canvas:
GeoCanvasGroup *group; group = geo_canvas_group_new(parent, GEO_TYPE_CANVAS_LINES, "itemtype", FOO_TYPE_CANVAS_LINE, "fill_color_rgba", 0xff0000ff, NULL); geo_canvas_group_begin(group); geo_canvas_group_add_point(group, -71.5, 41.0); geo_canvas_group_add_point(group, -71.0, 41.0); geo_canvas_group_add_point(group, -71.0, 40.5); geo_canvas_group_add_point(group, -71.5, 40.5); geo_canvas_group_end_segment(group); geo_canvas_group_end(group);
This example draws four distinct '*' points onto the canvas:
GeoCanvasGroup *group; GObject *object; group = geo_canvas_group_new(parent, GEO_TYPE_CANVAS_PLACES, "itemtype", FOO_TYPE_CANVAS_TEXT, "text", "*", "fill_color_rgba", 0xff0000ff, NULL); geo_canvas_group_begin(group); geo_canvas_group_add_point(group, -71.5, 41.0); geo_canvas_group_add_point(group, -71.0, 41.0); geo_canvas_group_add_point(group, -71.0, 40.5); geo_canvas_group_add_point(group, -71.5, 40.5); geo_canvas_group_end(group);
typedef struct { FooCanvasGroupClass parent_class; /* This is called by an idle handler but before the canvas update method * is called. Use it to recompute geo to world mappings as required. * When chaining-up always call the parent last to prevent * recursive requests. */ void (* rebuild_g2w) (GeoCanvasGroup *group); void (* set_item_type) (GeoCanvasGroup *group, GType type); /* These routines are used to building the lat/lon group. They return * the canvas item along the way so that properties or children can be * added. */ void (* begin) (GeoCanvasGroup *group); GObject * (* add_point) (GeoCanvasGroup *group, double lon, double lat); GObject * (* end_segment) (GeoCanvasGroup *group); void (* end) (GeoCanvasGroup *group); } GeoCanvasGroupClass;
GeoCanvasGroup* geo_canvas_group_new (FooCanvasGroup *parent, GType type, const gchar *first_arg_name, ...);
A factory that creates a new geo canvas group item with parent
as its parent
group. The type argument should be something like GEO_TYPE_CANVAS_LINES,
GEO_TYPE_CANVAS_PLACES, or GEO_TYPE_CANVAS_SHAPES. Any known properties for
the type that gets created may be passed into the variable argument list.
parent : |
The parent group for the new item. |
type : |
The object type of the item. |
first_arg_name : |
A list of object argument name/value pairs, NULL-terminated, used to configure the item. |
... : |
|
Returns : | The newly-created item. |
void geo_canvas_group_request_g2w (GeoCanvasGroup *group);
This routine sets up an idle handle. When idle, causes all geographic coordinates to be recomputed to new world coordinates. It is generally only useful to GeoCanvasGroup implementations.
group : |
void geo_canvas_group_begin (GeoCanvasGroup *group);
This will clear out any existing items in the group and start with a clean list.
group : |
GObject* geo_canvas_group_add_point (GeoCanvasGroup *group, double lon, double lat);
This will either add a new place canvas item or will add a new point to a polygon or line that is bsing built. In the former case a reference to the canvas item is returned.
group : |
|
lon : |
The longitude of the new point. |
lat : |
The latitude of the new point. |
Returns : | A pointer to a canvas item or NULL if this is a line or a polygon. |
GObject* geo_canvas_group_end_segment (GeoCanvasGroup *group);
This ends a logical segment. For a place group it does nothing. For a line group, it tells the object that the line is finished being constructed.
group : |
|
Returns : | A for polygons or lines, a FooCanvasItem that can be used for setting properties, else NULL. |
void geo_canvas_group_end (GeoCanvasGroup *group);
This tells the object that all of the data has been added and it is OK to draw the data.
group : |
itemtype
" property"itemtype" guint : Read / Write
For GeoCanvasLines use FOO_TYPE_CANVAS_POLYGON, FOO_TYPE_CANVAS_LINE, or any type that has the "points" property. For GeoCanvasPlaces use FOO_TYPE_CANVAS_GROUP, FOO_TYPE_CANVAS_TEXT, FOO_TYPE_CANVAS_PIXBUF, or any type that has x, and y coordinates.
Default value: 0
<< GeoCanvas | GeoCanvasLines >> |