remove LevelConnector
This commit is contained in:
parent
b974869a08
commit
5de423d5a0
3 changed files with 23 additions and 19 deletions
22
src/c3nav/mapdata/migrations/0044_auto_20170504_1023.py
Normal file
22
src/c3nav/mapdata/migrations/0044_auto_20170504_1023.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.4 on 2017-05-04 10:23
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('mapdata', '0043_auto_20170504_1010'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='levelconnector',
|
||||||
|
name='levels',
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='LevelConnector',
|
||||||
|
),
|
||||||
|
]
|
|
@ -235,24 +235,6 @@ class LineObstacle(GeometryMapItemWithLevel):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class LevelConnector(GeometryMapItem):
|
|
||||||
"""
|
|
||||||
A connector connecting levels
|
|
||||||
"""
|
|
||||||
geomtype = 'polygon'
|
|
||||||
levels = models.ManyToManyField('mapdata.Level', verbose_name=_('levels'))
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
verbose_name = _('Level Connector')
|
|
||||||
verbose_name_plural = _('Level Connectors')
|
|
||||||
default_related_name = 'levelconnectors'
|
|
||||||
|
|
||||||
def get_geojson_properties(self):
|
|
||||||
result = super().get_geojson_properties()
|
|
||||||
result['levels'] = tuple(self.levels.all().order_by('name').values_list('name', flat=True))
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
class Door(GeometryMapItemWithLevel):
|
class Door(GeometryMapItemWithLevel):
|
||||||
"""
|
"""
|
||||||
A connection between two rooms
|
A connection between two rooms
|
||||||
|
|
|
@ -9,7 +9,6 @@ from scipy.sparse.csgraph._shortest_path import shortest_path
|
||||||
from scipy.sparse.csgraph._tools import csgraph_from_dense
|
from scipy.sparse.csgraph._tools import csgraph_from_dense
|
||||||
|
|
||||||
from c3nav.mapdata.models import Elevator, Level
|
from c3nav.mapdata.models import Elevator, Level
|
||||||
from c3nav.mapdata.models.geometry import LevelConnector
|
|
||||||
from c3nav.mapdata.models.locations import AreaLocation, Location, LocationGroup, PointLocation
|
from c3nav.mapdata.models.locations import AreaLocation, Location, LocationGroup, PointLocation
|
||||||
from c3nav.routing.connection import GraphConnection
|
from c3nav.routing.connection import GraphConnection
|
||||||
from c3nav.routing.exceptions import AlreadyThere, NoRouteFound, NotYetRoutable
|
from c3nav.routing.exceptions import AlreadyThere, NoRouteFound, NotYetRoutable
|
||||||
|
@ -90,6 +89,7 @@ class Graph:
|
||||||
self._built_elevatorlevel_points[elevatorlevel.name] = point
|
self._built_elevatorlevel_points[elevatorlevel.name] = point
|
||||||
|
|
||||||
def connect_levelconnectors(self):
|
def connect_levelconnectors(self):
|
||||||
|
from c3nav.mapdata.models.geometry import LevelConnector
|
||||||
for levelconnector in LevelConnector.objects.all():
|
for levelconnector in LevelConnector.objects.all():
|
||||||
center = levelconnector.geometry.centroid
|
center = levelconnector.geometry.centroid
|
||||||
points = self._built_levelconnector_points.get(levelconnector.name, [])
|
points = self._built_levelconnector_points.get(levelconnector.name, [])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue