summaryrefslogtreecommitdiff
path: root/chimere/static
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-08-01 18:56:55 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-08-01 18:56:55 +0200
commit862f795c2a2067510d10fdabdaec7c2e491a78ed (patch)
tree4ff776593245faf3352bfcf4af35477344093e73 /chimere/static
parent7ddf224de3f1f751f00ebc883404f1424f018c3e (diff)
downloadChimère-862f795c2a2067510d10fdabdaec7c2e491a78ed.tar.bz2
Chimère-862f795c2a2067510d10fdabdaec7c2e491a78ed.zip
Manage agregation on higher zoom
* json give the needed zoom to have full access on objects * js reload items when the needed zoom is reach * on click on aggregated item zoom to the needed zoom to have access to items
Diffstat (limited to 'chimere/static')
-rw-r--r--chimere/static/chimere/js/jquery.chimere.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js
index 2fd94a4..a1490ef 100644
--- a/chimere/static/chimere/js/jquery.chimere.js
+++ b/chimere/static/chimere/js/jquery.chimere.js
@@ -839,13 +839,17 @@ function transform(obj) {
map.getView().calculateExtent(map.getSize()),
EPSG_PROJECTION, EPSG_DISPLAY_PROJECTION
);
+ var current_zoom = settings.map.getView().getZoom();
var init;
if (!settings._cache_boundingbox) init = true;
if (init ||
!ol.extent.containsCoordinate(settings._cache_boundingbox,
- current_extent)){
+ current_extent) ||
+ (settings._zoom_need_reload &&
+ current_zoom >= settings._zoom_need_reload)
+ ){
// enlarge current extent to cache values
x_extent = Math.abs(current_extent[2] - current_extent[0]);
y_extent = Math.abs(current_extent[3] - current_extent[1]);
@@ -854,6 +858,7 @@ function transform(obj) {
current_extent[2] = current_extent[2] + x_extent;
current_extent[3] = current_extent[3] + y_extent;
settings._cache_boundingbox = current_extent;
+ settings._cache_zoom = current_zoom;
if(!init) methods.loadGeoObjects();
}
@@ -1048,6 +1053,7 @@ function transform(obj) {
'min_lat': settings._cache_boundingbox[1],
'max_lon': settings._cache_boundingbox[2],
'max_lat': settings._cache_boundingbox[3],
+ 'zoom_level': settings._cache_zoom
};
}
$.ajax({url: uri,
@@ -1064,6 +1070,9 @@ function transform(obj) {
settings.layerCluster.removeAllFeatures();
}
if (!data.features) return;
+ if (data.zoom_need_reload){
+ settings._zoom_need_reload = data.zoom_need_reload;
+ }
for (var i = 0; i < data.features.length; i++) {
var feature = data.features[i];
if (feature.geometry.type == 'Point'){
@@ -2087,6 +2096,13 @@ function transform(obj) {
* update current detail panel with an AJAX request
*/
var uri = extra_url
+ if (key.length > 3 && key.substring(0, 3) == 'agg' && settings._zoom_need_reload){
+ var current_zoom = settings.map.getView().getZoom();
+ if (current_zoom < settings._zoom_need_reload){
+ settings.map.getView().setZoom(settings._zoom_need_reload);
+ }
+ return
+ }
if (settings.area_id) uri += settings.area_id + "/"
uri += "getDetail/" + key;
var params = {}