Parent Directory | Revision Log
Support for a dashed line style. Tweak Mapnik style to use it, and then compensate a bit for that fact that it makes things slower.
1 | harbaum | 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 | achadwick | 13 | gboolean dashed; |
48 | harbaum | 1 | |
49 | struct { | ||
50 | gboolean valid; | ||
51 | gint width; | ||
52 | } real; | ||
53 | |||
54 | struct { | ||
55 | gboolean valid; | ||
56 | gint width; | ||
57 | elemstyle_color_t color; | ||
58 | } bg; | ||
59 | |||
60 | float zoom_max; // XXX probably belongs in elemstyle_s | ||
61 | } elemstyle_line_t; | ||
62 | |||
63 | typedef struct { | ||
64 | elemstyle_color_t color; | ||
65 | float zoom_max; // XXX probably belongs in elemstyle_s | ||
66 | } elemstyle_area_t; | ||
67 | |||
68 | typedef struct { | ||
69 | gboolean annotate; | ||
70 | char *filename; | ||
71 | float zoom_max; // XXX probably belongs in elemstyle_s | ||
72 | } elemstyle_icon_t; | ||
73 | |||
74 | typedef struct elemstyle_s { | ||
75 | struct { | ||
76 | char *key; | ||
77 | char *value; | ||
78 | } condition; | ||
79 | |||
80 | elemstyle_type_t type; | ||
81 | |||
82 | union { | ||
83 | elemstyle_line_t *line; | ||
84 | elemstyle_area_t *area; | ||
85 | }; | ||
86 | |||
87 | elemstyle_icon_t *icon; | ||
88 | |||
89 | struct elemstyle_s *next; | ||
90 | } elemstyle_t; | ||
91 | |||
92 | elemstyle_t *josm_elemstyles_load(char *name); | ||
93 | void josm_elemstyles_free(elemstyle_t *elemstyles); | ||
94 | gboolean parse_color(xmlNode *a_node, char *name, elemstyle_color_t *color); | ||
95 | |||
96 | void josm_elemstyles_colorize_node(struct style_s *style, node_t *node); | ||
97 | void josm_elemstyles_colorize_way(struct style_s *style, way_t *way); | ||
98 | void josm_elemstyles_colorize_world(struct style_s *style, osm_t *osm); | ||
99 | |||
100 | #endif // JOSM_ELEMSTYLES_H | ||
101 | achadwick | 13 | |
102 | // vim:et:ts=8:sw=2:sts=2:ai |