.
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # map-stylizer
2 | GUI written in Python to parse OSM (OpenStreetMap) files and render them onscreen. Layers may be toggled on/off and drawing may be customized.
3 |
4 | This program allows a user to render OSM files within the GUI. The GUI enables the user to easily modify which layers are visible and the style of these layers.
5 | Basic Demo Video
6 |
7 | Steps
8 |
9 | - Download the source code open the program by typing
python main.py
in the command line.
10 | - Open your browser of choice to OpenStreetMap.
11 | - Click the "Export" tab and select the "Manually select a different area" link. Shape and place the box over the region from which you want map data. Click "Export" to download the OSM file for the box you've drawn. If you get an error that you've selected too many nodes, you may alternatively click "Overpass API."
Note: Ensure your downloaded OSM file is around 30MB. Larger files will noticeably slow the program.
12 | - Open your OSM file using the GUI.
13 | - Edit away!
14 |
15 | Editing
16 |
17 | - Choose which layers you want visible
Note: Layers are grouped by OSM keys (i.e., "highway," "waterway," etc.)
18 | - Change the style of line or fill layers
19 |
20 | - Line layers are QPen objects, so you can specify the line's width, color, style, cap style, and join style
21 | - Fill layers are QColor objects, so you can only specify their color
22 |
23 | - When you save an image, the resulting configuration is saved into the "configs" folder so you can reimport these settings for another project
24 | - You can also automate the creation of configurations via your own script, where you use the Configuration class to set colors of layers en masse
25 |
26 | Adding Additional Layers
27 | When you import an OSM file and begin manipulating it, you will likely notice warnings on your command prompt indicating there are additional layers not rendering because they need to be added. This is okay, as I've added the majority of layers you would be interested in; however, if you would like to add the layers mentioned, follow the below steps:
28 |
29 | - In the constants.py file:
30 |
31 | - Create a unique (both variable name and variable value) VAL variable under the appropriate KEY group
32 | - Create a unique (both variable name and variable value) CONFIG_STYLE variable under the appropriate KEY group
33 | - Connect the new VAL and new CONFIG_STYLE in the DATA_GROUPS dictionary
34 |
35 | - Finally, in the configuration.py file, connect the CONFIG_STYLE to a QPen (for a layer to be rendered as a line) or QColor (for a layer to be rendered as a fill)
36 |
37 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Sun Jun 21 15:22:41 2020
4 |
5 | @author: The Absolute Tinkerer
6 |
7 | https://www.openstreetmap.org/export
8 | """
9 |
10 | import os
11 | import sys
12 |
13 | from PyQt5.QtWidgets import QApplication
14 |
15 | # Simplify our imports from other files
16 | sourcePath = 'src'
17 | sys.path.append(sourcePath)
18 |
19 | # Gather all of the python source files and add them to the system path
20 | for subdir, dirs, files in os.walk(os.path.join(os.getcwd(), sourcePath)):
21 | for directory in dirs:
22 | if directory != '__pycache__':
23 | sys.path.append(os.path.join(subdir, directory))
24 |
25 | import constants as c
26 | from MainWindowHandlers import MainWindowHandlers
27 |
28 |
29 | if __name__ == '__main__':
30 | app = QApplication(sys.argv)
31 |
32 | # Ensure we create the necesary folders if they don't exist
33 | if not os.path.exists(c.FOLDER_DATA):
34 | os.mkdir(c.FOLDER_DATA)
35 | if not os.path.exists(c.FOLDER_OUTPUT):
36 | os.mkdir(c.FOLDER_OUTPUT)
37 | if not os.path.exists(c.FOLDER_CONFIGS):
38 | os.mkdir(c.FOLDER_CONFIGS)
39 | if not os.path.exists(c.FOLDER_USER_CONFIGS):
40 | os.mkdir(c.FOLDER_USER_CONFIGS)
41 |
42 | # Start the program
43 | window = MainWindowHandlers()
44 | window.initialize()
45 | window.show()
46 |
47 | sys.exit(app.exec_())
48 |
--------------------------------------------------------------------------------
/src/core/Map.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Sun Jun 21 16:18:49 2020
4 |
5 | @author: The Absolute Tinkerer
6 |
7 | This class is used to ingest an Open Source Map (osm extension) file. Map will
8 | render lines (represented by QPen type) and fills (represented by QColor type)
9 | but not points. Relations consist of Ways, which consist of Nodes.
10 | """
11 |
12 | import xml.etree.ElementTree as ET
13 |
14 | from PyQt5.QtGui import QPen, QColor, QPainterPath
15 | from PyQt5.QtCore import QPointF
16 |
17 | from Transform import Transform
18 |
19 | import constants as c
20 |
21 |
22 | class Node:
23 | def __init__(self, attrib, transform):
24 | """
25 | Constructor
26 | """
27 | self._id = int(attrib['id'])
28 | self._x = transform.convertLong(float(attrib['lon']))
29 | self._y = transform.convertLat(float(attrib['lat']))
30 |
31 | """
32 | ###########################################################################
33 | Properties
34 | ###########################################################################
35 | """
36 | @property
37 | def ID(self):
38 | return self._id
39 |
40 | @property
41 | def x(self):
42 | return self._x
43 |
44 | @property
45 | def y(self):
46 | return self._y
47 |
48 |
49 | class Way:
50 | def __init__(self, parent):
51 | """
52 | Constructor
53 | """
54 | self._id = int(parent.attrib['id'])
55 | self._nids = []
56 | self._tags = {}
57 |
58 | for child in parent:
59 | if child.tag == 'nd':
60 | self._nids.append(int(child.attrib['ref']))
61 | elif child.tag == 'tag':
62 | key, value = child.attrib['k'], child.attrib['v']
63 | self._tags[key] = value
64 |
65 | """
66 | ###########################################################################
67 | Properties
68 | ###########################################################################
69 | """
70 | @property
71 | def ID(self):
72 | return self._id
73 |
74 | @property
75 | def NIDs(self):
76 | return self._nids
77 |
78 | @property
79 | def tags(self):
80 | return self._tags
81 |
82 |
83 | class Relation:
84 | def __init__(self, parent):
85 | """
86 | Constructor
87 | """
88 | self._id = parent.attrib['id']
89 | self._wids = []
90 | self._tags = {}
91 |
92 | for child in parent:
93 | if child.tag == 'member' and child.attrib['type'] == 'way':
94 | self._wids.append(int(child.attrib['ref']))
95 | elif child.tag == 'tag':
96 | key, value = child.attrib['k'], child.attrib['v']
97 | self._tags[key] = value
98 |
99 | """
100 | ###########################################################################
101 | Properties
102 | ###########################################################################
103 | """
104 | @property
105 | def ID(self):
106 | return self._id
107 |
108 | @property
109 | def WIDs(self):
110 | return self._wids
111 |
112 | @property
113 | def tags(self):
114 | return self._tags
115 |
116 |
117 | class Map:
118 | def __init__(self, width, height, fname, config, scale=1):
119 | """
120 | Constructor
121 |
122 | Parameters:
123 | -----------
124 | width : int
125 | The width of the canvas we're displaying to the user; a separate
126 | width will be used when saving the file
127 | height : int
128 | The height of the canvas we're displaying to the user; a
129 | fname : String
130 | The OSM file name
131 | config : Configuration
132 | The configuration file we use to get all relevant settings
133 | scale : float
134 | This determines how much you scale the pen widths. You want the
135 | output image to look the same as the GUI, so we scale the pen
136 | widths accordingly
137 | """
138 | # Initial variables
139 | root = ET.parse(fname).getroot()
140 | transform = None
141 | nodes = {}
142 | ways = {}
143 | relations = {}
144 |
145 | for child in root:
146 | if child.tag == 'node':
147 | node = Node(child.attrib, transform)
148 | nodes[node.ID] = node
149 | elif child.tag == 'way':
150 | way = Way(child)
151 | ways[way.ID] = way
152 | elif child.tag == 'relation':
153 | relation = Relation(child)
154 | relations[relation.ID] = relation
155 | elif child.tag == 'bounds':
156 | transform = Transform(float(child.attrib['minlat']),
157 | float(child.attrib['maxlat']),
158 | float(child.attrib['minlon']),
159 | float(child.attrib['maxlon']),
160 | width, height)
161 |
162 | # Bind class variables
163 | self._copyright = c.COPYRIGHT
164 | self._attribution = c.ATTRIBUTION
165 | self._license = c.LICENSE
166 | self._transform = transform
167 | self._nodes = nodes
168 | self._ways = ways
169 | self._relations = relations
170 |
171 | self._fname = fname
172 | self._scale = scale
173 | self._config = config
174 |
175 | """
176 | ###########################################################################
177 | Properties
178 | ###########################################################################
179 | """
180 | @property
181 | def Copyright(self):
182 | return self._copyright
183 |
184 | @property
185 | def Attribution(self):
186 | return self._attribution
187 |
188 | @property
189 | def License(self):
190 | return self._license
191 |
192 | @property
193 | def fname(self):
194 | return self._fname
195 |
196 | """
197 | ###########################################################################
198 | Public Functions
199 | ###########################################################################
200 | """
201 | def setTransform(self, transform):
202 | """
203 | """
204 | self._transform = transform
205 |
206 | def getTransform(self):
207 | """
208 | """
209 | return self._transform
210 |
211 | def draw(self, p):
212 | """
213 | p : QPainter
214 | """
215 | p.setRenderHint(p.Antialiasing)
216 |
217 | # Simplification variables
218 | w, h = self._transform.width, self._transform.height
219 | xo, yo = self._transform.xOffset, self._transform.yOffset
220 |
221 | # Color the background according to the settings file
222 | p.fillRect(0, 0, w, h, self._config.getValue(c.CONFIG_BG_COLOR))
223 |
224 | # Fill all natural relations
225 | order = [c.KEY_NATURAL]
226 | for ID in self._relations.keys():
227 | rel = self._relations[ID]
228 | for i, tag in enumerate(order):
229 | try:
230 | if(tag in rel.tags.keys() and self._config.getItemState(
231 | c.DATA_GROUPS[tag][rel.tags[tag]])):
232 | self._renderRelation(p, rel, tag)
233 | except KeyError:
234 | # See note in _buildQueue for details
235 | s = '* WARNING: tag="%s"; key="%s"' % (tag, rel.tags[tag])
236 | s += ' will not render unless manually added!'
237 | print(s)
238 |
239 | # build the drawing queue so we don't have multiple for loops
240 | order = [c.KEY_LANDUSE, c.KEY_WATERWAY, c.KEY_NATURAL, c.KEY_HIGHWAY,
241 | c.KEY_BUILDING]
242 | queue = self._buildQueue(order)
243 |
244 | # Draw the ways from the queue
245 | for i, tag in enumerate(order):
246 | for way in queue[i]:
247 | self._render(p, way, tag)
248 |
249 | # Lastly, color the out of bounds regions white: T, B, L, R
250 | p.fillRect(0, 0, w, yo, QColor(255, 255, 255))
251 | p.fillRect(0, h-yo, w, yo, QColor(255, 255, 255))
252 | p.fillRect(0, 0, xo, h, QColor(255, 255, 255))
253 | p.fillRect(w-xo, 0, xo, h, QColor(255, 255, 255))
254 |
255 | """
256 | ###########################################################################
257 | Private Functions
258 | ###########################################################################
259 | """
260 | def _buildQueue(self, order):
261 | """
262 | Private function used to construct the paint order for elements. This
263 | will do very basic ordering, and it's recommended to implement a tool
264 | in the GUI to perform ordering in the future.
265 |
266 | Parameters:
267 | -----------
268 | order : String
269 | The KEY strings that determine in which order painting will be
270 | completed, with first indices being rendered first
271 |
272 | Returns:
273 | --------
274 | queue : List of Way lists
275 | This will be a 2d array of Ways for each KEY
276 | """
277 | queue = [[] for i in range(len(order))]
278 |
279 | for ID in self._ways.keys():
280 | way = self._ways[ID]
281 |
282 | for i, tag in enumerate(order):
283 | try:
284 | if(tag in way.tags.keys() and self._config.getItemState(
285 | c.DATA_GROUPS[tag][way.tags[tag]])):
286 | queue[i].append(way)
287 | except KeyError:
288 | # User will need to add by the following
289 | # 1) Create a unique VAL in constants.py
290 | # 2) Create a unique CONFIG_STYLE in constants.py
291 | # 3) Connect VAL and CONFIG_STYLE in the DATA_GROUPS data
292 | # (constants.py file)
293 | # 4) Connect the CONFIG_STYLE to a QPen or QColor in
294 | # configuration.py
295 | s = '* WARNING: tag="%s"; key="%s"' % (tag, way.tags[tag])
296 | s += ' will not render unless manually added!'
297 | print(s)
298 |
299 | return queue
300 |
301 | def _render(self, p, way, tag):
302 | """
303 | Private function used to render the Way object passed in. Ways may be
304 | filled or simply drawn, so the below code checks for a QPen (draw) vs.
305 | a QColor (fill)
306 |
307 | Parameters:
308 | -----------
309 | p : QPainter
310 | The object with which we're drawing
311 | way : Way
312 | The meta object containing drawing information
313 | tag : String
314 | The tag string corresponding to 'natural', 'highway', 'waterway',
315 | etc.
316 |
317 | Returns:
318 | --------
319 | """
320 | # Select the style
321 | styleKey = c.DATA_GROUPS[tag][way.tags[tag]]
322 | value = self._config.getValue(styleKey)
323 |
324 | points = []
325 | for nid in way.NIDs:
326 | points.append([self._nodes[nid].x,
327 | self._nodes[nid].y])
328 |
329 | if type(value) == QPen:
330 | value.setWidthF(self._scale*value.widthF())
331 | p.setPen(value)
332 | path = QPainterPath(QPointF(*points[0]))
333 | for x, y in points[1:]:
334 | path.lineTo(QPointF(x, y))
335 | p.drawPath(path)
336 | elif type(value) == QColor:
337 | path = QPainterPath(QPointF(*points[0]))
338 | for x, y in points[1:-1]:
339 | path.lineTo(QPointF(x, y))
340 | path.closeSubpath()
341 | p.fillPath(path, value)
342 |
343 | def _renderRelation(self, p, relation, tag):
344 | """
345 | Private function to render relations. Relations are just different from
346 | ways that I constructed a separate function for them. Little bit of
347 | code copy-paste, but not much
348 |
349 | Parameters:
350 | -----------
351 | p : QPainter
352 | The object with which we're drawing
353 | relation : Relation
354 | The meta object containing OSM Relation information
355 | tag : String
356 | The tag string corresponding to 'natural', 'highway', 'waterway',
357 | etc.
358 |
359 | Returns:
360 | --------
361 | """
362 | ways = []
363 | for wid in relation.WIDs:
364 | # return if we don't have the data for this relation
365 | # Note, some OSM files don't include all of the ways that are in
366 | # relations... kinda annoying actually
367 | if wid in self._ways.keys():
368 | ways.append(self._ways[wid])
369 | else:
370 | return
371 |
372 | # Select the style
373 | styleKey = c.DATA_GROUPS[tag][relation.tags[tag]]
374 | value = self._config.getValue(styleKey)
375 | path = QPainterPath()
376 |
377 | # Trace out the ways using a QPainterPath
378 | for way in ways:
379 | points = []
380 | for nid in way.NIDs:
381 | points.append([self._nodes[nid].x,
382 | self._nodes[nid].y])
383 |
384 | path.moveTo(*points[0])
385 | for x, y in points[1:]:
386 | path.lineTo(x, y)
387 | path.closeSubpath()
388 |
389 | # Draw the ways via the QPainter
390 | if type(value) == QPen:
391 | value.setWidthF(self._scale*value.widthF())
392 | p.setPen(value)
393 | p.drawPath(path)
394 | elif type(value) == QColor:
395 | p.fillPath(path, value)
396 |
--------------------------------------------------------------------------------
/src/core/Transform.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Sun Jun 21 16:39:56 2020
4 |
5 | @author: The Absolute Tinkerer
6 | """
7 |
8 | import math
9 |
10 |
11 | class Transform:
12 | def __init__(self, minLat, maxLat, minLong, maxLong, width, height):
13 | """
14 | Constructor
15 |
16 | Parameters:
17 | -----------
18 | minLat : float
19 | The minimum latitude documented in the bounds of the OSM file
20 | maxLat : float
21 | The maximum latitude documented in the bounds of the OSM file
22 | minLong : float
23 | The minimum longitude documented in the bounds of the OSM file
24 | maxLong : float
25 | The maximum longitude documented in the bounds of the OSM file
26 | width : int
27 | The width of the canvas being drawn on
28 | height : int
29 | The height of the canvas being drawn on
30 | """
31 | # Bind to class variables
32 | self._minLat = minLat
33 | self._maxLat = maxLat
34 | self._minLong = minLong
35 | self._maxLong = maxLong
36 | self._width = width
37 | self._height = height
38 | self._xOffset = 0
39 | self._yOffset = 0
40 |
41 | # Compute the offset values used to center mismatched dimensions that
42 | # may be experienced
43 | _maxLat, _minLat = self._lat2y(maxLat), self._lat2y(minLat)
44 | if (maxLong-minLong)/(_maxLat-_minLat) >= width/height:
45 | h = width*(_maxLat - _minLat)/(maxLong - minLong)
46 | self._yOffset = (height - h)/2
47 | else:
48 | w = height*(maxLong - minLong)/(_maxLat - _minLat)
49 | self._xOffset = (width - w)/2
50 |
51 | """
52 | ###########################################################################
53 | Properties
54 | ###########################################################################
55 | """
56 | @property
57 | def minLat(self):
58 | return self._minLat
59 |
60 | @property
61 | def maxLat(self):
62 | return self._maxLat
63 |
64 | @property
65 | def minLong(self):
66 | return self._minLong
67 |
68 | @property
69 | def maxLong(self):
70 | return self._maxLong
71 |
72 | @property
73 | def width(self):
74 | return self._width
75 |
76 | @property
77 | def height(self):
78 | return self._height
79 |
80 | @property
81 | def xOffset(self):
82 | return self._xOffset
83 |
84 | @property
85 | def yOffset(self):
86 | return self._yOffset
87 |
88 | """
89 | ###########################################################################
90 | Public Functions
91 | ###########################################################################
92 | """
93 | def convertLat(self, lat):
94 | """
95 | Used to convert a latitude to pixels
96 | """
97 | _lat = self._lat2y(lat)
98 | _maxLat, _minLat = self._lat2y(self._maxLat), self._lat2y(self._minLat)
99 | frac = (_lat - _minLat) / (_maxLat - _minLat)
100 | h = self._height - 2*self._yOffset
101 | return h - self._yOffset - frac*h
102 |
103 | def convertLong(self, long):
104 | """
105 | Used to convert a longitude to pixels
106 | """
107 | frac = (long - self._minLong) / (self._maxLong - self._minLong)
108 | w = self._width - 2*self._xOffset
109 | return self._xOffset+frac*w
110 |
111 | """
112 | ###########################################################################
113 | Private Functions
114 | ###########################################################################
115 | """
116 | # See (https://wiki.openstreetmap.org/wiki/Mercator#Python) for info on
117 | # these functions
118 | def _y2lat(self, a):
119 | return 180/math.pi*(2*math.atan(math.exp(a*math.pi/180))-math.pi/2)
120 |
121 | def _lat2y(self, a):
122 | return 180/math.pi*math.log(math.tan(math.pi/4+a*math.pi/180/2))
123 |
--------------------------------------------------------------------------------
/src/core/configuration.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Tue Jun 23 16:40:26 2020
4 |
5 | @author: The Absolute Tinkerer
6 |
7 | If the user wishes to add additional layers, they must include the CONFIG_STYLE
8 | connected with the appropriate QPen or QColor in the _initConfig function
9 | """
10 |
11 | import os
12 | import json
13 |
14 | from PyQt5.QtCore import Qt
15 | from PyQt5.QtGui import QColor, QPen
16 |
17 | import constants as c
18 |
19 |
20 | class Configuration:
21 | def __init__(self, fname=c.FILE_CONFIG):
22 | """
23 | Constructor for the user configuration file initialization
24 | """
25 | self._fname = fname
26 |
27 | if os.path.exists(fname):
28 | # When reading the config, we read the objects into the init fields
29 | # and if the file doesn't have all the fields the init has, those
30 | # new values will be added. This assures backward compatibility
31 | # AS LONG AS existing keys and values aren't altered. This only
32 | # addresses new items.
33 | self._read()
34 | else:
35 | self._initConfig()
36 |
37 | """
38 | ###########################################################################
39 | Public Functions
40 | ###########################################################################
41 | """
42 | def getValue(self, item):
43 | """
44 | Function used to get the value of a particular item
45 |
46 | Parameters:
47 | -----------
48 | item : String
49 | String used in the _config dict for a value
50 |
51 | Returns:
52 | --------
53 | : Object
54 | The value of the dict's item
55 | """
56 | item = self._config[item]
57 | if item[0] == c.CONFIG_TYPE_QCOLOR:
58 | return QColor(*item[2:])
59 | elif item[0] == c.CONFIG_TYPE_QPEN:
60 | color = QColor(*item[2:6])
61 | return QPen(color, *item[6:])
62 | return self._config[item]
63 |
64 | def setValue(self, item, value):
65 | """
66 | Function used to set the value of a particular item
67 |
68 | Parameters:
69 | -----------
70 | item : String
71 | String used in the _config dict for a value
72 | value : Object
73 | The new value of the dict's item
74 |
75 | Returns:
76 | --------
77 | """
78 | if type(value) == QColor:
79 | r, g, b = value.red(), value.green(), value.blue()
80 | a = value.alpha()
81 |
82 | state = self._config[item][1]
83 | self._config[item] = [c.CONFIG_TYPE_QCOLOR, state, r, g, b, a]
84 | self._write()
85 | elif type(value) == QPen:
86 | color = value.brush().color()
87 | r, g, b = color.red(), color.green(), color.blue()
88 | a = color.alpha()
89 | state = self._config[item][1]
90 |
91 | self._config[item] = [c.CONFIG_TYPE_QPEN, state, r, g, b, a,
92 | value.widthF(), value.style(),
93 | value.capStyle(), value.joinStyle()]
94 | self._write()
95 | else:
96 | raise Exception('setValue value type not correct!\nRequired: %s,' +
97 | ' Received: %s' % (type(self._config[item]),
98 | type(value)))
99 |
100 | def getItemState(self, item):
101 | """
102 | Function used to get the state of a particular item
103 |
104 | Parameters:
105 | -----------
106 | item : String
107 | String used in the _config dict for a value
108 |
109 | Returns:
110 | --------
111 | : boolean
112 | The state of the dict's item
113 | """
114 | return self._config[item][1]
115 |
116 | def setItemState(self, item, state):
117 | """
118 | Function used to set the state of a particular item
119 |
120 | Parameters:
121 | -----------
122 | item : String
123 | String used in the _config dict for a value
124 | state : boolean
125 | The new state of the dict's item
126 |
127 | Returns:
128 | --------
129 | """
130 | self._config[item][1] = state
131 | self._write()
132 |
133 | def getConfig(self):
134 | """
135 | Function used to get the configuration dict object
136 |
137 | Parameters:
138 | -----------
139 |
140 | Returns:
141 | --------
142 | : dict
143 | The configuration dict object
144 | """
145 | return self._config
146 |
147 | def setConfig(self, newConfig):
148 | """
149 | Function used to set the configuration dict object and write the new
150 | configuration to file
151 |
152 | Parameters:
153 | -----------
154 | newConfig : dict
155 | The new configuration dict object
156 |
157 | Returns:
158 | --------
159 | """
160 | self._config = newConfig
161 | self._write()
162 |
163 | """
164 | ###########################################################################
165 | Private Functions
166 | ###########################################################################
167 | """
168 | def _initConfig(self):
169 | """
170 | Private function used to initialize the configuration
171 |
172 | Parameters:
173 | -----------
174 | Returns:
175 | --------
176 | """
177 | self._config = {
178 | c.CONFIG_BG_COLOR: [c.CONFIG_TYPE_QCOLOR, True, 20, 20, 20, 255],
179 |
180 | c.CONFIG_STYLE_MOTORWAY: [
181 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
182 | 10, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
183 | c.CONFIG_STYLE_TRUNK: [
184 | c.CONFIG_TYPE_QPEN, True, 255, 100, 50, 255,
185 | 10, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
186 | c.CONFIG_STYLE_PRIMARY: [
187 | c.CONFIG_TYPE_QPEN, True, 255, 150, 50, 255,
188 | 5, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
189 | c.CONFIG_STYLE_SECONDARY: [
190 | c.CONFIG_TYPE_QPEN, True, 255, 255, 100, 255,
191 | 5, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
192 | c.CONFIG_STYLE_TERTIARY: [
193 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
194 | 5, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
195 | c.CONFIG_STYLE_UNCLASSIFIED: [
196 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
197 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
198 | c.CONFIG_STYLE_RESIDENTIAL: [
199 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
200 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
201 | c.CONFIG_STYLE_LINK_MOTORWAY: [
202 | c.CONFIG_TYPE_QPEN, True, 255, 50, 50, 255,
203 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
204 | c.CONFIG_STYLE_LINK_TRUNK: [
205 | c.CONFIG_TYPE_QPEN, True, 255, 100, 50, 255,
206 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
207 | c.CONFIG_STYLE_LINK_PRIMARY: [
208 | c.CONFIG_TYPE_QPEN, True, 255, 150, 50, 255,
209 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
210 | c.CONFIG_STYLE_LINK_SECONDARY: [
211 | c.CONFIG_TYPE_QPEN, True, 255, 255, 100, 255,
212 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
213 | c.CONFIG_STYLE_LINK_TERTIARY: [
214 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
215 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
216 | c.CONFIG_STYLE_STREET: [
217 | c.CONFIG_TYPE_QPEN, True, 200, 200, 200, 255,
218 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
219 | c.CONFIG_STYLE_SERVICE: [
220 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
221 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
222 | c.CONFIG_STYLE_PEDESTRIAN: [
223 | c.CONFIG_TYPE_QPEN, True, 150, 150, 150, 255,
224 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
225 | c.CONFIG_STYLE_TRACK: [
226 | c.CONFIG_TYPE_QPEN, True, 155, 113, 30, 255,
227 | 1, Qt.DashDotLine, Qt.RoundCap, Qt.RoundJoin],
228 | c.CONFIG_STYLE_BUS_GUIDEWAY: [
229 | c.CONFIG_TYPE_QPEN, True, 100, 100, 255, 255,
230 | 1, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin],
231 | c.CONFIG_STYLE_ESCAPE: [
232 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
233 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
234 | c.CONFIG_STYLE_RACEWAY: [
235 | c.CONFIG_TYPE_QPEN, True, 255, 192, 202, 255,
236 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
237 | c.CONFIG_STYLE_ROAD: [
238 | c.CONFIG_TYPE_QPEN, True, 125, 125, 125, 255,
239 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
240 | c.CONFIG_STYLE_FOOTWAY: [
241 | c.CONFIG_TYPE_QPEN, True, 247, 218, 218, 255,
242 | 1, Qt.DotLine, Qt.RoundCap, Qt.RoundJoin],
243 | c.CONFIG_STYLE_BRIDLEWAY: [
244 | c.CONFIG_TYPE_QPEN, True, 13, 134, 13, 255,
245 | 1, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin],
246 | c.CONFIG_STYLE_STEPS: [
247 | c.CONFIG_TYPE_QPEN, True, 249, 104, 92, 255,
248 | 1, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin],
249 | c.CONFIG_STYLE_CORRIDOR: [
250 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
251 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
252 | c.CONFIG_STYLE_PATH: [
253 | c.CONFIG_TYPE_QPEN, True, 247, 218, 218, 255,
254 | 1, Qt.DotLine, Qt.RoundCap, Qt.RoundJoin],
255 | c.CONFIG_STYLE_CYCLEWAY: [
256 | c.CONFIG_TYPE_QPEN, True, 49, 49, 253, 255,
257 | 1, Qt.DotLine, Qt.RoundCap, Qt.RoundJoin],
258 | c.CONFIG_STYLE_PROPOSED: [
259 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
260 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
261 | c.CONFIG_STYLE_CONSTRUCTION: [
262 | c.CONFIG_TYPE_QPEN, True, 100, 100, 200, 255,
263 | 1, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin],
264 | c.CONFIG_STYLE_BUS_STOP: [
265 | c.CONFIG_TYPE_QPEN, True, 255, 0, 0, 255,
266 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
267 | c.CONFIG_STYLE_CROSSING: [
268 | c.CONFIG_TYPE_QPEN, True, 55, 184, 33, 255,
269 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
270 | c.CONFIG_STYLE_ELEVATOR: [
271 | c.CONFIG_TYPE_QPEN, True, 31, 170, 186, 255,
272 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
273 | c.CONFIG_STYLE_EMERG_POINT: [
274 | c.CONFIG_TYPE_QPEN, True, 255, 0, 0, 255,
275 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
276 | c.CONFIG_STYLE_GIVE_WAY: [
277 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
278 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
279 | c.CONFIG_STYLE_MILESTONE: [
280 | c.CONFIG_TYPE_QPEN, True, 0, 185, 255, 255,
281 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
282 | c.CONFIG_STYLE_MINI_ROUNDABOUT: [
283 | c.CONFIG_TYPE_QPEN, True, 205, 128, 50, 255,
284 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
285 | c.CONFIG_STYLE_MOTORWAY_JUNC: [
286 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
287 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
288 | c.CONFIG_STYLE_PASSING_PLACE: [
289 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
290 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
291 | c.CONFIG_STYLE_PLATFORM: [
292 | c.CONFIG_TYPE_QPEN, True, 205, 128, 50, 255,
293 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
294 | c.CONFIG_STYLE_REST_AREA: [
295 | c.CONFIG_TYPE_QPEN, True, 80, 80, 255, 255,
296 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
297 | c.CONFIG_STYLE_SPEED_CAMERA: [
298 | c.CONFIG_TYPE_QPEN, True, 255, 0, 0, 255,
299 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
300 | c.CONFIG_STYLE_STREET_LAMP: [
301 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
302 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
303 | c.CONFIG_STYLE_SERVICES: [
304 | c.CONFIG_TYPE_QPEN, True, 80, 80, 255, 255,
305 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
306 | c.CONFIG_STYLE_STOP: [
307 | c.CONFIG_TYPE_QPEN, True, 255, 0, 0, 255,
308 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
309 | c.CONFIG_STYLE_TRAFFIC_MIRROR: [
310 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
311 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
312 | c.CONFIG_STYLE_TRAFFIC_SIGNAL: [
313 | c.CONFIG_TYPE_QPEN, True, 255, 255, 50, 255,
314 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
315 | c.CONFIG_STYLE_TRAILHEAD: [
316 | c.CONFIG_TYPE_QPEN, True, 205, 128, 50, 255,
317 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
318 | c.CONFIG_STYLE_TURNING_CIRCLE: [
319 | c.CONFIG_TYPE_QPEN, True, 205, 128, 50, 255,
320 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
321 | c.CONFIG_STYLE_TURNING_LOOP: [
322 | c.CONFIG_TYPE_QPEN, True, 205, 128, 50, 255,
323 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
324 | c.CONFIG_STYLE_TOLL_GANTRY: [
325 | c.CONFIG_TYPE_QPEN, True, 80, 80, 255, 255,
326 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
327 |
328 | c.CONFIG_STYLE_RIVER: [
329 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
330 | 5, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
331 | c.CONFIG_STYLE_RIVERBANK: [
332 | c.CONFIG_TYPE_QCOLOR, True,
333 | 170, 211, 223, 255],
334 | c.CONFIG_STYLE_STREAM: [
335 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
336 | 5, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
337 | c.CONFIG_STYLE_TIDAL_CHANNEL: [
338 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
339 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
340 | c.CONFIG_STYLE_CANAL: [
341 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
342 | 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
343 | c.CONFIG_STYLE_PRESSURIZED: [
344 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
345 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
346 | c.CONFIG_STYLE_DRAIN: [
347 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
348 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
349 | c.CONFIG_STYLE_DITCH: [
350 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
351 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
352 | c.CONFIG_STYLE_FAIRWAY: [
353 | c.CONFIG_TYPE_QPEN, True, 255, 255, 255, 255,
354 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
355 | c.CONFIG_STYLE_ARTIFICIAL: [
356 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
357 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
358 | c.CONFIG_STYLE_DERELICT: [
359 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
360 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
361 | c.CONFIG_STYLE_DOCK: [
362 | c.CONFIG_TYPE_QCOLOR, True,
363 | 170, 211, 223, 255],
364 | c.CONFIG_STYLE_BOATYARD: [
365 | c.CONFIG_TYPE_QCOLOR, True,
366 | 170, 211, 223, 255],
367 | c.CONFIG_STYLE_DAM: [
368 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
369 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
370 | c.CONFIG_STYLE_WEIR: [
371 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
372 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
373 | c.CONFIG_STYLE_FUEL: [
374 | c.CONFIG_TYPE_QCOLOR, True,
375 | 170, 211, 223, 255],
376 | c.CONFIG_STYLE_LOCK_GATE: [
377 | c.CONFIG_TYPE_QPEN, True, 170, 211, 223, 255,
378 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
379 |
380 | c.CONFIG_STYLE_WOOD: [
381 | c.CONFIG_TYPE_QCOLOR, True,
382 | 157, 202, 138, 255],
383 | c.CONFIG_STYLE_TREE_ROW: [
384 | c.CONFIG_TYPE_QPEN, True, 157, 202, 138, 255,
385 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
386 | c.CONFIG_STYLE_TREE: [
387 | c.CONFIG_TYPE_QPEN, True, 157, 202, 138, 255,
388 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
389 | c.CONFIG_STYLE_SCRUB: [
390 | c.CONFIG_TYPE_QCOLOR, True,
391 | 200, 215, 171, 255],
392 | c.CONFIG_STYLE_HEATH: [
393 | c.CONFIG_TYPE_QCOLOR, True,
394 | 214, 217, 159, 255],
395 | c.CONFIG_STYLE_MOOR: [
396 | c.CONFIG_TYPE_QCOLOR, True,
397 | 211, 210, 165, 255],
398 | c.CONFIG_STYLE_GRASS: [
399 | c.CONFIG_TYPE_QCOLOR, True,
400 | 205, 235, 176, 255],
401 | c.CONFIG_STYLE_GRASSLAND: [
402 | c.CONFIG_TYPE_QCOLOR, True,
403 | 205, 235, 176, 255],
404 | c.CONFIG_STYLE_FELL: [
405 | c.CONFIG_TYPE_QCOLOR, True,
406 | 174, 222, 126, 255],
407 | c.CONFIG_STYLE_BARE_ROCK: [
408 | c.CONFIG_TYPE_QCOLOR, True,
409 | 213, 209, 204, 255],
410 | c.CONFIG_STYLE_SCREE: [
411 | c.CONFIG_TYPE_QCOLOR, True,
412 | 237, 228, 220, 255],
413 | c.CONFIG_STYLE_SHINGLE: [
414 | c.CONFIG_TYPE_QCOLOR, True,
415 | 231, 223, 216, 255],
416 | c.CONFIG_STYLE_SAND: [
417 | c.CONFIG_TYPE_QCOLOR, True,
418 | 238, 226, 192, 255],
419 | c.CONFIG_STYLE_MUD: [
420 | c.CONFIG_TYPE_QCOLOR, True,
421 | 227, 219, 211, 255],
422 | c.CONFIG_STYLE_WATER: [
423 | c.CONFIG_TYPE_QCOLOR, True,
424 | 166, 198, 198, 255],
425 | c.CONFIG_STYLE_WETLAND: [
426 | c.CONFIG_TYPE_QCOLOR, True,
427 | 27, 139, 97, 255],
428 | c.CONFIG_STYLE_GLACIER: [
429 | c.CONFIG_TYPE_QCOLOR, True,
430 | 221, 236, 236, 255],
431 | c.CONFIG_STYLE_BAY: [
432 | c.CONFIG_TYPE_QCOLOR, True,
433 | 166, 198, 198, 255],
434 | c.CONFIG_STYLE_CAPE: [
435 | c.CONFIG_TYPE_QPEN, True, 166, 198, 198, 255,
436 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
437 | c.CONFIG_STYLE_STRAIT: [
438 | c.CONFIG_TYPE_QCOLOR, True,
439 | 166, 198, 198, 255],
440 | c.CONFIG_STYLE_BEACH: [
441 | c.CONFIG_TYPE_QCOLOR, True,
442 | 255, 241, 186, 255],
443 | c.CONFIG_STYLE_COASTLINE: [
444 | c.CONFIG_TYPE_QPEN, True, 237, 234, 226, 255,
445 | 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
446 | c.CONFIG_STYLE_REEF: [
447 | c.CONFIG_TYPE_QCOLOR, True,
448 | 202, 193, 170, 255],
449 | c.CONFIG_STYLE_SPRING: [
450 | c.CONFIG_TYPE_QPEN, True, 166, 198, 198, 255,
451 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
452 | c.CONFIG_STYLE_HOT_SPRING: [
453 | c.CONFIG_TYPE_QPEN, True, 203, 172, 169, 255,
454 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
455 | c.CONFIG_STYLE_GEYSER: [
456 | c.CONFIG_TYPE_QPEN, True, 166, 198, 198, 255,
457 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
458 | c.CONFIG_STYLE_MTN_RANGE: [
459 | c.CONFIG_TYPE_QPEN, True, 208, 143, 85, 255,
460 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
461 | c.CONFIG_STYLE_PEAK: [
462 | c.CONFIG_TYPE_QPEN, True, 208, 143, 85, 255,
463 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
464 | c.CONFIG_STYLE_DUNE: [
465 | c.CONFIG_TYPE_QCOLOR, True,
466 | 255, 241, 186, 255],
467 | c.CONFIG_STYLE_HILL: [
468 | c.CONFIG_TYPE_QPEN, True, 205, 235, 176, 255,
469 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
470 | c.CONFIG_STYLE_VOLCANO: [
471 | c.CONFIG_TYPE_QPEN, True, 212, 0, 0, 255,
472 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
473 | c.CONFIG_STYLE_VALLEY: [
474 | c.CONFIG_TYPE_QPEN, True, 63, 150, 100, 255,
475 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
476 | c.CONFIG_STYLE_RIDGE: [
477 | c.CONFIG_TYPE_QPEN, True, 208, 143, 85, 255,
478 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
479 | c.CONFIG_STYLE_ARETE: [
480 | c.CONFIG_TYPE_QPEN, True, 208, 143, 85, 255,
481 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
482 | c.CONFIG_STYLE_CLIFF: [
483 | c.CONFIG_TYPE_QPEN, True, 208, 143, 85, 255,
484 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
485 | c.CONFIG_STYLE_SADDLE: [
486 | c.CONFIG_TYPE_QPEN, True, 208, 143, 85, 255,
487 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
488 | c.CONFIG_STYLE_ISTHMUS: [
489 | c.CONFIG_TYPE_QCOLOR, True,
490 | 255, 241, 186, 255],
491 | c.CONFIG_STYLE_PENINSULA: [
492 | c.CONFIG_TYPE_QCOLOR, True,
493 | 37, 175, 106, 255],
494 | c.CONFIG_STYLE_ROCK: [
495 | c.CONFIG_TYPE_QCOLOR, True,
496 | 208, 143, 85, 255],
497 | c.CONFIG_STYLE_STONE: [
498 | c.CONFIG_TYPE_QPEN, True, 223, 208, 191, 255,
499 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
500 | c.CONFIG_STYLE_SINKHOLE: [
501 | c.CONFIG_TYPE_QCOLOR, True,
502 | 255, 241, 186, 255],
503 | c.CONFIG_STYLE_CAVE_ENTRANCE: [
504 | c.CONFIG_TYPE_QPEN, True, 30, 30, 30, 255,
505 | 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin],
506 |
507 | c.CONFIG_STYLE_COMMERCIAL: [
508 | c.CONFIG_TYPE_QCOLOR, True,
509 | 238, 207, 207, 255],
510 | c.CONFIG_STYLE_CONSTRUCTION_LU: [
511 | c.CONFIG_TYPE_QCOLOR, True,
512 | 199, 199, 180, 255],
513 | c.CONFIG_STYLE_INDUSTRIAL: [
514 | c.CONFIG_TYPE_QCOLOR, True,
515 | 230, 209, 227, 255],
516 | c.CONFIG_STYLE_RESIDENTIAL_LU: [
517 | c.CONFIG_TYPE_QCOLOR, True,
518 | 218, 218, 218, 255],
519 | c.CONFIG_STYLE_RETAIL: [
520 | c.CONFIG_TYPE_QCOLOR, True,
521 | 254, 202, 197, 255],
522 | c.CONFIG_STYLE_ALLOTMENTS: [
523 | c.CONFIG_TYPE_QCOLOR, True,
524 | 201, 225, 191, 255],
525 | c.CONFIG_STYLE_FARMLAND: [
526 | c.CONFIG_TYPE_QCOLOR, True,
527 | 238, 240, 213, 255],
528 | c.CONFIG_STYLE_FARM: [
529 | c.CONFIG_TYPE_QCOLOR, True,
530 | 238, 240, 213, 255],
531 | c.CONFIG_STYLE_FARMYARD: [
532 | c.CONFIG_TYPE_QCOLOR, True,
533 | 234, 204, 164, 255],
534 | c.CONFIG_STYLE_FOREST: [
535 | c.CONFIG_TYPE_QCOLOR, True,
536 | 157, 202, 138, 255],
537 | c.CONFIG_STYLE_MEADOW: [
538 | c.CONFIG_TYPE_QCOLOR, True,
539 | 205, 235, 176, 255],
540 | c.CONFIG_STYLE_ORCHARD: [
541 | c.CONFIG_TYPE_QCOLOR, True,
542 | 158, 220, 144, 255],
543 | c.CONFIG_STYLE_VINEYARD: [
544 | c.CONFIG_TYPE_QCOLOR, True,
545 | 158, 220, 144, 255],
546 | c.CONFIG_STYLE_GARDEN: [
547 | c.CONFIG_TYPE_QCOLOR, True,
548 | 158, 220, 144, 255],
549 | c.CONFIG_STYLE_BASIN: [
550 | c.CONFIG_TYPE_QCOLOR, True,
551 | 170, 211, 223, 255],
552 | c.CONFIG_STYLE_BROWNFIELD: [
553 | c.CONFIG_TYPE_QCOLOR, True,
554 | 167, 168, 126, 255],
555 | c.CONFIG_STYLE_CEMETERY: [
556 | c.CONFIG_TYPE_QCOLOR, True,
557 | 170, 203, 175, 255],
558 | c.CONFIG_STYLE_CONSERVATION: [
559 | c.CONFIG_TYPE_QCOLOR, True,
560 | 197, 236, 148, 255],
561 | c.CONFIG_STYLE_DEPOT: [
562 | c.CONFIG_TYPE_QCOLOR, True,
563 | 214, 214, 193, 255],
564 | c.CONFIG_STYLE_GARAGE: [
565 | c.CONFIG_TYPE_QCOLOR, True,
566 | 214, 214, 193, 255],
567 | c.CONFIG_STYLE_GARAGES: [
568 | c.CONFIG_TYPE_QCOLOR, True,
569 | 214, 214, 193, 255],
570 | c.CONFIG_STYLE_TRAF_ISLAND: [
571 | c.CONFIG_TYPE_QCOLOR, True,
572 | 230, 209, 227, 255],
573 | c.CONFIG_STYLE_GRASS_LU: [
574 | c.CONFIG_TYPE_QCOLOR, True,
575 | 197, 236, 148, 255],
576 | c.CONFIG_STYLE_GREENFIELD: [
577 | c.CONFIG_TYPE_QCOLOR, True,
578 | 241, 238, 232, 255],
579 | c.CONFIG_STYLE_GH_HORT: [
580 | c.CONFIG_TYPE_QCOLOR, True,
581 | 238, 240, 213, 255],
582 | c.CONFIG_STYLE_LANDFILL: [
583 | c.CONFIG_TYPE_QCOLOR, True,
584 | 167, 168, 126, 255],
585 | c.CONFIG_STYLE_MILITARY: [
586 | c.CONFIG_TYPE_QCOLOR, True,
587 | 243, 228, 222, 255],
588 | c.CONFIG_STYLE_PEAT_CUTTING: [
589 | c.CONFIG_TYPE_QCOLOR, True,
590 | 181, 229, 170, 255],
591 | c.CONFIG_STYLE_PLANT_NURSERY: [
592 | c.CONFIG_TYPE_QCOLOR, True,
593 | 181, 229, 170, 255],
594 | c.CONFIG_STYLE_PORT: [
595 | c.CONFIG_TYPE_QCOLOR, True,
596 | 166, 198, 198, 255],
597 | c.CONFIG_STYLE_QUARRY: [
598 | c.CONFIG_TYPE_QCOLOR, True,
599 | 183, 181, 181, 255],
600 | c.CONFIG_STYLE_RAILWAY: [
601 | c.CONFIG_TYPE_QCOLOR, True,
602 | 230, 209, 227, 255],
603 | c.CONFIG_STYLE_REC_GROUND: [
604 | c.CONFIG_TYPE_QCOLOR, True,
605 | 223, 252, 226, 255],
606 | c.CONFIG_STYLE_RELIGIOUS: [
607 | c.CONFIG_TYPE_QCOLOR, True,
608 | 205, 204, 201, 255],
609 | c.CONFIG_STYLE_CHURCHYARD: [
610 | c.CONFIG_TYPE_QCOLOR, True,
611 | 205, 204, 201, 255],
612 | c.CONFIG_STYLE_RESERVOIR: [
613 | c.CONFIG_TYPE_QCOLOR, True,
614 | 170, 211, 223, 255],
615 | c.CONFIG_STYLE_RES_WTSHED: [
616 | c.CONFIG_TYPE_QCOLOR, True,
617 | 129, 189, 207, 255],
618 | c.CONFIG_STYLE_SALT_POND: [
619 | c.CONFIG_TYPE_QCOLOR, True,
620 | 170, 211, 223, 255],
621 | c.CONFIG_STYLE_VILLAGE_GREEN: [
622 | c.CONFIG_TYPE_QCOLOR, True,
623 | 205, 235, 176, 255],
624 | c.CONFIG_STYLE_VACANT: [
625 | c.CONFIG_TYPE_QCOLOR, True,
626 | 200, 200, 200, 255],
627 | c.CONFIG_STYLE_YES_LU: [
628 | c.CONFIG_TYPE_QCOLOR, True,
629 | 200, 200, 200, 255],
630 | c.CONFIG_STYLE_GOVERNMENT_LU: [
631 | c.CONFIG_TYPE_QCOLOR, True,
632 | 200, 200, 200, 255],
633 |
634 | c.CONFIG_STYLE_APARTMENTS: [
635 | c.CONFIG_TYPE_QCOLOR, True,
636 | 140, 140, 140, 255],
637 | c.CONFIG_STYLE_INDOOR: [
638 | c.CONFIG_TYPE_QCOLOR, True,
639 | 140, 140, 140, 255],
640 | c.CONFIG_STYLE_CONDOMINIUM: [
641 | c.CONFIG_TYPE_QCOLOR, True,
642 | 140, 140, 140, 255],
643 | c.CONFIG_STYLE_CONDOMINIUM_2: [
644 | c.CONFIG_TYPE_QCOLOR, True,
645 | 140, 140, 140, 255],
646 | c.CONFIG_STYLE_TOWER: [
647 | c.CONFIG_TYPE_QCOLOR, True,
648 | 140, 140, 140, 255],
649 | c.CONFIG_STYLE_AMPHITHEATRE: [
650 | c.CONFIG_TYPE_QCOLOR, True,
651 | 140, 140, 140, 255],
652 | c.CONFIG_STYLE_BUNGALOW: [
653 | c.CONFIG_TYPE_QCOLOR, True,
654 | 140, 140, 140, 255],
655 | c.CONFIG_STYLE_CABIN: [
656 | c.CONFIG_TYPE_QCOLOR, True,
657 | 140, 140, 140, 255],
658 | c.CONFIG_STYLE_DETACHED: [
659 | c.CONFIG_TYPE_QCOLOR, True,
660 | 140, 140, 140, 255],
661 | c.CONFIG_STYLE_DORMITORY: [
662 | c.CONFIG_TYPE_QCOLOR, True,
663 | 140, 140, 140, 255],
664 | c.CONFIG_STYLE_FARM_BLDG: [
665 | c.CONFIG_TYPE_QCOLOR, True,
666 | 140, 140, 140, 255],
667 | c.CONFIG_STYLE_GER: [
668 | c.CONFIG_TYPE_QCOLOR, True,
669 | 140, 140, 140, 255],
670 | c.CONFIG_STYLE_HOTEL: [
671 | c.CONFIG_TYPE_QCOLOR, True,
672 | 140, 140, 140, 255],
673 | c.CONFIG_STYLE_HOUSE: [
674 | c.CONFIG_TYPE_QCOLOR, True,
675 | 140, 140, 140, 255],
676 | c.CONFIG_STYLE_HOUSEBOAT: [
677 | c.CONFIG_TYPE_QCOLOR, True,
678 | 140, 140, 140, 255],
679 | c.CONFIG_STYLE_RESID_BLDG: [
680 | c.CONFIG_TYPE_QCOLOR, True,
681 | 140, 140, 140, 255],
682 | c.CONFIG_STYLE_SD_HOUSE: [
683 | c.CONFIG_TYPE_QCOLOR, True,
684 | 140, 140, 140, 255],
685 | c.CONFIG_STYLE_STATIC_CARAVAN: [
686 | c.CONFIG_TYPE_QCOLOR, True,
687 | 140, 140, 140, 255],
688 | c.CONFIG_STYLE_TERRACE: [
689 | c.CONFIG_TYPE_QCOLOR, True,
690 | 140, 140, 140, 255],
691 | c.CONFIG_STYLE_COMM_BLDG: [
692 | c.CONFIG_TYPE_QCOLOR, True,
693 | 140, 140, 140, 255],
694 | c.CONFIG_STYLE_INDUSTRIAL_BLDG: [
695 | c.CONFIG_TYPE_QCOLOR, True,
696 | 140, 140, 140, 255],
697 | c.CONFIG_STYLE_MANUFACTURE: [
698 | c.CONFIG_TYPE_QCOLOR, True,
699 | 140, 140, 140, 255],
700 | c.CONFIG_STYLE_KIOSK: [
701 | c.CONFIG_TYPE_QCOLOR, True,
702 | 140, 140, 140, 255],
703 | c.CONFIG_STYLE_OFFICE: [
704 | c.CONFIG_TYPE_QCOLOR, True,
705 | 140, 140, 140, 255],
706 | c.CONFIG_STYLE_RETAIL_BLDG: [
707 | c.CONFIG_TYPE_QCOLOR, True,
708 | 140, 140, 140, 255],
709 | c.CONFIG_STYLE_SHOP: [
710 | c.CONFIG_TYPE_QCOLOR, True,
711 | 140, 140, 140, 255],
712 | c.CONFIG_STYLE_SUPERMARKET: [
713 | c.CONFIG_TYPE_QCOLOR, True,
714 | 140, 140, 140, 255],
715 | c.CONFIG_STYLE_WAREHOUSE: [
716 | c.CONFIG_TYPE_QCOLOR, True,
717 | 140, 140, 140, 255],
718 | c.CONFIG_STYLE_CATHEDRAL: [
719 | c.CONFIG_TYPE_QCOLOR, True,
720 | 140, 140, 140, 255],
721 | c.CONFIG_STYLE_CHAPEL: [
722 | c.CONFIG_TYPE_QCOLOR, True,
723 | 140, 140, 140, 255],
724 | c.CONFIG_STYLE_CHURCH: [
725 | c.CONFIG_TYPE_QCOLOR, True,
726 | 140, 140, 140, 255],
727 | c.CONFIG_STYLE_MOSQUE: [
728 | c.CONFIG_TYPE_QCOLOR, True,
729 | 140, 140, 140, 255],
730 | c.CONFIG_STYLE_RELIGIOUS_BLDG: [
731 | c.CONFIG_TYPE_QCOLOR, True,
732 | 140, 140, 140, 255],
733 | c.CONFIG_STYLE_SHRINE: [
734 | c.CONFIG_TYPE_QCOLOR, True,
735 | 140, 140, 140, 255],
736 | c.CONFIG_STYLE_SYNAGOGUE: [
737 | c.CONFIG_TYPE_QCOLOR, True,
738 | 140, 140, 140, 255],
739 | c.CONFIG_STYLE_TEMPLE: [
740 | c.CONFIG_TYPE_QCOLOR, True,
741 | 140, 140, 140, 255],
742 | c.CONFIG_STYLE_BAKEHOUSE: [
743 | c.CONFIG_TYPE_QCOLOR, True,
744 | 140, 140, 140, 255],
745 | c.CONFIG_STYLE_CIVIC: [
746 | c.CONFIG_TYPE_QCOLOR, True,
747 | 140, 140, 140, 255],
748 | c.CONFIG_STYLE_GYM: [
749 | c.CONFIG_TYPE_QCOLOR, True,
750 | 140, 140, 140, 255],
751 | c.CONFIG_STYLE_CANOPY: [
752 | c.CONFIG_TYPE_QCOLOR, True,
753 | 140, 140, 140, 255],
754 | c.CONFIG_STYLE_SHELTER: [
755 | c.CONFIG_TYPE_QCOLOR, True,
756 | 140, 140, 140, 255],
757 | c.CONFIG_STYLE_BURIAL_VAULT: [
758 | c.CONFIG_TYPE_QCOLOR, True,
759 | 140, 140, 140, 255],
760 |
761 | c.CONFIG_STYLE_PART: [
762 | c.CONFIG_TYPE_QCOLOR, True,
763 | 140, 140, 140, 255],
764 | c.CONFIG_STYLE_COLLEGE: [
765 | c.CONFIG_TYPE_QCOLOR, True,
766 | 140, 140, 140, 255],
767 | c.CONFIG_STYLE_HEALTH: [
768 | c.CONFIG_TYPE_QCOLOR, True,
769 | 140, 140, 140, 255],
770 | c.CONFIG_STYLE_HOTEL_2: [
771 | c.CONFIG_TYPE_QCOLOR, True,
772 | 140, 140, 140, 255],
773 | c.CONFIG_STYLE_MULTIPURPOSE: [
774 | c.CONFIG_TYPE_QCOLOR, True,
775 | 140, 140, 140, 255],
776 | c.CONFIG_STYLE_FIRE_STATION: [
777 | c.CONFIG_TYPE_QCOLOR, True,
778 | 140, 140, 140, 255],
779 | c.CONFIG_STYLE_GOVERNMENT: [
780 | c.CONFIG_TYPE_QCOLOR, True,
781 | 140, 140, 140, 255],
782 | c.CONFIG_STYLE_GOVERNEMENT: [
783 | c.CONFIG_TYPE_QCOLOR, True,
784 | 140, 140, 140, 255],
785 | c.CONFIG_STYLE_SUBWAY_ENTRY: [
786 | c.CONFIG_TYPE_QCOLOR, True,
787 | 140, 140, 140, 255],
788 | c.CONFIG_STYLE_LIBRARY: [
789 | c.CONFIG_TYPE_QCOLOR, True,
790 | 140, 140, 140, 255],
791 | c.CONFIG_STYLE_HOSPITAL: [
792 | c.CONFIG_TYPE_QCOLOR, True,
793 | 140, 140, 140, 255],
794 | c.CONFIG_STYLE_KINDERGARTEN: [
795 | c.CONFIG_TYPE_QCOLOR, True,
796 | 140, 140, 140, 255],
797 | c.CONFIG_STYLE_PUBLIC: [
798 | c.CONFIG_TYPE_QCOLOR, True,
799 | 140, 140, 140, 255],
800 | c.CONFIG_STYLE_SCHOOL: [
801 | c.CONFIG_TYPE_QCOLOR, True,
802 | 140, 140, 140, 255],
803 | c.CONFIG_STYLE_TOILETS: [
804 | c.CONFIG_TYPE_QCOLOR, True,
805 | 140, 140, 140, 255],
806 | c.CONFIG_STYLE_TRAIN_STATION: [
807 | c.CONFIG_TYPE_QCOLOR, True,
808 | 140, 140, 140, 255],
809 | c.CONFIG_STYLE_TRANSPORTATION: [
810 | c.CONFIG_TYPE_QCOLOR, True,
811 | 140, 140, 140, 255],
812 | c.CONFIG_STYLE_UNIVERSITY: [
813 | c.CONFIG_TYPE_QCOLOR, True,
814 | 140, 140, 140, 255],
815 | c.CONFIG_STYLE_BARN: [
816 | c.CONFIG_TYPE_QCOLOR, True,
817 | 140, 140, 140, 255],
818 | c.CONFIG_STYLE_CONSERVATORY: [
819 | c.CONFIG_TYPE_QCOLOR, True,
820 | 140, 140, 140, 255],
821 | c.CONFIG_STYLE_COWSHED: [
822 | c.CONFIG_TYPE_QCOLOR, True,
823 | 140, 140, 140, 255],
824 | c.CONFIG_STYLE_FARM_AUXILIARY: [
825 | c.CONFIG_TYPE_QCOLOR, True,
826 | 140, 140, 140, 255],
827 | c.CONFIG_STYLE_GREENHOUSE: [
828 | c.CONFIG_TYPE_QCOLOR, True,
829 | 140, 140, 140, 255],
830 | c.CONFIG_STYLE_SLURRY_TANK: [
831 | c.CONFIG_TYPE_QCOLOR, True,
832 | 140, 140, 140, 255],
833 | c.CONFIG_STYLE_STABLE: [
834 | c.CONFIG_TYPE_QCOLOR, True,
835 | 140, 140, 140, 255],
836 | c.CONFIG_STYLE_STY: [
837 | c.CONFIG_TYPE_QCOLOR, True,
838 | 140, 140, 140, 255],
839 | c.CONFIG_STYLE_GRANDSTAND: [
840 | c.CONFIG_TYPE_QCOLOR, True,
841 | 140, 140, 140, 255],
842 | c.CONFIG_STYLE_PAVILION: [
843 | c.CONFIG_TYPE_QCOLOR, True,
844 | 140, 140, 140, 255],
845 | c.CONFIG_STYLE_RIDING_HALL: [
846 | c.CONFIG_TYPE_QCOLOR, True,
847 | 140, 140, 140, 255],
848 | c.CONFIG_STYLE_SPORTS_HALL: [
849 | c.CONFIG_TYPE_QCOLOR, True,
850 | 140, 140, 140, 255],
851 | c.CONFIG_STYLE_STADIUM: [
852 | c.CONFIG_TYPE_QCOLOR, True,
853 | 140, 140, 140, 255],
854 | c.CONFIG_STYLE_HANGAR: [
855 | c.CONFIG_TYPE_QCOLOR, True,
856 | 140, 140, 140, 255],
857 | c.CONFIG_STYLE_HUT: [
858 | c.CONFIG_TYPE_QCOLOR, True,
859 | 140, 140, 140, 255],
860 | c.CONFIG_STYLE_SHED: [
861 | c.CONFIG_TYPE_QCOLOR, True,
862 | 140, 140, 140, 255],
863 | c.CONFIG_STYLE_CARPORT: [
864 | c.CONFIG_TYPE_QCOLOR, True,
865 | 140, 140, 140, 255],
866 | c.CONFIG_STYLE_GARAGE_BLDG: [
867 | c.CONFIG_TYPE_QCOLOR, True,
868 | 140, 140, 140, 255],
869 | c.CONFIG_STYLE_GARAGES_BLDG: [
870 | c.CONFIG_TYPE_QCOLOR, True,
871 | 140, 140, 140, 255],
872 | c.CONFIG_STYLE_PARKING: [
873 | c.CONFIG_TYPE_QCOLOR, True,
874 | 140, 140, 140, 255],
875 | c.CONFIG_STYLE_DIGESTER: [
876 | c.CONFIG_TYPE_QCOLOR, True,
877 | 140, 140, 140, 255],
878 | c.CONFIG_STYLE_SERVICE_BLDG: [
879 | c.CONFIG_TYPE_QCOLOR, True,
880 | 140, 140, 140, 255],
881 | c.CONFIG_STYLE_TRANSF_TOWER: [
882 | c.CONFIG_TYPE_QCOLOR, True,
883 | 140, 140, 140, 255],
884 | c.CONFIG_STYLE_WATER_TOWER: [
885 | c.CONFIG_TYPE_QCOLOR, True,
886 | 140, 140, 140, 255],
887 | c.CONFIG_STYLE_BUNKER: [
888 | c.CONFIG_TYPE_QCOLOR, True,
889 | 140, 140, 140, 255],
890 | c.CONFIG_STYLE_BRIDGE: [
891 | c.CONFIG_TYPE_QCOLOR, True,
892 | 140, 140, 140, 255],
893 | c.CONFIG_STYLE_CONSTR_BLDG: [
894 | c.CONFIG_TYPE_QCOLOR, True,
895 | 140, 140, 140, 255],
896 | c.CONFIG_STYLE_GATEHOUSE: [
897 | c.CONFIG_TYPE_QCOLOR, True,
898 | 140, 140, 140, 255],
899 | c.CONFIG_STYLE_ROOF: [
900 | c.CONFIG_TYPE_QCOLOR, True,
901 | 140, 140, 140, 255],
902 | c.CONFIG_STYLE_RUINS: [
903 | c.CONFIG_TYPE_QCOLOR, True,
904 | 140, 140, 140, 255],
905 | c.CONFIG_STYLE_TREE_HOUSE: [
906 | c.CONFIG_TYPE_QCOLOR, True,
907 | 140, 140, 140, 255],
908 | c.CONFIG_STYLE_YES: [
909 | c.CONFIG_TYPE_QCOLOR, True,
910 | 140, 140, 140, 255],
911 | c.CONFIG_STYLE_NO: [
912 | c.CONFIG_TYPE_QCOLOR, True,
913 | 140, 140, 140, 255],
914 | c.CONFIG_STYLE_UNDEF: [
915 | c.CONFIG_TYPE_QCOLOR, True,
916 | 140, 140, 140, 255]
917 | }
918 |
919 | self._write()
920 |
921 | def _write(self):
922 | """
923 | Private function used to write the user configuration to the
924 | user.config file
925 |
926 | Parameters:
927 | -----------
928 | Returns:
929 | --------
930 | """
931 | # Write to file
932 | with open(self._fname, 'w') as outfile:
933 | json.dump(self._config, outfile)
934 |
935 | def _read(self):
936 | """
937 | Private function used to read the user configuration from the
938 | user.config file
939 |
940 | Parameters:
941 | -----------
942 | Returns:
943 | --------
944 | """
945 | # Load the user configuration
946 | with open(self._fname) as f:
947 | temp = json.load(f)
948 |
949 | # Now load the initial config
950 | self._initConfig()
951 |
952 | # Transfer the temp values to the initial config object
953 | for key in temp.keys():
954 | if key in self._config.keys():
955 | # If a key doesn't exist anymore, then we ignore it
956 | # This also ensures initialization of new values
957 | self._config[key] = temp[key]
958 |
959 | # Now write the config back to file
960 | self._write()
961 |
--------------------------------------------------------------------------------
/src/core/constants.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Mon Jun 22 12:56:24 2020
4 |
5 | @author: The Absolute Tinkerer
6 |
7 | All of the constants used throughout this program. Please note, some of the
8 | "VAL_" keys are commented out - this is because that particular key has already
9 | been instantiated elsewhere, and they both have the same value. I've left
10 | these keys commented out as placeholders for user awareness that the key
11 | already exists and is defined elsewhere.
12 |
13 | The user should be extremely mindful not to redefine any existing keys, as it
14 | may result in undesireable and unexpected issues. Plus troubleshooting would be
15 | a pain.
16 |
17 | To add new layers to render, you must create a CONFIG_STYLE key, VAL key, and
18 | connect the VAL and CONFIG_STYLE in the DATA_GROUPS dictionary
19 | """
20 |
21 | from PyQt5.QtCore import Qt
22 |
23 |
24 | # Resource Strings
25 | FOLDER_DATA = 'data'
26 | FOLDER_OUTPUT = 'output'
27 | FOLDER_CONFIGS = 'configs'
28 | FOLDER_USER_CONFIGS = 'configs/user'
29 | FILE_ICON = 'src/resources/icon.png'
30 | FILE_CONFIG = 'user.config'
31 |
32 |
33 | # Constants
34 | DICT_QPEN_STYLE = {Qt.SolidLine: 'Solid Line',
35 | Qt.DashLine: 'Dash Line',
36 | Qt.DotLine: 'Dot Line',
37 | Qt.DashDotLine: 'Dash-Dot Line',
38 | Qt.DashDotDotLine: 'Dash-Dot-Dot Line'}
39 | DICT_QPEN_CAP = {Qt.SquareCap: 'Square Cap',
40 | Qt.FlatCap: 'Flat Cap',
41 | Qt.RoundCap: 'Round Cap'}
42 | DICT_QPEN_JOIN = {Qt.BevelJoin: 'Bevel Join',
43 | Qt.MiterJoin: 'Miter Join',
44 | Qt.RoundJoin: 'Round Join'}
45 |
46 |
47 | # OSM File Features
48 | COPYRIGHT = 'OpenStreetMap and contributors'
49 | ATTRIBUTION = 'http://www.openstreetmap.org/copyright'
50 | LICENSE = 'http://opendatacommons.org/licenses/odbl/1-0/'
51 |
52 |
53 | # OSM tag keys
54 | KEY_HIGHWAY = 'highway'
55 | KEY_WATERWAY = 'waterway'
56 | KEY_NATURAL = 'natural'
57 | KEY_LANDUSE = 'landuse'
58 | KEY_BUILDING = 'building'
59 |
60 |
61 | # Configuration Keys - Styles
62 | CONFIG_TYPE_QCOLOR = 'QColor'
63 | CONFIG_TYPE_QPEN = 'QPen'
64 |
65 | # The background color of the map
66 | CONFIG_BG_COLOR = 'Background Color'
67 |
68 | # KEY_HIGHWAY style keys
69 | CONFIG_STYLE_MOTORWAY = 'Motorway Style'
70 | CONFIG_STYLE_TRUNK = 'Trunk Style'
71 | CONFIG_STYLE_PRIMARY = 'Primary Style'
72 | CONFIG_STYLE_SECONDARY = 'Secondary Style'
73 | CONFIG_STYLE_TERTIARY = 'Tertiary Style'
74 | CONFIG_STYLE_UNCLASSIFIED = 'Unclassified Style'
75 | CONFIG_STYLE_RESIDENTIAL = 'Residential Style'
76 |
77 | CONFIG_STYLE_LINK_MOTORWAY = 'Motorway Link Style'
78 | CONFIG_STYLE_LINK_TRUNK = 'Trunk Link Style'
79 | CONFIG_STYLE_LINK_PRIMARY = 'Primary Link Style'
80 | CONFIG_STYLE_LINK_SECONDARY = 'Secondary Link Style'
81 | CONFIG_STYLE_LINK_TERTIARY = 'Tertiary Link Style'
82 |
83 | CONFIG_STYLE_STREET = 'Street Style'
84 | CONFIG_STYLE_SERVICE = 'Service Style'
85 | CONFIG_STYLE_PEDESTRIAN = 'Pedestrian Style'
86 | CONFIG_STYLE_TRACK = 'Track Style'
87 | CONFIG_STYLE_BUS_GUIDEWAY = 'Bus Guideway Style'
88 | CONFIG_STYLE_ESCAPE = 'Escape Style'
89 | CONFIG_STYLE_RACEWAY = 'Raceway Style'
90 | CONFIG_STYLE_ROAD = 'Road Style'
91 | CONFIG_STYLE_FOOTWAY = 'Footway Style'
92 | CONFIG_STYLE_BRIDLEWAY = 'Bridleway Style'
93 | CONFIG_STYLE_STEPS = 'Steps Style'
94 | CONFIG_STYLE_CORRIDOR = 'Corridor Style'
95 | CONFIG_STYLE_PATH = 'Path Style'
96 | CONFIG_STYLE_CYCLEWAY = 'Cycleway Style'
97 | CONFIG_STYLE_PROPOSED = 'Proposed Style'
98 | CONFIG_STYLE_CONSTRUCTION = 'Construction Style'
99 |
100 | CONFIG_STYLE_BUS_STOP = 'Bus Stop Style'
101 | CONFIG_STYLE_CROSSING = 'Crossing Style'
102 | CONFIG_STYLE_ELEVATOR = 'Elevator Style'
103 | CONFIG_STYLE_EMERG_POINT = 'Emergency Access Point Style'
104 | CONFIG_STYLE_GIVE_WAY = 'Give Way Style'
105 | CONFIG_STYLE_MILESTONE = 'Milestone Style'
106 | CONFIG_STYLE_MINI_ROUNDABOUT = 'Mini Roundabout Style'
107 | CONFIG_STYLE_MOTORWAY_JUNC = 'Motorway Junction Style'
108 | CONFIG_STYLE_PASSING_PLACE = 'Passing Place Style'
109 | CONFIG_STYLE_PLATFORM = 'Platform Style'
110 | CONFIG_STYLE_REST_AREA = 'Rest Area Style'
111 | CONFIG_STYLE_SPEED_CAMERA = 'Speed Camera Style'
112 | CONFIG_STYLE_STREET_LAMP = 'Street Lamp Style'
113 | CONFIG_STYLE_SERVICES = 'Services Style'
114 | CONFIG_STYLE_STOP = 'Stop Style'
115 | CONFIG_STYLE_TRAFFIC_MIRROR = 'Traffic Mirror Style'
116 | CONFIG_STYLE_TRAFFIC_SIGNAL = 'Traffic Signals Style'
117 | CONFIG_STYLE_TRAILHEAD = 'Trailhead Style'
118 | CONFIG_STYLE_TURNING_CIRCLE = 'Turning Circle Style'
119 | CONFIG_STYLE_TURNING_LOOP = 'Turning Loop Style'
120 | CONFIG_STYLE_TOLL_GANTRY = 'Toll Gantry Style'
121 |
122 | # KEY_NATURAL style keys
123 | CONFIG_STYLE_RIVER = 'River Style'
124 | CONFIG_STYLE_RIVERBANK = 'Riverbank Style'
125 | CONFIG_STYLE_STREAM = 'Stream Style'
126 | CONFIG_STYLE_TIDAL_CHANNEL = 'Tidal Channel Style'
127 | CONFIG_STYLE_CANAL = 'Canal Style'
128 | CONFIG_STYLE_PRESSURIZED = 'Pressurized Style'
129 | CONFIG_STYLE_DRAIN = 'Drain Style'
130 | CONFIG_STYLE_DITCH = 'Ditch Style'
131 | CONFIG_STYLE_FAIRWAY = 'Fairway Style'
132 | CONFIG_STYLE_ARTIFICIAL = 'Artificial Style'
133 | CONFIG_STYLE_DERELICT = 'Derelict Canal Style'
134 |
135 | CONFIG_STYLE_DOCK = 'Dock Style'
136 | CONFIG_STYLE_BOATYARD = 'Boatyard Style'
137 | CONFIG_STYLE_DAM = 'Dam Style'
138 | CONFIG_STYLE_WEIR = 'Weir Style'
139 | CONFIG_STYLE_FUEL = 'Fuel Style'
140 | CONFIG_STYLE_LOCK_GATE = 'Lock Gate Style'
141 |
142 | CONFIG_STYLE_WOOD = 'Wood Style'
143 | CONFIG_STYLE_TREE_ROW = 'Tree Row Style'
144 | CONFIG_STYLE_TREE = 'Tree Style'
145 | CONFIG_STYLE_SCRUB = 'Scrub Style'
146 | CONFIG_STYLE_HEATH = 'Heath Style'
147 | CONFIG_STYLE_MOOR = 'Moor Style'
148 | CONFIG_STYLE_GRASS = 'Grass Style'
149 | CONFIG_STYLE_GRASSLAND = 'Grassland Style'
150 | CONFIG_STYLE_FELL = 'Fell Style'
151 | CONFIG_STYLE_BARE_ROCK = 'Bare Rock'
152 | CONFIG_STYLE_SCREE = 'Scree Style'
153 | CONFIG_STYLE_SHINGLE = 'Shingle Style'
154 | CONFIG_STYLE_SAND = 'Sand Style'
155 | CONFIG_STYLE_MUD = 'Mud Style'
156 |
157 | CONFIG_STYLE_WATER = 'Water Style'
158 | CONFIG_STYLE_WETLAND = 'Wetland'
159 | CONFIG_STYLE_GLACIER = 'Glacier Style'
160 | CONFIG_STYLE_BAY = 'Bay Style'
161 | CONFIG_STYLE_CAPE = 'Cape Style'
162 | CONFIG_STYLE_STRAIT = 'Strait Style'
163 | CONFIG_STYLE_BEACH = 'Beach Style'
164 | CONFIG_STYLE_COASTLINE = 'Coastline Style'
165 | CONFIG_STYLE_REEF = 'Reef Style'
166 | CONFIG_STYLE_SPRING = 'Spring Style'
167 | CONFIG_STYLE_HOT_SPRING = 'Hot Spring Style'
168 | CONFIG_STYLE_GEYSER = 'Geyser Style'
169 | CONFIG_STYLE_MTN_RANGE = 'Mountain Range Style'
170 |
171 | CONFIG_STYLE_PEAK = 'Peak Style'
172 | CONFIG_STYLE_DUNE = 'Dune Style'
173 | CONFIG_STYLE_HILL = 'Hill Style'
174 | CONFIG_STYLE_VOLCANO = 'Volcano Style'
175 | CONFIG_STYLE_VALLEY = 'Valley Style'
176 | CONFIG_STYLE_RIDGE = 'Ridge Style'
177 | CONFIG_STYLE_ARETE = 'Arete Style'
178 | CONFIG_STYLE_CLIFF = 'Cliff Style'
179 | CONFIG_STYLE_SADDLE = 'Saddle Style'
180 | CONFIG_STYLE_ISTHMUS = 'Isthmus Style'
181 | CONFIG_STYLE_PENINSULA = 'Peninsula Style'
182 | CONFIG_STYLE_ROCK = 'Rock Style'
183 | CONFIG_STYLE_STONE = 'Stone Style'
184 | CONFIG_STYLE_SINKHOLE = 'Sinkhole Style'
185 | CONFIG_STYLE_CAVE_ENTRANCE = 'Cave Entrance Style'
186 |
187 | # KEY_LANDUSE style keys
188 | CONFIG_STYLE_COMMERCIAL = 'Commercial Style'
189 | CONFIG_STYLE_CONSTRUCTION_LU = 'Construction Land Use Style'
190 | CONFIG_STYLE_INDUSTRIAL = 'Industrial Style'
191 | CONFIG_STYLE_RESIDENTIAL_LU = 'Residential Land Use Style'
192 | CONFIG_STYLE_RETAIL = 'Retail Style'
193 | CONFIG_STYLE_ALLOTMENTS = 'Allotments Style'
194 | CONFIG_STYLE_FARMLAND = 'Farmland Style'
195 | CONFIG_STYLE_FARM = 'Farm Style'
196 | CONFIG_STYLE_FARMYARD = 'Farmyard Style'
197 | CONFIG_STYLE_FOREST = 'Forest Style'
198 | CONFIG_STYLE_MEADOW = 'Meadow Style'
199 | CONFIG_STYLE_ORCHARD = 'Orchard Style'
200 | CONFIG_STYLE_VINEYARD = 'Vineyard Style'
201 | CONFIG_STYLE_GARDEN = 'Garden Style'
202 | CONFIG_STYLE_BASIN = 'Basin Style'
203 | CONFIG_STYLE_BROWNFIELD = 'Brownfield Style'
204 | CONFIG_STYLE_CEMETERY = 'Cemetery Style'
205 | CONFIG_STYLE_CONSERVATION = 'Conservation Style'
206 | CONFIG_STYLE_DEPOT = 'Depot Style'
207 | CONFIG_STYLE_GARAGE = 'Garages Style'
208 | CONFIG_STYLE_GARAGES = 'Garages Style'
209 | CONFIG_STYLE_TRAF_ISLAND = 'Traffic Island Style'
210 | CONFIG_STYLE_GRASS_LU = 'Grass Land Use Style'
211 | CONFIG_STYLE_GREENFIELD = 'Greenfield Style'
212 | CONFIG_STYLE_GH_HORT = 'Greenhouse Horticulture Style'
213 | CONFIG_STYLE_LANDFILL = 'Landfill Style'
214 | CONFIG_STYLE_MILITARY = 'Military Style'
215 | CONFIG_STYLE_PEAT_CUTTING = 'Peat_cutting Style'
216 | CONFIG_STYLE_PLANT_NURSERY = 'Plant Nursery Style'
217 | CONFIG_STYLE_PORT = 'Port Style'
218 | CONFIG_STYLE_QUARRY = 'Quarry Style'
219 | CONFIG_STYLE_RAILWAY = 'Railway Style'
220 | CONFIG_STYLE_REC_GROUND = 'Recreation Ground Style'
221 | CONFIG_STYLE_RELIGIOUS = 'Religious Style'
222 | CONFIG_STYLE_CHURCHYARD = 'Churchyard Style'
223 | CONFIG_STYLE_RESERVOIR = 'Reservoir Style'
224 | CONFIG_STYLE_RES_WTSHED = 'Reservoir Watershed Style'
225 | CONFIG_STYLE_SALT_POND = 'Salt_pond Style'
226 | CONFIG_STYLE_VILLAGE_GREEN = 'Village Green Style'
227 | CONFIG_STYLE_VACANT = 'Vacant Style'
228 | CONFIG_STYLE_YES_LU = 'Yes Land Use Style'
229 | CONFIG_STYLE_GOVERNMENT_LU = 'Government Land Use Style'
230 |
231 | # KEY_BUILDING style keys
232 | CONFIG_STYLE_APARTMENTS = 'Apartments Style'
233 | CONFIG_STYLE_INDOOR = 'Indoor Style'
234 | CONFIG_STYLE_CONDOMINIUM = 'Condominium Style'
235 | CONFIG_STYLE_CONDOMINIUM_2 = '(C)ondominium Style'
236 | CONFIG_STYLE_TOWER = 'Tower Style'
237 | CONFIG_STYLE_AMPHITHEATRE = 'Amphitheatre Style'
238 | CONFIG_STYLE_BUNGALOW = 'Bungalow Style'
239 | CONFIG_STYLE_CABIN = 'Cabin Style'
240 | CONFIG_STYLE_DETACHED = 'Detached Style'
241 | CONFIG_STYLE_DORMITORY = 'Dormitory Style'
242 | CONFIG_STYLE_FARM_BLDG = 'Farm (Building) Style'
243 | CONFIG_STYLE_GER = 'Ger Style'
244 | CONFIG_STYLE_HOTEL = 'Hotel Style'
245 | CONFIG_STYLE_HOUSE = 'House Style'
246 | CONFIG_STYLE_HOUSEBOAT = 'Houseboat Style'
247 | CONFIG_STYLE_RESID_BLDG = 'Residential (Building) Style'
248 | CONFIG_STYLE_SD_HOUSE = 'Semidetached House Style'
249 | CONFIG_STYLE_STATIC_CARAVAN = 'Static Caravan Style'
250 | CONFIG_STYLE_TERRACE = 'Terrace Style'
251 | CONFIG_STYLE_COMM_BLDG = 'Commercial (Building) Style'
252 | CONFIG_STYLE_INDUSTRIAL_BLDG = 'Industrial (Building) Style'
253 | CONFIG_STYLE_MANUFACTURE = 'Manufacture Style'
254 | CONFIG_STYLE_KIOSK = 'Kiosk Style'
255 | CONFIG_STYLE_OFFICE = 'Office Style'
256 | CONFIG_STYLE_RETAIL_BLDG = 'Retail (Building) Style'
257 | CONFIG_STYLE_SHOP = 'Shop Style'
258 | CONFIG_STYLE_SUPERMARKET = 'Supermarket Style'
259 | CONFIG_STYLE_WAREHOUSE = 'Warehouse Style'
260 | CONFIG_STYLE_CATHEDRAL = 'Cathedral Style'
261 | CONFIG_STYLE_CHAPEL = 'Chapel Style'
262 | CONFIG_STYLE_CHURCH = 'Church Style'
263 | CONFIG_STYLE_MOSQUE = 'Mosque Style'
264 | CONFIG_STYLE_RELIGIOUS_BLDG = 'Religious (Building) Style'
265 | CONFIG_STYLE_SHRINE = 'Shrine Style'
266 | CONFIG_STYLE_SYNAGOGUE = 'Synagogue Style'
267 | CONFIG_STYLE_TEMPLE = 'Temple Style'
268 | CONFIG_STYLE_BAKEHOUSE = 'Bakehouse Style'
269 | CONFIG_STYLE_CIVIC = 'Civic Style'
270 | CONFIG_STYLE_GYM = 'Gym Style'
271 | CONFIG_STYLE_CANOPY = 'Canopy Style'
272 | CONFIG_STYLE_SHELTER = 'Shelter Style'
273 | CONFIG_STYLE_BURIAL_VAULT = 'Burial Vault Style'
274 | CONFIG_STYLE_PART = 'Part Style'
275 | CONFIG_STYLE_COLLEGE = 'College Style'
276 | CONFIG_STYLE_HEALTH = 'Health_Style'
277 | CONFIG_STYLE_HOTEL_2 = '(H)otel Style'
278 | CONFIG_STYLE_MULTIPURPOSE = 'Multipurpose Style'
279 | CONFIG_STYLE_FIRE_STATION = 'Fire Station Style'
280 | CONFIG_STYLE_GOVERNMENT = 'Government Style'
281 | CONFIG_STYLE_GOVERNEMENT = 'Governement Style' # An OSM misspelling...
282 | CONFIG_STYLE_SUBWAY_ENTRY = 'Subway Entrance Style'
283 | CONFIG_STYLE_LIBRARY = 'Library Style'
284 | CONFIG_STYLE_HOSPITAL = 'Hospital Style'
285 | CONFIG_STYLE_KINDERGARTEN = 'Kindergarten Style'
286 | CONFIG_STYLE_PUBLIC = 'Public Style'
287 | CONFIG_STYLE_SCHOOL = 'School Style'
288 | CONFIG_STYLE_TOILETS = 'Toilets Style'
289 | CONFIG_STYLE_TRAIN_STATION = 'Train Station Style'
290 | CONFIG_STYLE_TRANSPORTATION = 'Transportation Style'
291 | CONFIG_STYLE_UNIVERSITY = 'University Style'
292 | CONFIG_STYLE_BARN = 'Barn Style'
293 | CONFIG_STYLE_CONSERVATORY = 'Conservatory Style'
294 | CONFIG_STYLE_COWSHED = 'Cowshed Style'
295 | CONFIG_STYLE_FARM_AUXILIARY = 'Farm Auxiliary Style'
296 | CONFIG_STYLE_GREENHOUSE = 'Greenhouse Style'
297 | CONFIG_STYLE_SLURRY_TANK = 'Slurry Tank Style'
298 | CONFIG_STYLE_STABLE = 'Stable Style'
299 | CONFIG_STYLE_STY = 'Sty Style'
300 | CONFIG_STYLE_GRANDSTAND = 'Grandstand Style'
301 | CONFIG_STYLE_PAVILION = 'Pavilion Style'
302 | CONFIG_STYLE_RIDING_HALL = 'Riding Hall Style'
303 | CONFIG_STYLE_SPORTS_HALL = 'Sports_ Hall Style'
304 | CONFIG_STYLE_STADIUM = 'Stadium Style'
305 | CONFIG_STYLE_HANGAR = 'Hangar Style'
306 | CONFIG_STYLE_HUT = 'Hut Style'
307 | CONFIG_STYLE_SHED = 'Shed Style'
308 | CONFIG_STYLE_CARPORT = 'Carport Style'
309 | CONFIG_STYLE_GARAGE_BLDG = 'Garage Style'
310 | CONFIG_STYLE_GARAGES_BLDG = 'Garages (Building) Style'
311 | CONFIG_STYLE_PARKING = 'Parking Style'
312 | CONFIG_STYLE_DIGESTER = 'Digester Style'
313 | CONFIG_STYLE_SERVICE_BLDG = 'Service (Building) Style'
314 | CONFIG_STYLE_TRANSF_TOWER = 'Transformer Tower Style'
315 | CONFIG_STYLE_WATER_TOWER = 'Water Tower Style'
316 | CONFIG_STYLE_BUNKER = 'Bunker Style'
317 | CONFIG_STYLE_BRIDGE = 'Bridge Style'
318 | CONFIG_STYLE_CONSTR_BLDG = 'Construction (Building) Style'
319 | CONFIG_STYLE_GATEHOUSE = 'Gatehouse Style'
320 | CONFIG_STYLE_ROOF = 'Roof Style'
321 | CONFIG_STYLE_RUINS = 'Ruins Style'
322 | CONFIG_STYLE_TREE_HOUSE = 'Tree House Style'
323 | CONFIG_STYLE_YES = 'Yes Style'
324 | CONFIG_STYLE_NO = 'No Style'
325 | CONFIG_STYLE_UNDEF = 'Undefined Style'
326 |
327 |
328 | # OSM tag KEY_HIGHWAY values
329 | # see: https://wiki.openstreetmap.org/wiki/Key:highway
330 | VAL_MOTORWAY = 'motorway'
331 | VAL_TRUNK = 'trunk'
332 | VAL_PRIMARY = 'primary'
333 | VAL_SECONDARY = 'secondary'
334 | VAL_TERTIARY = 'tertiary'
335 | VAL_UNCLASSIFIED = 'unclassified'
336 | VAL_RESIDENTIAL = 'residential'
337 |
338 | VAL_LINK_MOTORWAY = 'motorway_link'
339 | VAL_LINK_TRUNK = 'trunk_link'
340 | VAL_LINK_PRIMARY = 'primary_link'
341 | VAL_LINK_SECONDARY = 'secondary_link'
342 | VAL_LINK_TERTIARY = 'tertiary_link'
343 |
344 | VAL_STREET = 'living_street'
345 | VAL_SERVICE = 'service'
346 | VAL_PEDESTRIAN = 'pedestrian'
347 | VAL_TRACK = 'track'
348 | VAL_BUS_GUIDEWAY = 'bus_guideway'
349 | VAL_ESCAPE = 'escape'
350 | VAL_RACEWAY = 'raceway'
351 | VAL_ROAD = 'road'
352 | VAL_FOOTWAY = 'footway'
353 | VAL_BRIDLEWAY = 'bridleway'
354 | VAL_STEPS = 'steps'
355 | VAL_CORRIDOR = 'corridor'
356 | VAL_PATH = 'path'
357 | VAL_CYCLEWAY = 'cycleway'
358 | VAL_PROPOSED = 'proposed'
359 | VAL_CONSTRUCTION = 'construction'
360 |
361 | VAL_BUS_STOP = 'bus_stop'
362 | VAL_CROSSING = 'crossing'
363 | VAL_ELEVATOR = 'elevator'
364 | VAL_EMERG_POINT = 'emergency_access_point'
365 | VAL_GIVE_WAY = 'give_way'
366 | VAL_MILESTONE = 'milestone'
367 | VAL_MINI_RABOUT = 'mini_roundabout'
368 | VAL_MOTORWAY_JUNC = 'motorway_junction'
369 | VAL_PASSING_PLACE = 'passing_place'
370 | VAL_PLATFORM = 'platform'
371 | VAL_REST_AREA = 'rest_area'
372 | VAL_SPEED_CAMERA = 'speed_camera'
373 | VAL_STREET_LAMP = 'street_lamp'
374 | VAL_SERVICES = 'services'
375 | VAL_STOP = 'stop'
376 | VAL_TRAFFIC_MIRROR = 'traffic_mirror'
377 | VAL_TRAFFIC_SIGNAL = 'traffic_signals'
378 | VAL_TRAILHEAD = 'trailhead'
379 | VAL_TURNING_CIRCLE = 'turning_circle'
380 | VAL_TURNING_LOOP = 'turning_loop'
381 | VAL_TOLL_GANTRY = 'toll_gantry'
382 |
383 |
384 | # OSM tag KEY_WATERWAY values
385 | VAL_RIVER = 'river'
386 | VAL_RIVERBANK = 'riverbank'
387 | VAL_STREAM = 'stream'
388 | VAL_TIDAL_CHANNEL = 'tidal_channel'
389 | VAL_CANAL = 'canal'
390 | VAL_PRESSURIZED = 'pressurised'
391 | VAL_DRAIN = 'drain'
392 | VAL_DITCH = 'ditch'
393 | VAL_FAIRWAY = 'fairway'
394 | VAL_ARTIFICIAL = 'artificial'
395 | VAL_DERELICT = 'derelict_canal'
396 |
397 | VAL_DOCK = 'dock'
398 | VAL_BOATYARD = 'boatyard'
399 | VAL_DAM = 'dam'
400 | VAL_WEIR = 'weir'
401 | VAL_FUEL = 'fuel'
402 | VAL_LOCK_GATE = 'lock_gate'
403 |
404 |
405 | # OSM tag KEY_NATURAL values
406 | VAL_WOOD = 'wood'
407 | VAL_TREE_ROW = 'tree_row'
408 | VAL_TREE = 'tree'
409 | VAL_SCRUB = 'scrub'
410 | VAL_HEATH = 'heath'
411 | VAL_MOOR = 'moor'
412 | VAL_GRASS = 'grass'
413 | VAL_GRASSLAND = 'grassland'
414 | VAL_FELL = 'fell'
415 | VAL_BARE_ROCK = 'bare_rock'
416 | VAL_SCREE = 'scree'
417 | VAL_SHINGLE = 'shingle'
418 | VAL_SAND = 'sand'
419 | VAL_MUD = 'mud'
420 |
421 | VAL_WATER = 'water'
422 | VAL_WETLAND = 'wetland'
423 | VAL_GLACIER = 'glacier'
424 | VAL_BAY = 'bay'
425 | VAL_CAPE = 'cape'
426 | VAL_STRAIT = 'strait'
427 | VAL_BEACH = 'beach'
428 | VAL_COASTLINE = 'coastline'
429 | VAL_REEF = 'reef'
430 | VAL_SPRING = 'spring'
431 | VAL_HOT_SPRING = 'hot_spring'
432 | VAL_GEYSER = 'geyser'
433 | VAL_MTN_RANGE = 'mountain_range'
434 |
435 | VAL_PEAK = 'peak'
436 | VAL_DUNE = 'dune'
437 | VAL_HILL = 'hill'
438 | VAL_VOLCANO = 'volcano'
439 | VAL_VALLEY = 'valley'
440 | VAL_RIDGE = 'ridge'
441 | VAL_ARETE = 'arete'
442 | VAL_CLIFF = 'cliff'
443 | VAL_SADDLE = 'saddle'
444 | VAL_ISTHMUS = 'isthmus'
445 | VAL_PENINSULA = 'peninsula'
446 | VAL_ROCK = 'rock'
447 | VAL_STONE = 'stone'
448 | VAL_SINKHOLE = 'sinkhole'
449 | VAL_CAVE_ENTRANCE = 'cave_entrance'
450 |
451 |
452 | # OSM tag KEY_LANDUSE values
453 | VAL_COMMERCIAL = 'commercial'
454 | # VAL_CONSTRUCTION = 'construction'
455 | VAL_INDUSTRIAL = 'industrial'
456 | # VAL_RESIDENTIAL = 'residential'
457 | VAL_RETAIL = 'retail'
458 | VAL_ALLOTMENTS = 'allotments'
459 | VAL_FARMLAND = 'farmland'
460 | VAL_FARM = 'farm'
461 | VAL_FARMYARD = 'farmyard'
462 | VAL_FOREST = 'forest'
463 | VAL_MEADOW = 'meadow'
464 | VAL_ORCHARD = 'orchard'
465 | VAL_VINEYARD = 'vineyard'
466 | VAL_GARDEN = 'Garden'
467 | VAL_BASIN = 'basin'
468 | VAL_BROWNFIELD = 'brownfield'
469 | VAL_CEMETERY = 'cemetery'
470 | VAL_CONSERVATION = 'conservation'
471 | VAL_DEPOT = 'depot'
472 | VAL_GARAGE = 'garage'
473 | VAL_GARAGES = 'garages'
474 | VAL_TRAF_ISLAND = 'traffic_island'
475 | # VAL_GRASS = 'grass'
476 | VAL_GREENFIELD = 'greenfield'
477 | VAL_GH_HORT = 'greenhouse_horticulture'
478 | VAL_LANDFILL = 'landfill'
479 | VAL_MILITARY = 'military'
480 | VAL_PEAT_CUTTING = 'peat_cutting'
481 | VAL_PLANT_NURSERY = 'plant_nursery'
482 | VAL_PORT = 'port'
483 | VAL_QUARRY = 'quarry'
484 | VAL_RAILWAY = 'railway'
485 | VAL_REC_GROUND = 'recreation_ground'
486 | VAL_RELIGIOUS = 'religious'
487 | VAL_CHURCHYARD = 'churchyard'
488 | VAL_RESERVOIR = 'reservoir'
489 | VAL_RES_WTSHED = 'reservoir_watershed'
490 | VAL_SALT_POND = 'salt_pond'
491 | VAL_VILLAGE_GREEN = 'village_green'
492 | VAL_VACANT = 'vacant'
493 | VAL_YES_LU = 'yes'
494 | VAL_GOVERNMENT_LU = 'government'
495 |
496 |
497 | # OSM tag KEY_BUILDING values
498 | VAL_APARTMENTS = 'apartments'
499 | VAL_INDOOR = 'indoor'
500 | VAL_CONDOMINIUM = 'condominium'
501 | VAL_CONDOMINIUM_2 = 'Condominium'
502 | VAL_TOWER = 'tower'
503 | VAL_AMPHITHEATRE = 'amphitheatre'
504 | VAL_BUNGALOW = 'bungalow'
505 | VAL_CABIN = 'cabin'
506 | VAL_DETACHED = 'detached'
507 | VAL_DORMITORY = 'dormitory'
508 | # VAL_FARM = 'farm'
509 | VAL_GER = 'ger'
510 | VAL_HOTEL = 'hotel'
511 | VAL_HOUSE = 'house'
512 | VAL_HOUSEBOAT = 'houseboat'
513 | # VAL_RESIDENTIAL = 'residential'
514 | VAL_SD_HOUSE = 'semidetached_house'
515 | VAL_STATIC_CARAVAN = 'static_caravan'
516 | VAL_TERRACE = 'terrace'
517 | # VAL_COMMERCIAL = 'commercial'
518 | # VAL_INDUSTRIAL = 'industrial'
519 | VAL_MANUFACTURE = 'manufacture'
520 | VAL_KIOSK = 'kiosk'
521 | VAL_OFFICE = 'office'
522 | # VAL_RETAIL = 'retail'
523 | VAL_SHOP = 'shop'
524 | VAL_SUPERMARKET = 'supermarket'
525 | VAL_WAREHOUSE = 'warehouse'
526 | VAL_CATHEDRAL = 'cathedral'
527 | VAL_CHAPEL = 'chapel'
528 | VAL_CHURCH = 'church'
529 | VAL_MOSQUE = 'mosque'
530 | # VAL_RELIGIOUS = 'religious'
531 | VAL_SHRINE = 'shrine'
532 | VAL_SYNAGOGUE = 'synagogue'
533 | VAL_TEMPLE = 'temple'
534 | VAL_BAKEHOUSE = 'bakehouse'
535 | VAL_CIVIC = 'civic'
536 | VAL_GYM = 'Gym'
537 | VAL_CANOPY = 'canopy'
538 | VAL_SHELTER = 'shelter'
539 | VAL_BURIAL_VAULT = 'burial_vault'
540 | VAL_PART = 'part'
541 | VAL_COLLEGE = 'college'
542 | VAL_HEALTH = 'health'
543 | VAL_HOTEL_2 = 'Hotel'
544 | VAL_MULTIPURPOSE = 'multipurpose'
545 | VAL_FIRE_STATION = 'fire_station'
546 | VAL_GOVERNMENT = 'government'
547 | VAL_GOVERNEMENT = 'governement' # This was a misspelling in some OSM files...
548 | VAL_SUBWAY_ENTRY = 'subway_entrance'
549 | VAL_LIBRARY = 'library'
550 | VAL_HOSPITAL = 'hospital'
551 | VAL_KINDERGARTEN = 'kindergarten'
552 | VAL_PUBLIC = 'public'
553 | VAL_SCHOOL = 'school'
554 | VAL_TOILETS = 'toilets'
555 | VAL_TRAIN_STATION = 'train_station'
556 | VAL_TRANSPORTATION = 'transportation'
557 | VAL_UNIVERSITY = 'university'
558 | VAL_BARN = 'barn'
559 | VAL_CONSERVATORY = 'conservatory'
560 | VAL_COWSHED = 'cowshed'
561 | VAL_FARM_AUXILIARY = 'farm_auxiliary'
562 | VAL_GREENHOUSE = 'greenhouse'
563 | VAL_SLURRY_TANK = 'slurry_tank'
564 | VAL_STABLE = 'stable'
565 | VAL_STY = 'sty'
566 | VAL_GRANDSTAND = 'grandstand'
567 | VAL_PAVILION = 'pavilion'
568 | VAL_RIDING_HALL = 'riding_hall'
569 | VAL_SPORTS_HALL = 'sports_hall'
570 | VAL_STADIUM = 'stadium'
571 | VAL_HANGAR = 'hangar'
572 | VAL_HUT = 'hut'
573 | VAL_SHED = 'shed'
574 | VAL_CARPORT = 'carport'
575 | # VAL_GARAGE = 'garage'
576 | # VAL_GARAGES = 'garages'
577 | VAL_PARKING = 'parking'
578 | VAL_DIGESTER = 'digester'
579 | # VAL_SERVICE = 'service'
580 | VAL_TRANSF_TOWER = 'transformer_tower'
581 | VAL_WATER_TOWER = 'water_tower'
582 | VAL_BUNKER = 'bunker'
583 | VAL_BRIDGE = 'bridge'
584 | # VAL_CONSTRUCTION = 'construction'
585 | VAL_GATEHOUSE = 'gatehouse'
586 | VAL_ROOF = 'roof'
587 | VAL_RUINS = 'ruins'
588 | VAL_TREE_HOUSE = 'tree_house'
589 | VAL_YES = 'yes'
590 | VAL_NO = 'no'
591 | VAL_UNDEF = 'undefined'
592 |
593 | # Connect the OSM groups to the proper setting
594 | DATA_GROUPS = {KEY_HIGHWAY: {VAL_MOTORWAY: CONFIG_STYLE_MOTORWAY,
595 | VAL_TRUNK: CONFIG_STYLE_TRUNK,
596 | VAL_PRIMARY: CONFIG_STYLE_PRIMARY,
597 | VAL_SECONDARY: CONFIG_STYLE_SECONDARY,
598 | VAL_TERTIARY: CONFIG_STYLE_TERTIARY,
599 | VAL_UNCLASSIFIED: CONFIG_STYLE_UNCLASSIFIED,
600 | VAL_RESIDENTIAL: CONFIG_STYLE_RESIDENTIAL,
601 | VAL_LINK_MOTORWAY: CONFIG_STYLE_LINK_MOTORWAY,
602 | VAL_LINK_TRUNK: CONFIG_STYLE_LINK_TRUNK,
603 | VAL_LINK_PRIMARY: CONFIG_STYLE_LINK_PRIMARY,
604 | VAL_LINK_SECONDARY: CONFIG_STYLE_LINK_SECONDARY,
605 | VAL_LINK_TERTIARY: CONFIG_STYLE_LINK_TERTIARY,
606 | VAL_STREET: CONFIG_STYLE_STREET,
607 | VAL_SERVICE: CONFIG_STYLE_SERVICE,
608 | VAL_PEDESTRIAN: CONFIG_STYLE_PEDESTRIAN,
609 | VAL_TRACK: CONFIG_STYLE_TRACK,
610 | VAL_BUS_GUIDEWAY: CONFIG_STYLE_BUS_GUIDEWAY,
611 | VAL_ESCAPE: CONFIG_STYLE_ESCAPE,
612 | VAL_RACEWAY: CONFIG_STYLE_RACEWAY,
613 | VAL_ROAD: CONFIG_STYLE_ROAD,
614 | VAL_FOOTWAY: CONFIG_STYLE_FOOTWAY,
615 | VAL_BRIDLEWAY: CONFIG_STYLE_BRIDLEWAY,
616 | VAL_STEPS: CONFIG_STYLE_STEPS,
617 | VAL_CORRIDOR: CONFIG_STYLE_CORRIDOR,
618 | VAL_PATH: CONFIG_STYLE_PATH,
619 | VAL_CYCLEWAY: CONFIG_STYLE_CYCLEWAY,
620 | VAL_PROPOSED: CONFIG_STYLE_PROPOSED,
621 | VAL_CONSTRUCTION: CONFIG_STYLE_CONSTRUCTION,
622 | VAL_BUS_STOP: CONFIG_STYLE_BUS_STOP,
623 | VAL_CROSSING: CONFIG_STYLE_CROSSING,
624 | VAL_ELEVATOR: CONFIG_STYLE_ELEVATOR,
625 | VAL_EMERG_POINT: CONFIG_STYLE_EMERG_POINT,
626 | VAL_GIVE_WAY: CONFIG_STYLE_GIVE_WAY,
627 | VAL_MILESTONE: CONFIG_STYLE_MILESTONE,
628 | VAL_MINI_RABOUT: CONFIG_STYLE_MINI_ROUNDABOUT,
629 | VAL_MOTORWAY_JUNC: CONFIG_STYLE_MOTORWAY_JUNC,
630 | VAL_PASSING_PLACE: CONFIG_STYLE_PASSING_PLACE,
631 | VAL_PLATFORM: CONFIG_STYLE_PLATFORM,
632 | VAL_REST_AREA: CONFIG_STYLE_REST_AREA,
633 | VAL_SPEED_CAMERA: CONFIG_STYLE_SPEED_CAMERA,
634 | VAL_STREET_LAMP: CONFIG_STYLE_STREET_LAMP,
635 | VAL_SERVICES: CONFIG_STYLE_SERVICES,
636 | VAL_STOP: CONFIG_STYLE_STOP,
637 | VAL_TRAFFIC_MIRROR: CONFIG_STYLE_TRAFFIC_MIRROR,
638 | VAL_TRAFFIC_SIGNAL: CONFIG_STYLE_TRAFFIC_SIGNAL,
639 | VAL_TRAILHEAD: CONFIG_STYLE_TRAILHEAD,
640 | VAL_TURNING_CIRCLE: CONFIG_STYLE_TURNING_CIRCLE,
641 | VAL_TURNING_LOOP: CONFIG_STYLE_TURNING_LOOP,
642 | VAL_TOLL_GANTRY: CONFIG_STYLE_TOLL_GANTRY},
643 | KEY_WATERWAY: {VAL_RIVER: CONFIG_STYLE_RIVER,
644 | VAL_RIVERBANK: CONFIG_STYLE_RIVERBANK,
645 | VAL_STREAM: CONFIG_STYLE_STREAM,
646 | VAL_TIDAL_CHANNEL: CONFIG_STYLE_TIDAL_CHANNEL,
647 | VAL_CANAL: CONFIG_STYLE_CANAL,
648 | VAL_PRESSURIZED: CONFIG_STYLE_PRESSURIZED,
649 | VAL_DRAIN: CONFIG_STYLE_DRAIN,
650 | VAL_DITCH: CONFIG_STYLE_DITCH,
651 | VAL_FAIRWAY: CONFIG_STYLE_FAIRWAY,
652 | VAL_ARTIFICIAL: CONFIG_STYLE_ARTIFICIAL,
653 | VAL_DERELICT: CONFIG_STYLE_DERELICT,
654 | VAL_DOCK: CONFIG_STYLE_DOCK,
655 | VAL_BOATYARD: CONFIG_STYLE_BOATYARD,
656 | VAL_DAM: CONFIG_STYLE_DAM,
657 | VAL_WEIR: CONFIG_STYLE_WEIR,
658 | VAL_FUEL: CONFIG_STYLE_FUEL,
659 | VAL_LOCK_GATE: CONFIG_STYLE_LOCK_GATE},
660 | KEY_NATURAL: {VAL_WOOD: CONFIG_STYLE_WOOD,
661 | VAL_TREE_ROW: CONFIG_STYLE_TREE_ROW,
662 | VAL_TREE: CONFIG_STYLE_TREE,
663 | VAL_SCRUB: CONFIG_STYLE_SCRUB,
664 | VAL_HEATH: CONFIG_STYLE_HEATH,
665 | VAL_MOOR: CONFIG_STYLE_MOOR,
666 | VAL_GRASS: CONFIG_STYLE_GRASS,
667 | VAL_GRASSLAND: CONFIG_STYLE_GRASSLAND,
668 | VAL_FELL: CONFIG_STYLE_FELL,
669 | VAL_BARE_ROCK: CONFIG_STYLE_BARE_ROCK,
670 | VAL_SCREE: CONFIG_STYLE_SCREE,
671 | VAL_SHINGLE: CONFIG_STYLE_SHINGLE,
672 | VAL_SAND: CONFIG_STYLE_SAND,
673 | VAL_MUD: CONFIG_STYLE_MUD,
674 | VAL_WATER: CONFIG_STYLE_WATER,
675 | VAL_WETLAND: CONFIG_STYLE_WETLAND,
676 | VAL_GLACIER: CONFIG_STYLE_GLACIER,
677 | VAL_BAY: CONFIG_STYLE_BAY,
678 | VAL_CAPE: CONFIG_STYLE_CAPE,
679 | VAL_STRAIT: CONFIG_STYLE_STRAIT,
680 | VAL_BEACH: CONFIG_STYLE_BEACH,
681 | VAL_COASTLINE: CONFIG_STYLE_COASTLINE,
682 | VAL_REEF: CONFIG_STYLE_REEF,
683 | VAL_SPRING: CONFIG_STYLE_SPRING,
684 | VAL_HOT_SPRING: CONFIG_STYLE_HOT_SPRING,
685 | VAL_GEYSER: CONFIG_STYLE_GEYSER,
686 | VAL_MTN_RANGE: CONFIG_STYLE_MTN_RANGE,
687 | VAL_PEAK: CONFIG_STYLE_PEAK,
688 | VAL_DUNE: CONFIG_STYLE_DUNE,
689 | VAL_HILL: CONFIG_STYLE_HILL,
690 | VAL_VOLCANO: CONFIG_STYLE_VOLCANO,
691 | VAL_VALLEY: CONFIG_STYLE_VALLEY,
692 | VAL_RIDGE: CONFIG_STYLE_RIDGE,
693 | VAL_ARETE: CONFIG_STYLE_ARETE,
694 | VAL_CLIFF: CONFIG_STYLE_CLIFF,
695 | VAL_SADDLE: CONFIG_STYLE_SADDLE,
696 | VAL_ISTHMUS: CONFIG_STYLE_ISTHMUS,
697 | VAL_PENINSULA: CONFIG_STYLE_PENINSULA,
698 | VAL_ROCK: CONFIG_STYLE_ROCK,
699 | VAL_STONE: CONFIG_STYLE_STONE,
700 | VAL_SINKHOLE: CONFIG_STYLE_SINKHOLE,
701 | VAL_CAVE_ENTRANCE: CONFIG_STYLE_CAVE_ENTRANCE},
702 | KEY_LANDUSE: {VAL_COMMERCIAL: CONFIG_STYLE_COMMERCIAL,
703 | VAL_CONSTRUCTION: CONFIG_STYLE_CONSTRUCTION_LU,
704 | VAL_INDUSTRIAL: CONFIG_STYLE_INDUSTRIAL,
705 | VAL_RESIDENTIAL: CONFIG_STYLE_RESIDENTIAL_LU,
706 | VAL_RETAIL: CONFIG_STYLE_RETAIL,
707 | VAL_ALLOTMENTS: CONFIG_STYLE_ALLOTMENTS,
708 | VAL_FARMLAND: CONFIG_STYLE_FARMLAND,
709 | VAL_FARM: CONFIG_STYLE_FARM,
710 | VAL_FARMYARD: CONFIG_STYLE_FARMYARD,
711 | VAL_FOREST: CONFIG_STYLE_FOREST,
712 | VAL_MEADOW: CONFIG_STYLE_MEADOW,
713 | VAL_ORCHARD: CONFIG_STYLE_ORCHARD,
714 | VAL_VINEYARD: CONFIG_STYLE_VINEYARD,
715 | VAL_GARDEN: CONFIG_STYLE_GARDEN,
716 | VAL_BASIN: CONFIG_STYLE_BASIN,
717 | VAL_BROWNFIELD: CONFIG_STYLE_BROWNFIELD,
718 | VAL_CEMETERY: CONFIG_STYLE_CEMETERY,
719 | VAL_CONSERVATION: CONFIG_STYLE_CONSERVATION,
720 | VAL_DEPOT: CONFIG_STYLE_DEPOT,
721 | VAL_GARAGE: CONFIG_STYLE_GARAGE,
722 | VAL_GARAGES: CONFIG_STYLE_GARAGES,
723 | VAL_TRAF_ISLAND: CONFIG_STYLE_TRAF_ISLAND,
724 | VAL_GRASS: CONFIG_STYLE_GRASS_LU,
725 | VAL_GREENFIELD: CONFIG_STYLE_GREENFIELD,
726 | VAL_GH_HORT: CONFIG_STYLE_GH_HORT,
727 | VAL_LANDFILL: CONFIG_STYLE_LANDFILL,
728 | VAL_MILITARY: CONFIG_STYLE_MILITARY,
729 | VAL_PEAT_CUTTING: CONFIG_STYLE_PEAT_CUTTING,
730 | VAL_PLANT_NURSERY: CONFIG_STYLE_PLANT_NURSERY,
731 | VAL_PORT: CONFIG_STYLE_PORT,
732 | VAL_QUARRY: CONFIG_STYLE_QUARRY,
733 | VAL_RAILWAY: CONFIG_STYLE_RAILWAY,
734 | VAL_REC_GROUND: CONFIG_STYLE_REC_GROUND,
735 | VAL_RELIGIOUS: CONFIG_STYLE_RELIGIOUS,
736 | VAL_CHURCHYARD: CONFIG_STYLE_CHURCHYARD,
737 | VAL_RESERVOIR: CONFIG_STYLE_RESERVOIR,
738 | VAL_RES_WTSHED: CONFIG_STYLE_RES_WTSHED,
739 | VAL_SALT_POND: CONFIG_STYLE_SALT_POND,
740 | VAL_VILLAGE_GREEN: CONFIG_STYLE_VILLAGE_GREEN,
741 | VAL_VACANT: CONFIG_STYLE_VACANT,
742 | VAL_YES_LU: CONFIG_STYLE_YES_LU,
743 | VAL_GOVERNMENT_LU: CONFIG_STYLE_GOVERNMENT_LU},
744 | KEY_BUILDING: {VAL_APARTMENTS: CONFIG_STYLE_APARTMENTS,
745 | VAL_INDOOR: CONFIG_STYLE_INDOOR,
746 | VAL_CONDOMINIUM: CONFIG_STYLE_CONDOMINIUM,
747 | VAL_CONDOMINIUM_2: CONFIG_STYLE_CONDOMINIUM_2,
748 | VAL_TOWER: CONFIG_STYLE_TOWER,
749 | VAL_AMPHITHEATRE: CONFIG_STYLE_AMPHITHEATRE,
750 | VAL_BUNGALOW: CONFIG_STYLE_BUNGALOW,
751 | VAL_CABIN: CONFIG_STYLE_CABIN,
752 | VAL_DETACHED: CONFIG_STYLE_DETACHED,
753 | VAL_DORMITORY: CONFIG_STYLE_DORMITORY,
754 | VAL_FARM: CONFIG_STYLE_FARM_BLDG,
755 | VAL_GER: CONFIG_STYLE_GER,
756 | VAL_HOTEL: CONFIG_STYLE_HOTEL,
757 | VAL_HOUSE: CONFIG_STYLE_HOUSE,
758 | VAL_HOUSEBOAT: CONFIG_STYLE_HOUSEBOAT,
759 | VAL_RESIDENTIAL: CONFIG_STYLE_RESID_BLDG,
760 | VAL_SD_HOUSE: CONFIG_STYLE_SD_HOUSE,
761 | VAL_STATIC_CARAVAN: CONFIG_STYLE_STATIC_CARAVAN,
762 | VAL_TERRACE: CONFIG_STYLE_TERRACE,
763 | VAL_COMMERCIAL: CONFIG_STYLE_COMM_BLDG,
764 | VAL_INDUSTRIAL: CONFIG_STYLE_INDUSTRIAL_BLDG,
765 | VAL_MANUFACTURE: CONFIG_STYLE_MANUFACTURE,
766 | VAL_KIOSK: CONFIG_STYLE_KIOSK,
767 | VAL_OFFICE: CONFIG_STYLE_OFFICE,
768 | VAL_RETAIL: CONFIG_STYLE_RETAIL_BLDG,
769 | VAL_SHOP: CONFIG_STYLE_SHOP,
770 | VAL_SUPERMARKET: CONFIG_STYLE_SUPERMARKET,
771 | VAL_WAREHOUSE: CONFIG_STYLE_WAREHOUSE,
772 | VAL_CATHEDRAL: CONFIG_STYLE_CATHEDRAL,
773 | VAL_CHAPEL: CONFIG_STYLE_CHAPEL,
774 | VAL_CHURCH: CONFIG_STYLE_CHURCH,
775 | VAL_MOSQUE: CONFIG_STYLE_MOSQUE,
776 | VAL_RELIGIOUS: CONFIG_STYLE_RELIGIOUS_BLDG,
777 | VAL_SHRINE: CONFIG_STYLE_SHRINE,
778 | VAL_SYNAGOGUE: CONFIG_STYLE_SYNAGOGUE,
779 | VAL_TEMPLE: CONFIG_STYLE_TEMPLE,
780 | VAL_BAKEHOUSE: CONFIG_STYLE_BAKEHOUSE,
781 | VAL_CIVIC: CONFIG_STYLE_CIVIC,
782 | VAL_GYM: CONFIG_STYLE_GYM,
783 | VAL_CANOPY: CONFIG_STYLE_CANOPY,
784 | VAL_SHELTER: CONFIG_STYLE_SHELTER,
785 | VAL_BURIAL_VAULT: CONFIG_STYLE_BURIAL_VAULT,
786 | VAL_PART: CONFIG_STYLE_PART,
787 | VAL_COLLEGE: CONFIG_STYLE_COLLEGE,
788 | VAL_HEALTH: CONFIG_STYLE_HEALTH,
789 | VAL_HOTEL_2: CONFIG_STYLE_HOTEL_2,
790 | VAL_MULTIPURPOSE: CONFIG_STYLE_MULTIPURPOSE,
791 | VAL_FIRE_STATION: CONFIG_STYLE_FIRE_STATION,
792 | VAL_GOVERNMENT: CONFIG_STYLE_GOVERNMENT,
793 | VAL_GOVERNEMENT: CONFIG_STYLE_GOVERNEMENT,
794 | VAL_SUBWAY_ENTRY: CONFIG_STYLE_SUBWAY_ENTRY,
795 | VAL_LIBRARY: CONFIG_STYLE_LIBRARY,
796 | VAL_HOSPITAL: CONFIG_STYLE_HOSPITAL,
797 | VAL_KINDERGARTEN: CONFIG_STYLE_KINDERGARTEN,
798 | VAL_PUBLIC: CONFIG_STYLE_PUBLIC,
799 | VAL_SCHOOL: CONFIG_STYLE_SCHOOL,
800 | VAL_TOILETS: CONFIG_STYLE_TOILETS,
801 | VAL_TRAIN_STATION: CONFIG_STYLE_TRAIN_STATION,
802 | VAL_TRANSPORTATION: CONFIG_STYLE_TRANSPORTATION,
803 | VAL_UNIVERSITY: CONFIG_STYLE_UNIVERSITY,
804 | VAL_BARN: CONFIG_STYLE_BARN,
805 | VAL_CONSERVATORY: CONFIG_STYLE_CONSERVATORY,
806 | VAL_COWSHED: CONFIG_STYLE_COWSHED,
807 | VAL_FARM_AUXILIARY: CONFIG_STYLE_FARM_AUXILIARY,
808 | VAL_GREENHOUSE: CONFIG_STYLE_GREENHOUSE,
809 | VAL_SLURRY_TANK: CONFIG_STYLE_SLURRY_TANK,
810 | VAL_STABLE: CONFIG_STYLE_STABLE,
811 | VAL_STY: CONFIG_STYLE_STY,
812 | VAL_GRANDSTAND: CONFIG_STYLE_GRANDSTAND,
813 | VAL_PAVILION: CONFIG_STYLE_PAVILION,
814 | VAL_RIDING_HALL: CONFIG_STYLE_RIDING_HALL,
815 | VAL_SPORTS_HALL: CONFIG_STYLE_SPORTS_HALL,
816 | VAL_STADIUM: CONFIG_STYLE_STADIUM,
817 | VAL_HANGAR: CONFIG_STYLE_HANGAR,
818 | VAL_HUT: CONFIG_STYLE_HUT,
819 | VAL_SHED: CONFIG_STYLE_SHED,
820 | VAL_CARPORT: CONFIG_STYLE_CARPORT,
821 | VAL_GARAGE: CONFIG_STYLE_GARAGE_BLDG,
822 | VAL_GARAGES: CONFIG_STYLE_GARAGES_BLDG,
823 | VAL_PARKING: CONFIG_STYLE_PARKING,
824 | VAL_DIGESTER: CONFIG_STYLE_DIGESTER,
825 | VAL_SERVICE: CONFIG_STYLE_SERVICE_BLDG,
826 | VAL_TRANSF_TOWER: CONFIG_STYLE_TRANSF_TOWER,
827 | VAL_WATER_TOWER: CONFIG_STYLE_WATER_TOWER,
828 | VAL_BUNKER: CONFIG_STYLE_BUNKER,
829 | VAL_BRIDGE: CONFIG_STYLE_BRIDGE,
830 | VAL_CONSTRUCTION: CONFIG_STYLE_CONSTR_BLDG,
831 | VAL_GATEHOUSE: CONFIG_STYLE_GATEHOUSE,
832 | VAL_ROOF: CONFIG_STYLE_ROOF,
833 | VAL_RUINS: CONFIG_STYLE_RUINS,
834 | VAL_TREE_HOUSE: CONFIG_STYLE_TREE_HOUSE,
835 | VAL_YES: CONFIG_STYLE_YES,
836 | VAL_NO: CONFIG_STYLE_NO,
837 | VAL_UNDEF: CONFIG_STYLE_UNDEF}}
838 |
--------------------------------------------------------------------------------
/src/core/painter.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Thu Aug 22 16:45:40 2019
4 |
5 | @author: The Absolute Tinkerer
6 | """
7 |
8 | from PyQt5.QtGui import QPainter, QPixmap, QColor
9 | from PyQt5.QtCore import Qt
10 |
11 |
12 | class Painter(QPainter):
13 | def __init__(self, width, height):
14 | """
15 | Constructor
16 | """
17 | super(Painter, self).__init__()
18 |
19 | # Create the image upon which we're going to draw
20 | self.image = QPixmap(width, height)
21 | self.bg_color = QColor(255, 255, 255, 255)
22 |
23 | self.image.fill(Qt.transparent)
24 |
25 | # Begin the drawing on the image
26 | self.begin(self.image)
27 |
28 | self.fillRect(0, 0, width, height, self.bg_color)
29 |
30 | def saveImage(self, fileName, fmt=None, quality=-1):
31 | """
32 | """
33 | return self.image.save(fileName, fmt, quality)
34 |
35 | def pixmap(self):
36 | """
37 | Give the pixmap to the user
38 | """
39 | return self.image
40 |
--------------------------------------------------------------------------------
/src/gui/MainWindow/MainWindowHandlers.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Tue Jun 23 15:57:36 2020
4 |
5 | @author: The Absolute Tinkerer
6 | """
7 |
8 | from PyQt5.QtWidgets import QMainWindow, QPushButton, QTreeWidget
9 | from PyQt5.QtWidgets import QDoubleSpinBox, QTreeWidgetItem, QColorDialog
10 | from PyQt5.QtWidgets import QWidget, QFileDialog, QLabel, QComboBox
11 |
12 | from PyQt5.QtGui import QIcon, QPen, QColor
13 |
14 | from PyQt5.QtCore import Qt
15 |
16 | from shutil import copyfile
17 |
18 | from MainWindowUI import Ui_MainWindow
19 |
20 | import constants as c
21 |
22 | from configuration import Configuration
23 |
24 |
25 | class MainWindowHandlers(QMainWindow):
26 | def __init__(self):
27 | """
28 | Constructor
29 | """
30 | QMainWindow.__init__(self)
31 |
32 | # Assign the UI file to this window and maximize
33 | ui = Ui_MainWindow()
34 | ui.setupUi(self)
35 | self.showMaximized()
36 |
37 | # Set the window icon
38 | self.setWindowIcon(QIcon(c.FILE_ICON))
39 |
40 | """
41 | ###########################################################################
42 | Public Functions
43 | ###########################################################################
44 | """
45 | def initialize(self):
46 | """
47 | Public function called upon program start to ensure we assign GUI
48 | elements to class variables. This cannot be done in the constructor!
49 |
50 | Parameters:
51 | -----------
52 | Returns:
53 | --------
54 | """
55 | # Bind widgets to class variables
56 | self._initWidgets()
57 |
58 | # Bind other class variables
59 | self._config = Configuration()
60 |
61 | # Finalize the widgets' appearance using the config file
62 | self._configWidgets()
63 |
64 | """
65 | ###########################################################################
66 | Slot Functions
67 | ###########################################################################
68 | """
69 | def bgColorBtnClicked(self):
70 | """
71 | Button to set the background color has been clicked
72 | """
73 | color = self._colorPicker(self._config.getValue(c.CONFIG_BG_COLOR))
74 |
75 | # If the user cancels out
76 | if not color.isValid():
77 | return
78 |
79 | # Update the button background, save to the config file, and update
80 | # the map widget
81 | self._setButtonColor(self._btn_bg_color, color)
82 | self._config.setValue(c.CONFIG_BG_COLOR, color)
83 |
84 | def lineColorBtnClicked(self):
85 | """
86 | Button to set the selected line color clicked
87 | """
88 | item = self._tree_line.selectedItems()[0]
89 | text, ptext = item.text(0), item.parent().text(0)
90 | pen = self._config.getValue(c.DATA_GROUPS[ptext][text])
91 |
92 | color = self._colorPicker(pen.color())
93 |
94 | # if the user cancels out
95 | if not color.isValid():
96 | return
97 |
98 | # Update the config file, button color
99 | pen.setColor(color)
100 | self._setButtonColor(self._btn_line, color)
101 | self._config.setValue(c.DATA_GROUPS[ptext][text], pen)
102 |
103 | def lineWidthChanged(self, value):
104 | """
105 | The user has changed the width of the selected line
106 | """
107 | item = self._tree_line.selectedItems()[0]
108 | text, ptext = item.text(0), item.parent().text(0)
109 | pen = self._config.getValue(c.DATA_GROUPS[ptext][text])
110 |
111 | # Update the pen, map, and the config file
112 | pen.setWidthF(value)
113 | self._config.setValue(c.DATA_GROUPS[ptext][text], pen)
114 | self._map.update()
115 |
116 | def lineComboChanged(self, value):
117 | """
118 | The user has changed the selected item's line style combo box
119 | """
120 | item = self._tree_line.selectedItems()[0]
121 | text, ptext = item.text(0), item.parent().text(0)
122 | pen = self._config.getValue(c.DATA_GROUPS[ptext][text])
123 |
124 | # Update the pen, map, and the config file
125 | lStyle = list(c.DICT_QPEN_STYLE.keys())[
126 | list(c.DICT_QPEN_STYLE.values()).index(value)]
127 | pen.setStyle(lStyle)
128 | self._config.setValue(c.DATA_GROUPS[ptext][text], pen)
129 | self._map.update()
130 |
131 | def capComboChanged(self, value):
132 | """
133 | The user has changed the selected item's line cap combo box
134 | """
135 | item = self._tree_line.selectedItems()[0]
136 | text, ptext = item.text(0), item.parent().text(0)
137 | pen = self._config.getValue(c.DATA_GROUPS[ptext][text])
138 |
139 | # Update the pen, map, and the config file
140 | cStyle = list(c.DICT_QPEN_CAP.keys())[
141 | list(c.DICT_QPEN_CAP.values()).index(value)]
142 | pen.setCapStyle(cStyle)
143 | self._config.setValue(c.DATA_GROUPS[ptext][text], pen)
144 | self._map.update()
145 |
146 | def joinComboChanged(self, value):
147 | """
148 | The user has changed the selected item's join combo box
149 | """
150 | item = self._tree_line.selectedItems()[0]
151 | text, ptext = item.text(0), item.parent().text(0)
152 | pen = self._config.getValue(c.DATA_GROUPS[ptext][text])
153 |
154 | # Update the pen and the config file
155 | jStyle = list(c.DICT_QPEN_JOIN.keys())[
156 | list(c.DICT_QPEN_JOIN.values()).index(value)]
157 | pen.setJoinStyle(jStyle)
158 | self._config.setValue(c.DATA_GROUPS[ptext][text], pen)
159 |
160 | def fillColorBtnClicked(self):
161 | """
162 | Button to set the selected fill color clicked
163 | """
164 | item = self._tree_fill.selectedItems()[0]
165 | text, ptext = item.text(0), item.parent().text(0)
166 | color = self._colorPicker(self._config.getValue(
167 | c.DATA_GROUPS[ptext][text]))
168 |
169 | # if the user cancels out
170 | if not color.isValid():
171 | return
172 |
173 | # Update the config file, button color
174 | self._setButtonColor(self._btn_fill, color)
175 | self._config.setValue(c.DATA_GROUPS[ptext][text], color)
176 |
177 | def checkboxChanged(self, item, idx):
178 | """
179 | The user has changed an item's checked state
180 | """
181 | text = item.text(0)
182 | state = text not in c.DATA_GROUPS.keys()
183 |
184 | if state:
185 | ptext = item.parent().text(0)
186 | state = item.checkState(0) == Qt.Checked
187 | self._config.setItemState(c.DATA_GROUPS[ptext][text], state)
188 |
189 | # Update the map
190 | self._map.update()
191 |
192 | def loadOSMFile(self):
193 | """
194 | The user has clicked the button to load an OSM file
195 | """
196 | fileName, _ = QFileDialog.getOpenFileName(
197 | self, 'Open OSM File', 'data', 'OpenStreetMap Files (*.osm)')
198 |
199 | if not fileName:
200 | return
201 |
202 | # Create the map object
203 | self._map.setOSMFile(fileName)
204 |
205 | # Enable all settings fields
206 | self._tree_line.setEnabled(True)
207 | self._tree_fill.setEnabled(True)
208 | self._btn_save.setEnabled(True)
209 | self._btn_reset.setEnabled(True)
210 | self._btn_load_settings.setEnabled(True)
211 |
212 | # Select the first item
213 | self._tree_line.topLevelItem(0).setSelected(True)
214 | self._tree_fill.topLevelItem(0).setSelected(True)
215 |
216 | # Update the lists so we capture a config file's changes
217 | self._refreshLists()
218 |
219 | # Force the item metadata fields to update
220 | self.lineSelChanged()
221 | self.fillSelChanged()
222 |
223 | # Update the map
224 | self._map.update()
225 |
226 | def saveImage(self):
227 | """
228 | The user has clicked the button to save the map as an image
229 | """
230 | fileName, _ = QFileDialog.getSaveFileName(
231 | self, 'Save Image', 'output', 'Image Files (*.jpg)')
232 |
233 | if fileName:
234 | self._map.saveImage(self._box_max_dim.value(), fileName)
235 |
236 | # Copy the user config file to reflect the user's settings for the
237 | # image
238 | fileName = fileName.split('/')[-1]
239 | dst = '%s/%s.%s' % (c.FOLDER_USER_CONFIGS, fileName[:-4],
240 | c.FILE_CONFIG.split('.')[1])
241 | copyfile(c.FILE_CONFIG, dst)
242 |
243 | def resetBtnClicked(self):
244 | """
245 | The user has clicked the button to reset the map to the default
246 | configuration
247 | """
248 | # Reset the configuration file
249 | self._config._initConfig()
250 |
251 | self._refreshLists()
252 |
253 | # Force the item metadata fields to update
254 | self.lineSelChanged()
255 | self.fillSelChanged()
256 |
257 | # Update the map
258 | self._map.update()
259 |
260 | def loadSettingsClicked(self):
261 | """
262 | The user has clicked the button to load a pre-defined configuration
263 | file
264 | """
265 | fileName, _ = QFileDialog.getOpenFileName(
266 | self, 'Set Config File', 'configs', 'Config Files (*.config)')
267 |
268 | if fileName:
269 | # Overwrite the existing config file
270 | copyfile(fileName, c.FILE_CONFIG)
271 |
272 | # Rebuild the config file
273 | self._config._read()
274 |
275 | # Update the lists
276 | self._refreshLists()
277 |
278 | # Force the item metadata fields to update
279 | self.lineSelChanged()
280 | self.fillSelChanged()
281 |
282 | # Update the map
283 | self._map.update()
284 |
285 | def lineSelChanged(self):
286 | """
287 | The user has changed which line item is selected
288 | """
289 | item = self._tree_line.selectedItems()[0]
290 |
291 | text = item.text(0)
292 | state = text not in c.DATA_GROUPS.keys()
293 |
294 | # Enable / disable the configuration edit field
295 | self._label_line.setEnabled(state)
296 | self._btn_line.setEnabled(state)
297 | self._box_line.setEnabled(state)
298 | self._combo_line.setEnabled(state)
299 | self._combo_cap.setEnabled(state)
300 | self._combo_join.setEnabled(state)
301 |
302 | # Populate the metadata fields
303 | if state:
304 | self._blockAllSignals(True)
305 |
306 | self._label_line.setText(text)
307 | ptext = item.parent().text(0)
308 | pen = self._config.getValue(c.DATA_GROUPS[ptext][text])
309 | self._setButtonColor(self._btn_line, pen.color())
310 |
311 | self._box_line.setValue(pen.widthF())
312 |
313 | idx = self._combo_line.findText(c.DICT_QPEN_STYLE[pen.style()])
314 | self._combo_line.setCurrentIndex(idx)
315 | idx = self._combo_cap.findText(c.DICT_QPEN_CAP[pen.capStyle()])
316 | self._combo_cap.setCurrentIndex(idx)
317 | idx = self._combo_join.findText(c.DICT_QPEN_JOIN[pen.joinStyle()])
318 | self._combo_join.setCurrentIndex(idx)
319 |
320 | self._blockAllSignals(False)
321 |
322 | def fillSelChanged(self):
323 | """
324 | The user has changed which fill item is selected
325 | """
326 | item = self._tree_fill.selectedItems()[0]
327 |
328 | text = item.text(0)
329 | state = text not in c.DATA_GROUPS.keys()
330 |
331 | # Enable / disable the configuration edit field
332 | self._label_fill.setEnabled(state)
333 | self._btn_fill.setEnabled(state)
334 |
335 | # Populate the metadata fields
336 | if state:
337 | self._blockAllSignals(True)
338 |
339 | self._label_fill.setText(text)
340 | ptext = item.parent().text(0)
341 | color = self._config.getValue(c.DATA_GROUPS[ptext][text])
342 | self._setButtonColor(self._btn_fill, color)
343 |
344 | self._blockAllSignals(False)
345 |
346 | """
347 | ###########################################################################
348 | Private Functions
349 | ###########################################################################
350 | """
351 | def _initWidgets(self):
352 | """
353 | Private function used to bind the GUI elements to class variables so
354 | we can work with them
355 |
356 | Parameters:
357 | -----------
358 | Returns:
359 | --------
360 | """
361 | # QLabels
362 | self._label_line = self.findChild(QLabel, 'label_line')
363 | self._label_fill = self.findChild(QLabel, 'label_fill')
364 |
365 | # QComboBoxes
366 | self._combo_line = self.findChild(QComboBox, 'comboBox_line')
367 | self._combo_cap = self.findChild(QComboBox, 'comboBox_cap')
368 | self._combo_join = self.findChild(QComboBox, 'comboBox_join')
369 |
370 | # QDoubleSpinBoxes
371 | self._box_max_dim = self.findChild(QDoubleSpinBox, 'doubleSpinBox_max')
372 | self._box_line = self.findChild(QDoubleSpinBox, 'doubleSpinBox_line')
373 |
374 | # QPushButtons
375 | self._btn_bg_color = self.findChild(QPushButton, 'button_bg_color')
376 | self._btn_line = self.findChild(QPushButton, 'button_line')
377 | self._btn_fill = self.findChild(QPushButton, 'button_fill')
378 | self._btn_save = self.findChild(QPushButton, 'pushButton_save')
379 | self._btn_reset = self.findChild(QPushButton, 'pushButton_reset')
380 | self._btn_load_settings = self.findChild(QPushButton,
381 | 'pushButton_load_settings')
382 |
383 | # QTreeWidgets
384 | self._tree_line = self.findChild(QTreeWidget,
385 | 'treeWidget_line_settings')
386 | self._tree_fill = self.findChild(QTreeWidget,
387 | 'treeWidget_fill_settings')
388 |
389 | # Map Widget
390 | self._map = self.findChild(QWidget, 'widget_map')
391 |
392 | def _blockAllSignals(self, state):
393 | """
394 | Private function used to block all signals from firing. This is useful
395 | if a signal fires due to updating a widget, but it's not desireable to
396 | fire that signal at this time
397 |
398 | Parameters:
399 | -----------
400 | state : boolean
401 | True to block all signals; False otherwise
402 |
403 | Returns:
404 | --------
405 | """
406 | self._label_line.blockSignals(state)
407 | self._label_fill.blockSignals(state)
408 |
409 | self._combo_line.blockSignals(state)
410 | self._combo_cap.blockSignals(state)
411 | self._combo_join.blockSignals(state)
412 |
413 | self._box_max_dim.blockSignals(state)
414 | self._box_line.blockSignals(state)
415 |
416 | self._btn_bg_color.blockSignals(state)
417 | self._btn_line.blockSignals(state)
418 | self._btn_fill.blockSignals(state)
419 |
420 | self._tree_line.blockSignals(state)
421 | self._tree_fill.blockSignals(state)
422 |
423 | self._map.blockSignals(state)
424 |
425 | def _configWidgets(self):
426 | """
427 | Private function used to configure the widgets according to the
428 | user's configuration file
429 |
430 | Parameters:
431 | -----------
432 | Returns:
433 | --------
434 | """
435 | # Attach this configuration instance to the map widget
436 | self._map.setConfiguration(self._config)
437 |
438 | # Set the background color of the bg button
439 | self._setButtonColor(self._btn_bg_color,
440 | self._config.getValue(c.CONFIG_BG_COLOR))
441 |
442 | # Populate the line and fill widgets
443 | self._blockAllSignals(True)
444 | self._populateList(QPen, self._tree_line, noAlph=[c.KEY_HIGHWAY])
445 | self._populateList(QColor, self._tree_fill)
446 | self._blockAllSignals(False)
447 |
448 | def _setButtonColor(self, button, color):
449 | """
450 | Private helper function used to set the background color of a specified
451 | button
452 |
453 | Parameters:
454 | -----------
455 | button : QPushButton
456 | The button you're changing the background color of
457 | color : QColor
458 | The new background color
459 |
460 | Returns:
461 | --------
462 | """
463 | r, g, b = color.red(), color.green(), color.blue()
464 | button.setStyleSheet('background-color: rgb(%s, %s, %s)' % (r, g, b))
465 |
466 | def _populateList(self, dType, tree, noAlph=[]):
467 | """
468 | Private function used to populate a QTreeWidget with list item
469 |
470 | Parameters:
471 | -----------
472 | dType : QPen | QColor
473 | This function is used to add both datatypes to our lists, but only
474 | one at a time, as Line-Items used QPen and Fill-Items use QColor
475 | tree : QTreeWidget
476 | The parent list widget receiving the items
477 | noAlpha : list of Strings
478 | Include the keys for the items (natural, highway, etc.) that you
479 | do NOT want to alphabetize on presentation. Typically, you want
480 | everything except highway alphabetized.
481 |
482 | Returns:
483 | --------
484 | """
485 | # Add the data groups to the top level for the line tree
486 | for key in c.DATA_GROUPS.keys():
487 | parent = None
488 |
489 | # Alphabetize?
490 | childKeys = list(c.DATA_GROUPS[key].keys())
491 | if key not in noAlph:
492 | # Ensure full alphabetization including upper case keys
493 | childKeys.sort(key=lambda item: item.lower())
494 |
495 | for childKey in childKeys:
496 | childConfig = c.DATA_GROUPS[key][childKey]
497 |
498 | # Add the children to the relevant list
499 | typ = type(self._config.getValue(childConfig))
500 | if typ == dType:
501 | # Only create a parent if any children are the proper type
502 | if parent is None:
503 | parent = self._parentHelper(tree, key)
504 | child = QTreeWidgetItem(parent)
505 | child.setText(0, childKey)
506 | child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
507 | child.setCheckState(0, Qt.Checked)
508 |
509 | def _refreshLists(self):
510 | """
511 | Private function used to update the QTreeWidgets with the proper
512 | checked states after a change has occured, such as loading a new
513 | configuration file
514 |
515 | Parameters:
516 | -----------
517 | Returns:
518 | --------
519 | """
520 | # Block signals during updating
521 | self._blockAllSignals(True)
522 |
523 | # Iterate over the QTreeWidgets and set the proper checked state
524 | for tree in [self._tree_line, self._tree_fill]:
525 | root = tree.invisibleRootItem()
526 | for i in range(root.childCount()):
527 | pitem = root.child(i)
528 | for j in range(pitem.childCount()):
529 | citem = pitem.child(j)
530 | ptext, ctext = pitem.text(0), citem.text(0)
531 |
532 | # Set the check state
533 | if self._config.getItemState(c.DATA_GROUPS[ptext][ctext]):
534 | citem.setCheckState(0, Qt.Checked)
535 | else:
536 | citem.setCheckState(0, Qt.Unchecked)
537 |
538 | # Unblock signals
539 | self._blockAllSignals(False)
540 |
541 | def _parentHelper(self, tree, text):
542 | """
543 | Private function used to initialize and add a QTreeWidgetItem parent
544 | for a given tree and with given text
545 |
546 | Parameters:
547 | -----------
548 | tree : QTreeWidget
549 | The tree you're adding to
550 | text : String
551 | The text of the item
552 |
553 | Returns:
554 | --------
555 | parent : QTreeWidgetItem
556 | The parent item
557 | """
558 | parent = QTreeWidgetItem(tree)
559 | parent.setText(0, text)
560 | parent.setFlags(parent.flags() | Qt.ItemIsTristate |
561 | Qt.ItemIsUserCheckable)
562 | parent.setCheckState(0, Qt.Checked)
563 |
564 | return parent
565 |
566 | def _colorPicker(self, sColor):
567 | """
568 | Private function used to return a selected color to the user
569 |
570 | Parameters:
571 | -----------
572 | sColor : QColor
573 | The starting color of the color chooser
574 |
575 | Returns:
576 | --------
577 | color : QColor
578 | Resulting selection
579 | """
580 | color = QColorDialog.getColor(sColor, self,
581 | 'Choose a Color',
582 | QColorDialog.ShowAlphaChannel)
583 |
584 | return color
585 |
--------------------------------------------------------------------------------
/src/gui/MainWindow/MainWindowUI.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'mainwindow.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.9.2
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 | from PyQt5 import QtCore, QtGui, QtWidgets
10 |
11 | class Ui_MainWindow(object):
12 | def setupUi(self, MainWindow):
13 | MainWindow.setObjectName("MainWindow")
14 | MainWindow.resize(986, 631)
15 | self.centralwidget = QtWidgets.QWidget(MainWindow)
16 | self.centralwidget.setObjectName("centralwidget")
17 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
18 | self.horizontalLayout.setObjectName("horizontalLayout")
19 | self.widget_left_panel = QtWidgets.QWidget(self.centralwidget)
20 | self.widget_left_panel.setMinimumSize(QtCore.QSize(350, 0))
21 | self.widget_left_panel.setObjectName("widget_left_panel")
22 | self.verticalLayout = QtWidgets.QVBoxLayout(self.widget_left_panel)
23 | self.verticalLayout.setObjectName("verticalLayout")
24 | self.widget_4 = QtWidgets.QWidget(self.widget_left_panel)
25 | self.widget_4.setObjectName("widget_4")
26 | self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.widget_4)
27 | self.horizontalLayout_8.setContentsMargins(-1, 0, -1, 0)
28 | self.horizontalLayout_8.setObjectName("horizontalLayout_8")
29 | self.pushButton_load = QtWidgets.QPushButton(self.widget_4)
30 | self.pushButton_load.setMinimumSize(QtCore.QSize(100, 0))
31 | self.pushButton_load.setObjectName("pushButton_load")
32 | self.horizontalLayout_8.addWidget(self.pushButton_load)
33 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
34 | self.horizontalLayout_8.addItem(spacerItem)
35 | self.pushButton_load_settings = QtWidgets.QPushButton(self.widget_4)
36 | self.pushButton_load_settings.setEnabled(False)
37 | self.pushButton_load_settings.setMinimumSize(QtCore.QSize(100, 0))
38 | self.pushButton_load_settings.setObjectName("pushButton_load_settings")
39 | self.horizontalLayout_8.addWidget(self.pushButton_load_settings)
40 | self.verticalLayout.addWidget(self.widget_4)
41 | self.widget_5 = QtWidgets.QWidget(self.widget_left_panel)
42 | self.widget_5.setObjectName("widget_5")
43 | self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.widget_5)
44 | self.horizontalLayout_9.setContentsMargins(-1, 0, -1, 0)
45 | self.horizontalLayout_9.setObjectName("horizontalLayout_9")
46 | self.pushButton_save = QtWidgets.QPushButton(self.widget_5)
47 | self.pushButton_save.setEnabled(False)
48 | self.pushButton_save.setMinimumSize(QtCore.QSize(100, 0))
49 | self.pushButton_save.setObjectName("pushButton_save")
50 | self.horizontalLayout_9.addWidget(self.pushButton_save)
51 | spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
52 | self.horizontalLayout_9.addItem(spacerItem1)
53 | self.pushButton_reset = QtWidgets.QPushButton(self.widget_5)
54 | self.pushButton_reset.setEnabled(False)
55 | self.pushButton_reset.setMinimumSize(QtCore.QSize(100, 0))
56 | self.pushButton_reset.setObjectName("pushButton_reset")
57 | self.horizontalLayout_9.addWidget(self.pushButton_reset)
58 | self.verticalLayout.addWidget(self.widget_5)
59 | self.groupBox_general_settings = QtWidgets.QGroupBox(self.widget_left_panel)
60 | self.groupBox_general_settings.setObjectName("groupBox_general_settings")
61 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_general_settings)
62 | self.verticalLayout_2.setObjectName("verticalLayout_2")
63 | self.widget_gen_1 = QtWidgets.QWidget(self.groupBox_general_settings)
64 | self.widget_gen_1.setObjectName("widget_gen_1")
65 | self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget_gen_1)
66 | self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
67 | self.horizontalLayout_2.setObjectName("horizontalLayout_2")
68 | self.label = QtWidgets.QLabel(self.widget_gen_1)
69 | self.label.setObjectName("label")
70 | self.horizontalLayout_2.addWidget(self.label)
71 | self.doubleSpinBox_max = QtWidgets.QDoubleSpinBox(self.widget_gen_1)
72 | self.doubleSpinBox_max.setMinimumSize(QtCore.QSize(100, 0))
73 | self.doubleSpinBox_max.setMaximumSize(QtCore.QSize(100, 16777215))
74 | self.doubleSpinBox_max.setDecimals(0)
75 | self.doubleSpinBox_max.setMinimum(1.0)
76 | self.doubleSpinBox_max.setMaximum(40000.0)
77 | self.doubleSpinBox_max.setProperty("value", 6000.0)
78 | self.doubleSpinBox_max.setObjectName("doubleSpinBox_max")
79 | self.horizontalLayout_2.addWidget(self.doubleSpinBox_max)
80 | self.verticalLayout_2.addWidget(self.widget_gen_1)
81 | self.widget_gen_2 = QtWidgets.QWidget(self.groupBox_general_settings)
82 | self.widget_gen_2.setObjectName("widget_gen_2")
83 | self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.widget_gen_2)
84 | self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
85 | self.horizontalLayout_3.setObjectName("horizontalLayout_3")
86 | self.verticalLayout_2.addWidget(self.widget_gen_2)
87 | self.widget_gen_3 = QtWidgets.QWidget(self.groupBox_general_settings)
88 | self.widget_gen_3.setObjectName("widget_gen_3")
89 | self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.widget_gen_3)
90 | self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
91 | self.horizontalLayout_4.setObjectName("horizontalLayout_4")
92 | self.label_bg_color = QtWidgets.QLabel(self.widget_gen_3)
93 | self.label_bg_color.setObjectName("label_bg_color")
94 | self.horizontalLayout_4.addWidget(self.label_bg_color)
95 | self.button_bg_color = QtWidgets.QPushButton(self.widget_gen_3)
96 | self.button_bg_color.setMinimumSize(QtCore.QSize(100, 0))
97 | self.button_bg_color.setMaximumSize(QtCore.QSize(100, 16777215))
98 | self.button_bg_color.setText("")
99 | self.button_bg_color.setObjectName("button_bg_color")
100 | self.horizontalLayout_4.addWidget(self.button_bg_color)
101 | self.verticalLayout_2.addWidget(self.widget_gen_3)
102 | self.verticalLayout.addWidget(self.groupBox_general_settings)
103 | self.groupBox_line_settings = QtWidgets.QGroupBox(self.widget_left_panel)
104 | self.groupBox_line_settings.setObjectName("groupBox_line_settings")
105 | self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_line_settings)
106 | self.verticalLayout_4.setObjectName("verticalLayout_4")
107 | self.treeWidget_line_settings = QtWidgets.QTreeWidget(self.groupBox_line_settings)
108 | self.treeWidget_line_settings.setEnabled(False)
109 | self.treeWidget_line_settings.setObjectName("treeWidget_line_settings")
110 | self.treeWidget_line_settings.header().setVisible(False)
111 | self.verticalLayout_4.addWidget(self.treeWidget_line_settings)
112 | self.widget = QtWidgets.QWidget(self.groupBox_line_settings)
113 | self.widget.setObjectName("widget")
114 | self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.widget)
115 | self.horizontalLayout_5.setContentsMargins(-1, 0, -1, 0)
116 | self.horizontalLayout_5.setObjectName("horizontalLayout_5")
117 | self.label_line = QtWidgets.QLabel(self.widget)
118 | self.label_line.setEnabled(False)
119 | self.label_line.setObjectName("label_line")
120 | self.horizontalLayout_5.addWidget(self.label_line)
121 | self.button_line = QtWidgets.QPushButton(self.widget)
122 | self.button_line.setEnabled(False)
123 | self.button_line.setMinimumSize(QtCore.QSize(100, 0))
124 | self.button_line.setMaximumSize(QtCore.QSize(100, 16777215))
125 | self.button_line.setText("")
126 | self.button_line.setObjectName("button_line")
127 | self.horizontalLayout_5.addWidget(self.button_line)
128 | self.verticalLayout_4.addWidget(self.widget)
129 | self.widget_3 = QtWidgets.QWidget(self.groupBox_line_settings)
130 | self.widget_3.setObjectName("widget_3")
131 | self.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.widget_3)
132 | self.horizontalLayout_7.setContentsMargins(-1, 0, -1, 0)
133 | self.horizontalLayout_7.setObjectName("horizontalLayout_7")
134 | self.doubleSpinBox_line = QtWidgets.QDoubleSpinBox(self.widget_3)
135 | self.doubleSpinBox_line.setEnabled(False)
136 | self.doubleSpinBox_line.setDecimals(2)
137 | self.doubleSpinBox_line.setMaximum(100.0)
138 | self.doubleSpinBox_line.setSingleStep(1.0)
139 | self.doubleSpinBox_line.setObjectName("doubleSpinBox_line")
140 | self.horizontalLayout_7.addWidget(self.doubleSpinBox_line)
141 | self.comboBox_line = QtWidgets.QComboBox(self.widget_3)
142 | self.comboBox_line.setEnabled(False)
143 | self.comboBox_line.setObjectName("comboBox_line")
144 | self.comboBox_line.addItem("")
145 | self.comboBox_line.addItem("")
146 | self.comboBox_line.addItem("")
147 | self.comboBox_line.addItem("")
148 | self.comboBox_line.addItem("")
149 | self.horizontalLayout_7.addWidget(self.comboBox_line)
150 | self.comboBox_cap = QtWidgets.QComboBox(self.widget_3)
151 | self.comboBox_cap.setEnabled(False)
152 | self.comboBox_cap.setObjectName("comboBox_cap")
153 | self.comboBox_cap.addItem("")
154 | self.comboBox_cap.addItem("")
155 | self.comboBox_cap.addItem("")
156 | self.horizontalLayout_7.addWidget(self.comboBox_cap)
157 | self.comboBox_join = QtWidgets.QComboBox(self.widget_3)
158 | self.comboBox_join.setEnabled(False)
159 | self.comboBox_join.setObjectName("comboBox_join")
160 | self.comboBox_join.addItem("")
161 | self.comboBox_join.addItem("")
162 | self.comboBox_join.addItem("")
163 | self.horizontalLayout_7.addWidget(self.comboBox_join)
164 | self.verticalLayout_4.addWidget(self.widget_3)
165 | self.verticalLayout.addWidget(self.groupBox_line_settings)
166 | self.groupBox_fill_settings = QtWidgets.QGroupBox(self.widget_left_panel)
167 | self.groupBox_fill_settings.setObjectName("groupBox_fill_settings")
168 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_fill_settings)
169 | self.verticalLayout_3.setObjectName("verticalLayout_3")
170 | self.treeWidget_fill_settings = QtWidgets.QTreeWidget(self.groupBox_fill_settings)
171 | self.treeWidget_fill_settings.setEnabled(False)
172 | self.treeWidget_fill_settings.setObjectName("treeWidget_fill_settings")
173 | self.treeWidget_fill_settings.header().setVisible(False)
174 | self.verticalLayout_3.addWidget(self.treeWidget_fill_settings)
175 | self.widget_2 = QtWidgets.QWidget(self.groupBox_fill_settings)
176 | self.widget_2.setObjectName("widget_2")
177 | self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.widget_2)
178 | self.horizontalLayout_6.setContentsMargins(-1, 0, -1, 0)
179 | self.horizontalLayout_6.setObjectName("horizontalLayout_6")
180 | self.label_fill = QtWidgets.QLabel(self.widget_2)
181 | self.label_fill.setEnabled(False)
182 | self.label_fill.setObjectName("label_fill")
183 | self.horizontalLayout_6.addWidget(self.label_fill)
184 | self.button_fill = QtWidgets.QPushButton(self.widget_2)
185 | self.button_fill.setEnabled(False)
186 | self.button_fill.setMinimumSize(QtCore.QSize(100, 0))
187 | self.button_fill.setMaximumSize(QtCore.QSize(100, 16777215))
188 | self.button_fill.setText("")
189 | self.button_fill.setObjectName("button_fill")
190 | self.horizontalLayout_6.addWidget(self.button_fill)
191 | self.verticalLayout_3.addWidget(self.widget_2)
192 | self.verticalLayout.addWidget(self.groupBox_fill_settings)
193 | self.horizontalLayout.addWidget(self.widget_left_panel)
194 | self.widget_map = MapWidget(self.centralwidget)
195 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
196 | sizePolicy.setHorizontalStretch(1)
197 | sizePolicy.setVerticalStretch(0)
198 | sizePolicy.setHeightForWidth(self.widget_map.sizePolicy().hasHeightForWidth())
199 | self.widget_map.setSizePolicy(sizePolicy)
200 | self.widget_map.setMinimumSize(QtCore.QSize(300, 300))
201 | self.widget_map.setObjectName("widget_map")
202 | self.horizontalLayout.addWidget(self.widget_map)
203 | MainWindow.setCentralWidget(self.centralwidget)
204 | self.menubar = QtWidgets.QMenuBar(MainWindow)
205 | self.menubar.setGeometry(QtCore.QRect(0, 0, 986, 21))
206 | self.menubar.setObjectName("menubar")
207 | MainWindow.setMenuBar(self.menubar)
208 |
209 | self.retranslateUi(MainWindow)
210 | self.button_bg_color.clicked.connect(MainWindow.bgColorBtnClicked)
211 | self.pushButton_load.clicked.connect(MainWindow.loadOSMFile)
212 | self.pushButton_save.clicked.connect(MainWindow.saveImage)
213 | self.treeWidget_line_settings.itemSelectionChanged.connect(MainWindow.lineSelChanged)
214 | self.treeWidget_fill_settings.itemSelectionChanged.connect(MainWindow.fillSelChanged)
215 | self.button_line.clicked.connect(MainWindow.lineColorBtnClicked)
216 | self.button_fill.clicked.connect(MainWindow.fillColorBtnClicked)
217 | self.doubleSpinBox_line.valueChanged['double'].connect(MainWindow.lineWidthChanged)
218 | self.comboBox_line.currentTextChanged['QString'].connect(MainWindow.lineComboChanged)
219 | self.comboBox_cap.currentTextChanged['QString'].connect(MainWindow.capComboChanged)
220 | self.comboBox_join.currentTextChanged['QString'].connect(MainWindow.joinComboChanged)
221 | self.treeWidget_line_settings.itemChanged['QTreeWidgetItem*','int'].connect(MainWindow.checkboxChanged)
222 | self.treeWidget_fill_settings.itemChanged['QTreeWidgetItem*','int'].connect(MainWindow.checkboxChanged)
223 | self.pushButton_reset.clicked.connect(MainWindow.resetBtnClicked)
224 | self.pushButton_load_settings.clicked.connect(MainWindow.loadSettingsClicked)
225 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
226 |
227 | def retranslateUi(self, MainWindow):
228 | _translate = QtCore.QCoreApplication.translate
229 | MainWindow.setWindowTitle(_translate("MainWindow", "Map Stylizer"))
230 | self.pushButton_load.setText(_translate("MainWindow", "Load OSM File"))
231 | self.pushButton_load_settings.setText(_translate("MainWindow", "Load Settings"))
232 | self.pushButton_save.setText(_translate("MainWindow", "Save Image"))
233 | self.pushButton_reset.setText(_translate("MainWindow", "Reset Settings"))
234 | self.groupBox_general_settings.setTitle(_translate("MainWindow", "General Settings"))
235 | self.label.setText(_translate("MainWindow", "Max Dimension"))
236 | self.label_bg_color.setText(_translate("MainWindow", "Background Color"))
237 | self.groupBox_line_settings.setTitle(_translate("MainWindow", "Line Settings"))
238 | self.label_line.setText(_translate("MainWindow", ""))
239 | self.comboBox_line.setItemText(0, _translate("MainWindow", "Solid Line"))
240 | self.comboBox_line.setItemText(1, _translate("MainWindow", "Dash Line"))
241 | self.comboBox_line.setItemText(2, _translate("MainWindow", "Dot Line"))
242 | self.comboBox_line.setItemText(3, _translate("MainWindow", "Dash-Dot Line"))
243 | self.comboBox_line.setItemText(4, _translate("MainWindow", "Dash-Dot-Dot Line"))
244 | self.comboBox_cap.setItemText(0, _translate("MainWindow", "Square Cap"))
245 | self.comboBox_cap.setItemText(1, _translate("MainWindow", "Flat Cap"))
246 | self.comboBox_cap.setItemText(2, _translate("MainWindow", "Round Cap"))
247 | self.comboBox_join.setItemText(0, _translate("MainWindow", "Bevel Join"))
248 | self.comboBox_join.setItemText(1, _translate("MainWindow", "Miter Join"))
249 | self.comboBox_join.setItemText(2, _translate("MainWindow", "Round Join"))
250 | self.groupBox_fill_settings.setTitle(_translate("MainWindow", "Fill Settings"))
251 | self.label_fill.setText(_translate("MainWindow", ""))
252 |
253 | from mapwidget import MapWidget
254 |
--------------------------------------------------------------------------------
/src/gui/MainWindow/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 986
10 | 631
11 |
12 |
13 |
14 | Map Stylizer
15 |
16 |
17 |
18 | -
19 |
20 |
21 |
22 | 350
23 | 0
24 |
25 |
26 |
27 |
-
28 |
29 |
30 |
31 | 0
32 |
33 |
34 | 0
35 |
36 |
-
37 |
38 |
39 |
40 | 100
41 | 0
42 |
43 |
44 |
45 | Load OSM File
46 |
47 |
48 |
49 | -
50 |
51 |
52 | Qt::Horizontal
53 |
54 |
55 |
56 | 40
57 | 20
58 |
59 |
60 |
61 |
62 | -
63 |
64 |
65 | false
66 |
67 |
68 |
69 | 100
70 | 0
71 |
72 |
73 |
74 | Load Settings
75 |
76 |
77 |
78 |
79 |
80 |
81 | -
82 |
83 |
84 |
85 | 0
86 |
87 |
88 | 0
89 |
90 |
-
91 |
92 |
93 | false
94 |
95 |
96 |
97 | 100
98 | 0
99 |
100 |
101 |
102 | Save Image
103 |
104 |
105 |
106 | -
107 |
108 |
109 | Qt::Horizontal
110 |
111 |
112 |
113 | 40
114 | 20
115 |
116 |
117 |
118 |
119 | -
120 |
121 |
122 | false
123 |
124 |
125 |
126 | 100
127 | 0
128 |
129 |
130 |
131 | Reset Settings
132 |
133 |
134 |
135 |
136 |
137 |
138 | -
139 |
140 |
141 | General Settings
142 |
143 |
144 |
-
145 |
146 |
147 |
148 | 0
149 |
150 |
151 | 0
152 |
153 |
154 | 0
155 |
156 |
157 | 0
158 |
159 |
-
160 |
161 |
162 | Max Dimension
163 |
164 |
165 |
166 | -
167 |
168 |
169 |
170 | 100
171 | 0
172 |
173 |
174 |
175 |
176 | 100
177 | 16777215
178 |
179 |
180 |
181 | 0
182 |
183 |
184 | 1.000000000000000
185 |
186 |
187 | 40000.000000000000000
188 |
189 |
190 | 6000.000000000000000
191 |
192 |
193 |
194 |
195 |
196 |
197 | -
198 |
199 |
200 |
201 | 0
202 |
203 |
204 | 0
205 |
206 |
207 | 0
208 |
209 |
210 | 0
211 |
212 |
213 |
214 |
215 | -
216 |
217 |
218 |
219 | 0
220 |
221 |
222 | 0
223 |
224 |
225 | 0
226 |
227 |
228 | 0
229 |
230 |
-
231 |
232 |
233 | Background Color
234 |
235 |
236 |
237 | -
238 |
239 |
240 |
241 | 100
242 | 0
243 |
244 |
245 |
246 |
247 | 100
248 | 16777215
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 | -
263 |
264 |
265 | Line Settings
266 |
267 |
268 |
-
269 |
270 |
271 | false
272 |
273 |
274 | false
275 |
276 |
277 |
278 | -
279 |
280 |
281 |
282 | 0
283 |
284 |
285 | 0
286 |
287 |
-
288 |
289 |
290 | false
291 |
292 |
293 | <value>
294 |
295 |
296 |
297 | -
298 |
299 |
300 | false
301 |
302 |
303 |
304 | 100
305 | 0
306 |
307 |
308 |
309 |
310 | 100
311 | 16777215
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 | -
323 |
324 |
325 |
326 | 0
327 |
328 |
329 | 0
330 |
331 |
-
332 |
333 |
334 | false
335 |
336 |
337 | 2
338 |
339 |
340 | 100.000000000000000
341 |
342 |
343 | 1.000000000000000
344 |
345 |
346 |
347 | -
348 |
349 |
350 | false
351 |
352 |
-
353 |
354 | Solid Line
355 |
356 |
357 | -
358 |
359 | Dash Line
360 |
361 |
362 | -
363 |
364 | Dot Line
365 |
366 |
367 | -
368 |
369 | Dash-Dot Line
370 |
371 |
372 | -
373 |
374 | Dash-Dot-Dot Line
375 |
376 |
377 |
378 |
379 | -
380 |
381 |
382 | false
383 |
384 |
-
385 |
386 | Square Cap
387 |
388 |
389 | -
390 |
391 | Flat Cap
392 |
393 |
394 | -
395 |
396 | Round Cap
397 |
398 |
399 |
400 |
401 | -
402 |
403 |
404 | false
405 |
406 |
-
407 |
408 | Bevel Join
409 |
410 |
411 | -
412 |
413 | Miter Join
414 |
415 |
416 | -
417 |
418 | Round Join
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 | -
430 |
431 |
432 | Fill Settings
433 |
434 |
435 |
-
436 |
437 |
438 | false
439 |
440 |
441 | false
442 |
443 |
444 |
445 | -
446 |
447 |
448 |
449 | 0
450 |
451 |
452 | 0
453 |
454 |
-
455 |
456 |
457 | false
458 |
459 |
460 | <value>
461 |
462 |
463 |
464 | -
465 |
466 |
467 | false
468 |
469 |
470 |
471 | 100
472 | 0
473 |
474 |
475 |
476 |
477 | 100
478 | 16777215
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 | -
496 |
497 |
498 |
499 | 1
500 | 0
501 |
502 |
503 |
504 |
505 | 300
506 | 300
507 |
508 |
509 |
510 |
511 |
512 |
513 |
523 |
524 |
525 |
526 | MapWidget
527 | QWidget
528 |
529 | 1
530 |
531 |
532 |
533 |
534 |
535 | button_bg_color
536 | clicked()
537 | MainWindow
538 | bgColorBtnClicked()
539 |
540 |
541 | 359
542 | 170
543 |
544 |
545 | 6
546 | 145
547 |
548 |
549 |
550 |
551 | pushButton_load
552 | clicked()
553 | MainWindow
554 | loadOSMFile()
555 |
556 |
557 | 56
558 | 52
559 |
560 |
561 | 5
562 | 45
563 |
564 |
565 |
566 |
567 | pushButton_save
568 | clicked()
569 | MainWindow
570 | saveImage()
571 |
572 |
573 | 42
574 | 88
575 |
576 |
577 | 0
578 | 22
579 |
580 |
581 |
582 |
583 | treeWidget_line_settings
584 | itemSelectionChanged()
585 | MainWindow
586 | lineSelChanged()
587 |
588 |
589 | 48
590 | 266
591 |
592 |
593 | 4
594 | 220
595 |
596 |
597 |
598 |
599 | treeWidget_fill_settings
600 | itemSelectionChanged()
601 | MainWindow
602 | fillSelChanged()
603 |
604 |
605 | 55
606 | 470
607 |
608 |
609 | 5
610 | 451
611 |
612 |
613 |
614 |
615 | button_line
616 | clicked()
617 | MainWindow
618 | lineColorBtnClicked()
619 |
620 |
621 | 281
622 | 375
623 |
624 |
625 | 1
626 | 354
627 |
628 |
629 |
630 |
631 | button_fill
632 | clicked()
633 | MainWindow
634 | fillColorBtnClicked()
635 |
636 |
637 | 275
638 | 585
639 |
640 |
641 | 2
642 | 591
643 |
644 |
645 |
646 |
647 | doubleSpinBox_line
648 | valueChanged(double)
649 | MainWindow
650 | lineWidthChanged(double)
651 |
652 |
653 | 48
654 | 393
655 |
656 |
657 | 3
658 | 264
659 |
660 |
661 |
662 |
663 | comboBox_line
664 | currentTextChanged(QString)
665 | MainWindow
666 | lineComboChanged(QString)
667 |
668 |
669 | 111
670 | 401
671 |
672 |
673 | 2
674 | 296
675 |
676 |
677 |
678 |
679 | comboBox_cap
680 | currentTextChanged(QString)
681 | MainWindow
682 | capComboChanged(QString)
683 |
684 |
685 | 233
686 | 401
687 |
688 |
689 | 4
690 | 324
691 |
692 |
693 |
694 |
695 | comboBox_join
696 | currentTextChanged(QString)
697 | MainWindow
698 | joinComboChanged(QString)
699 |
700 |
701 | 308
702 | 394
703 |
704 |
705 | 2
706 | 379
707 |
708 |
709 |
710 |
711 | treeWidget_line_settings
712 | itemChanged(QTreeWidgetItem*,int)
713 | MainWindow
714 | checkboxChanged(QTreeWidgetItem*,int)
715 |
716 |
717 | 174
718 | 266
719 |
720 |
721 | -4
722 | 179
723 |
724 |
725 |
726 |
727 | treeWidget_fill_settings
728 | itemChanged(QTreeWidgetItem*,int)
729 | MainWindow
730 | checkboxChanged(QTreeWidgetItem*,int)
731 |
732 |
733 | 163
734 | 533
735 |
736 |
737 | 4
738 | 538
739 |
740 |
741 |
742 |
743 | pushButton_reset
744 | clicked()
745 | MainWindow
746 | resetBtnClicked()
747 |
748 |
749 | 289
750 | 87
751 |
752 |
753 | 6
754 | 81
755 |
756 |
757 |
758 |
759 | pushButton_load_settings
760 | clicked()
761 | MainWindow
762 | loadSettingsClicked()
763 |
764 |
765 | 303
766 | 45
767 |
768 |
769 | 5
770 | 123
771 |
772 |
773 |
774 |
775 |
776 | radioChanged()
777 | bgColorBtnClicked()
778 | loadOSMFile()
779 | saveImage()
780 | lineSelChanged()
781 | fillSelChanged()
782 | lineColorBtnClicked()
783 | fillColorBtnClicked()
784 | lineWidthChanged(double)
785 | lineComboChanged(QString)
786 | capComboChanged(QString)
787 | joinComboChanged(QString)
788 | checkboxChanged(QTreeWidgetItem*,int)
789 | resetBtnClicked()
790 | loadSettingsClicked()
791 |
792 |
793 |
--------------------------------------------------------------------------------
/src/gui/Widgets/mapwidget.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Tue Jun 23 18:44:56 2020
4 |
5 | @author: The Absolute Tinkerer
6 | """
7 |
8 |
9 | from PyQt5.QtWidgets import QWidget
10 | from PyQt5.QtGui import QPainter
11 |
12 | import constants as c
13 | from Map import Map
14 | from painter import Painter
15 |
16 |
17 | class MapWidget(QWidget):
18 | def __init__(self, parent=None):
19 | """
20 | Constructor
21 | """
22 | super(MapWidget, self).__init__(parent)
23 |
24 | # Bind class variables
25 | self._config = None
26 | self._map = None
27 |
28 | """
29 | ###########################################################################
30 | Built-In Functions
31 | ###########################################################################
32 | """
33 | def paintEvent(self, event):
34 | """
35 | """
36 | super(MapWidget, self).paintEvent(event)
37 |
38 | # Create the painter object and being the painter
39 | p = QPainter()
40 | p.begin(self)
41 |
42 | # Draw the map only if a map instance exists
43 | if self._map is not None:
44 | self._map.draw(p)
45 | else:
46 | self._drawPreloadScreen(p)
47 |
48 | """
49 | ###########################################################################
50 | Public Functions
51 | ###########################################################################
52 | """
53 | def setConfiguration(self, config):
54 | """
55 | Public function used to attach the configuration file instance to this
56 | class. I really don't want conflicting instances.
57 |
58 | Parameters:
59 | -----------
60 | config : Configuration
61 | The configuration instance
62 |
63 | Returns:
64 | --------
65 | """
66 | self._config = config
67 |
68 | def setOSMFile(self, fname):
69 | """
70 | Public function used to assign the OSM file we're plotting
71 |
72 | Parameters:
73 | -----------
74 | fname : String
75 | The OSM file name
76 |
77 | Returns:
78 | --------
79 | """
80 | self._map = Map(self.width(), self.height(), fname, self._config)
81 | self.update()
82 |
83 | def saveImage(self, max_dim, fname):
84 | """
85 | """
86 | # Compute the scale parameter
87 | t = self._map.getTransform()
88 | w, h = t.width - 2*t.xOffset, t.height - 2*t.yOffset
89 | # Clamp height
90 | if w >= h:
91 | scale = max_dim/h
92 | width = max_dim
93 | height = max_dim*h/w
94 | # Clamp width
95 | else:
96 | scale = max_dim/w
97 | height = max_dim
98 | width = max_dim*w/h
99 |
100 | # Instantiate the independent painter object on which we will draw the
101 | # image
102 | p = Painter(width, height)
103 |
104 | # Create a new map object from which we'll draw this image
105 | _map = Map(width, height, self._map.fname, self._config, scale=scale)
106 |
107 | # Actually draw the map
108 | _map.draw(p)
109 |
110 | # Save the resulting image
111 | p.saveImage(fname, fname[-3:], 100)
112 |
113 | # Delete the map object
114 | del _map
115 |
116 | """
117 | ###########################################################################
118 | Private Functions
119 | ###########################################################################
120 | """
121 | def _drawPreloadScreen(self, p):
122 | """
123 | Private function used to draw the text centered on the screen
124 | instructing the user to load an OSM file to begin
125 |
126 | Parameters:
127 | -----------
128 | p : QPainter
129 |
130 | Returns:
131 | --------
132 | """
133 | p.fillRect(0, 0, self.width(), self.height(),
134 | self._config.getValue(c.CONFIG_BG_COLOR))
135 |
136 | text = 'Load an OSM file to begin!'
137 | fm = p.fontMetrics()
138 | w, h = fm.width(text), fm.height()
139 | p.drawText(self.width()/2-w/2, self.height()/2+h/2, text)
140 |
--------------------------------------------------------------------------------
/src/resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Absolute-Tinkerer/map-stylizer/6279f40408aff823a4eb1071334bd2acd10cb921/src/resources/icon.png
--------------------------------------------------------------------------------