summaryrefslogtreecommitdiff
path: root/chimere/templates
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-02-26 00:30:51 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-02-26 00:30:51 +0100
commit8b3d6619b0def3eaec09f16b14e92c9bd9b59772 (patch)
tree71d4dbf1edbf4c398f1f8e65143329768e1c8edf /chimere/templates
parentfee4daab6598a3d6e51a31e2e70e059fc5419908 (diff)
downloadChimère-8b3d6619b0def3eaec09f16b14e92c9bd9b59772.tar.bz2
Chimère-8b3d6619b0def3eaec09f16b14e92c9bd9b59772.zip
Workon polygon edition widget.
Diffstat (limited to 'chimere/templates')
-rw-r--r--chimere/templates/chimere/blocks/polygon_edit.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/chimere/templates/chimere/blocks/polygon_edit.html b/chimere/templates/chimere/blocks/polygon_edit.html
new file mode 100644
index 0000000..7c773b4
--- /dev/null
+++ b/chimere/templates/chimere/blocks/polygon_edit.html
@@ -0,0 +1,46 @@
+{% load unescape i18n %}<script type='text/javascript'>
+ var resolutions;
+ var zoomOffset;
+ image_path = '{static_url}chimere/img/';
+ var EPSG_DISPLAY_PROJECTION = epsg_display_projection = 'EPSG:{display_projection}';
+ var EPSG_PROJECTION = epsg_projection = 'EPSG:{projection}';
+ var CENTER_LONLAT = centerLonLat = ol.proj.transform(
+ {center}, epsg_display_projection, epsg_projection);
+ var DEFAULT_ZOOM = {zoom};
+ var chimere_init_options = {% raw %}{{}}{% endraw %};
+ chimere_init_options["input_id"] = 'id_{{name}}';
+ {% if map_layers %}chimere_init_options["map_layers"] = [{map_layers}];{% endif %}
+ chimere_init_options['dynamic_categories'] = false;
+ chimere_init_options['edition'] = true;
+ chimere_init_options['edition_type'] = 'polygon';
+ chimere_init_options["checked_categories"] = [];
+ {% if default_area %} chimere_init_options['selected_map_layer'] = {{default_area}};{% endif %}
+</script>
+
+</div>
+
+<div id='popup'></div>
+<div id='map_edit'>
+<div class='map_button'>
+ <a href='#' id='polygon_move' class='toggle-button toggle-button-active'>{% trans "Move on the map" %}</a>
+ <a href='#' id='polygon_draw' class='toggle-button toggle-button-inactive'>{% trans "Draw" %}</a>
+</div>
+</div>
+ <input type='hidden' name='{{name}}' id='id_{{name}}' value='{{val}}'/>
+
+<script type="text/javascript">
+ function init_map_edit(){% raw %}{{{% endraw %}
+ $('#map_edit').chimere(chimere_init_options);
+ {% raw %}}}{% endraw %}
+ {% if initialized %}init_map_edit();{% endif %}
+ $('#polygon_draw').click(function(){% raw %}{{{% endraw %}
+ $('#polygon_move').removeClass('toggle-button-active').addClass('toggle-button-inactive');
+ $('#polygon_draw').removeClass('toggle-button-inactive').addClass('toggle-button-active');
+ $('#map_edit').chimere('activateDraw');
+ {% raw %}}}{% endraw %});
+ $('#polygon_move').click(function(){% raw %}{{{% endraw %}
+ $('#polygon_draw').removeClass('toggle-button-active').addClass('toggle-button-inactive');
+ $('#polygon_move').removeClass('toggle-button-inactive').addClass('toggle-button-active');
+ $('#map_edit').chimere('deactivateDraw');
+ {% raw %}}}{% endraw %});
+</script>