diff options
Diffstat (limited to 'ishtar_common/static/js/ishtar-map.js')
| -rw-r--r-- | ishtar_common/static/js/ishtar-map.js | 23 | 
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 | 
