X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fgis-viewer.h;h=5e84e439157fb991656f76a0a03d4d98d74a5eca;hb=c0075ba789491de3bb30fd37c6c382685f73bf75;hp=6b0d6bdfb2b5f0d40a667c77060c478df022637f;hpb=921d317225e75527d6f1d9fdc96b2fd1fb3f6840;p=grits diff --git a/src/gis-viewer.h b/src/gis-viewer.h index 6b0d6bd..5e84e43 100644 --- a/src/gis-viewer.h +++ b/src/gis-viewer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Andy Spencer + * Copyright (C) 2009-2010 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,63 +15,112 @@ * along with this program. If not, see . */ -#ifndef __GIS_VIEW_H__ -#define __GIS_VIEW_H__ +#ifndef __GIS_VIEWER_H__ +#define __GIS_VIEWER_H__ +#include #include +/* Rendering levels */ +#define GIS_LEVEL_BACKGROUND -100 +#define GIS_LEVEL_WORLD 0 +#define GIS_LEVEL_OVERLAY 100 +#define GIS_LEVEL_HUD 200 + /* Type macros */ -#define GIS_TYPE_VIEW (gis_view_get_type()) -#define GIS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GIS_TYPE_VIEW, GisView)) -#define GIS_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GIS_TYPE_VIEW)) -#define GIS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIS_TYPE_VIEW, GisViewClass)) -#define GIS_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIS_TYPE_VIEW)) -#define GIS_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIS_TYPE_VIEW, GisViewClass)) +#define GIS_TYPE_VIEWER (gis_viewer_get_type()) +#define GIS_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GIS_TYPE_VIEWER, GisViewer)) +#define GIS_IS_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GIS_TYPE_VIEWER)) +#define GIS_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIS_TYPE_VIEWER, GisViewerClass)) +#define GIS_IS_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIS_TYPE_VIEWER)) +#define GIS_VIEWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIS_TYPE_VIEWER, GisViewerClass)) + +typedef struct _GisViewer GisViewer; +typedef struct _GisViewerClass GisViewerClass; + +typedef gdouble (*GisHeightFunc)(gdouble lat, gdouble lon, gpointer user_data); -typedef struct _GisView GisView; -typedef struct _GisViewClass GisViewClass; +#include "gis-plugin.h" +#include "gis-prefs.h" +#include "objects/gis-object.h" +#include "objects/gis-tile.h" -struct _GisView { - GObject parent_instance; +struct _GisViewer { + GtkDrawingArea parent_instance; /* instance members */ - gchar *time; - gchar *site; - gdouble location[3]; - gdouble rotation[3]; - gboolean offline; + GisPlugins *plugins; + GisPrefs *prefs; + gchar *time; + gdouble location[3]; + gdouble rotation[3]; + gboolean offline; }; -struct _GisViewClass { - GObjectClass parent_class; +struct _GisViewerClass { + GtkDrawingAreaClass parent_class; /* class members */ + void (*center_position) (GisViewer *viewer, + gdouble lat, gdouble lon, gdouble elev); + + void (*project) (GisViewer *viewer, + gdouble lat, gdouble lon, gdouble elev, + gdouble *px, gdouble *py, gdouble *pz); + + void (*clear_height_func)(GisViewer *self); + void (*set_height_func) (GisViewer *self, GisTile *tile, + GisHeightFunc height_func, gpointer user_data, + gboolean update); + + void (*begin) (GisViewer *viewer); + void (*end) (GisViewer *viewer); + + gpointer (*add) (GisViewer *viewer, GisObject *object, + gint level, gboolean sort); + void (*remove) (GisViewer *viewer, gpointer ref); }; -GType gis_view_get_type(void); +GType gis_viewer_get_type(void); /* Methods */ -GisView *gis_view_new(); +void gis_viewer_setup(GisViewer *viewer, GisPlugins *plugins, GisPrefs *prefs); + +void gis_viewer_set_time(GisViewer *viewer, const gchar *time); +gchar *gis_viewer_get_time(GisViewer *viewer); + +void gis_viewer_set_location(GisViewer *viewer, gdouble lat, gdouble lon, gdouble elev); +void gis_viewer_get_location(GisViewer *viewer, gdouble *lat, gdouble *lon, gdouble *elev); +void gis_viewer_pan (GisViewer *viewer, gdouble lat, gdouble lon, gdouble elev); +void gis_viewer_zoom (GisViewer *viewer, gdouble scale); + +void gis_viewer_set_rotation(GisViewer *viewer, gdouble x, gdouble y, gdouble z); +void gis_viewer_get_rotation(GisViewer *viewer, gdouble *x, gdouble *y, gdouble *z); +void gis_viewer_rotate (GisViewer *viewer, gdouble x, gdouble y, gdouble z); + +void gis_viewer_refresh(GisViewer *viewer); -void gis_view_set_time(GisView *view, const gchar *time); -gchar *gis_view_get_time(GisView *view); +void gis_viewer_set_offline(GisViewer *viewer, gboolean offline); +gboolean gis_viewer_get_offline(GisViewer *viewer); -void gis_view_set_location(GisView *view, gdouble lat, gdouble lon, gdouble elev); -void gis_view_get_location(GisView *view, gdouble *lat, gdouble *lon, gdouble *elev); -void gis_view_pan (GisView *view, gdouble lat, gdouble lon, gdouble elev); -void gis_view_zoom (GisView *view, gdouble scale); +/* To be implemented by subclasses */ +void gis_viewer_center_position(GisViewer *viewer, + gdouble lat, gdouble lon, gdouble elev); -void gis_view_set_rotation(GisView *view, gdouble x, gdouble y, gdouble z); -void gis_view_get_rotation(GisView *view, gdouble *x, gdouble *y, gdouble *z); -void gis_view_rotate (GisView *view, gdouble x, gdouble y, gdouble z); +void gis_viewer_project(GisViewer *viewer, + gdouble lat, gdouble lon, gdouble elev, + gdouble *px, gdouble *py, gdouble *pz); -/* To be deprecated, use {get,set}_location */ -void gis_view_set_site(GisView *view, const gchar *site); -gchar *gis_view_get_site(GisView *view); +void gis_viewer_clear_height_func(GisViewer *self); +void gis_viewer_set_height_func(GisViewer *self, GisTile *tile, + GisHeightFunc height_func, gpointer user_data, + gboolean update); -void gis_world_refresh(GisWorld *world); +void gis_viewer_begin(GisViewer *viewer); +void gis_viewer_end (GisViewer *viewer); -void gis_world_set_offline(GisWorld *world, gboolean offline); -gboolean gis_world_get_offline(GisWorld *world); +gpointer gis_viewer_add(GisViewer *self, GisObject *object, + gint level, gboolean sort); +void gis_viewer_remove(GisViewer *self, gpointer ref); #endif