Skip to content
Snippets Groups Projects
Commit ddf901ed authored by Piotr Gawron's avatar Piotr Gawron
Browse files

refreshOverlayMarkers simplified to handle only optimization issues

parent a328ead1
No related branches found
Tags v12.0.0-alpha.1
1 merge request!5Frontend refactor
......@@ -497,37 +497,14 @@ CustomMap.prototype.refreshMarkers = function() {
CustomMap.prototype.refreshOverlayMarkers = function(overlay) {
logger.debug("Refresh overlay: " + overlay.name);
var boundsArray = [];
boundsArray[this.getId()] = new google.maps.LatLngBounds();
for (var i = 0; i < this.submaps.length; i++) {
boundsArray[this.submaps[i].getId()] = new google.maps.LatLngBounds();
}
var updated = false;
var stillMissing = false;
var bounds;
for ( var aliasKey in overlay.aliasMarkers) {
if (overlay.aliasMarkers.hasOwnProperty(aliasKey) && overlay.aliasMarkers[aliasKey] !== undefined
&& overlay.aliasMarkers[aliasKey] !== null) {
var alias = overlay.aliasMarkers[aliasKey];
if (alias.getAliasData() === null || alias.getAliasData() === undefined) {
alias.getCustomMap().getModel().getAliasById(alias.getId()).then(function(aliasData) {
alias.setAliasData(aliasData);
alias.init();
alias.show();
updated = true;
bounds = alias.getBounds();
boundsArray[alias.getCustomMap().getId()].extend(bounds.getNorthEast());
});
} else {
bounds = alias.getBounds();
if (!this.isMarkerOptimization()) {
alias.hide();
alias.show();
}
boundsArray[alias.getCustomMap().getId()].extend(bounds.getNorthEast());
boundsArray[alias.getCustomMap().getId()].extend(bounds.getSouthWest());
if (!this.isMarkerOptimization()) {
alias.hide();
alias.show();
}
}
}
......@@ -540,12 +517,10 @@ CustomMap.prototype.refreshOverlayMarkers = function(overlay) {
// visualization is
// already there
// alias.update();
bounds = pointMarker.getBounds();
if (!this.isMarkerOptimization()) {
pointMarker.hide();
pointMarker.show();
}
boundsArray[pointMarker.getCustomMap().getId()].extend(bounds.getNorthEast());
}
}
......@@ -556,25 +531,10 @@ CustomMap.prototype.refreshOverlayMarkers = function(overlay) {
if (!reactionOverlay.isShown()) {
reactionOverlay.show();
}
bounds = reactionOverlay.getBounds();
if (!this.isMarkerOptimization()) {
reactionOverlay.hide();
reactionOverlay.show();
}
boundsArray[reactionOverlay.getCustomMap().getId()].extend(bounds.getNorthEast());
boundsArray[reactionOverlay.getCustomMap().getId()].extend(bounds.getSouthWest());
}
}
if (!stillMissing && updated && overlay.fitBounds) {
for ( var mapId in boundsArray) {
if (boundsArray.hasOwnProperty(mapId)) {
var map = this.getSubmodelById(mapId).getGoogleMap();
bounds = boundsArray[mapId];
if (map !== undefined && !bounds.isEmpty()) {
map.fitBounds(bounds);
}
}
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment