source: branches/client-library-split/memphis-map.c @ 85

Last change on this file since 85 was 85, checked in by simon, 5 years ago

start of the map class implementation and renederer class enhancements

File size: 2.6 KB
Line 
1/*
2 * Memphis - Cairo Rederer for OSM in C
3 * Copyright (C) 2009  Simon Wenner <simon@wenner.ch>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#include "memphis-map.h"
21#include "osm05.h"
22
23G_DEFINE_TYPE (MemphisMap, memphis_map, G_TYPE_OBJECT)
24
25#define GET_PRIVATE(o) \
26  (G_TYPE_INSTANCE_GET_PRIVATE ((o), MEMPHIS_TYPE_MAP, MemphisMapPrivate))
27
28typedef struct _MemphisMapPrivate MemphisMapPrivate;
29
30struct _MemphisMapPrivate {
31    int dummy;
32};
33
34static void
35memphis_map_get_property (GObject *object, guint property_id,
36                              GValue *value, GParamSpec *pspec)
37{
38  switch (property_id) {
39  default:
40    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
41  }
42}
43
44static void
45memphis_map_set_property (GObject *object, guint property_id,
46                              const GValue *value, GParamSpec *pspec)
47{
48  switch (property_id) {
49  default:
50    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
51  }
52}
53
54static void
55memphis_map_dispose (GObject *object)
56{
57  MemphisMap *self = MEMPHIS_MAP (object);
58
59  osmFree(self->map);
60  G_OBJECT_CLASS (memphis_map_parent_class)->dispose (object);
61}
62
63static void
64memphis_map_class_init (MemphisMapClass *klass)
65{
66  GObjectClass *object_class = G_OBJECT_CLASS (klass);
67
68  g_type_class_add_private (klass, sizeof (MemphisMapPrivate));
69
70  object_class->get_property = memphis_map_get_property;
71  object_class->set_property = memphis_map_set_property;
72  object_class->dispose = memphis_map_dispose;
73}
74
75static void
76memphis_map_init (MemphisMap *self)
77{
78  self->map = NULL;
79}
80
81MemphisMap*
82memphis_map_new_from_file (gchar* filename)
83{
84  MemphisMap* mmap = g_object_new (MEMPHIS_TYPE_MAP, NULL);
85  mmap->map = (osmFile *) osmRead(filename);
86  return mmap;
87}
88
89MemphisMap*
90memphis_map_new_from_data (gchar* data)
91{
92  // TODO
93  return g_object_new (MEMPHIS_TYPE_MAP, NULL);
94}
95
96void
97memphis_map_free (MemphisMap* map)
98{
99  g_object_unref (G_OBJECT (map));
100}
Note: See TracBrowser for help on using the repository browser.