2 * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
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/>.
21 #include "gis-object.h"
25 GisPoint *gis_point_new()
27 return g_new0(GisPoint, 1);
30 void gis_point_set_lle(GisPoint *self, gdouble lat, gdouble lon, gdouble elev)
37 void gis_point_free(GisPoint *self)
44 GisMarker *gis_marker_new(const gchar *label)
46 static const int RADIUS = 4;
47 static const int WIDTH = 100;
48 static const int HEIGHT = 20;
50 GisMarker *self = g_new0(GisMarker, 1);
51 GIS_OBJECT(self)->type = GIS_TYPE_MARKER;
53 self->yoff = HEIGHT-RADIUS;
54 self->label = g_strdup(label);
55 self->cairo = cairo_create(cairo_image_surface_create(
56 CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT));
57 cairo_set_source_rgba(self->cairo, 1, 1, 1, 1);
58 cairo_arc(self->cairo, self->xoff, self->yoff, RADIUS, 0, 2*G_PI);
59 cairo_fill(self->cairo);
60 cairo_move_to(self->cairo, self->xoff+4, self->yoff-8);
61 cairo_set_font_size(self->cairo, 10);
62 cairo_show_text(self->cairo, self->label);
66 void gis_marker_free(GisMarker *self)
68 cairo_surface_destroy(cairo_get_target(self->cairo));
69 cairo_destroy(self->cairo);
76 GisCallback *gis_callback_new(GisCallbackFunc callback, gpointer user_data)
78 GisCallback *self = g_new0(GisCallback, 1);
79 GIS_OBJECT(self)->type = GIS_TYPE_CALLBACK;
80 self->callback = callback;
81 self->user_data = user_data;
85 void gis_callback_free(GisCallback *self)