Better styling.
- added bridges
This commit is contained in:
parent
3453083473
commit
501d6a9da7
2 changed files with 26 additions and 5 deletions
|
@ -225,7 +225,17 @@ def poly(cr, c):
|
|||
for k in range(2, len(c), 2):
|
||||
cr.line_to(c[k], c[k + 1])
|
||||
cr.fill()
|
||||
|
||||
class Color:
|
||||
def __init__(self):
|
||||
self.colortable = {}
|
||||
def translate(self, col):
|
||||
try:
|
||||
return self.colortable[col]
|
||||
except KeyError:
|
||||
colz = gtk.gdk.Color(col)
|
||||
self.colortable[col] = (colz.red/65536., colz.green/65536., colz.blue/65536.)
|
||||
return self.colortable[col]
|
||||
color_tool = Color()
|
||||
|
||||
|
||||
class RasterTile:
|
||||
|
@ -298,9 +308,12 @@ class RasterTile:
|
|||
for obj in data:
|
||||
#debug(obj[1])
|
||||
if "fill-color" in obj[1]:
|
||||
#color = color_tool.translate(obj[1]["fill-color"])
|
||||
color = gtk.gdk.Color(obj[1]["fill-color"])
|
||||
cr.set_source_rgb(color.red, color.green, color.blue)
|
||||
cr.set_line_width (0)
|
||||
#debug((color.red/65536., color.green/65536., color.blue/65536.))
|
||||
cr.set_source_rgb(color.red/65535., color.green/65535., color.blue/65535.)
|
||||
#cr.set_source_rgb(color[0], color[1], color[2])
|
||||
cr.set_line_width (1)
|
||||
#debug("poly!")
|
||||
poly(cr, obj[0].cs)
|
||||
# - draw casings on layer
|
||||
|
|
12
src/style.py
12
src/style.py
|
@ -31,8 +31,16 @@ class Styling():
|
|||
self.Selectors["relation"] = []
|
||||
if not stylefile:
|
||||
### using "builtin" styling
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("highway",),("residential", "tertiary", "living_street")) ] ),{"width": 3, "color":"#ffffff", "casing-width": 5, "z-index":100} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("building",),(None) ) ] ),{"fill-color":"#ff0000"} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("highway",),(None) ) ] ),{"width":1,"color":"#ff0000"} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("highway",),("residential", "tertiary", "living_street")) ] ),{"width": 3, "color":"#ffffff", "casing-width": 5, "z-index":10} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("highway",),("service", "unclassified")) ] ),{"width": 3, "color":"#ccc", "casing-width": 5, "z-index":9} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("highway",),("primary", "motorway", "trunk")) ] ),{"width": 4, "color":"#ff0", "casing-width": 6, "z-index":11} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("highway",),("primary_link", "motorway_link", "trunk_link")) ] ),{"width": 3.5, "color":"#ff0", "casing-width": 6, "z-index":11} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("living_street",),("yes")) ] ),{"width": 2, "casing-width": 3, "z-index": 0} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("landuse","natural"),("forest", "wood") ) ] ),{"fill-color": "#3e3"} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("bridge",),("yes") ) ] ),{"casing-width":10,"z-index": 100} ))
|
||||
self.Selectors["way"].append(StyleSelector( ( [ ( ("building",),(None) ) ] ),{"fill-color": "#522"} ))
|
||||
|
||||
self.stylefile = stylefile
|
||||
self.useful_keys = set()
|
||||
for objtype in self.Selectors.values(): # getting useful keys
|
||||
|
|
Loading…
Add table
Reference in a new issue