]> Pileus Git - grits/blob - src/gis-viewer.h
GisViewer: remove begin/end functions
[grits] / src / gis-viewer.h
1 /*
2  * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 #ifndef __GIS_VIEWER_H__
19 #define __GIS_VIEWER_H__
20
21 #include <gtk/gtk.h>
22 #include <glib-object.h>
23
24 /* Rendering levels */
25 #define GIS_LEVEL_BACKGROUND -100
26 #define GIS_LEVEL_WORLD         0
27 #define GIS_LEVEL_OVERLAY     100
28 #define GIS_LEVEL_HUD         200
29
30 /* Type macros */
31 #define GIS_TYPE_VIEWER            (gis_viewer_get_type())
32 #define GIS_VIEWER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),   GIS_TYPE_VIEWER, GisViewer))
33 #define GIS_IS_VIEWER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),   GIS_TYPE_VIEWER))
34 #define GIS_VIEWER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST   ((klass), GIS_TYPE_VIEWER, GisViewerClass))
35 #define GIS_IS_VIEWER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE   ((klass), GIS_TYPE_VIEWER))
36 #define GIS_VIEWER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),   GIS_TYPE_VIEWER, GisViewerClass))
37
38 typedef struct _GisViewer      GisViewer;
39 typedef struct _GisViewerClass GisViewerClass;
40
41 typedef gdouble (*GisHeightFunc)(gdouble lat, gdouble lon, gpointer user_data);
42
43 #include "gis-plugin.h"
44 #include "gis-prefs.h"
45 #include "objects/gis-object.h"
46 #include "objects/gis-tile.h"
47
48 struct _GisViewer {
49         GtkDrawingArea parent_instance;
50
51         /* instance members */
52         GisPlugins *plugins;
53         GisPrefs   *prefs;
54         gchar      *time;
55         gdouble     location[3];
56         gdouble     rotation[3];
57         gboolean    offline;
58 };
59
60 struct _GisViewerClass {
61         GtkDrawingAreaClass parent_class;
62
63         /* class members */
64         void (*center_position)  (GisViewer *viewer,
65                                   gdouble lat, gdouble lon, gdouble elev);
66
67         void (*project)          (GisViewer *viewer,
68                                   gdouble lat, gdouble lon, gdouble elev,
69                                   gdouble *px, gdouble *py, gdouble *pz);
70
71         void (*clear_height_func)(GisViewer *self);
72         void (*set_height_func)  (GisViewer *self, GisTile *tile,
73                                   GisHeightFunc height_func, gpointer user_data,
74                                   gboolean update);
75
76         gpointer (*add)          (GisViewer *viewer, GisObject *object,
77                                   gint level, gboolean sort);
78         void (*remove)           (GisViewer *viewer, gpointer ref);
79 };
80
81 GType gis_viewer_get_type(void);
82
83 /* Methods */
84 void gis_viewer_setup(GisViewer *viewer, GisPlugins *plugins, GisPrefs *prefs);
85
86 void gis_viewer_set_time(GisViewer *viewer, const gchar *time);
87 gchar *gis_viewer_get_time(GisViewer *viewer);
88
89 void gis_viewer_set_location(GisViewer *viewer, gdouble  lat, gdouble  lon, gdouble  elev);
90 void gis_viewer_get_location(GisViewer *viewer, gdouble *lat, gdouble *lon, gdouble *elev);
91 void gis_viewer_pan         (GisViewer *viewer, gdouble  lat, gdouble  lon, gdouble  elev);
92 void gis_viewer_zoom        (GisViewer *viewer, gdouble  scale);
93
94 void gis_viewer_set_rotation(GisViewer *viewer, gdouble  x, gdouble  y, gdouble  z);
95 void gis_viewer_get_rotation(GisViewer *viewer, gdouble *x, gdouble *y, gdouble *z);
96 void gis_viewer_rotate      (GisViewer *viewer, gdouble  x, gdouble  y, gdouble  z);
97
98 void gis_viewer_refresh(GisViewer *viewer);
99
100 void gis_viewer_set_offline(GisViewer *viewer, gboolean offline);
101 gboolean gis_viewer_get_offline(GisViewer *viewer);
102
103 /* To be implemented by subclasses */
104 void gis_viewer_center_position(GisViewer *viewer,
105                 gdouble lat, gdouble lon, gdouble elev);
106
107 void gis_viewer_project(GisViewer *viewer,
108                 gdouble lat, gdouble lon, gdouble elev,
109                 gdouble *px, gdouble *py, gdouble *pz);
110
111 void gis_viewer_clear_height_func(GisViewer *self);
112 void gis_viewer_set_height_func(GisViewer *self, GisTile *tile,
113                 GisHeightFunc height_func, gpointer user_data,
114                 gboolean update);
115
116 gpointer gis_viewer_add(GisViewer *self, GisObject *object,
117                 gint level, gboolean sort);
118 void gis_viewer_remove(GisViewer *self, gpointer ref);
119
120 #endif