GParamSpec *pspec);
-#define GTK_GIS_GEOMETRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_GIS_GEOMETRY, GtkGisGeometryPrivate))
+/*#define GTK_GIS_GEOMETRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_GIS_GEOMETRY, GtkGisGeometryPrivate))
typedef struct _GtkGisGeometryPrivate GtkGisGeometryPrivate;
struct _GtkGisGeometryPrivate
{
- };
+ };*/
-GType
-gtk_gis_geometry_get_type (void)
-{
- static GType gtk_gis_geometry_type = 0;
-
- if (!gtk_gis_geometry_type)
- {
- static const GTypeInfo gtk_gis_geometry_info =
- {
- sizeof (GtkGisGeometryClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_geometry_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisGeometry),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_geometry_init,
- NULL
- };
-
- gtk_gis_geometry_type = g_type_register_static (G_TYPE_OBJECT, "GtkGisGeometry",
- >k_gis_geometry_info, 0);
- }
-
- return gtk_gis_geometry_type;
-}
+G_DEFINE_TYPE (GtkGisGeometry, gtk_gis_geometry, G_TYPE_OBJECT)
static void
gtk_gis_geometry_class_init (GtkGisGeometryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (GtkGisGeometryPrivate));
+ /*g_type_class_add_private (object_class, sizeof (GtkGisGeometryPrivate));*/
object_class->set_property = gtk_gis_geometry_set_property;
object_class->get_property = gtk_gis_geometry_get_property;
static void
gtk_gis_geometry_init (GtkGisGeometry *gtk_gis_geometry)
{
- GtkGisGeometryPrivate *priv = GTK_GIS_GEOMETRY_GET_PRIVATE (gtk_gis_geometry);
+ /*GtkGisGeometryPrivate *priv = GTK_GIS_GEOMETRY_GET_PRIVATE (gtk_gis_geometry);*/
}
static void
{
GtkGisGeometry *gtk_gis_geometry = GTK_GIS_GEOMETRY (object);
- GtkGisGeometryPrivate *priv = GTK_GIS_GEOMETRY_GET_PRIVATE (gtk_gis_geometry);
+ /*GtkGisGeometryPrivate *priv = GTK_GIS_GEOMETRY_GET_PRIVATE (gtk_gis_geometry);*/
switch (property_id)
{
{
GtkGisGeometry *gtk_gis_geometry = GTK_GIS_GEOMETRY (object);
- GtkGisGeometryPrivate *priv = GTK_GIS_GEOMETRY_GET_PRIVATE (gtk_gis_geometry);
+ /*GtkGisGeometryPrivate *priv = GTK_GIS_GEOMETRY_GET_PRIVATE (gtk_gis_geometry);*/
switch (property_id)
{
GtkGisGeometry
*gtk_gis_geometry_line_new ()
{
- GtkGisGeometry *gtk_gis_geometry_line;
+ GtkGisGeometry *line;
- gtk_gis_geometry_line = g_object_new (gtk_gis_geometry_line_get_type (), NULL);
+ line = g_object_new (gtk_gis_geometry_line_get_type (), NULL);
- return gtk_gis_geometry_line;
+ return line;
}
/**
GtkGisGeometry
*gtk_gis_geometry_line_new_from_array (GPtrArray *points)
{
- GtkGisGeometry *line;
+ GtkGisGeometry *line = NULL;
GtkGisGeometryLinePrivate *priv;
line = gtk_gis_geometry_line_new ();
GtkGisPoint point;
};
-GType
-gtk_gis_geometry_point_get_type (void)
-{
- static GType gtk_gis_geometry_point_type = 0;
-
- if (!gtk_gis_geometry_point_type)
- {
- static const GTypeInfo gtk_gis_geometry_point_info =
- {
- sizeof (GtkGisGeometryPointClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_geometry_point_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisGeometryPoint),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_geometry_point_init,
- NULL
- };
-
- gtk_gis_geometry_point_type = g_type_register_static (TYPE_GTK_GIS_GEOMETRY, "GtkGisGeometryPoint",
- >k_gis_geometry_point_info, 0);
- }
-
- return gtk_gis_geometry_point_type;
-}
+G_DEFINE_TYPE (GtkGisGeometryPoint, gtk_gis_geometry_point, TYPE_GTK_GIS_GEOMETRY)
static void
gtk_gis_geometry_point_class_init (GtkGisGeometryPointClass *klass)
GtkGisGeometry
*gtk_gis_geometry_polygon_new_from_array (GPtrArray *points)
{
- GtkGisGeometry *polygon;
- GtkGisGeometry *line;
+ GtkGisGeometry *polygon = NULL;
+ GtkGisGeometry *line = NULL;
line = gtk_gis_geometry_line_new_from_array (points);
- gtk_gis_geometry_polygon_add_line (GTK_GIS_GEOMETRY_POLYGON (polygon), GTK_GIS_GEOMETRY_LINE (line));
+ if (line != NULL)
+ {
+ polygon = gtk_gis_geometry_polygon_new ();
+ gtk_gis_geometry_polygon_add_line (GTK_GIS_GEOMETRY_POLYGON (polygon), GTK_GIS_GEOMETRY_LINE (line));
+ }
return polygon;
}
#ifndef __GTK_GIS_GEOMETRY_POLYGON_H__
#define __GTK_GIS_GEOMETRY_POLYGON_H__
-#include "geometry.h"
#include "geometryline.h"
G_BEGIN_DECLS
{
};
-GType
-gtk_gis_geometry_raster_get_type (void)
-{
- static GType gtk_gis_geometry_raster_type = 0;
-
- if (!gtk_gis_geometry_raster_type)
- {
- static const GTypeInfo gtk_gis_geometry_raster_info =
- {
- sizeof (GtkGisGeometryRasterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_geometry_raster_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisGeometryRaster),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_geometry_raster_init,
- NULL
- };
-
- gtk_gis_geometry_raster_type = g_type_register_static (TYPE_GTK_GIS_GEOMETRY, "GtkGisGeometryRaster",
- >k_gis_geometry_raster_info, 0);
- }
-
- return gtk_gis_geometry_raster_type;
-}
+G_DEFINE_TYPE (GtkGisGeometryRaster, gtk_gis_geometry_raster, TYPE_GTK_GIS_GEOMETRY)
static void
gtk_gis_geometry_raster_class_init (GtkGisGeometryRasterClass *klass)
gboolean editable;
};
-GType
-gtk_gis_layer_get_type (void)
-{
- static GType gtk_gis_layer_type = 0;
-
- if (!gtk_gis_layer_type)
- {
- static const GTypeInfo gtk_gis_layer_info =
- {
- sizeof (GtkGisLayerClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_layer_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisLayer),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_layer_init,
- NULL
- };
-
- gtk_gis_layer_type = g_type_register_static (G_TYPE_OBJECT, "GtkGisLayer",
- >k_gis_layer_info, 0);
- }
-
- return gtk_gis_layer_type;
-}
+G_DEFINE_TYPE (GtkGisLayer, gtk_gis_layer, G_TYPE_OBJECT)
static void
gtk_gis_layer_class_init (GtkGisLayerClass *klass)
*/
GtkGisLayer
*gtk_gis_layer_new (GtkGisLayerSource *source,
- gchar *name,
+ const gchar *name,
GtkGisLayerGeometryType geometry_type)
{
GtkGisLayer *gtk_gis_layer;
*/
GtkGisLayer
*gtk_gis_layer_new_from_source (GtkGisLayerSource *source,
- gchar *name)
+ const gchar *name)
{
- GtkGisLayer *layer;
+ GtkGisLayer *layer = NULL;
- GtkGisLayerGeometryType type;
+ GtkGisLayerGeometryType type = -1;
type = gtk_gis_layer_source_get_layer_geometry_type (source, name);
- layer = gtk_gis_layer_new (source, name, type);
+ if (type >= 0)
+ {
+ layer = gtk_gis_layer_new (source, name, type);
- gtk_gis_layer_fill_from_source (layer);
+ gtk_gis_layer_fill_from_source (layer);
+ }
return layer;
}
GtkGisLayer *gtk_gis_layer_new (GtkGisLayerSource *source,
- gchar *name,
+ const gchar *name,
GtkGisLayerGeometryType geometry_type);
GtkGisLayer *gtk_gis_layer_new_from_source (GtkGisLayerSource *source,
- gchar *name);
+ const gchar *name);
gchar *gtk_gis_layer_get_name (GtkGisLayer *layer);
GList *layers;
};
-GType
-gtk_gis_layers_group_get_type (void)
-{
- static GType gtk_gis_layers_group_type = 0;
-
- if (!gtk_gis_layers_group_type)
- {
- static const GTypeInfo gtk_gis_layers_group_info =
- {
- sizeof (GtkGisLayersGroupClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_layers_group_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisLayersGroup),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_layers_group_init,
- NULL
- };
-
- gtk_gis_layers_group_type = g_type_register_static (G_TYPE_OBJECT, "GtkGisLayersGroup",
- >k_gis_layers_group_info, 0);
- }
-
- return gtk_gis_layers_group_type;
-}
+G_DEFINE_TYPE (GtkGisLayersGroup, gtk_gis_layers_group, G_TYPE_OBJECT)
static void
gtk_gis_layers_group_class_init (GtkGisLayersGroupClass *klass)
#include <ogr_core.h>
#include "layersource.h"
+#include "geometry.h"
#include "geometryline.h"
#include "geometrypoint.h"
#include "geometrypolygon.h"
+#include "geometryraster.h"
static void gtk_gis_layer_source_class_init (GtkGisLayerSourceClass *klass);
static void gtk_gis_layer_source_init (GtkGisLayerSource *gtk_gis_layer_source);
static void
gtk_gis_layer_source_set_ogr_datasource (GtkGisLayerSource *source,
- OGRDataSourceH datasource)
+ OGRDataSourceH datasource)
{
GtkGisLayerSourcePrivate *priv = GTK_GIS_LAYER_SOURCE_GET_PRIVATE (source);
*
* Loads the #GtkGisLayerSource from the disk.
*
- * Returns: .
+ * Returns: a #GList of #GtkGeometry objects.
*/
GList
*gtk_gis_layer_source_get_geometries (GtkGisLayerSource *source,
for (i_geometry = 0; i_geometry < num_geometries; i_geometry++)
{
-
gint points;
gint point;
GPtrArray *gar_points;
gchar *password;
};
-GType
-gtk_gis_layer_source_postgis_get_type (void)
-{
- static GType gtk_gis_layer_source_postgis_type = 0;
-
- if (!gtk_gis_layer_source_postgis_type)
- {
- static const GTypeInfo gtk_gis_layer_source_postgis_info =
- {
- sizeof (GtkGisLayerSourcePostgisClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_layer_source_postgis_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisLayerSourcePostgis),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_layer_source_postgis_init,
- NULL
- };
-
- gtk_gis_layer_source_postgis_type = g_type_register_static (TYPE_GTK_GIS_LAYER_SOURCE, "GtkGisLayerSourcePostgis",
- >k_gis_layer_source_postgis_info, 0);
- }
-
- return gtk_gis_layer_source_postgis_type;
-}
+G_DEFINE_TYPE (GtkGisLayerSourcePostgis, gtk_gis_layer_source_postgis, TYPE_GTK_GIS_LAYER_SOURCE)
static void
gtk_gis_layer_source_postgis_class_init (GtkGisLayerSourcePostgisClass *klass)
gchar *filename;
};
-GType
-gtk_gis_layer_source_shp_get_type (void)
-{
- static GType gtk_gis_layer_source_shp_type = 0;
-
- if (!gtk_gis_layer_source_shp_type)
- {
- static const GTypeInfo gtk_gis_layer_source_shp_info =
- {
- sizeof (GtkGisLayerSourceShpClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_gis_layer_source_shp_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkGisLayerSourceShp),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_gis_layer_source_shp_init,
- NULL
- };
-
- gtk_gis_layer_source_shp_type = g_type_register_static (TYPE_GTK_GIS_LAYER_SOURCE, "GtkGisLayerSourceShp",
- >k_gis_layer_source_shp_info, 0);
- }
-
- return gtk_gis_layer_source_shp_type;
-}
+G_DEFINE_TYPE (GtkGisLayerSourceShp, gtk_gis_layer_source_shp, TYPE_GTK_GIS_LAYER_SOURCE)
static void
gtk_gis_layer_source_shp_class_init (GtkGisLayerSourceShpClass *klass)
<!--<layer name="airports">
<source>
- <shape filename="samples/airports.shp" />
+ <shape filename="/home/andreaz/files/c/libgtkgis/tests/samples/airports.shp" />
</source>
</layer>
<layer name="railroads">
<source>
- <shape filename="samples/railroads.shp" />
+ <shape filename="/home/andreaz/files/c/libgtkgis/tests/samples/railroads.shp" />
</source>
</layer>
<layer name="rivers">
<source>
- <shape filename="samples/rivers.shp" />
+ <shape filename="/home/andreaz/files/c/libgtkgis/tests/samples/rivers.shp" />
</source>
</layer>-->