door heights

This commit is contained in:
Laura Klünder 2017-11-14 21:33:55 +01:00
parent f2b0fc26b1
commit 3315fbf057
3 changed files with 27 additions and 3 deletions

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-14 20:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0044_mapupdate_processed'),
]
operations = [
migrations.AddField(
model_name='level',
name='door_height',
field=models.DecimalField(decimal_places=2, default=2.0, max_digits=6, verbose_name='door height'),
),
]

View file

@ -21,6 +21,7 @@ class Level(SpecificLocation, models.Model):
"""
base_altitude = models.DecimalField(_('base altitude'), null=False, unique=True, max_digits=6, decimal_places=2)
default_height = models.DecimalField(_('default space height'), max_digits=6, decimal_places=2, default=3.0)
door_height = models.DecimalField(_('door height'), max_digits=6, decimal_places=2, default=2.0)
on_top_of = models.ForeignKey('mapdata.Level', null=True, on_delete=models.CASCADE,
related_name='levels_on_top', verbose_name=_('on top of'))
short_label = models.SlugField(max_length=20, verbose_name=_('short label'), unique=True)

View file

@ -283,6 +283,7 @@ class LevelRenderData:
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.door_height = old_geoms.door_height
new_geoms.min_altitude = (min(area.altitude for area in new_geoms.altitudeareas)
if new_geoms.altitudeareas else new_geoms.base_altitude)
@ -381,6 +382,7 @@ class LevelGeometries:
self.short_label = None
self.base_altitude = None
self.default_height = None
self.door_height = None
self.min_altitude = None
@staticmethod
@ -475,6 +477,7 @@ class LevelGeometries:
geoms.short_label = level.short_label
geoms.base_altititude = int(level.base_altitude * 1000)
geoms.default_height = int(level.default_height * 1000)
geoms.door_height = int(level.door_height * 1000)
geoms.min_altitude = (min(area.altitude for area in geoms.altitudeareas)
if geoms.altitudeareas else geoms.base_altitude)
@ -624,8 +627,8 @@ class LevelGeometries:
self.doors_extended = HybridGeometry(self.doors.geom, self.doors.faces)
self.doors.build_polyhedron(self._create_polyhedron,
crops=crops,
lower=vertex_wall_heights - int(1 * 1000),
upper=vertex_wall_heights)
lower=vertex_altitudes + self.door_height,
upper=vertex_wall_heights - 1)
if interpolator is not None:
upper = interpolator(*np.transpose(self.vertices)).astype(np.int32) - int(0.7 * 1000)
@ -634,7 +637,7 @@ class LevelGeometries:
upper=upper,
bottom=False)
self.doors_extended.build_polyhedron(self._create_polyhedron,
lower=vertex_wall_heights,
lower=vertex_wall_heights - 1,
upper=upper,
bottom=False)
else: