Commit f01a0e61 authored by Thomas Albrecht's avatar Thomas Albrecht

LOWI year 2525

skyscrapers position lights
parent ca4f7c7b
......@@ -56,7 +56,7 @@ def random_LOD():
default_height=12.
random_level_height = random_number(float, 3.1, 3.6)
random_levels = random_number(int, 2, 5)
#random_levels = random_number(int, 8, 30)
random_levels_skyscraper = random_number(int, 10, 60)
def check_height(building_height, t):
"""check if a texture t fits the building height (h)
......@@ -262,9 +262,19 @@ def analyse(buildings, static_objects, transform, elev, facades, roofs, model_pr
p = Polygon(r)
b.area = p.area
level_height = random_level_height()
# -- LOWI year 2525
if True:
if b.area > 2000:
b.levels = random_levels_skyscraper()
b.height = float(b.levels) * level_height
# if b.area < 8000. or (b.area < 500. and random.uniform(0,1) < 0.5):
if b.area < 200. or (b.area < 500. and random.uniform(0,1) < 0.5):
tools.stats.skipped_small += 1
continue
# try OSM height first
# catch exceptions, since height might be "5 m" instead of "5"
try:
......@@ -292,6 +302,12 @@ def analyse(buildings, static_objects, transform, elev, facades, roofs, model_pr
tools.stats.skipped_small += 1
continue
# -- skipping 50% of under 200 sqm buildings
if b.area < 30. or (b.area < 200. and random.uniform(0,1) < 0.5):
#if b.area < 20. : # FIXME use limits.area_min:
#print "Skipping small building (area)"
tools.stats.skipped_small += 1
continue
# -- roof is controlled by two flags:
# bool b.roof_separate: whether or not to include roof as separate model
......@@ -352,13 +368,6 @@ def analyse(buildings, static_objects, transform, elev, facades, roofs, model_pr
tools.stats.skipped_nearby += 1
continue
# -- skipping 50% of under 200 sqm buildings
if b.area < 30. or (b.area < 200. and random.uniform(0,1) < 0.5):
#if b.area < 20. : # FIXME use limits.area_min:
#print "Skipping small building (area)"
tools.stats.skipped_small += 1
continue
# -- skip buildings outside elevation raster
if elev(vec2d(X[0])) == -9999:
print "-9999"
......@@ -483,7 +492,7 @@ def write(b, out, elev, tile_elev, transform, offset, LOD_lists):
i = 0
for r in b.refs:
X[i,0] -= offset.x # cluster coordinates
X[i,0] -= offset.x # cluster coordinates. NB: this changes building coordinates!
X[i,1] -= offset.y
i += 1
......@@ -499,6 +508,8 @@ def write(b, out, elev, tile_elev, transform, offset, LOD_lists):
for x in X[:-1]:
out.write("%1.2f %1.2f %1.2f\n" % (-x[1], ground_elev + b.height, -x[0]))
b.ceiling = ground_elev + b.height
write_and_count_numsurf(out, b, nsurf)
# -- walls
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Bump and specular effect -->
<PropertyList>
<name>cityLM</name>
<inherits-from>/Effects/model-combined-deferred</inherits-from>
......
......@@ -344,7 +344,7 @@ def write_ac_header(out, nb):
# -----------------------------------------------------------------------------
# -- write xml
def write_xml(fname, LOD_lists, LM_dict):
def write_xml(fname, LOD_lists, LM_dict, buildings):
# -- LOD animation
xml = open(fname + ".xml", "w")
xml.write("""<?xml version="1.0"?>\n<PropertyList>\n""")
......@@ -395,6 +395,28 @@ def write_xml(fname, LOD_lists, LM_dict):
# xml.write(" <object-name>%s</object-name>\n" % name)
xml.write("</effect>\n")
# -- hi-rise building position lights
for b in buildings:
if b.levels > 30:
if len(b.refs) > 6: step = 2
else: step = 1
for i in range(0, len(b.refs), step):
xo = b.X[i,0]# - offset.x # -- b.X already in cluster coordinates
yo = b.X[i,1]# - offset.y
zo = b.ceiling + 1.5
# <path>cursor.ac</path>
xml.write(textwrap.dedent("""
<model>
<path>../../../Models/Effects/pos_lamp_red_light_2st.xml</path>
<offsets>
<x-m>%g</x-m>
<y-m>%g</y-m>
<z-m>%g</z-m>
<pitch-deg> 0.00</pitch-deg>
<heading-deg>0.0 </heading-deg>
</offsets>
</model>""" % (-yo, xo, zo) )) # -- I just don't get those coordinate systems.
# -- LOD animation
xml.write(textwrap.dedent("""
......@@ -535,7 +557,7 @@ if __name__ == "__main__":
# -- get cluster center
offset = cl.center
# print "\ncl offset", offset
print "\ncl offset", offset
# for b in cl.objects:
#print (b.anchor - offset), " ", b.anchor
......@@ -568,7 +590,7 @@ if __name__ == "__main__":
LM_dict = building_lib.make_lightmap_dict(cl.objects)
# -- write xml
write_xml(fname, LOD_lists, LM_dict)
write_xml(fname, LOD_lists, LM_dict, cl.objects)
# -- write stg
tile_index = calc_tile.tile_index(center_lon, center_lat)
......
......@@ -181,41 +181,71 @@ def init():
global roofs
facades = FacadeManager('facade')
facades.append(Texture('tex/DSCF9495_pow2',
14, (585, 873, 1179, 1480, 2048), True,
19.4, (1094, 1531, 2048), False, True,
requires=['roof:color:black'],
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
# -- just two windows. Looks rather boring. But maybe we need a very narrow texture?
# facades.append(Texture('tex/DSCF9496_pow2',
# 4.44, None, True,
# 17.93, (1099, 1521, 2048), False, True,
# requires=['roof:color:black'],
# provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/LZ_old_bright_bc2',
17.9, (345,807,1023,1236,1452,1686,2048), True,
14.8, (558,1005,1446,2048), False, True,
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/facade_modern36x36_12',
36., (None), True,
36., (158, 234, 312, 388, 465, 542, 619, 697, 773, 870, 1024), True, True,
provides=['shape:urban','shape:residential','age:modern',
'compat:roof-flat']))
# facades.append(Texture('tex/DSCF9503_pow2',
# 12.85, None, True,
# 17.66, (1168, 1560, 2048), False, True,
# requires=['roof:color:black'],
# provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/DSCF9503_noroofsec_pow2',
12.85, None, True,
17.66, (556,1015,1474,2048), False, True,
requires=['roof:color:black'],
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
if True:
facades.append(Texture('tex/DSCF9495_pow2',
14, (585, 873, 1179, 1480, 2048), True,
19.4, (1094, 1531, 2048), False, True,
requires=['roof:color:black'],
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
# -- just two windows. Looks rather boring. But maybe we need a very narrow texture?
# facades.append(Texture('tex/DSCF9496_pow2',
# 4.44, None, True,
# 17.93, (1099, 1521, 2048), False, True,
# requires=['roof:color:black'],
# provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/LZ_old_bright_bc2',
17.9, (345,807,1023,1236,1452,1686,2048), True,
14.8, (558,1005,1446,2048), False, True,
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/facade_modern36x36_12',
36., (None), True,
36., (158, 234, 312, 388, 465, 542, 619, 697, 773, 870, 1024), True, True,
provides=['shape:urban','shape:residential','age:modern',
'compat:roof-flat']))
# facades.append(Texture('tex/DSCF9503_pow2',
# 12.85, None, True,
# 17.66, (1168, 1560, 2048), False, True,
# requires=['roof:color:black'],
# provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/DSCF9503_noroofsec_pow2',
12.85, None, True,
17.66, (556,1015,1474,2048), False, True,
requires=['roof:color:black'],
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
# -- this just looks ugly
# facades.append(Texture('tex/facade_modern1',
# 2.5, None, True,
# 2.8, None, True,
# height_min = 15.,
# provides=['shape:urban','shape:residential','age:modern',
# 'compat:roof-flat']))
# facades.append(Texture('tex/DSCF9710_pow2',
# 29.9, (284,556,874,1180,1512,1780,2048), True,
# 19.8, (173,329,490,645,791,1024), False, True,
# provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/DSCF9710',
29.9, (142,278,437,590,756,890,1024), True,
19.8, (130,216,297,387,512), False, True,
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/DSCF9678_pow2',
10.4, (97,152,210,299,355,411,512), True,
15.5, (132,211,310,512), False, True,
provides=['shape:residential','shape:commercial','age:modern','compat:roof-flat']))
facades.append(Texture('tex/DSCF9726_noroofsec_pow2',
15.1, (321,703,1024), True,
9.6, (227,512), False, True,
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/wohnheime_petersburger',
15.6, (215, 414, 614, 814, 1024), True,
......@@ -223,35 +253,10 @@ def init():
height_min = 15.,
provides=['shape:urban','shape:residential','age:modern',
'compat:roof-flat']))
# provides=['shape:urban','shape:residential','age:modern','age:old',
# 'compat:roof-flat','compat:roof-gable']))
# -- this just looks ugly
# facades.append(Texture('tex/facade_modern1',
# 2.5, None, True,
# 2.8, None, True,
# height_min = 15.,
# provides=['shape:urban','shape:residential','age:modern',
# 'compat:roof-flat']))
# facades.append(Texture('tex/DSCF9710_pow2',
# 29.9, (284,556,874,1180,1512,1780,2048), True,
# 19.8, (173,329,490,645,791,1024), False, True,
# provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/DSCF9710',
29.9, (142,278,437,590,756,890,1024), True,
19.8, (130,216,297,387,512), False, True,
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
facades.append(Texture('tex/DSCF9678_pow2',
10.4, (97,152,210,299,355,411,512), True,
15.5, (132,211,310,512), False, True,
provides=['shape:residential','shape:commercial','age:modern','compat:roof-flat']))
facades.append(Texture('tex/DSCF9726_noroofsec_pow2',
15.1, (321,703,1024), True,
9.6, (227,512), False, True,
provides=['shape:residential','age:old','compat:roof-flat','compat:roof-gable']))
roofs = TextureManager('roof')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment