From: Andrea Zagli Date: Sun, 21 Jun 2009 09:12:44 +0000 (+0200) Subject: Base classes X-Git-Tag: GTKGIS_0_0_1~13 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=8eadd3b3a78612366bb19143cc60085d4248c31a;p=libgtkgis Base classes --- diff --git a/INSTALL b/INSTALL deleted file mode 100644 index e69de29..0000000 diff --git a/INSTALL b/INSTALL new file mode 120000 index 0000000..5bb6e7b --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +/usr/share/automake-1.10/INSTALL \ No newline at end of file diff --git a/configure.ac b/configure.ac index ec817ca..29dc4a6 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,8 @@ GTK_DOC_CHECK AC_PATH_PROG(GDAL_CONFIG, "gdal-config", "", $PATH) # Checks for libraries. -PKG_CHECK_MODULES([GTKGIS], [gtk+-2.0 >= 2.10.0]) +PKG_CHECK_MODULES([GTKGIS], [gtk+-2.0 >= 2.10.0 + goocanvas >= 0.13]) AC_SUBST(GTKGIS_CFLAGS) AC_SUBST(GTKGIS_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index c44f47b..753e687 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,9 +10,21 @@ lib_LTLIBRARIES = libgtkgis.la libgtkgis_la_LDFLAGS = -no-undefined libgtkgis_la_SOURCES = \ - gtkgis.c + gtkgis.c \ + layer.c \ + layersource.c \ + layersourceshp.c \ + layersourcepostgis.c \ + geometry.c include_HEADERS = \ - libgtkgis.h + libgtkgis.h \ + gtkgis.h \ + layer.h \ + layersource.h \ + layersourceshp.h \ + layersourcepostgis.h \ + geometry.h + noinst_HEADERS = diff --git a/src/gtkgis.c b/src/gtkgis.c index 362398a..b215af6 100644 --- a/src/gtkgis.c +++ b/src/gtkgis.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include #include @@ -45,6 +45,10 @@ static void gtk_gis_get_property (GObject *object, typedef struct _GtkGisPrivate GtkGisPrivate; struct _GtkGisPrivate { + GtkWidget *canvas; + GooCanvasItem *canvas_root; + + GList *layers; }; GType @@ -109,12 +113,59 @@ GtkGis return gtk_gis; } +/** + * gtk_gis_new_from_file: + * @filename: + * + * Returns: the newly created #GtkGis object. + */ +GtkGis +*gtk_gis_new_from_file (gchar *filename) +{ +} + +/** + * gtk_gis_save_to_file: + * @gtkgis: + * @filename: + */ +void +*gtk_gis_save_to_file (GtkGis *gtkgis, gchar *filename) +{ +} + +/** + * gtk_gis_add_layer: + * @gtkgis: + * @layer: + */ +void +gtk_gis_add_layer (GtkGis *gtkgis, GtkGisLayer *layer) +{ + GtkGisPrivate *priv = GTK_GIS_GET_PRIVATE (gtkgis); + + priv->layers = g_list_append (priv->layers, layer); +} + +/** + * gtk_gis_remove_layer: + * @gtkgis: + * @layer: + */ +void +gtk_gis_remove_layer (GtkGis *gtkgis, GtkGisLayer *layer) +{ + GtkGisPrivate *priv = GTK_GIS_GET_PRIVATE (gtkgis); + + priv->layers = g_list_remove (priv->layers, layer); +} + static void gtk_gis_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - GtkGis *gtk_gis = GTK_GIS (object); + GtkGis *gtkgis = GTK_GIS (object); - GtkGisPrivate *priv = GTK_GIS_GET_PRIVATE (gtk_gis); + GtkGisPrivate *priv = GTK_GIS_GET_PRIVATE (gtkgis); switch (property_id) { @@ -127,9 +178,9 @@ gtk_gis_set_property (GObject *object, guint property_id, const GValue *value, G static void gtk_gis_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - GtkGis *gtk_gis = GTK_GIS (object); + GtkGis *gtkgis = GTK_GIS (object); - GtkGisPrivate *priv = GTK_GIS_GET_PRIVATE (gtk_gis); + GtkGisPrivate *priv = GTK_GIS_GET_PRIVATE (gtkgis); switch (property_id) { diff --git a/src/gtkgis.h b/src/gtkgis.h index 30d6485..f28b800 100644 --- a/src/gtkgis.h +++ b/src/gtkgis.h @@ -20,8 +20,9 @@ #ifndef __GTK_GIS_H__ #define __GTK_GIS_H__ -#include -#include +#include + +#include "layer.h" G_BEGIN_DECLS @@ -39,12 +40,12 @@ typedef struct _GtkGisClass GtkGisClass; struct _GtkGis { - GObject parent; + GtkWidget parent; }; struct _GtkGisClass { - GObjectClass parent_class; + GtkWidgetClass parent_class; }; GType gtk_gis_get_type (void) G_GNUC_CONST; @@ -52,6 +53,17 @@ GType gtk_gis_get_type (void) G_GNUC_CONST; GtkGis *gtk_gis_new (void); +GtkGis *gtk_gis_new_from_file (gchar *filename); + +void *gtk_gis_save_to_file (GtkGis *gtkgis, gchar *filename); + +void gtk_gis_add_layer (GtkGis *gtkgis, GtkGisLayer *layer); +void gtk_gis_remove_layer (GtkGis *gtkgis, GtkGisLayer *layer); + +void gtk_gis_set_legend_visible (GtkGis *gtkgis, gboolean visible); + +GtkWidget *gtk_gis_get_legend (GtkGis *gtkgis); + G_END_DECLS