]> saetta.ns0.it Git - libgtkgis/commitdiff
Continued layer's label implementation.
authorAndrea Zagli <azagli@libero.it>
Wed, 12 Aug 2009 17:28:25 +0000 (19:28 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 12 Aug 2009 17:28:25 +0000 (19:28 +0200)
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.

20 files changed:
docs/reference/libgtkgis-decl-list.txt
docs/reference/libgtkgis-decl.txt
docs/reference/libgtkgis-undeclared.txt
docs/reference/libgtkgis-undocumented.txt
docs/reference/libgtkgis-unused.txt
docs/reference/tmpl/geometrypolygon.sgml
docs/reference/tmpl/libgtkgis-unused.sgml
src/commons.h
src/geometry.c
src/geometry.h
src/geometryline.c
src/geometrypoint.c
src/geometrypolygon.c
src/geometrypolygon.h
src/gtkgis.c
src/gtkgis.h
src/layer.c
src/layer.h
src/layersource.c
src/layersource.h

index 9e39428bf38bfbff19726800902b0b50a904ac54..93bc5b81daad2df46b443a036c178e7a8e8134bf 100644 (file)
@@ -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
 </SECTION>
 
@@ -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
 </SECTION>
 
index b725a23a238b7ac7f07ab8b9b7b38749943d0d3e..2806a3719ca43fa1fbecfca34b508694bd1e6f99 100644 (file)
@@ -191,7 +191,7 @@ void
 GtkGisGeometryLine *line
 </FUNCTION>
 <FUNCTION>
-<NAME>gtk_gis_geometry_polygon_new_from_list</NAME>
+<NAME>gtk_gis_geometry_polygon_new_from_points</NAME>
 <RETURNS>GtkGisGeometry *</RETURNS>
 GSList *points
 </FUNCTION>
@@ -201,7 +201,7 @@ GSList *points
 GtkGisGeometryPolygon *polygon, GtkGisGeometryLine *line
 </FUNCTION>
 <FUNCTION>
-<NAME>gtk_gis_geometry_polygon_add_line_from_list</NAME>
+<NAME>gtk_gis_geometry_polygon_add_line_from_points</NAME>
 <RETURNS>void </RETURNS>
 GtkGisGeometryPolygon *polygon, GSList *points
 </FUNCTION>
@@ -327,7 +327,7 @@ GtkGis *gtkgis, GtkGisScale *scale
 <FUNCTION>
 <NAME>gtk_gis_zoom_to_extent</NAME>
 <RETURNS>void </RETURNS>
-GtkGis *gtkgis, GtkGisLayerExtent extent
+GtkGis *gtkgis, GtkGisExtent extent
 </FUNCTION>
 <FUNCTION>
 <NAME>gtk_gis_zoom_to_max</NAME>
@@ -519,7 +519,7 @@ GtkGisLayer *layer,GtkGisGeometry *geometry
 </FUNCTION>
 <FUNCTION>
 <NAME>gtk_gis_layer_get_extent</NAME>
-<RETURNS>GtkGisLayerExtent *</RETURNS>
+<RETURNS>GtkGisExtent *</RETURNS>
 GtkGisLayer *layer
 </FUNCTION>
 <FUNCTION>
@@ -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
 </FUNCTION>
 <FUNCTION>
+<NAME>gtk_gis_geometry_get_extent</NAME>
+<RETURNS>GtkGisExtent *</RETURNS>
+GtkGisGeometry *geometry
+</FUNCTION>
+<FUNCTION>
 <NAME>gtk_gis_geometry_draw</NAME>
 <RETURNS>GooCanvasItem *</RETURNS>
 GtkGisGeometry *geometry,GtkGisScale *scale,GtkGisLayerStyle style
@@ -915,13 +922,13 @@ GtkGisLayerSource *source,const gchar *name
 </FUNCTION>
 <FUNCTION>
 <NAME>gtk_gis_layer_source_get_layer_extent</NAME>
-<RETURNS>GtkGisLayerExtent *</RETURNS>
+<RETURNS>GtkGisExtent *</RETURNS>
 GtkGisLayerSource *source,const gchar *name
 </FUNCTION>
 <FUNCTION>
 <NAME>gtk_gis_layer_source_set_max_extent</NAME>
 <RETURNS>void </RETURNS>
-GtkGisLayerSource *source,GtkGisLayerExtent *extent
+GtkGisLayerSource *source,GtkGisExtent *extent
 </FUNCTION>
 <ENUM>
 <NAME>GtkGisLayerGeometryType</NAME>
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..994f2fb64238b6ebb2b211d9960ca381e6c58691 100644 (file)
@@ -0,0 +1,2 @@
+gtk_gis_geometry_polygon_add_line_from_list
+gtk_gis_geometry_polygon_new_from_list
index fedae384613a5785dead13c6c56cc4c69410bba7..1aad4e22a06f6fa5b5c186150830a07defd9f185 100644 (file)
@@ -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
index 789dcc88e0b5b5ac0c63889a9adaeab8b432305c..b02fb8657b91962b810ceb6a6b12215fdb0ec463 100644 (file)
@@ -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
index 11fceebb94f095dc3b9f9cd1df2f6f43915f94a1..ac05dbede4c2dfb22e0ecac3b258171e575f58e7 100644 (file)
@@ -95,15 +95,6 @@ GtkGisGeometryPolygon
 @Returns: 
 
 
-<!-- ##### FUNCTION gtk_gis_geometry_polygon_new_from_list ##### -->
-<para>
-
-</para>
-
-@points: 
-@Returns: 
-
-
 <!-- ##### FUNCTION gtk_gis_geometry_polygon_add_line ##### -->
 <para>
 
@@ -113,15 +104,6 @@ GtkGisGeometryPolygon
 @line: 
 
 
-<!-- ##### FUNCTION gtk_gis_geometry_polygon_add_line_from_list ##### -->
-<para>
-
-</para>
-
-@polygon: 
-@points: 
-
-
 <!-- ##### FUNCTION gtk_gis_geometry_polygon_remove_line ##### -->
 <para>
 
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..75e4975a2655701470917a9ae4d3745e7b8c2322 100644 (file)
@@ -0,0 +1,16 @@
+<!-- ##### FUNCTION gtk_gis_geometry_polygon_add_line_from_list ##### -->
+<para>
+
+</para>
+
+@polygon: 
+@points: 
+
+<!-- ##### FUNCTION gtk_gis_geometry_polygon_new_from_list ##### -->
+<para>
+
+</para>
+
+@points: 
+@Returns: 
+
index 2875222bb4988a19f211849b7753419818ee2d7e..f7b3d293960ad38d47b2b280c01088cee61300b5 100644 (file)
@@ -45,7 +45,7 @@ typedef struct
                gdouble min_y;
                gdouble max_x;
                gdouble max_y;
-       } GtkGisLayerExtent;
+       } GtkGisExtent;
 
 typedef struct
        {
index d2a98c635ff378b7bf47bce2b0f9e5de8310be14..49a007ef362304fdce1b0a6261ba40bac51a9467 100644 (file)
@@ -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.
index d1f1af2ca2926c977dba6988597988e52d5e2ca6..95e53c6f47611e82d2c563558763ad431ee5d3e0 100644 (file)
@@ -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);
index 35d9c7740de8f71241849a40f989db69f79ccd1a..a11398fde580cebeecfa1ea57cb489427ec3523d 100644 (file)
@@ -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,
index c970abfab1213298cbe12e4a4cb83bd1e6b26789..90b01ae0166912a02c878895fb9087bf5d1a51ae 100644 (file)
@@ -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,
index dd75085c51c4dc3da41bbaae5654ccc08650be41..38f5029c93ad816a681d2463fe5d64bdf7b77d4a 100644 (file)
@@ -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;
index bfaf046745c6ebfc8baa44f6d4024854ece7053d..17b14a0a0d472041ff88610c68b80cd76d0083b7 100644 (file)
@@ -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);
 
 
index 210d3493b508611ff05e355b295fc22f1ccc9077..45d1ef24b56dccea20840ef11a41a0339c2a2dba 100644 (file)
@@ -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));
index 5db9e2797837082e9fe597eeee26af54639a5460..22d756d967c2791abc0e7d7d3f7f12d2878a3a4f 100644 (file)
@@ -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);
 
index b6628d756003e583378ab819f8b681d6775e903c..6f3b12af8e78afbcef4170d8e791e324f1476a3b 100644 (file)
@@ -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);
 
index 8e344614951b6b209278b0cb1df6bfd924d73f16..08ee2a3a8bbc423d437397d9630709d6ea443d11 100644 (file)
@@ -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,
index 551068dac51a255ad9990bc52a37886ebd8c4709..6eff09e6c590a5bba80c2ae7dfc1f2e335570404 100644 (file)
@@ -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);
                                                                }
                                                }
                                }
index b62067c78736a0df759eaf96d23d105121d3ef82..c8d3c7cd8caebf0145d4a15e2d30d29a9ee9c2a4 100644 (file)
@@ -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