diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-09-01 12:08:11 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:23:18 +0100 |
commit | d69e4e26fc10223ad4c2648b23b319902c16afb0 (patch) | |
tree | 3d9fc261943e56b46c70a9236713909b9761648d /ishtar_common/templates | |
parent | b86863ff5ac6c3106ec8b243615becb983435b04 (diff) | |
download | Ishtar-d69e4e26fc10223ad4c2648b23b319902c16afb0.tar.bz2 Ishtar-d69e4e26fc10223ad4c2648b23b319902c16afb0.zip |
Geo: select geo item to display on the sheet
Diffstat (limited to 'ishtar_common/templates')
4 files changed, 50 insertions, 85 deletions
diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 8041452c6..12e8567a1 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -73,6 +73,8 @@ var YES = "{% trans 'yes' %}"; var NO = "{% trans 'no' %}"; var fetching_msg = "{% trans 'Fetching data...' %}"; + var base_maps_msg = "{% trans 'Base maps' %}"; + var layers_msg = "{% trans 'Layers' %}"; var stats_incompatible_modality = "{% trans 'This graph type accept only one modality.' %}"; var show_msg = "{% trans "Show" %}"; var entries_msg = "{% trans "entries" %}"; diff --git a/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html b/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html deleted file mode 100644 index 0093ed31f..000000000 --- a/ishtar_common/templates/ishtar/blocks/sheet_coordinates.html +++ /dev/null @@ -1,28 +0,0 @@ -{% load i18n window_field %}{% if PROFILE.mapping and geo_item.main_geodata %} -{% with geodata=geo_item.main_geodata %} -{% if geodata.cached_x or geodata.cached_z %} -<dl class="col-12"> - <dt>{% trans "Coordinates" %}</dt> - <dd> - {% with coordinates=geodata.display_coordinates %} - {% trans "X:"%} {{coordinates.0|default_if_none:"-"}} - {% if geodata.estimated_error_x %} ({% trans "error:" %} {{geodata.estimated_error_x}}){% endif %}, - {% trans "Y:"%} {{coordinates.1|default_if_none:"-"}} - {% if geodata.estimated_error_y %} ({% trans "error:" %} {{geodata.estimated_error_y}}){% endif %}, - {% endwith %} - {% trans "Z:"%} {{geodata.z|default_if_none:"-"}} - {% if geodata.estimated_error_z %} ({% trans "error:" %} {{geodata.estimated_error_z}}){% endif %} - {% with srs=geodata.display_spatial_reference_system %} - {% if srs %} – {{srs.label}} - {% trans "SRID"%} {{srs.srid}} {% endif %} - {% endwith %} - </dd> -</dl> -{% field_flex_full "Data type" geodata.data_type %} -{% field_flex_full "Source" geodata.source_label %} -{% field_flex_full "Name" geodata.name %} -{% field_flex_full "Origin" geodata.origin %} -{% field_flex_full "Provider" geodata.provider %} -{% field_flex_full "Comment" geodata.comment %} -{% endif %} -{% endwith %} -{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html deleted file mode 100644 index 12e4b4ef0..000000000 --- a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html +++ /dev/null @@ -1,48 +0,0 @@ -{% load i18n window_field %}{% if PROFILE.mapping %} -{% if geo_item.point_2d or geo_item.multi_polygon %} -<dl class="col-12"> - <dt id="display-geo-items-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Display geo items" %}</dt> - <dd> - <fieldset> - {% if geo_item.SLUG == "operation" %} - <input type="checkbox" id="disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}" class='checkbox-geo-items'> - <label for="disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Display context records" %}</label> - {% endif %} - <input type="checkbox" id="disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}" class='checkbox-geo-items'> - <label for="disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Display base finds" %}</label> - </fieldset> - </dd> - <dd> - <label for="get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}" id="get-poly-label-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Geometry: " %}</label> - <select id="get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}" class='get-poly-geo-items'> - <option value="polygons" selected="selected">{% trans "Display polygons" %}</option> - <option value="points">{% trans "Display points" %}</option> - </select> - </dd> -</dl> -<script> -const hide_get_polygons = function() { - const disp_cr = $("#disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); - const disp_bf = $("#disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); - const get_poly = $("#get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); - const label = $("#get-poly-label-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); - get_poly.hide(); - label.hide(); - const display_get_poly = function () { - if (disp_bf.prop('checked') || ((disp_cr.length > 0) && disp_cr.prop('checked'))) { - get_poly.show(); - label.show(); - } else { - get_poly.hide(); - label.hide();} - } - if (disp_cr.length > 0) { - disp_cr.change( display_get_poly ); - } - disp_bf.change( display_get_poly ) -} -hide_get_polygons(); - -</script> -{% endif %} -{% endif %}
\ No newline at end of file diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html index e0278b8c7..16e014b49 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_map.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html @@ -1,22 +1,60 @@ -{% if PROFILE.mapping and geo_item.main_geodata %} +{% load i18n window_field %}{% if PROFILE.mapping and geo_item.main_geodata %} +{% with geodata_list=geo_item.geodata_list %} <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> + <input type="checkbox" name="map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}" + id="map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}" + {% if not forloop.counter0 %}checked{% endif %} + > + <label for="map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}"> + <strong>{{geodata.data_type}}</strong></label><br/> + {{geodata.name}} + </li>{% endfor %} + </ul> +</div> <script type="text/javascript"> -const disp_map = function() { +const refresh_map_{{item.SLUG}}_{{item.pk}} = function(first_init) { + var {{geo_item.SLUG}}{{geo_item.pk}}_point = {"type": "FeatureCollection", "features": []}; + var {{geo_item.SLUG}}{{geo_item.pk}}_other = {"type": "FeatureCollection", "features": []}; + {% for geodata in geodata_list %} + if ($("#map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}").prop('checked')){ + let geojson = {{geodata.geojson|safe}}; + {% if geodata.geometry_type == 'POINT' %} + Array.prototype.push.apply({{geo_item.SLUG}}{{geo_item.pk}}_point["features"], + geojson["features"]); + {% else %} + Array.prototype.push.apply({{geo_item.SLUG}}{{geo_item.pk}}_other["features"], + geojson["features"]); + {% endif %} + }{% endfor %} + display_lines_and_polys("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", {{geo_item.SLUG}}{{geo_item.pk}}_other, first_init); + display_points("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", {{geo_item.SLUG}}{{geo_item.pk}}_point, first_init); +} + +const display_map_{{item.SLUG}}_{{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); - const {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.main_geodata.geojson|safe}}; - {% if geo_item.main_geodata.geometry_type == 'POINT' %} - display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", {{geo_item.SLUG}}{{geo_item.pk}}); - {% else %} - display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", null, {{geo_item.SLUG}}{{geo_item.pk}}); - {% endif %} + display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", null, null); + {% for geodata in geodata_list %} + $("#map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}").change( + function(){ + refresh_map_{{item.SLUG}}_{{item.pk}}(false); + } + ); + {% endfor %} } -disp_map(); + +display_map_{{item.SLUG}}_{{item.pk}}(); +refresh_map_{{item.SLUG}}_{{item.pk}}(true); + {% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %} const disp_geo_items = function(disp_cr, disp_bf, get_polygons) { @@ -69,4 +107,5 @@ get_polygons.change( function () { {% endif %} </script> +{% endwith %} {% endif %} |