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"
84 #include "objects/gis-tile.h"
87 GtkDrawingArea parent_instance;
89 /* instance members */
99 gdouble drag_x, drag_y;
102 struct _GisViewerClass {
103 GtkDrawingAreaClass parent_class;
106 void (*center_position) (GisViewer *viewer,
107 gdouble lat, gdouble lon, gdouble elev);
109 void (*project) (GisViewer *viewer,
110 gdouble lat, gdouble lon, gdouble elev,
111 gdouble *px, gdouble *py, gdouble *pz);
113 void (*clear_height_func)(GisViewer *viewer);
114 void (*set_height_func) (GisViewer *viewer, GisTile *tile,
115 GisHeightFunc height_func, gpointer user_data,
118 gpointer (*add) (GisViewer *viewer, GisObject *object,
119 gint level, gboolean sort);
120 GisObject *(*remove) (GisViewer *viewer, gpointer ref);
123 GType gis_viewer_get_type(void);
126 void gis_viewer_setup(GisViewer *viewer, GisPlugins *plugins, GisPrefs *prefs);
128 void gis_viewer_set_time(GisViewer *viewer, time_t time);
129 time_t gis_viewer_get_time(GisViewer *viewer);
131 void gis_viewer_set_location(GisViewer *viewer, gdouble lat, gdouble lon, gdouble elev);
132 void gis_viewer_get_location(GisViewer *viewer, gdouble *lat, gdouble *lon, gdouble *elev);
133 void gis_viewer_pan(GisViewer *viewer, gdouble forward, gdouble right, gdouble up);
134 void gis_viewer_zoom(GisViewer *viewer, gdouble scale);
136 void gis_viewer_set_rotation(GisViewer *viewer, gdouble x, gdouble y, gdouble z);
137 void gis_viewer_get_rotation(GisViewer *viewer, gdouble *x, gdouble *y, gdouble *z);
138 void gis_viewer_rotate (GisViewer *viewer, gdouble x, gdouble y, gdouble z);
140 void gis_viewer_refresh(GisViewer *viewer);
142 void gis_viewer_set_offline(GisViewer *viewer, gboolean offline);
143 gboolean gis_viewer_get_offline(GisViewer *viewer);
145 /* To be implemented by subclasses */
146 void gis_viewer_center_position(GisViewer *viewer,
147 gdouble lat, gdouble lon, gdouble elev);
149 void gis_viewer_project(GisViewer *viewer,
150 gdouble lat, gdouble lon, gdouble elev,
151 gdouble *px, gdouble *py, gdouble *pz);
153 void gis_viewer_clear_height_func(GisViewer *viewer);
154 void gis_viewer_set_height_func(GisViewer *viewer, GisTile *tile,
155 GisHeightFunc height_func, gpointer user_data,
158 gpointer gis_viewer_add(GisViewer *viewer, GisObject *object,
159 gint level, gboolean sort);
160 GisObject *gis_viewer_remove(GisViewer *viewer, gpointer ref);