use level.short_label as group name for rendering

This commit is contained in:
Laura Klünder 2017-11-14 14:37:32 +01:00
parent c99b9e4e58
commit d6b94b0167
3 changed files with 10 additions and 5 deletions

View file

@ -273,6 +273,7 @@ class LevelRenderData:
new_geoms.pk = old_geoms.pk
new_geoms.on_top_of_id = old_geoms.on_top_of_id
new_geoms.short_label = old_geoms.short_label
new_geoms.base_altitude = old_geoms.base_altitude
new_geoms.default_height = old_geoms.default_height
new_geoms.min_altitude = (min(area.altitude for area in new_geoms.altitudeareas)
@ -369,6 +370,7 @@ class LevelGeometries:
self.pk = None
self.on_top_of_id = None
self.short_label = None
self.base_altitude = None
self.default_height = None
self.min_altitude = None
@ -463,6 +465,7 @@ class LevelGeometries:
# general level infos
geoms.pk = level.pk
geoms.on_top_of_id = level.on_top_of_id
geoms.short_label = level.short_label
geoms.base_altititude = int(level.base_altitude * 1000)
geoms.default_height = int(level.default_height * 1000)
geoms.min_altitude = (min(area.altitude for area in geoms.altitudeareas)

View file

@ -13,7 +13,7 @@ class OpenSCADEngine(Base3DEngine):
vertices = tuple(set(tuple(vertex) for vertex in facets.reshape((-1, 3))))
lookup = {vertex: i for i, vertex in enumerate(vertices)}
return (b'module ' + name.encode() + b'() {\n' +
return (b'module ' + name.replace('-', 'minus').encode() + b'() {\n' +
b' polyhedron(\n' +
b' points = [\n' +
b'\n'.join((b' [%.3f, %.3f, %.3f],' % tuple(vertex)) for vertex in vertices) + b'\n' +
@ -29,11 +29,13 @@ class OpenSCADEngine(Base3DEngine):
def render(self) -> bytes:
result = (b'c3nav_export();\n\n' +
b'module c3nav_export() {\n' +
b'\n'.join((b' %s();' % group.encode()) for group in self.groups.keys()) + b'\n' +
b'\n'.join((b' %s();' % group.replace('-', 'minus').encode())
for group in self.groups.keys()) + b'\n' +
b'}\n\n')
for group, subgroups in self.groups.items():
result += (b'module ' + group.encode() + b'() {\n' +
b'\n'.join((b' %s();' % subgroup.encode()) for subgroup in subgroups) + b'\n' +
result += (b'module ' + group.replace('-', 'minus').encode() + b'() {\n' +
b'\n'.join((b' %s();' % subgroup.replace('-', 'minus').encode())
for subgroup in subgroups) + b'\n' +
b'}\n')
result += b'\n'
for group, vertices in self.vertices.items():

View file

@ -90,7 +90,7 @@ class MapRenderer:
if not bbox.intersects(geoms.affected_area):
continue
engine.add_group('level_%s' % geoms.pk)
engine.add_group('level_%s' % geoms.short_label)
# hide indoor and outdoor rooms if their access restriction was not unlocked
add_walls = hybrid_union(tuple(area for access_restriction, area in geoms.restricted_spaces_indoors.items()