summaryrefslogtreecommitdiff
path: root/ishtar_common/static/js/ishtar.js
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
-rw-r--r--ishtar_common/static/js/ishtar.js53
1 files changed, 46 insertions, 7 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index b865c7153..e59ce4f2c 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -1384,14 +1384,16 @@ var render_map_list_modal = function(map_id){
};
var limit_map_msg = "Limit to {0} items";
+var display_poly_map_msg = "Display lines, polygons";
var limit_map_help_msg = "Unchecking this limit on a poorly performing device may result in web browser freeze";
var limit_map_nb = 50000;
var current_map_limit = limit_map_nb;
+var display_polygon_on_map = false;
var displayed_map_msg = "{0} items displayed on the map";
var non_displayed_map_msg = "{0} items not displayed";
var non_displayed_map_link_msg = "(list)";
-var render_map = function(map_id, use_map_limit, hide_limit){
+var render_map = function(map_id, use_map_limit, hide_limit, display_polygons){
var html = "";
if (!hide_limit){
html += "<div class='ishtar-map-top row'>";
@@ -1403,6 +1405,14 @@ var render_map = function(map_id, use_map_limit, hide_limit){
html += "<label class='form-check-label' for='ishtar-map-limit-" + map_id + "'>";
html += limit_map_msg.format(number_with_commas(limit_map_nb));
html += " <i class='fa fa-question-circle' title=\""+ limit_map_help_msg +"\" aria-hidden='true'></i></label>";
+ html += "</div>";
+ html += "<div class='ishtar-map-limit col-sm form-check'>";
+ html += "<input class='form-check-input' type='checkbox' id='ishtar-map-poly-" + map_id + "' ";
+ if (display_polygons) html += " checked='checked'";
+ html += "/> ";
+ html += "<label class='form-check-label' for='ishtar-map-poly-" + map_id + "'>";
+ html += display_poly_map_msg;
+ html += " </label>";
html += "</div></div>";
}
@@ -1415,8 +1425,21 @@ var render_map = function(map_id, use_map_limit, hide_limit){
var no_geo_window_content = "";
-var register_map = function(map_id, points){
- display_map(map_id, points);
+var register_map = function(map_id, result){
+ let points = {};
+ Object.assign(points, result);
+ points["features"] = new Array();
+ let line_and_polys = {};
+ Object.assign(line_and_polys, result);
+ line_and_polys["features"] = new Array();
+ for (const feature of result["features"]){
+ if (feature["geometry"] && feature["geometry"]["type"] === "Point"){
+ points["features"].push(feature);
+ } else {
+ line_and_polys["features"].push(feature);
+ }
+ }
+ display_map(map_id, points, line_and_polys);
$('#ishtar-map-limit-' + map_id).change(function() {
if ($(this).prop('checked')) {
current_map_limit = limit_map_nb;
@@ -1425,6 +1448,14 @@ var register_map = function(map_id, points){
}
$(".search_button").click();
});
+ $('#ishtar-map-poly-' + map_id).change(function() {
+ if ($(this).prop('checked')) {
+ display_polygon_on_map = true;
+ } else {
+ display_polygon_on_map = false;
+ }
+ $(".search_button").click();
+ });
if (points){
var lbl = "";
if (points['features'].length){
@@ -1493,10 +1524,18 @@ var search_get_query_data = function(query_vars, table_name){
if (data) data += "&";
data += "start=" + ((current_image_page - 1) * $(id_select).val());
}
- if (current_tab == "map" && !current_map_limit){
- if (data) data += "&";
- data += "no_limit=true";
+ if (current_tab == "map"){
+ if (!current_map_limit){
+ if (data) data += "&";
+ data += "no_limit=true";
+ }
+ if (display_polygon_on_map){
+ if (data) data += "&";
+ data += "display_polygon=true";
+ }
}
+
+
return data;
};
@@ -1919,4 +1958,4 @@ var redraw_plots = function(name, key){
$('#chart-' + name + "-" + key).width($('#charts-' + name + "-" + key).width()* 0.96);
stats_current_graph[key].replot({resetAxes: true});
}
-}; \ No newline at end of file
+};