blob: f37213c2fa0e3be12a2cb53cf154a86c38abf58d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
{% load i18n l10n window_field %}{% if PROFILE.mapping and geo_item.main_geodata %}
{% with geodata_list=geo_item.geodata_list %}
{% localize off %}
<div class="col-12 col-lg-6 flex-wrap">
<div class="window-map" id="map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}">
</div>
<div id="map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"></div>
</div>
<div class="col-12 col-lg-6 flex-wrap">
<h4>{% trans "Geographic data" %}</h4>
<ul>{% for geodata in geodata_list %}
<li>
<a role="link" href="#" aria-disabled="true" class="map-zoom-link"
id="map-zoom-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}"
data-map-id="map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"
data-geo-id="{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}"
>
<i class="fa fa-search" aria-hidden="true"></i>
</a>
<input type="checkbox" name="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}"
class="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}"
id="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}"
{% if not forloop.counter0 %}checked{% endif %}
>
<label for="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}">
<strong>{% if geodata.data_type %}{{geodata.data_type}}{% else %}{{geodata.name}}{% endif %}</strong></label><br/>
{% if geodata.geometry_type == "POINT" %}{% with coordinates=geodata.display_coordinates_3d %}
{% if geodata.data_type %}{{geodata.name}}{% endif %}
<br><span>
{% if coordinates.0 != None %}
<strong>{% trans "X:" %}</strong> {{coordinates.0}} ;
<strong>{% trans "Y:" %}</strong> {{coordinates.1}}
{% endif %}
{% if coordinates.2 != None %}
{% if coordinates.0 != None %}; {% endif %}
<strong>{% trans "Z:" %}</strong> {{coordinates.2}}
{% endif %}
{% endwith %}{% if geodata.spatial_reference_system %} - ({{geodata.spatial_reference_system.label}}){% endif %}{% endif %}
</span>
</li>{% endfor %}
{% if geo_item.SLUG == "operation" and display_context_records %}
<li>
<input type="checkbox" name="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-crs"
class="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}"
id="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-crs">
<label for="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-crs">
<strong>{% trans "Associated context records" %}</strong></label>
</li>
{% endif %}
{% if display_finds %}{% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %}
<li>
<input type="checkbox" name="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-finds"
class="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}"
id="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-finds">
<label for="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-finds">
<strong>{% trans "Associated finds" %}</strong></label>
</li>
{% endif %}{% endif %}
</ul>
</div>
<script type="text/javascript">
const refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}} = function(first_init) {
let idx = "{{geo_item.SLUG}}-{{geo_item.pk}}";
let geodata_list = { {% for geodata in geodata_list %}
"{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}": ["{{geodata.geometry_type}}", {{geodata.geojson|safe}}]{% if not forloop.last %},{% endif %}
{% endfor %} };
let url{% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %} = "{% url 'api-get-geo' %}"{% endif %};
let attrs{% if geo_item.SLUG == "operation" %} = {"operation_id": "{{geo_item.pk}}"}{% elif geo_item.SLUG == "contextrecord" %} = {"context_record_id": "{{geo_item.pk}}"}{% endif %};
refresh_map(idx, geodata_list, url, attrs);
display_lines_and_polys("map-{{window_id}}-" + idx, _geo_other[idx]);
display_points("map-{{window_id}}-" + idx, _geo_points[idx]);
if (first_init) zoom_to_extent("map-{{window_id}}-" + idx);
}
const display_map_{{geo_item.SLUG}}_{{geo_item.pk}} = function() {
const html = render_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", false, true);
$("#map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}").html(html);
display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", null, null);
$(".map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}").change(
function(){
refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}}(false);
}
);
}
display_map_{{geo_item.SLUG}}_{{geo_item.pk}}();
refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}}(true);
</script>
{% endlocalize %}
{% endwith %}
{% endif %}
|