source: trunk/src/memphis-rule.c @ 142

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

Add an autotools based build system

  • moved all code to the src directory
  • generates pkg-config files

remove memphis-uninstalled.pc.in

File size: 3.3 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-rule.h"
21
22G_DEFINE_TYPE (MemphisRule, memphis_rule, G_TYPE_OBJECT)
23
24#define GET_PRIVATE(o) \
25  (G_TYPE_INSTANCE_GET_PRIVATE ((o), MEMPHIS_TYPE_RULE, MemphisRulePrivate))
26
27typedef struct _MemphisRulePrivate MemphisRulePrivate;
28
29/*
30struct _MemphisRulePrivate {
31    int dummy;
32};
33*/
34
35static void
36memphis_rule_get_property (GObject *object, guint property_id,
37                              GValue *value, GParamSpec *pspec)
38{
39  switch (property_id) {
40  default:
41    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
42  }
43}
44
45static void
46memphis_rule_set_property (GObject *object, guint property_id,
47                              const GValue *value, GParamSpec *pspec)
48{
49  switch (property_id) {
50  default:
51    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
52  }
53}
54
55static void
56memphis_rule_dispose (GObject *object)
57{
58  G_OBJECT_CLASS (memphis_rule_parent_class)->dispose (object);
59}
60
61static void
62memphis_rule_finalize (GObject *object)
63{
64  MemphisRule *self = MEMPHIS_RULE (object);
65
66  if (self->keys != NULL)
67    g_strfreev (self->keys);
68  if (self->values != NULL)
69    g_strfreev (self->values);
70  G_OBJECT_CLASS (memphis_rule_parent_class)->finalize (object);
71}
72
73static void
74memphis_rule_class_init (MemphisRuleClass *klass)
75{
76  GObjectClass *object_class = G_OBJECT_CLASS (klass);
77
78  //g_type_class_add_private (klass, sizeof (MemphisRulePrivate));
79
80  object_class->get_property = memphis_rule_get_property;
81  object_class->set_property = memphis_rule_set_property;
82  object_class->dispose = memphis_rule_dispose;
83  object_class->finalize = memphis_rule_finalize;
84}
85
86static void
87memphis_rule_init (MemphisRule *self)
88{
89  self->keys = NULL;
90  self->values = NULL;
91  self->type = 0;
92
93  self->polygon_color[0] = -1;
94  self->polygon_color[1] = -1;
95  self->polygon_color[2] = -1;
96  self->polygon_z[0] = -1;
97  self->polygon_z[1] = -1;
98
99  self->line_color[0] = -1;
100  self->line_color[1] = -1;
101  self->line_color[2] = -1;
102  self->line_size = -1.0;
103  self->line_z[0] = -1;
104  self->line_z[1] = -1;
105
106  self->border_color[0] = -1;
107  self->border_color[1] = -1;
108  self->border_color[2] = -1;
109  self->border_size = -1.0;
110  self->border_z[0] = -1;
111  self->border_z[1] = -1;
112
113  self->text_color[0] = -1;
114  self->text_color[1] = -1;
115  self->text_color[2] = -1;
116  self->text_size = -1.0;
117  self->text_z[0] = -1;
118  self->text_z[1] = -1;
119}
120
121MemphisRule*
122memphis_rule_new (void)
123{
124  return g_object_new (MEMPHIS_TYPE_RULE, NULL);
125}
126
127void
128memphis_rule_free (MemphisRule* rule)
129{
130  g_object_unref (rule);
131}
Note: See TracBrowser for help on using the repository browser.