Parent Directory | Revision Log
Initial import
1 | /* |
2 | * Copyright (C) 2008 Till Harbaum <till@harbaum.org>. |
3 | * |
4 | * This file is part of OSM2Go. |
5 | * |
6 | * OSM2Go is free software: you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation, either version 3 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * OSM2Go is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU General Public License |
17 | * along with OSM2Go. If not, see <http://www.gnu.org/licenses/>. |
18 | */ |
19 | |
20 | #ifndef JOSM_ELEMSTYLES_H |
21 | #define JOSM_ELEMSTYLES_H |
22 | |
23 | // Ratio conversions |
24 | |
25 | float scaledn_to_zoom(const float scaledn); |
26 | float zoom_to_scaledn(const float zoom); |
27 | |
28 | |
29 | typedef enum { |
30 | ES_TYPE_NONE = 0, |
31 | ES_TYPE_LINE, |
32 | ES_TYPE_AREA |
33 | } elemstyle_type_t; |
34 | |
35 | typedef gulong elemstyle_color_t; |
36 | |
37 | /* from elemstyles.xml: |
38 | * line attributes |
39 | * - width absolute width in pixel in every zoom level |
40 | * - realwidth relative width which will be scaled in meters, integer |
41 | * - colour |
42 | */ |
43 | |
44 | typedef struct { |
45 | gint width; |
46 | elemstyle_color_t color; |
47 | |
48 | struct { |
49 | gboolean valid; |
50 | gint width; |
51 | } real; |
52 | |
53 | struct { |
54 | gboolean valid; |
55 | gint width; |
56 | elemstyle_color_t color; |
57 | } bg; |
58 | |
59 | float zoom_max; // XXX probably belongs in elemstyle_s |
60 | } elemstyle_line_t; |
61 | |
62 | typedef struct { |
63 | elemstyle_color_t color; |
64 | float zoom_max; // XXX probably belongs in elemstyle_s |
65 | } elemstyle_area_t; |
66 | |
67 | typedef struct { |
68 | gboolean annotate; |
69 | char *filename; |
70 | float zoom_max; // XXX probably belongs in elemstyle_s |
71 | } elemstyle_icon_t; |
72 | |
73 | typedef struct elemstyle_s { |
74 | struct { |
75 | char *key; |
76 | char *value; |
77 | } condition; |
78 | |
79 | elemstyle_type_t type; |
80 | |
81 | union { |
82 | elemstyle_line_t *line; |
83 | elemstyle_area_t *area; |
84 | }; |
85 | |
86 | elemstyle_icon_t *icon; |
87 | |
88 | struct elemstyle_s *next; |
89 | } elemstyle_t; |
90 | |
91 | elemstyle_t *josm_elemstyles_load(char *name); |
92 | void josm_elemstyles_free(elemstyle_t *elemstyles); |
93 | gboolean parse_color(xmlNode *a_node, char *name, elemstyle_color_t *color); |
94 | |
95 | void josm_elemstyles_colorize_node(struct style_s *style, node_t *node); |
96 | void josm_elemstyles_colorize_way(struct style_s *style, way_t *way); |
97 | void josm_elemstyles_colorize_world(struct style_s *style, osm_t *osm); |
98 | |
99 | #endif // JOSM_ELEMSTYLES_H |