]> Pileus Git - grits/blob - src/gis-object.h
Update copyright and email address
[grits] / src / gis-object.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_OBJECT_H__
19 #define __GIS_OBJECT_H__
20
21 #include <glib.h>
22 #include <cairo.h>
23
24 /* GisPoint */
25 typedef struct _GisPoint      GisPoint;
26
27 struct _GisPoint {
28         gdouble lat, lon, elev;
29 };
30
31 GisPoint *gis_point_new();
32 void gis_point_set_lle(GisPoint *point, gdouble lat, gdouble lon, gdouble elev);
33 void gis_point_free(GisPoint *point);
34
35
36 /* GisObject */
37 #define GIS_OBJECT(object)     ((GisObject  *)object)
38
39 typedef enum {
40         GIS_TYPE_CALLBACK,
41         GIS_TYPE_MARKER,
42         GIS_NUM_TYPES,
43 } GisObjectType;
44
45 typedef struct _GisObject GisObject;
46
47 struct _GisObject {
48         GisObjectType type;
49         GisPoint      center;
50         gdouble       lod;
51 };
52
53 static inline GisPoint *gis_object_center(GisObject *object)
54 {
55         return &GIS_OBJECT(object)->center;
56 }
57
58
59 /* GisMarker */
60 #define GIS_MARKER(marker) ((GisMarker  *)marker)
61
62 typedef struct _GisMarker GisMarker;
63
64 struct _GisMarker   {
65         GisObject  parent;
66         gint       xoff, yoff;
67         gchar     *label;
68         cairo_t   *cairo;
69         guint      tex;
70 };
71
72 GisMarker *gis_marker_new(const gchar *label);
73 void gis_marker_free(GisMarker *marker);
74
75
76 /* GisCallback */
77 #define GIS_CALLBACK(callback) ((GisCallback*)callback)
78
79 typedef struct _GisCallback GisCallback;
80 typedef gpointer (*GisCallbackFunc)(GisCallback *callback, gpointer user_data);
81
82 struct _GisCallback {
83         GisObject       parent;
84         GisCallbackFunc callback;
85         gpointer        user_data;
86 };
87
88 GisCallback *gis_callback_new(GisCallbackFunc callback, gpointer user_data);
89 void gis_callback_free(GisCallback *cb);
90
91
92 #endif