obstacle altitude
This commit is contained in:
parent
4826930bbb
commit
7734863c39
5 changed files with 37 additions and 3 deletions
|
@ -230,8 +230,8 @@ class AltitudeArea(LevelGeometryMixin, models.Model):
|
|||
space.geometry = space.geometry.difference(buildings_geom)
|
||||
space_accessible = space.geometry.difference(
|
||||
unary_union(tuple(c.geometry for c in space.columns.all() if c.access_restriction_id is None) +
|
||||
tuple(o.geometry for o in space.obstacles.all()) +
|
||||
tuple(o.buffered_geometry for o in space.lineobstacles.all()) +
|
||||
tuple(o.geometry for o in space.obstacles.all() if o.altitude == 0) +
|
||||
tuple(o.buffered_geometry for o in space.lineobstacles.all() if o.altitude == 0) +
|
||||
tuple(h.geometry for h in space.holes.all()))
|
||||
)
|
||||
|
||||
|
|
|
@ -170,6 +170,8 @@ class Obstacle(SpaceGeometryMixin, models.Model):
|
|||
geometry = GeometryField('polygon')
|
||||
height = models.DecimalField(_('height'), max_digits=6, decimal_places=2, default=0.8,
|
||||
validators=[MinValueValidator(Decimal('0'))])
|
||||
altitude = models.DecimalField(_('altitude above ground'), max_digits=6, decimal_places=2, default=0,
|
||||
validators=[MinValueValidator(Decimal('0'))])
|
||||
color = models.CharField(null=True, blank=True, max_length=32, verbose_name=_('color (optional)'))
|
||||
|
||||
class Meta:
|
||||
|
@ -186,6 +188,7 @@ class Obstacle(SpaceGeometryMixin, models.Model):
|
|||
def _serialize(self, geometry=True, **kwargs):
|
||||
result = super()._serialize(geometry=geometry, **kwargs)
|
||||
result['height'] = float(str(self.height))
|
||||
result['altitude'] = float(str(self.altitude))
|
||||
result['color'] = self.color
|
||||
return result
|
||||
|
||||
|
@ -198,6 +201,8 @@ class LineObstacle(SpaceGeometryMixin, models.Model):
|
|||
width = models.DecimalField(_('width'), max_digits=4, decimal_places=2, default=0.15)
|
||||
height = models.DecimalField(_('height'), max_digits=6, decimal_places=2, default=0.8,
|
||||
validators=[MinValueValidator(Decimal('0'))])
|
||||
altitude = models.DecimalField(_('altitude above ground'), max_digits=6, decimal_places=2, default=0,
|
||||
validators=[MinValueValidator(Decimal('0'))])
|
||||
color = models.CharField(null=True, blank=True, max_length=32, verbose_name=_('color (optional)'))
|
||||
|
||||
class Meta:
|
||||
|
@ -215,6 +220,7 @@ class LineObstacle(SpaceGeometryMixin, models.Model):
|
|||
result = super()._serialize(geometry=geometry, **kwargs)
|
||||
result['width'] = float(str(self.width))
|
||||
result['height'] = float(str(self.height))
|
||||
result['altitude'] = float(str(self.altitude))
|
||||
result['color'] = self.color
|
||||
if geometry:
|
||||
result['buffered_geometry'] = format_geojson(mapping(self.buffered_geometry))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue