summaryrefslogtreecommitdiff
path: root/ishtar_common/static
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-07-26 18:41:53 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-09-01 12:36:46 +0200
commit5f1ccd67fbeb5fc1fe69765b639ce6bddb70e988 (patch)
tree6fbdd8e9f10363b27c73216becb12cd1c6a4e9b5 /ishtar_common/static
parenta1abf9cd4ae5a736026e2e47d3add324dd3e461b (diff)
downloadIshtar-5f1ccd67fbeb5fc1fe69765b639ce6bddb70e988.tar.bz2
Ishtar-5f1ccd67fbeb5fc1fe69765b639ce6bddb70e988.zip
fixes urls import
Diffstat (limited to 'ishtar_common/static')
-rw-r--r--ishtar_common/static/js/ishtar-map.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js
index b22467668..c78da1098 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -645,7 +645,8 @@ var display_lines_and_polys = function(map_id, lines_and_polys){
}
};
-var disp_geo_items = function(map_id, base_url, slug, pk, display_both) {
+var disp_geo_items = function(map_id, base_url, slug, pk,
+ display_both, get_poly) {
var url = base_url;
if (slug === "operation") {
url += "?operation_pk=";
@@ -662,10 +663,18 @@ var disp_geo_items = function(map_id, base_url, slug, pk, display_both) {
if (httpRequest.status === 200) {
geo_items = to_geo_items(JSON.parse(httpRequest.responseText), slug, display_both)
for (geo_item of geo_items['base-finds']) {
- display_associated_polys(map_id, geo_item, 'basefind');
+ if (get_poly) {
+ display_associated_polys(map_id, geo_item, 'basefind');
+ } else {
+ display_associated_points(map_id, geo_item, 'basefind');
+ }
}
for (geo_item of geo_items['context-records']) {
- display_associated_polys(map_id, geo_item, 'contextrecord');
+ if (get_poly) {
+ display_associated_polys(map_id, geo_item, 'contextrecord');
+ } else {
+ display_associated_points(map_id, geo_item, 'contextrecord');
+ }
}
} else { return; }
}
@@ -727,16 +736,20 @@ var get_associated_context_record_style = function (feature) {
}),
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
- })
+ }),
+ radius: 10
});
};
var display_associated_points = function (map_id, points, slug) {
+ console.log(points);
_point_features = geojson_format.readFeatures(points);
+ console.log(_point_features[0].getGeometry().getType())
_cluster_source = new ol.source.Cluster({
distance: 40,
source: new ol.source.Vector()
});
+ _cluster_source.getSource().addFeatures(_point_features);
style = get_associated_base_find_style;
if (slug === 'contextrecord') {
style = get_associated_context_record_style;
@@ -747,5 +760,5 @@ var display_associated_points = function (map_id, points, slug) {
style: style
});
map[map_id].addLayer(_cluster_layer);
- _cluster_source.getSource().addFeatures(_point_features);
+
} \ No newline at end of file