2 * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef __GIS_VIEWER_H__
19 #define __GIS_VIEWER_H__
22 #include <glib-object.h>
24 /* Rendering levels */
26 * GIS_LEVEL_BACKGROUND:
28 * The level used to draw background objects (stars, atmosphere, etc).
30 #define GIS_LEVEL_BACKGROUND -100
35 * The level used to draw world objects. This is for both surface data as well
36 * as things in the air or underground. Most objects should use
39 #define GIS_LEVEL_WORLD 0
44 * The level used to draw screen overlays. These will be drawn in front of most
45 * of ther objects. Text and markers should use %GIS_LEVEL_OVERLAY.
47 #define GIS_LEVEL_OVERLAY 100
52 * The level used to draw the Heads Up Display. This is for things that are not
53 * anchored at all the the world. They should be drawn in front of everything
56 #define GIS_LEVEL_HUD 200
59 #define GIS_TYPE_VIEWER (gis_viewer_get_type())
60 #define GIS_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GIS_TYPE_VIEWER, GisViewer))
61 #define GIS_IS_VIEWER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GIS_TYPE_VIEWER))
62 #define GIS_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIS_TYPE_VIEWER, GisViewerClass))
63 #define GIS_IS_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIS_TYPE_VIEWER))
64 #define GIS_VIEWER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIS_TYPE_VIEWER, GisViewerClass))
66 typedef struct _GisViewer GisViewer;
67 typedef struct _GisViewerClass GisViewerClass;
71 * @lat: the target latitude
72 * @lon: the target longitude
73 * @user_data: user data passed to the function
75 * Determine the surface elevation (ground level) at a given point.
77 * Returns: the elevation in meters above sea level
79 typedef gdouble (*GisHeightFunc)(gdouble lat, gdouble lon, gpointer user_data);
81 #include "gis-plugin.h"
82 #include "gis-prefs.h"
83 #include "objects/gis-object.h"
86 GtkDrawingArea parent_instance;
88 /* instance members */
98 gdouble drag_x, drag_y;
101 struct _GisViewerClass {
102 GtkDrawingAreaClass parent_class;
105 void (*center_position) (GisViewer *viewer,
106 gdouble lat, gdouble lon, gdouble elev);
108 void (*project) (GisViewer *viewer,
109 gdouble lat, gdouble lon, gdouble elev,
110 gdouble *px, gdouble *py, gdouble *pz);
112 void (*clear_height_func)(GisViewer *viewer);
113 void (*set_height_func) (GisViewer *viewer, GisBounds *bounds,
114 GisHeightFunc height_func, gpointer user_data,
117 gpointer (*add) (GisViewer *viewer, GisObject *object,
118 gint level, gboolean sort);
119 GisObject *(*remove) (GisViewer *viewer, gpointer ref);
122 GType gis_viewer_get_type(void);
125 void gis_viewer_setup(GisViewer *viewer, GisPlugins *plugins, GisPrefs *prefs);
127 void gis_viewer_set_time(GisViewer *viewer, time_t time);
128 time_t gis_viewer_get_time(GisViewer *viewer);
130 void gis_viewer_set_location(GisViewer *viewer, gdouble lat, gdouble lon, gdouble elev);
131 void gis_viewer_get_location(GisViewer *viewer, gdouble *lat, gdouble *lon, gdouble *elev);
132 void gis_viewer_pan(GisViewer *viewer, gdouble forward, gdouble right, gdouble up);
133 void gis_viewer_zoom(GisViewer *viewer, gdouble scale);
135 void gis_viewer_set_rotation(GisViewer *viewer, gdouble x, gdouble y, gdouble z);
136 void gis_viewer_get_rotation(GisViewer *viewer, gdouble *x, gdouble *y, gdouble *z);
137 void gis_viewer_rotate (GisViewer *viewer, gdouble x, gdouble y, gdouble z);
139 void gis_viewer_refresh(GisViewer *viewer);
141 void gis_viewer_set_offline(GisViewer *viewer, gboolean offline);
142 gboolean gis_viewer_get_offline(GisViewer *viewer);
144 /* To be implemented by subclasses */
145 void gis_viewer_center_position(GisViewer *viewer,
146 gdouble lat, gdouble lon, gdouble elev);
148 void gis_viewer_project(GisViewer *viewer,
149 gdouble lat, gdouble lon, gdouble elev,
150 gdouble *px, gdouble *py, gdouble *pz);
152 void gis_viewer_clear_height_func(GisViewer *viewer);
153 void gis_viewer_set_height_func(GisViewer *viewer, GisBounds *bounds,
154 GisHeightFunc height_func, gpointer user_data,
157 gpointer gis_viewer_add(GisViewer *viewer, GisObject *object,
158 gint level, gboolean sort);
159 GisObject *gis_viewer_remove(GisViewer *viewer, gpointer ref);