summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2019-02-06 14:25:30 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-06-17 13:21:27 +0200
commitcfabd636d0a6d84e8377be3e4d041b4e75ddda9a (patch)
tree6c6f299e3b8d17e6c0f3bac1f2cdc0db2082b123
parent930b7cdac5a2bf80ed4838e7835273f5816b819e (diff)
downloadIshtar-cfabd636d0a6d84e8377be3e4d041b4e75ddda9a.tar.bz2
Ishtar-cfabd636d0a6d84e8377be3e4d041b4e75ddda9a.zip
Geo: manage autogen of polygons
-rw-r--r--archaeological_context_records/migrations/0040_auto_20190206_1423.py35
-rw-r--r--archaeological_context_records/models.py25
-rw-r--r--archaeological_finds/migrations/0060_auto_20190206_1423.py35
-rw-r--r--archaeological_operations/migrations/0050_auto_20190206_1423.py55
-rw-r--r--archaeological_operations/models.py14
5 files changed, 163 insertions, 1 deletions
diff --git a/archaeological_context_records/migrations/0040_auto_20190206_1423.py b/archaeological_context_records/migrations/0040_auto_20190206_1423.py
new file mode 100644
index 000000000..b3c5a6837
--- /dev/null
+++ b/archaeological_context_records/migrations/0040_auto_20190206_1423.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2019-02-06 14:23
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_context_records', '0039_auto_20190122_1550'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='contextrecord',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='contextrecord',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ migrations.AddField(
+ model_name='historicalcontextrecord',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='historicalcontextrecord',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ ]
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index cc51c3b7a..190baffad 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -486,7 +486,30 @@ class ContextRecord(BulkUpdatedItem, DocumentItem, BaseHistorizedItem,
verbose_name=_(u"Excavation technique"))
related_context_records = models.ManyToManyField(
'ContextRecord', through='RecordRelations', blank=True)
-
+ x = models.FloatField(_(u'X'), blank=True, null=True)
+ y = models.FloatField(_(u'Y'), blank=True, null=True)
+ z = models.FloatField(_(u'Z'), blank=True, null=True)
+ estimated_error_x = models.FloatField(_(u'Estimated error for X'),
+ blank=True, null=True)
+ estimated_error_y = models.FloatField(_(u'Estimated error for Y'),
+ blank=True, null=True)
+ estimated_error_z = models.FloatField(_(u'Estimated error for Z'),
+ blank=True, null=True)
+ spatial_reference_system = models.ForeignKey(
+ SpatialReferenceSystem, verbose_name=_(u"Spatial Reference System"),
+ blank=True, null=True)
+ point_2d = models.PointField(_(u"Point (2D)"), blank=True, null=True)
+ point = models.PointField(_(u"Point (3D)"), blank=True, null=True, dim=3)
+ point_source = models.CharField(
+ _(u"Point source"),
+ choices=(('T', _(u"Town")), ('P', _(u"Precise"))), max_length=1,
+ blank=True, null=True)
+ multi_polygon = models.MultiPolygonField(_(u"Multi polygon"), blank=True,
+ null=True)
+ multi_polygon_source = models.CharField(
+ _(u"Multi-polygon source"),
+ choices=(('T', _(u"Town")), ('P', _(u"Precise"))), max_length=1,
+ blank=True, null=True)
documents = models.ManyToManyField(
Document, related_name='context_records', verbose_name=_(u"Documents"),
blank=True)
diff --git a/archaeological_finds/migrations/0060_auto_20190206_1423.py b/archaeological_finds/migrations/0060_auto_20190206_1423.py
new file mode 100644
index 000000000..6ddfa5145
--- /dev/null
+++ b/archaeological_finds/migrations/0060_auto_20190206_1423.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2019-02-06 14:23
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_finds', '0059_auto_20190204_1134'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='basefind',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='basefind',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ migrations.AddField(
+ model_name='historicalbasefind',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='historicalbasefind',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ ]
diff --git a/archaeological_operations/migrations/0050_auto_20190206_1423.py b/archaeological_operations/migrations/0050_auto_20190206_1423.py
new file mode 100644
index 000000000..a632b6059
--- /dev/null
+++ b/archaeological_operations/migrations/0050_auto_20190206_1423.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.10 on 2019-02-06 14:23
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_operations', '0049_auto_20190122_1621'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='archaeologicalsite',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='archaeologicalsite',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ migrations.AddField(
+ model_name='historicalarchaeologicalsite',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='historicalarchaeologicalsite',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ migrations.AddField(
+ model_name='historicaloperation',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='historicaloperation',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ migrations.AddField(
+ model_name='operation',
+ name='multi_polygon_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Multi-polygon source'),
+ ),
+ migrations.AddField(
+ model_name='operation',
+ name='point_source',
+ field=models.CharField(blank=True, choices=[(b'T', 'Commune'), (b'P', 'Precise')], max_length=1, null=True, verbose_name='Point source'),
+ ),
+ ]
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 98be07abd..219589acf 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -398,6 +398,13 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem,
return
return q.all()[0].poly, self._meta.verbose_name
+ def get_town_polygons(self):
+ q = self.towns.filter(limit__isnull=False).annotate(
+ poly=Union('limit')).all()
+ if not q.count():
+ return None
+ return q.all()[0].poly
+
def _get_base_image_path(self):
return u"{}/{}".format(self.SLUG, self.reference)
@@ -1135,6 +1142,13 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem,
return None
return q.all()[0].poly, self._meta.verbose_name
+ def get_town_polygons(self):
+ q = self.towns.filter(limit__isnull=False).annotate(
+ poly=Union('limit')).all()
+ if not q.count():
+ return None
+ return q.all()[0].poly
+
def context_record_relations_q(self):
from archaeological_context_records.models \
import RecordRelations as CRRL