src/.libs/
stamp-h1
tests/.deps
+tests/from_xml
# temporarily
TODO.tasks
void
gtk_gis_geomtry_line_add_point (GtkGisGeometryLine *line, GtkGisGeometryPoint *point)
{
- GtkGisGeometryLinePrivate *priv = GTK_GIS_GEOMETRY_LINE_GET_PRIVATE (gtk_gis_geometry_line);
+ GtkGisGeometryLinePrivate *priv = GTK_GIS_GEOMETRY_LINE_GET_PRIVATE (line);
g_ptr_array_add (priv->points, point);
}
gdouble
gtk_gis_geometry_get_x (GtkGisGeometryPoint *point)
{
- GtkGisGeometryPointPrivate *priv = GTK_GIS_GEOMETRY_POINT_GET_PRIVATE (gtk_gis_geometry_point);
+ GtkGisGeometryPointPrivate *priv = GTK_GIS_GEOMETRY_POINT_GET_PRIVATE (point);
return priv->x;
}
gdouble
gtk_gis_geometry_get_y (GtkGisGeometryPoint *point)
{
- GtkGisGeometryPointPrivate *priv = GTK_GIS_GEOMETRY_POINT_GET_PRIVATE (gtk_gis_geometry_point);
+ GtkGisGeometryPointPrivate *priv = GTK_GIS_GEOMETRY_POINT_GET_PRIVATE (point);
return priv->y;
}
struct _GtkGisGeometryPolygonClass
{
- GtkGisGeometryClassLine parent_class;
+ GtkGisGeometryLineClass parent_class;
};
GType gtk_gis_geometry_polygon_get_type (void) G_GNUC_CONST;
filename = xmlGetProp (cur, (const xmlChar *)"filename");
if (filename != NULL)
{
- layer_source = gtk_gis_layer_source_shp_new (filename);
+ layer_source = GTK_GIS_LAYER_SOURCE (gtk_gis_layer_source_shp_new (filename));
}
}
else if (xmlStrcmp (cur->name, "postgis") == 0)
GtkGis *gtk_gis_new (void);
GtkGis *gtk_gis_new_from_xml (xmlDoc *xdoc);
-GtkGis *gtk_gis_new_from_file (gchar *filename);
+GtkGis *gtk_gis_new_from_file (const gchar *filename);
void *gtk_gis_save_to_xml (GtkGis *gtkgis, const gchar *filename);
gtk_gis_layer = GTK_GIS_LAYER (g_object_new (gtk_gis_layer_get_type (), NULL));
- priv = GTK_GIS_LAYER_GET_PRIVATE (layer);
+ priv = GTK_GIS_LAYER_GET_PRIVATE (gtk_gis_layer);
priv->source = source;
priv->name = g_strdup (name);
*
*/
void
-gtk_gis_layer_draw (GtkGisLayer *layer
+gtk_gis_layer_draw (GtkGisLayer *layer,
GooCanvasItem *canvas_root)
{
- if (IS_GTK_GIS_LAYER_OBJECT (layer) && GTK_GIS_LAYER_GET_CLASS (layer)->draw != NULL)
+ /*if (IS_GTK_GIS_LAYER_OBJECT (layer) && GTK_GIS_LAYER_GET_CLASS (layer)->draw != NULL)
{
GTK_GIS_LAYER_GET_CLASS (layer)->draw (layer, canvas_root);
- }
+ }*/
}
static void
GType gtk_gis_layer_get_type (void) G_GNUC_CONST;
-typedef enum
-{
- LAYER_GEOMETRY_TYPE_POINT,
- LAYER_GEOMETRY_TYPE_LINE,
- LAYER_GEOMETRY_TYPE_POLYGON,
- LAYER_GEOMETRY_TYPE_RASTER
-} GtkGisLayerGeometryType;
-
GtkGisLayer *gtk_gis_layer_new (GtkGisLayerSource *source,
gchar *name,
GtkGisLayerGeometryType geometry_type);
gtk_gis_layers_group = GTK_GIS_LAYERS_GROUP (g_object_new (gtk_gis_layers_group_get_type (), NULL));
- priv = GTK_GIS_LAYERS_GROUP_GET_PRIVATE (layers_group);
+ priv = GTK_GIS_LAYERS_GROUP_GET_PRIVATE (gtk_gis_layers_group);
priv->name = g_strdup (name);
void gtk_gis_layers_group_remove_layer (GtkGisLayersGroup *layers_group,
GtkGisLayer *layer);
-const gchar *gtk_gis_layers_group_get_name (GtkGisLayersGroup *layers_group);
+gchar *gtk_gis_layers_group_get_name (GtkGisLayersGroup *layers_group);
void gtk_gis_layers_group_set_name (GtkGisLayersGroup *layers_group,
const gchar *name);
}
/**
- * gtk_gis_layer_source_fill_layer:
+ * gtk_gis_layer_source_get_geometries:
* @source:
- * @layer:
*
*/
-gboolean
-gtk_gis_layer_source_fill_layer (GtkGisLayerSource *source,
- GtkGisLayer *layer)
+GList
+*gtk_gis_layer_source_get_geometries (GtkGisLayerSource *source,
+ const gchar *name)
{
- gboolean ret = FALSE;
+ GList *geometries;
- if (IS_GTK_GIS_LAYER_SOURCE_OBJECT (source) && GTK_GIS_LAYER_SOURCE_GET_CLASS (source)->load != NULL)
+ if (IS_GTK_GIS_LAYER_SOURCE_OBJECT (source) && GTK_GIS_LAYER_SOURCE_GET_CLASS (source)->get_geometries != NULL)
{
- ret = GTK_GIS_LAYER_SOURCE_GET_CLASS (source)->fill_layer (source, layer);
+ geometries = GTK_GIS_LAYER_SOURCE_GET_CLASS (source)->get_geometries (source, name);
}
- return ret;
+ return geometries;
}
/**
#include <glib.h>
#include <glib-object.h>
-#include "layer.h"
+#include "geometry.h"
G_BEGIN_DECLS
#define GTK_GIS_LAYER_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_GIS_LAYER_SOURCE, GtkGisLayerSourceClass))
+typedef enum
+{
+ LAYER_GEOMETRY_TYPE_POINT,
+ LAYER_GEOMETRY_TYPE_LINE,
+ LAYER_GEOMETRY_TYPE_POLYGON,
+ LAYER_GEOMETRY_TYPE_RASTER
+} GtkGisLayerGeometryType;
+
+
typedef struct _GtkGisLayerSource GtkGisLayerSource;
typedef struct _GtkGisLayerSourceClass GtkGisLayerSourceClass;
{
GObjectClass parent_class;
- gboolean (*fill_layer) (GtkGisLayerSource *source,
- GtkGisLayer *layer);
+ GList *(*get_geometries) (GtkGisLayerSource *source, const gchar *name);
GtkGisLayerGeometryType (*get_layer_geometry_type) (GtkGisLayerSource *source,
gchar *name);
GType gtk_gis_layer_source_get_type (void) G_GNUC_CONST;
-gboolean gtk_gis_layer_source_fill_layer (GtkGisLayerSource *source,
- GtkGisLayer *layer);
+GList *gtk_gis_layer_source_get_geometries (GtkGisLayerSource *source,
+ const gchar *name);
GtkGisLayerGeometryType gtk_gis_layer_source_get_layer_geometry_type (GtkGisLayerSource *source,
gchar *name);
typedef struct _GtkGisLayerSourcePostgisPrivate GtkGisLayerSourcePostgisPrivate;
struct _GtkGisLayerSourcePostgisPrivate
{
+ gchar *host;
+ gint port;
+ gchar *username;
+ gchar *password;
};
GType
#include <ogr_core.h>
#include "layersourceshp.h"
-#include "geomtryline.h"
-#include "geomtrypoint.h"
-#include "geomtrypolygon.h"
+#include "geometryline.h"
+#include "geometrypoint.h"
+#include "geometrypolygon.h"
static void gtk_gis_layer_source_shp_class_init (GtkGisLayerSourceShpClass *klass);
static void gtk_gis_layer_source_shp_init (GtkGisLayerSourceShp *gtk_gis_layer_source_shp);
object_class->set_property = gtk_gis_layer_source_shp_set_property;
object_class->get_property = gtk_gis_layer_source_shp_get_property;
- gtkgislayersource_class->fill_layer = gtk_gis_layer_source_shp_fill_layer;
+ gtkgislayersource_class->get_geometries = gtk_gis_layer_source_shp_get_geometries;
gtkgislayersource_class->get_layer_geometry_type = gtk_gis_layer_source_shp_get_layer_geometry_type;
}
}
/**
- * gtk_gis_layer_source_shp_fill_layer:
+ * gtk_gis_layer_source_shp_get_geometries:
* @source:
- * @layer:
+ * @name:
*
* Loads the #GtkGisLayerSource from the disk.
*
- * Returns: FALSE on error.
+ * Returns: .
*/
-gboolean
-gtk_gis_layer_source_shp_fill_layer (GtkGisLayerSource *source,
- GtkGisLayer *layer)
+GList
+*gtk_gis_layer_source_shp_get_geometries (GtkGisLayerSource *source,
+ const gchar *name)
{
- gboolean ret = TRUE;
+ GList *geometries = NULL;
- GtkGisLayerSourceShpPrivate *priv = GTK_GIS_LAYER_SOURCE_SHP_GET_PRIVATE (gtk_gis_layer_source);
+ GtkGisLayerSourceShpPrivate *priv = GTK_GIS_LAYER_SOURCE_SHP_GET_PRIVATE (source);
if (priv->datasource == NULL)
{
/* TO DO */
- ret = FALSE;
}
else
{
OGRLayerH layer;
OGRFeatureDefnH layerDefn;
- gchar *name = gtk_gis_layer_get_name (layer);
-
- GtkGisLayerSourceShpPrivate *priv = GTK_GIS_LAYER_SOURCE_SHP_GET_PRIVATE (gtk_gis_layer_source);
+ GtkGisLayerSourceShpPrivate *priv = GTK_GIS_LAYER_SOURCE_SHP_GET_PRIVATE (source);
numLayers = OGR_DS_GetLayerCount (priv->datasource);
for (i = 0; i < numLayers; i++)
if (poGeometry != NULL
&& wkbFlatten(OGR_G_GetGeometryType (poGeometry)) == wkbPoint)
{
- geometry = gtk_gis_geometry_point_new (OGR_G_GetX (poGeometry, 0), OGR_G_GetY (poGeometry, 0));
+ geometry = GTK_GIS_GEOMETRY (gtk_gis_geometry_point_new (OGR_G_GetX (poGeometry, 0), OGR_G_GetY (poGeometry, 0)));
}
else if (poGeometry != NULL
&& wkbFlatten(OGR_G_GetGeometryType (poGeometry)) == wkbLineString)
&& wkbFlatten(OGR_G_GetGeometryType (poGeometry)) == wkbPolygon)
{
}
+
+ geometries = g_list_append (geometries, geometry);
}
break;
}
}
- return ret;
+ return geometries;
}
/**
OGRLayerH layer;
OGRFeatureDefnH layerDefn;
- GtkGisLayerSourceShpPrivate *priv = GTK_GIS_LAYER_SOURCE_SHP_GET_PRIVATE (gtk_gis_layer_source);
+ GtkGisLayerSourceShpPrivate *priv = GTK_GIS_LAYER_SOURCE_SHP_GET_PRIVATE (source);
numLayers = OGR_DS_GetLayerCount (priv->datasource);
for (i = 0; i < numLayers; i++)
gchar *gtk_gis_layer_get_filename (GtkGisLayerSourceShp *source);
+GList *gtk_gis_layer_source_shp_get_geometries (GtkGisLayerSource *source, const gchar *name);
+
+GtkGisLayerGeometryType gtk_gis_layer_source_shp_get_layer_geometry_type (GtkGisLayerSource *source,
+ gchar *name);
+
G_END_DECLS
+#include <libgtkgis.h>
+
+int
+main (int argc, char *argv[])
+{
+ return 0;
+}