| 1 |
/* |
| 2 |
* Copyright (C) 2009 Simon Wenner <simon@wenner.ch> |
| 3 |
* Copyright (C) 2010-2012 Jiri Techet <techet@gmail.com> |
| 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 |
#ifndef _CHAMPLAIN_MEMPHIS_RENDERER |
| 21 |
#define _CHAMPLAIN_MEMPHIS_RENDERER |
| 22 |
|
| 23 |
#define __CHAMPLAIN_CHAMPLAIN_H_INSIDE__ |
| 24 |
|
| 25 |
#include "champlain/champlain-features.h" |
| 26 |
|
| 27 |
#include <champlain/champlain-tile-source.h> |
| 28 |
#include <champlain/champlain-bounding-box.h> |
| 29 |
|
| 30 |
#include <glib-object.h> |
| 31 |
|
| 32 |
G_BEGIN_DECLS |
| 33 |
|
| 34 |
#define CHAMPLAIN_TYPE_MEMPHIS_RENDERER champlain_memphis_renderer_get_type () |
| 35 |
|
| 36 |
#define CHAMPLAIN_MEMPHIS_RENDERER(obj) \ |
| 37 |
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MEMPHIS_RENDERER, ChamplainMemphisRenderer)) |
| 38 |
|
| 39 |
#define CHAMPLAIN_MEMPHIS_RENDERER_CLASS(klass) \ |
| 40 |
(G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_MEMPHIS_RENDERER, ChamplainMemphisRendererClass)) |
| 41 |
|
| 42 |
#define CHAMPLAIN_IS_MEMPHIS_RENDERER(obj) \ |
| 43 |
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_MEMPHIS_RENDERER)) |
| 44 |
|
| 45 |
#define CHAMPLAIN_IS_MEMPHIS_RENDERER_CLASS(klass) \ |
| 46 |
(G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MEMPHIS_RENDERER)) |
| 47 |
|
| 48 |
#define CHAMPLAIN_MEMPHIS_RENDERER_GET_CLASS(obj) \ |
| 49 |
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MEMPHIS_RENDERER, ChamplainMemphisRendererClass)) |
| 50 |
|
| 51 |
typedef struct _ChamplainMemphisRendererPrivate ChamplainMemphisRendererPrivate; |
| 52 |
|
| 53 |
typedef struct _ChamplainMemphisRenderer ChamplainMemphisRenderer; |
| 54 |
typedef struct _ChamplainMemphisRendererClass ChamplainMemphisRendererClass; |
| 55 |
|
| 56 |
typedef struct _ChamplainMemphisRule ChamplainMemphisRule; |
| 57 |
typedef struct _ChamplainMemphisRuleAttr ChamplainMemphisRuleAttr; |
| 58 |
|
| 59 |
/** |
| 60 |
* ChamplainMemphisRuleType: |
| 61 |
* @CHAMPLAIN_MEMPHIS_RULE_TYPE_UNKNOWN: MEMPHIS_RULE_TYPE_UNKNOWN |
| 62 |
* @CHAMPLAIN_MEMPHIS_RULE_TYPE_NODE: MEMPHIS_RULE_TYPE_NODE |
| 63 |
* @CHAMPLAIN_MEMPHIS_RULE_TYPE_WAY: MEMPHIS_RULE_TYPE_WAY |
| 64 |
* @CHAMPLAIN_MEMPHIS_RULE_TYPE_RELATION: MEMPHIS_RULE_TYPE_RELATION |
| 65 |
* |
| 66 |
* A wrapper of the MemphisRuleType union. For details see the libmemphis |
| 67 |
* documentation. |
| 68 |
* |
| 69 |
* Since: 0.8 |
| 70 |
*/ |
| 71 |
typedef enum |
| 72 |
{ |
| 73 |
CHAMPLAIN_MEMPHIS_RULE_TYPE_UNKNOWN, |
| 74 |
CHAMPLAIN_MEMPHIS_RULE_TYPE_NODE, |
| 75 |
CHAMPLAIN_MEMPHIS_RULE_TYPE_WAY, |
| 76 |
CHAMPLAIN_MEMPHIS_RULE_TYPE_RELATION |
| 77 |
} ChamplainMemphisRuleType; |
| 78 |
|
| 79 |
/** |
| 80 |
* ChamplainMemphisRenderer: |
| 81 |
* |
| 82 |
* The #ChamplainMemphisRenderer structure contains only private data |
| 83 |
* and should be accessed using the provided API |
| 84 |
* |
| 85 |
* Since: 0.8 |
| 86 |
*/ |
| 87 |
struct _ChamplainMemphisRenderer |
| 88 |
{ |
| 89 |
ChamplainRenderer parent; |
| 90 |
|
| 91 |
ChamplainMemphisRendererPrivate *priv; |
| 92 |
}; |
| 93 |
|
| 94 |
struct _ChamplainMemphisRendererClass |
| 95 |
{ |
| 96 |
ChamplainRendererClass parent_class; |
| 97 |
}; |
| 98 |
|
| 99 |
/** |
| 100 |
* ChamplainMemphisRuleAttr: |
| 101 |
* @z_min: z_min |
| 102 |
* @z_max: z_max |
| 103 |
* @color_red: color_red |
| 104 |
* @color_green: color_green |
| 105 |
* @color_blue: color_blue |
| 106 |
* @color_alpha: color_alpha |
| 107 |
* @style: style |
| 108 |
* @size: size |
| 109 |
* |
| 110 |
* A wrapper of the MemphisRuleAttr structure. For details see the libmemphis |
| 111 |
* documentation. |
| 112 |
* |
| 113 |
* Since: 0.8 |
| 114 |
*/ |
| 115 |
struct _ChamplainMemphisRuleAttr |
| 116 |
{ |
| 117 |
guint8 z_min; |
| 118 |
guint8 z_max; |
| 119 |
guint8 color_red; |
| 120 |
guint8 color_green; |
| 121 |
guint8 color_blue; |
| 122 |
guint8 color_alpha; |
| 123 |
gchar *style; |
| 124 |
gdouble size; |
| 125 |
}; |
| 126 |
|
| 127 |
/** |
| 128 |
* ChamplainMemphisRule: |
| 129 |
* @keys: keys |
| 130 |
* @values: values |
| 131 |
* @type: type |
| 132 |
* @polygon: polygon |
| 133 |
* @line: line |
| 134 |
* @border: border |
| 135 |
* @text: text |
| 136 |
* |
| 137 |
* A wrapper of the MemphisRule structure. For details see the libmemphis |
| 138 |
* documentation. |
| 139 |
* |
| 140 |
* Since: 0.8 |
| 141 |
*/ |
| 142 |
struct _ChamplainMemphisRule |
| 143 |
{ |
| 144 |
gchar **keys; |
| 145 |
gchar **values; |
| 146 |
ChamplainMemphisRuleType type; |
| 147 |
ChamplainMemphisRuleAttr *polygon; |
| 148 |
ChamplainMemphisRuleAttr *line; |
| 149 |
ChamplainMemphisRuleAttr *border; |
| 150 |
ChamplainMemphisRuleAttr *text; |
| 151 |
}; |
| 152 |
|
| 153 |
GType champlain_memphis_renderer_get_type (void); |
| 154 |
|
| 155 |
ChamplainMemphisRenderer *champlain_memphis_renderer_new_full (guint tile_size); |
| 156 |
|
| 157 |
void champlain_memphis_renderer_load_rules ( |
| 158 |
ChamplainMemphisRenderer *renderer, |
| 159 |
const gchar *rules_path); |
| 160 |
|
| 161 |
ClutterColor *champlain_memphis_renderer_get_background_color ( |
| 162 |
ChamplainMemphisRenderer *renderer); |
| 163 |
|
| 164 |
void champlain_memphis_renderer_set_background_color ( |
| 165 |
ChamplainMemphisRenderer *renderer, |
| 166 |
const ClutterColor *color); |
| 167 |
|
| 168 |
GList *champlain_memphis_renderer_get_rule_ids ( |
| 169 |
ChamplainMemphisRenderer *renderer); |
| 170 |
|
| 171 |
void champlain_memphis_renderer_set_rule ( |
| 172 |
ChamplainMemphisRenderer *renderer, |
| 173 |
ChamplainMemphisRule *rule); |
| 174 |
|
| 175 |
ChamplainMemphisRule *champlain_memphis_renderer_get_rule ( |
| 176 |
ChamplainMemphisRenderer *renderer, |
| 177 |
const gchar *id); |
| 178 |
|
| 179 |
void champlain_memphis_renderer_remove_rule ( |
| 180 |
ChamplainMemphisRenderer *renderer, |
| 181 |
const gchar *id); |
| 182 |
|
| 183 |
ChamplainBoundingBox *champlain_memphis_renderer_get_bounding_box (ChamplainMemphisRenderer *renderer); |
| 184 |
|
| 185 |
void champlain_memphis_renderer_set_tile_size (ChamplainMemphisRenderer *renderer, |
| 186 |
guint size); |
| 187 |
|
| 188 |
guint champlain_memphis_renderer_get_tile_size (ChamplainMemphisRenderer *renderer); |
| 189 |
|
| 190 |
#undef __CHAMPLAIN_CHAMPLAIN_H_INSIDE__ |
| 191 |
|
| 192 |
G_END_DECLS |
| 193 |
|
| 194 |
#endif /* _CHAMPLAIN_MEMPHIS_RENDERER */ |