Added mechanism to remember the resource used in case affected water tiles needed re-rendering.
This commit is contained in:
parent
9ee77b9032
commit
ef5fba6345
@ -129,6 +129,7 @@ mstr_ortho_layers = [
|
|||||||
("highway", "residential", 4),
|
("highway", "residential", 4),
|
||||||
("highway", "primary", 6),
|
("highway", "primary", 6),
|
||||||
("highway", "secondary", 3),
|
("highway", "secondary", 3),
|
||||||
|
("highway", "trunk", 3)
|
||||||
("highway", "tertiary", 5),
|
("highway", "tertiary", 5),
|
||||||
("highway", "unclassified", 4),
|
("highway", "unclassified", 4),
|
||||||
("highway", "living_street", 3),
|
("highway", "living_street", 3),
|
||||||
@ -239,6 +240,7 @@ mstr_mask_blur = [
|
|||||||
# Z-Order 4
|
# Z-Order 4
|
||||||
("highway", "motorway", 0.5),
|
("highway", "motorway", 0.5),
|
||||||
("highway", "primary", 0.5),
|
("highway", "primary", 0.5),
|
||||||
|
("highway", "trunk", 0.5),
|
||||||
("highway", "secondary", 0.5),
|
("highway", "secondary", 0.5),
|
||||||
("highway", "tertiary", 0.5),
|
("highway", "tertiary", 0.5),
|
||||||
("highway", "unclassified", 0.5),
|
("highway", "unclassified", 0.5),
|
||||||
|
16
layergen.py
16
layergen.py
@ -67,9 +67,19 @@ class mstr_layergen:
|
|||||||
self._latlngfld = latlngfld
|
self._latlngfld = latlngfld
|
||||||
|
|
||||||
# Set the resource to use
|
# Set the resource to use
|
||||||
def set_resource(self, res):
|
def load_resource(self):
|
||||||
self._resource = res
|
self._resource = -1
|
||||||
|
fnlines = []
|
||||||
|
fn = mstr_datafolder + "z_orthographic/data/" + self._latlngfld + "/resdata"
|
||||||
|
with open(fn) as textfile:
|
||||||
|
fnlines = textfile.readlines()
|
||||||
|
for l in range(0, len(fnlines)):
|
||||||
|
linedata = fnlines[l].split(" ")
|
||||||
|
if linedata[0] == self._tag and linedata[1] == self._value:
|
||||||
|
self._resource = int(linedata[2])
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
# Tile info object
|
# Tile info object
|
||||||
def open_tile_info(self):
|
def open_tile_info(self):
|
||||||
self._tileinfo = mstr_tileinfo(self._latitude, self._longitude, self._lat_number, self._lng_number, self._latlngfld)
|
self._tileinfo = mstr_tileinfo(self._latitude, self._longitude, self._lat_number, self._lng_number, self._latlngfld)
|
||||||
@ -654,7 +664,7 @@ class mstr_layergen:
|
|||||||
|
|
||||||
|
|
||||||
# Highways and runways of any kind get some special treatment
|
# Highways and runways of any kind get some special treatment
|
||||||
if (self._tag == "highway" and self._value == "motorway") or (self._tag == "highway" and self._value == "primary") or (self._tag == "highway" and self._value == "secondary") or (self._tag == "highway" and self._value == "tertiary") or (self._tag == "aeroway" and self._value == "runway"):
|
if (self._tag == "highway" and self._value == "motorway") or (self._tag == "highway" and self._value == "primary") or (self._tag == "highway" and self._value == "secondary") or (self._tag == "highway" and self._value == "tertiary") or (self._tag == "aeroway" and self._value == "runway") or (self._tag == "highway" and self._value == "trunk"):
|
||||||
# We will now add some white lines for coolness
|
# We will now add some white lines for coolness
|
||||||
osm_edge = mask.filter(ImageFilter.FIND_EDGES)
|
osm_edge = mask.filter(ImageFilter.FIND_EDGES)
|
||||||
mask_pix = osm_edge.load()
|
mask_pix = osm_edge.load()
|
||||||
|
@ -74,6 +74,14 @@ class mstr_orthographic:
|
|||||||
rs = [ l[0], l[1], randrange(1, 16) ]
|
rs = [ l[0], l[1], randrange(1, 16) ]
|
||||||
self._tile_resources.append(rs)
|
self._tile_resources.append(rs)
|
||||||
|
|
||||||
|
# Save to disk
|
||||||
|
fn = mstr_datafolder + "z_orthographic/data/" + self._latlngfld + "/resdata"
|
||||||
|
if os.path.isfile(fn) == False:
|
||||||
|
for rsd in range(0, len(self._tile_resources)):
|
||||||
|
line = self._tile_resources[rsd][0] + " " + self._tile_resources[rsd][1] + " " + str(self._tile_resources[rsd][2]) + "\r\n"
|
||||||
|
with open(fn, 'a') as textfile:
|
||||||
|
textfile.write(line)
|
||||||
|
|
||||||
|
|
||||||
# This will determine the vertical stepping in degrees in order to generate
|
# This will determine the vertical stepping in degrees in order to generate
|
||||||
# masks with a 1:1 square ratio. This is important as X-Plane textures for
|
# masks with a 1:1 square ratio. This is important as X-Plane textures for
|
||||||
@ -371,12 +379,7 @@ class mstr_orthographic:
|
|||||||
lg.set_zoomlevel(self._zoomlevelfactor)
|
lg.set_zoomlevel(self._zoomlevelfactor)
|
||||||
|
|
||||||
# Find resource to use
|
# Find resource to use
|
||||||
rs = -1
|
lg.load_resource()
|
||||||
for r in self._tile_resources:
|
|
||||||
if r[0] == layer[0] and r[1] == layer[1]:
|
|
||||||
rs = r[2]
|
|
||||||
break
|
|
||||||
lg.set_resource(rs)
|
|
||||||
|
|
||||||
#lg.open_tile_info()
|
#lg.open_tile_info()
|
||||||
lyr = lg.genlayer(mask, osmxml)
|
lyr = lg.genlayer(mask, osmxml)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user