summaryrefslogtreecommitdiff
path: root/ishtar_common/static/js
diff options
context:
space:
mode:
authorQuentin André <quentin.andre@imt-atlantique.net>2021-08-19 00:46:25 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-07-08 09:58:48 +0200
commita6f2786eddf66a17b6a9aed59af52fb10480354d (patch)
treeed312a2c98b44f60da60fadf5910918cbd9817d6 /ishtar_common/static/js
parenta868645fb16485bd9e55260b6a5e7971171b4158 (diff)
downloadIshtar-a6f2786eddf66a17b6a9aed59af52fb10480354d.tar.bz2
Ishtar-a6f2786eddf66a17b6a9aed59af52fb10480354d.zip
create_cr_with_bfs returns pks
Diffstat (limited to 'ishtar_common/static/js')
-rw-r--r--ishtar_common/static/js/ishtar-map.js59
1 files changed, 28 insertions, 31 deletions
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js
index 4d6ebcd48..00aadfd9b 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -684,31 +684,23 @@ var display_geo_items = function(map_id, base_url, slug, pk,
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
geo_items = to_geo_items(JSON.parse(httpRequest.responseText), slug, disp_cr, disp_bf)
+ console.log('geoitems')
+ console.log(geo_items)
if (current_test) {
geo_items_features[map_id] = [];
}
- var feat = null;
- for (geo_item of geo_items['base-finds']) {
- if (get_poly) {
- feat = display_associated_polys(map_id, geo_item, 'basefind');
- } else {
- feat = display_associated_points(map_id, geo_item, 'basefind');
- }
- if (current_test) {
- geo_items_features[map_id].push(feat);
- }
- }
- for (geo_item of geo_items['context-records']) {
- if (get_poly) {
- feat = display_associated_polys(map_id, geo_item, 'contextrecord');
- } else {
- feat = display_associated_points(map_id, geo_item, 'contextrecord');
- }
- if (current_test) {
- geo_items_features[map_id].push(feat);
- }
+ let bfs = null;
+ let crs = null;
+ if (get_poly) {
+ bfs = display_associated_polys(map_id, geo_items['base-finds'], 'basefind');
+ crs = display_associated_polys(map_id, geo_items['context-records'], 'contextrecord');
+ } else {
+ bfs = display_associated_points(map_id, geo_items['base-finds'], 'basefind');
+ crs = display_associated_points(map_id, geo_items['context-records'], 'contextrecord');
}
if (current_test) {
+ geo_items_features[map_id].push(bfs)
+ geo_items_features[map_id].push(crs)
$("#http-geo-items-ready").show();
}
} else { return; }
@@ -719,21 +711,26 @@ var display_geo_items = function(map_id, base_url, slug, pk,
};
var to_geo_items = function (obj, slug, disp_cr, disp_bf) {
- const objects = {'context-records': [], 'base-finds': []};
+ const objects = {'context-records': {'features': [], 'type': 'FeatureCollection'},
+ 'base-finds': {'features': [], 'type': 'FeatureCollection'}};
if (slug === "operation") {
const crs = obj['properties']['context-records'];
for (const cr of crs['features']) {
- if (disp_bf) {
- objects['base-finds'].push(cr['properties']['base-finds'])
+ if (disp_bf) {console.log(cr);
+ for (const bf of cr['properties']['base-finds']['features']) {
+ objects['base-finds']['features'].push(bf)
+ }
}
delete cr['properties'];
- }
- if (disp_cr) {
- objects['context-records'].push(crs);
+ if (disp_cr) {
+ objects['context-records']['features'].push(cr)
+ }
}
}
else {
- objects['base-finds'].push(obj['properties']['base-finds'])
+ for (const bf of obj['properties']['base-finds']['features']) {
+ objects['base-finds']['features'].push(bf)
+ }
}
return objects;
}
@@ -780,9 +777,9 @@ var get_associated_context_record_style = function (feature) {
};
var display_associated_points = function (map_id, points, slug) {
- //console.log('geo items points')
- //console.log(points);
- /*_point_features = geojson_format.readFeatures(points);
+ console.log('geo items points')
+ console.log(points);
+ _point_features = geojson_format.readFeatures(points);
_cluster_source = new ol.source.Cluster({
distance: 40,
source: new ol.source.Vector()
@@ -799,7 +796,7 @@ var display_associated_points = function (map_id, points, slug) {
style: style
});
map[map_id].addLayer(_cluster_layer);
- return _point_features;*/
+ return _point_features;
}
// for test purpose