From: Andrea Zagli Date: Wed, 12 Aug 2009 17:28:25 +0000 (+0200) Subject: Continued layer's label implementation. X-Git-Tag: GTKGIS_0_0_3~4 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=d73cd990b900a2e7db1a78d12d6de7657ec5c64b;p=libgtkgis Continued layer's label implementation. Changed GtkGisGeometryPolygon::new_from_list to GtkGisGeometryPolygon::new_from_points. Changed GtkGisGeometryPolygon::add_line_from_list to GtkGisGeometryPolygon::add_line_from_points. Added GtkGisGeometry::get_extent. Changed GtkGisLayerExtent to GtkGisExtent. --- diff --git a/docs/reference/libgtkgis-decl-list.txt b/docs/reference/libgtkgis-decl-list.txt index 9e39428..93bc5b8 100644 --- a/docs/reference/libgtkgis-decl-list.txt +++ b/docs/reference/libgtkgis-decl-list.txt @@ -44,9 +44,9 @@ GtkGisGeometryPolygon gtk_gis_geometry_polygon_get_type gtk_gis_geometry_polygon_new gtk_gis_geometry_polygon_new_from_line -gtk_gis_geometry_polygon_new_from_list +gtk_gis_geometry_polygon_new_from_points gtk_gis_geometry_polygon_add_line -gtk_gis_geometry_polygon_add_line_from_list +gtk_gis_geometry_polygon_add_line_from_points gtk_gis_geometry_polygon_remove_line @@ -168,6 +168,7 @@ gtk_gis_geometry_get_editable gtk_gis_geometry_set_editable gtk_gis_geometry_get_label gtk_gis_geometry_set_label +gtk_gis_geometry_get_extent gtk_gis_geometry_draw diff --git a/docs/reference/libgtkgis-decl.txt b/docs/reference/libgtkgis-decl.txt index b725a23..2806a37 100644 --- a/docs/reference/libgtkgis-decl.txt +++ b/docs/reference/libgtkgis-decl.txt @@ -191,7 +191,7 @@ void GtkGisGeometryLine *line -gtk_gis_geometry_polygon_new_from_list +gtk_gis_geometry_polygon_new_from_points GtkGisGeometry * GSList *points @@ -201,7 +201,7 @@ GSList *points GtkGisGeometryPolygon *polygon, GtkGisGeometryLine *line -gtk_gis_geometry_polygon_add_line_from_list +gtk_gis_geometry_polygon_add_line_from_points void GtkGisGeometryPolygon *polygon, GSList *points @@ -327,7 +327,7 @@ GtkGis *gtkgis, GtkGisScale *scale gtk_gis_zoom_to_extent void -GtkGis *gtkgis, GtkGisLayerExtent extent +GtkGis *gtkgis, GtkGisExtent extent gtk_gis_zoom_to_max @@ -519,7 +519,7 @@ GtkGisLayer *layer,GtkGisGeometry *geometry gtk_gis_layer_get_extent -GtkGisLayerExtent * +GtkGisExtent * GtkGisLayer *layer @@ -684,6 +684,8 @@ struct _GtkGisGeometryClass { GObjectClass parent_class; + GtkGisExtent *(*get_extent) (GtkGisGeometry *geometry); + GooCanvasItem *(*draw) (GtkGisGeometry *geometry, GtkGisScale *scale, GtkGisLayerStyle style); @@ -715,6 +717,11 @@ GtkGisGeometry *geometry GtkGisGeometry *geometry, const gchar *label +gtk_gis_geometry_get_extent +GtkGisExtent * +GtkGisGeometry *geometry + + gtk_gis_geometry_draw GooCanvasItem * GtkGisGeometry *geometry,GtkGisScale *scale,GtkGisLayerStyle style @@ -915,13 +922,13 @@ GtkGisLayerSource *source,const gchar *name gtk_gis_layer_source_get_layer_extent -GtkGisLayerExtent * +GtkGisExtent * GtkGisLayerSource *source,const gchar *name gtk_gis_layer_source_set_max_extent void -GtkGisLayerSource *source,GtkGisLayerExtent *extent +GtkGisLayerSource *source,GtkGisExtent *extent GtkGisLayerGeometryType diff --git a/docs/reference/libgtkgis-undeclared.txt b/docs/reference/libgtkgis-undeclared.txt index e69de29..994f2fb 100644 --- a/docs/reference/libgtkgis-undeclared.txt +++ b/docs/reference/libgtkgis-undeclared.txt @@ -0,0 +1,2 @@ +gtk_gis_geometry_polygon_add_line_from_list +gtk_gis_geometry_polygon_new_from_list diff --git a/docs/reference/libgtkgis-undocumented.txt b/docs/reference/libgtkgis-undocumented.txt index fedae38..1aad4e2 100644 --- a/docs/reference/libgtkgis-undocumented.txt +++ b/docs/reference/libgtkgis-undocumented.txt @@ -1,7 +1,7 @@ 11% symbol docs coverage. 22 symbols documented. 7 symbols incomplete. -179 not documented. +180 not documented. GTK_GIS @@ -94,6 +94,7 @@ gtk_gis_add_layer gtk_gis_draw gtk_gis_geometry_draw gtk_gis_geometry_get_editable +gtk_gis_geometry_get_extent gtk_gis_geometry_get_label gtk_gis_geometry_get_point gtk_gis_geometry_get_type @@ -105,7 +106,7 @@ gtk_gis_geometry_point_get_type gtk_gis_geometry_point_get_x gtk_gis_geometry_point_get_y gtk_gis_geometry_polygon_add_line -gtk_gis_geometry_polygon_add_line_from_list +gtk_gis_geometry_polygon_add_line_from_points gtk_gis_geometry_polygon_get_type gtk_gis_geometry_polygon_remove_line gtk_gis_geometry_raster_get_type diff --git a/docs/reference/libgtkgis-unused.txt b/docs/reference/libgtkgis-unused.txt index 789dcc8..b02fb86 100644 --- a/docs/reference/libgtkgis-unused.txt +++ b/docs/reference/libgtkgis-unused.txt @@ -10,8 +10,11 @@ GtkGisLayerSourcePostgisClass GtkGisLayerSourceRasterClass GtkGisLayerSourceShpClass GtkGisLayersGroupClass +gtk_gis_geometry_get_extent gtk_gis_geometry_get_label gtk_gis_geometry_line_get_svg_path +gtk_gis_geometry_polygon_add_line_from_points +gtk_gis_geometry_polygon_new_from_points gtk_gis_geometry_set_label gtk_gis_layer_get_label gtk_gis_layer_get_style diff --git a/docs/reference/tmpl/geometrypolygon.sgml b/docs/reference/tmpl/geometrypolygon.sgml index 11fceeb..ac05dbe 100644 --- a/docs/reference/tmpl/geometrypolygon.sgml +++ b/docs/reference/tmpl/geometrypolygon.sgml @@ -95,15 +95,6 @@ GtkGisGeometryPolygon @Returns: - - - - - -@points: -@Returns: - - @@ -113,15 +104,6 @@ GtkGisGeometryPolygon @line: - - - - - -@polygon: -@points: - - diff --git a/docs/reference/tmpl/libgtkgis-unused.sgml b/docs/reference/tmpl/libgtkgis-unused.sgml index e69de29..75e4975 100644 --- a/docs/reference/tmpl/libgtkgis-unused.sgml +++ b/docs/reference/tmpl/libgtkgis-unused.sgml @@ -0,0 +1,16 @@ + + + + + +@polygon: +@points: + + + + + + +@points: +@Returns: + diff --git a/src/commons.h b/src/commons.h index 2875222..f7b3d29 100644 --- a/src/commons.h +++ b/src/commons.h @@ -45,7 +45,7 @@ typedef struct gdouble min_y; gdouble max_x; gdouble max_y; - } GtkGisLayerExtent; + } GtkGisExtent; typedef struct { diff --git a/src/geometry.c b/src/geometry.c index d2a98c6..49a007e 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -138,6 +138,24 @@ gtk_gis_geometry_set_label (GtkGisGeometry *geometry, const gchar *label) priv->label = g_strdup (label); } +/** + * gtk_gis_geometry_get_extent: + * @line: a #GtkGisGeometry object. + * + */ +GtkGisExtent +*gtk_gis_geometry_get_extent (GtkGisGeometry *geometry) +{ + GtkGisExtent *extent = NULL; + + if (IS_GTK_GIS_GEOMETRY (geometry) && GTK_GIS_GEOMETRY_GET_CLASS (geometry)->get_extent != NULL) + { + extent = GTK_GIS_GEOMETRY_GET_CLASS (geometry)->get_extent (geometry); + } + + return extent; +} + /** * gtk_gis_geometry_draw: * @geometry: a #GtkGisGeometry object. diff --git a/src/geometry.h b/src/geometry.h index d1f1af2..95e53c6 100644 --- a/src/geometry.h +++ b/src/geometry.h @@ -50,6 +50,8 @@ struct _GtkGisGeometryClass { GObjectClass parent_class; + GtkGisExtent *(*get_extent) (GtkGisGeometry *geometry); + GooCanvasItem *(*draw) (GtkGisGeometry *geometry, GtkGisScale *scale, GtkGisLayerStyle style); @@ -64,6 +66,8 @@ void gtk_gis_geometry_set_editable (GtkGisGeometry *geometry, gboolean editable) const gchar *gtk_gis_geometry_get_label (GtkGisGeometry *geometry); void gtk_gis_geometry_set_label (GtkGisGeometry *geometry, const gchar *label); +GtkGisExtent *gtk_gis_geometry_get_extent (GtkGisGeometry *geometry); + GooCanvasItem *gtk_gis_geometry_draw (GtkGisGeometry *geometry, GtkGisScale *scale, GtkGisLayerStyle style); diff --git a/src/geometryline.c b/src/geometryline.c index 35d9c77..a11398f 100644 --- a/src/geometryline.c +++ b/src/geometryline.c @@ -32,6 +32,7 @@ static void gtk_gis_geometry_line_init (GtkGisGeometryLine *gtk_gis_geometry_lin static gchar *convert_comma_to_dot (gchar *str); +static GtkGisExtent *gtk_gis_geometry_line_get_extent (GtkGisGeometry *line); static GooCanvasItem *gtk_gis_geometry_line_draw (GtkGisGeometry *line, GtkGisScale *scale, GtkGisLayerStyle style); @@ -52,6 +53,8 @@ typedef struct _GtkGisGeometryLinePrivate GtkGisGeometryLinePrivate; struct _GtkGisGeometryLinePrivate { GSList *points; + + GtkGisExtent *extent; }; G_DEFINE_TYPE (GtkGisGeometryLine, gtk_gis_geometry_line, TYPE_GTK_GIS_GEOMETRY) @@ -67,6 +70,7 @@ gtk_gis_geometry_line_class_init (GtkGisGeometryLineClass *klass) object_class->set_property = gtk_gis_geometry_line_set_property; object_class->get_property = gtk_gis_geometry_line_get_property; + geometry_class->get_extent = gtk_gis_geometry_line_get_extent; geometry_class->draw = gtk_gis_geometry_line_draw; } @@ -76,6 +80,7 @@ gtk_gis_geometry_line_init (GtkGisGeometryLine *gtk_gis_geometry_line) GtkGisGeometryLinePrivate *priv = GTK_GIS_GEOMETRY_LINE_GET_PRIVATE (gtk_gis_geometry_line); priv->points = NULL; + priv->extent = NULL; } /** @@ -137,6 +142,35 @@ gtk_gis_geometry_line_add_point (GtkGisGeometryLine *line, GtkGisPoint point) gpoint->x = point.x; gpoint->y = point.y; + /* recalculate the new extent */ + if (priv->extent = NULL) + { + priv->extent = g_malloc (sizeof (GtkGisExtent)); + priv->extent->min_x = gpoint->x; + priv->extent->min_y = gpoint->y; + priv->extent->max_x = gpoint->x; + priv->extent->max_y = gpoint->y; + } + else + { + if (gpoint->x < priv->extent->min_x) + { + priv->extent->min_x = gpoint->x; + } + if (gpoint->y < priv->extent->min_y) + { + priv->extent->min_y = gpoint->y; + } + if (gpoint->x > priv->extent->max_x) + { + priv->extent->max_x = gpoint->x; + } + if (gpoint->y > priv->extent->max_y) + { + priv->extent->max_y = gpoint->y; + } + } + priv->points = g_slist_append (priv->points, gpoint); } @@ -227,6 +261,18 @@ static gchar return ret; } +static GtkGisExtent +*gtk_gis_geometry_line_get_extent (GtkGisGeometry *line) +{ + GtkGisGeometryLinePrivate *priv; + + g_return_val_if_fail (IS_GTK_GIS_GEOMETRY_LINE (line), NULL); + + priv = GTK_GIS_GEOMETRY_LINE_GET_PRIVATE (GTK_GIS_GEOMETRY_LINE (line)); + + return g_memdup (priv->extent, sizeof (GtkGisExtent)); +} + static GooCanvasItem *gtk_gis_geometry_line_draw (GtkGisGeometry *line, GtkGisScale *scale, diff --git a/src/geometrypoint.c b/src/geometrypoint.c index c970abf..90b01ae 100644 --- a/src/geometrypoint.c +++ b/src/geometrypoint.c @@ -30,6 +30,7 @@ static void gtk_gis_geometry_point_class_init (GtkGisGeometryPointClass *klass); static void gtk_gis_geometry_point_init (GtkGisGeometryPoint *gtk_gis_geometry_point); +static GtkGisExtent *gtk_gis_geometry_point_get_extent (GtkGisGeometry *point); static GooCanvasItem *gtk_gis_geometry_point_draw (GtkGisGeometry *point, GtkGisScale *scale, GtkGisLayerStyle style); @@ -65,6 +66,7 @@ gtk_gis_geometry_point_class_init (GtkGisGeometryPointClass *klass) object_class->set_property = gtk_gis_geometry_point_set_property; object_class->get_property = gtk_gis_geometry_point_get_property; + geometry_class->get_extent = gtk_gis_geometry_point_get_extent; geometry_class->draw = gtk_gis_geometry_point_draw; } @@ -149,6 +151,25 @@ gtk_gis_geometry_point_get_y (GtkGisGeometryPoint *point) return priv->point->y; } +static GtkGisExtent +*gtk_gis_geometry_point_get_extent (GtkGisGeometry *point) +{ + GtkGisGeometryPointPrivate *priv; + GtkGisExtent *extent; + + g_return_val_if_fail (IS_GTK_GIS_GEOMETRY_POINT (point), NULL); + + priv = GTK_GIS_GEOMETRY_POINT_GET_PRIVATE (GTK_GIS_GEOMETRY_POINT (point)); + + extent = g_malloc (sizeof (GtkGisExtent)); + extent->min_x = priv->point->x; + extent->min_y = priv->point->y; + extent->max_x = priv->point->x; + extent->max_y = priv->point->y; + + return extent; +} + static GooCanvasItem *gtk_gis_geometry_point_draw (GtkGisGeometry *point, GtkGisScale *scale, diff --git a/src/geometrypolygon.c b/src/geometrypolygon.c index dd75085..38f5029 100644 --- a/src/geometrypolygon.c +++ b/src/geometrypolygon.c @@ -30,6 +30,7 @@ static void gtk_gis_geometry_polygon_class_init (GtkGisGeometryPolygonClass *klass); static void gtk_gis_geometry_polygon_init (GtkGisGeometryPolygon *gtk_gis_geometry_polygon); +static GtkGisExtent *gtk_gis_geometry_polygon_get_extent (GtkGisGeometry *polygon); static GooCanvasItem *gtk_gis_geometry_polygon_draw (GtkGisGeometry *polygon, GtkGisScale *scale, GtkGisLayerStyle style); @@ -50,6 +51,8 @@ typedef struct _GtkGisGeometryPolygonPrivate GtkGisGeometryPolygonPrivate; struct _GtkGisGeometryPolygonPrivate { GSList *lines; + + GtkGisExtent *extent; }; G_DEFINE_TYPE (GtkGisGeometryPolygon, gtk_gis_geometry_polygon, TYPE_GTK_GIS_GEOMETRY) @@ -65,6 +68,7 @@ gtk_gis_geometry_polygon_class_init (GtkGisGeometryPolygonClass *klass) object_class->set_property = gtk_gis_geometry_polygon_set_property; object_class->get_property = gtk_gis_geometry_polygon_get_property; + geometry_class->get_extent = gtk_gis_geometry_polygon_get_extent; geometry_class->draw = gtk_gis_geometry_polygon_draw; } @@ -114,7 +118,7 @@ GtkGisGeometry } /** - * gtk_gis_geometry_polygon_new_from_list: + * gtk_gis_geometry_polygon_new_from_points: * @points: a #GSList og #GtkGisPoint to add to the polygon. * * Creates a new #GtkGisGeometryPolygon object. @@ -122,7 +126,7 @@ GtkGisGeometry * Returns: the newly created #GtkGisGeometryPolygon object. */ GtkGisGeometry -*gtk_gis_geometry_polygon_new_from_list (GSList *points) +*gtk_gis_geometry_polygon_new_from_points (GSList *points) { GtkGisGeometry *polygon = NULL; GtkGisGeometry *line = NULL; @@ -149,24 +153,56 @@ gtk_gis_geometry_polygon_add_line (GtkGisGeometryPolygon *polygon, GtkGisGeometryLine *line) { GtkGisGeometryPolygonPrivate *priv; + GtkGisExtent *line_extent; g_return_if_fail (IS_GTK_GIS_GEOMETRY_POLYGON (polygon)); g_return_if_fail (IS_GTK_GIS_GEOMETRY_LINE (line)); priv = GTK_GIS_GEOMETRY_POLYGON_GET_PRIVATE (polygon); + /* recalculate the new extent */ + line_extent = gtk_gis_geometry_get_extent (GTK_GIS_GEOMETRY (line)); + + if (priv->extent = NULL) + { + priv->extent = g_malloc (sizeof (GtkGisExtent)); + priv->extent->min_x = line_extent->min_x; + priv->extent->min_y = line_extent->min_y; + priv->extent->max_x = line_extent->max_x; + priv->extent->max_y = line_extent->max_y; + } + else + { + if (line_extent->min_x < priv->extent->min_x) + { + priv->extent->min_x = line_extent->min_x; + } + if (line_extent->min_y < priv->extent->min_y) + { + priv->extent->min_y = line_extent->min_y; + } + if (line_extent->max_x > priv->extent->max_x) + { + priv->extent->max_x = line_extent->max_x; + } + if (line_extent->max_y > priv->extent->max_y) + { + priv->extent->max_y = line_extent->max_y; + } + } + priv->lines = g_slist_append (priv->lines, line); } /** - * gtk_gis_geometry_polygon_add_line_from_list: + * gtk_gis_geometry_polygon_add_line_from_points: * @polygon: a #GtkGisGeometryPolygon object. * @points: * */ void -gtk_gis_geometry_polygon_add_line_from_list (GtkGisGeometryPolygon *polygon, - GSList *points) +gtk_gis_geometry_polygon_add_line_from_points (GtkGisGeometryPolygon *polygon, + GSList *points) { GtkGisGeometry *line; @@ -197,9 +233,25 @@ gtk_gis_geometry_polygon_remove_line (GtkGisGeometryPolygon *polygon, priv = GTK_GIS_GEOMETRY_POLYGON_GET_PRIVATE (polygon); + /* TO DO + * recalculate the new extent + */ + priv->lines = g_slist_remove (priv->lines, line); } +static GtkGisExtent +*gtk_gis_geometry_polygon_get_extent (GtkGisGeometry *polygon) +{ + GtkGisGeometryPolygonPrivate *priv; + + g_return_val_if_fail (IS_GTK_GIS_GEOMETRY_POLYGON (polygon), NULL); + + priv = GTK_GIS_GEOMETRY_POLYGON_GET_PRIVATE (GTK_GIS_GEOMETRY_POLYGON (polygon)); + + return g_memdup (priv->extent, sizeof (GtkGisExtent)); +} + static GooCanvasItem *gtk_gis_geometry_polygon_draw (GtkGisGeometry *polygon, GtkGisScale *scale, @@ -219,6 +271,9 @@ static GooCanvasItem GSList *cur; GtkGisGeometry *line; + const gchar *str_label; + GooCanvasItem *item_label; + cur = priv->lines; while (cur != NULL) { @@ -238,6 +293,30 @@ static GooCanvasItem "fill-color", style.fill_color, "fill-rule", CAIRO_FILL_RULE_EVEN_ODD, NULL); + + str_label = gtk_gis_geometry_get_label (polygon); + if (str_label != NULL + && g_strcmp0 (str_label, "") != 0) + { + gdouble x; + gdouble y; + + /* center the label inside the polygon */ + + /* TO DO + * the label must be visible every time that the polygon is visible + */ + + x = priv->extent->min_x + (priv->extent->max_x - priv->extent->min_x) / 2; + y = priv->extent->min_y + (priv->extent->max_y - priv->extent->min_y) / 2; + + item_label = goo_canvas_text_new (item, + str_label, + x, y, -1, + GTK_ANCHOR_CENTER, + "font", "Sans 12", + NULL); + } } return item; diff --git a/src/geometrypolygon.h b/src/geometrypolygon.h index bfaf046..17b14a0 100644 --- a/src/geometrypolygon.h +++ b/src/geometrypolygon.h @@ -52,10 +52,10 @@ GType gtk_gis_geometry_polygon_get_type (void) G_GNUC_CONST; GtkGisGeometry *gtk_gis_geometry_polygon_new (void); GtkGisGeometry *gtk_gis_geometry_polygon_new_from_line (GtkGisGeometryLine *line); -GtkGisGeometry *gtk_gis_geometry_polygon_new_from_list (GSList *points); +GtkGisGeometry *gtk_gis_geometry_polygon_new_from_points (GSList *points); void gtk_gis_geometry_polygon_add_line (GtkGisGeometryPolygon *polygon, GtkGisGeometryLine *line); -void gtk_gis_geometry_polygon_add_line_from_list (GtkGisGeometryPolygon *polygon, GSList *points); +void gtk_gis_geometry_polygon_add_line_from_points (GtkGisGeometryPolygon *polygon, GSList *points); void gtk_gis_geometry_polygon_remove_line (GtkGisGeometryPolygon *polygon, GtkGisGeometryLine *line); diff --git a/src/gtkgis.c b/src/gtkgis.c index 210d349..45d1ef2 100644 --- a/src/gtkgis.c +++ b/src/gtkgis.c @@ -90,7 +90,7 @@ struct _GtkGisPrivate GSList *layers_groups; GSList *layers; - GtkGisLayerExtent *extent; + GtkGisExtent *extent; GtkGisScale *scale; GtkGisPoint *sel_start; @@ -445,7 +445,7 @@ void gtk_gis_add_layer (GtkGis *gtkgis, GtkGisLayer *layer) { GtkGisPrivate *priv; - GtkGisLayerExtent *extent; + GtkGisExtent *extent; g_return_if_fail (IS_GTK_GIS (gtkgis)); @@ -459,7 +459,7 @@ gtk_gis_add_layer (GtkGis *gtkgis, GtkGisLayer *layer) { if (priv->extent == NULL) { - priv->extent = g_malloc (sizeof (GtkGisLayerExtent)); + priv->extent = g_malloc (sizeof (GtkGisExtent)); priv->extent->min_x = extent->min_x; priv->extent->max_x = extent->max_x; priv->extent->min_y = extent->min_y; @@ -649,11 +649,11 @@ gtk_gis_set_scale (GtkGis *gtkgis, GtkGisScale *scale) /** * gtk_gis_zoom_to_extent: * @gtkgis: a #GtkGis object. - * @extent: a #GtkGisLayerExtent struct. + * @extent: a #GtkGisExtent struct. * */ void -gtk_gis_zoom_to_extent (GtkGis *gtkgis, GtkGisLayerExtent extent) +gtk_gis_zoom_to_extent (GtkGis *gtkgis, GtkGisExtent extent) { GtkGisPrivate *priv; GtkGisScale *scale; @@ -800,7 +800,7 @@ gtk_gis_zoom_to_max (GtkGis *gtkgis) void gtk_gis_zoom_to_layer (GtkGis *gtkgis, GtkGisLayer *layer) { - GtkGisLayerExtent *extent; + GtkGisExtent *extent; g_return_if_fail (IS_GTK_GIS (gtkgis)); g_return_if_fail (IS_GTK_GIS_LAYER (layer)); diff --git a/src/gtkgis.h b/src/gtkgis.h index 5db9e27..22d756d 100644 --- a/src/gtkgis.h +++ b/src/gtkgis.h @@ -75,7 +75,7 @@ void gtk_gis_draw (GtkGis *gtkgis); GtkGisScale *gtk_gis_get_scale (GtkGis *gtkgis); void gtk_gis_set_scale (GtkGis *gtkgis, GtkGisScale *scale); -void gtk_gis_zoom_to_extent (GtkGis *gtkgis, GtkGisLayerExtent extent); +void gtk_gis_zoom_to_extent (GtkGis *gtkgis, GtkGisExtent extent); void gtk_gis_zoom_to_max (GtkGis *gtkgis); void gtk_gis_zoom_to_layer (GtkGis *gtkgis, GtkGisLayer *layer); diff --git a/src/layer.c b/src/layer.c index b6628d7..6f3b12a 100644 --- a/src/layer.c +++ b/src/layer.c @@ -334,11 +334,11 @@ gtk_gis_layer_remove_geometry (GtkGisLayer *layer, GtkGisGeometry *geometry) * @layer: a #GtkGisLayer object. * */ -GtkGisLayerExtent +GtkGisExtent *gtk_gis_layer_get_extent (GtkGisLayer *layer) { GtkGisLayerPrivate *priv; - GtkGisLayerExtent *extent; + GtkGisExtent *extent; g_return_val_if_fail (IS_GTK_GIS_LAYER (layer), NULL); diff --git a/src/layer.h b/src/layer.h index 8e34461..08ee2a3 100644 --- a/src/layer.h +++ b/src/layer.h @@ -81,7 +81,7 @@ void gtk_gis_layer_add_geometry (GtkGisLayer *layer, void gtk_gis_layer_remove_geometry (GtkGisLayer *layer, GtkGisGeometry *geometry); -GtkGisLayerExtent *gtk_gis_layer_get_extent (GtkGisLayer *layer); +GtkGisExtent *gtk_gis_layer_get_extent (GtkGisLayer *layer); gboolean gtk_gis_layer_get_visible (GtkGisLayer *layer); void gtk_gis_layer_set_visible (GtkGisLayer *layer, diff --git a/src/layersource.c b/src/layersource.c index 551068d..6eff09e 100644 --- a/src/layersource.c +++ b/src/layersource.c @@ -63,7 +63,7 @@ struct _GtkGisLayerSourcePrivate OGRDataSourceH datasource; GDALDatasetH dataset; - GtkGisLayerExtent *max_extent; + GtkGisExtent *max_extent; }; G_DEFINE_TYPE (GtkGisLayerSource, gtk_gis_layer_source, G_TYPE_OBJECT) @@ -212,11 +212,11 @@ gtk_gis_layer_source_get_layer_geometry_type (GtkGisLayerSource *source, * * Returns: */ -GtkGisLayerExtent +GtkGisExtent *gtk_gis_layer_source_get_layer_extent (GtkGisLayerSource *source, const gchar *name) { - GtkGisLayerExtent *extent = NULL; + GtkGisExtent *extent = NULL; GtkGisLayerSourcePrivate *priv = GTK_GIS_LAYER_SOURCE_GET_PRIVATE (source); @@ -229,7 +229,7 @@ GtkGisLayerExtent if (layer != NULL) { - extent = g_malloc0 (sizeof (GtkGisLayerExtent)); + extent = g_malloc0 (sizeof (GtkGisExtent)); OGR_L_GetExtent (layer, &psExtent, 1); @@ -245,7 +245,7 @@ GtkGisLayerExtent if (GDALGetGeoTransform (priv->dataset, adfGeoTransform) == CE_None) { - extent = g_malloc0 (sizeof (GtkGisLayerExtent)); + extent = g_malloc0 (sizeof (GtkGisExtent)); extent->min_x = adfGeoTransform[0]; extent->max_x = extent->min_x + GDALGetRasterXSize (priv->dataset); @@ -271,7 +271,7 @@ GtkGisLayerExtent */ void gtk_gis_layer_source_set_max_extent (GtkGisLayerSource *source, - GtkGisLayerExtent *extent) + GtkGisExtent *extent) { GtkGisLayerSourcePrivate *priv = GTK_GIS_LAYER_SOURCE_GET_PRIVATE (source); @@ -279,7 +279,7 @@ gtk_gis_layer_source_set_max_extent (GtkGisLayerSource *source, if (priv->max_extent == NULL) { - priv->max_extent = g_malloc0 (sizeof (GtkGisLayerExtent)); + priv->max_extent = g_malloc0 (sizeof (GtkGisExtent)); } priv->max_extent->min_x = extent->min_x; @@ -421,11 +421,11 @@ static GSList if (i_geometry == 0) { - geometry = gtk_gis_geometry_polygon_new_from_list (gpoints); + geometry = gtk_gis_geometry_polygon_new_from_points (gpoints); } else { - gtk_gis_geometry_polygon_add_line_from_list (GTK_GIS_GEOMETRY_POLYGON (geometry), gpoints); + gtk_gis_geometry_polygon_add_line_from_points (GTK_GIS_GEOMETRY_POLYGON (geometry), gpoints); } } } diff --git a/src/layersource.h b/src/layersource.h index b62067c..c8d3c7c 100644 --- a/src/layersource.h +++ b/src/layersource.h @@ -75,11 +75,11 @@ GSList *gtk_gis_layer_source_get_geometries (GtkGisLayerSource *source, GtkGisLayerGeometryType gtk_gis_layer_source_get_layer_geometry_type (GtkGisLayerSource *source, const gchar *name); -GtkGisLayerExtent *gtk_gis_layer_source_get_layer_extent (GtkGisLayerSource *source, - const gchar *name); +GtkGisExtent *gtk_gis_layer_source_get_layer_extent (GtkGisLayerSource *source, + const gchar *name); void gtk_gis_layer_source_set_max_extent (GtkGisLayerSource *source, - GtkGisLayerExtent *extent); + GtkGisExtent *extent); G_END_DECLS