diff --git a/frontend-js/src/main/js/map/surface/AbstractSurfaceElement.js b/frontend-js/src/main/js/map/surface/AbstractSurfaceElement.js index 4a8d7b2b58163fef9b6d66e2d86e1f80a379e5a6..d657fd6bceeb294d0f01cd2440652bce567ba8d7 100644 --- a/frontend-js/src/main/js/map/surface/AbstractSurfaceElement.js +++ b/frontend-js/src/main/js/map/surface/AbstractSurfaceElement.js @@ -15,6 +15,9 @@ function AbstractOverlayElement(params) { self.registerListenerType("onClick"); self.setCustomMap(params.map); + if (params.element !== undefined && params.element !== null) { + self.setIdentifiedElement(params.element); + } self._googleMapObjects = []; if (params.onClick !== undefined) { @@ -42,7 +45,7 @@ AbstractOverlayElement.prototype.getBounds = function() { for (var i = 0; i < this.getGoogleMapObjects().length; i++) { bounds.extend(this.getGoogleMapObjects()[i].getBounds().getSouthWest()); bounds.extend(this.getGoogleMapObjects()[i].getBounds().getNorthEast()); - } + } return bounds; }; @@ -96,6 +99,10 @@ AbstractOverlayElement.prototype.getIdentifiedElement = function() { return this._identifiedElement; }; +AbstractOverlayElement.prototype.getModelId = function() { + return this.getIdentifiedElement().getModelId(); +}; + AbstractOverlayElement.prototype.updateIdentifiedElement = function(identifiedElement) { if (identifiedElement.getColor() !== undefined) { this.setColor(identifiedElement.getColor()); @@ -106,6 +113,18 @@ AbstractOverlayElement.prototype.setIdentifiedElement = function(identifiedEleme this._identifiedElement = identifiedElement; }; +AbstractOverlayElement.prototype.getBounds = function() { + var self = this; + var bounds = new google.maps.LatLngBounds(); + for (var i = 0; i < self.getGoogleMapObjects().length; i++) { + var elementBounds = self.getGoogleMapObjects()[i].getBounds(); + bounds.extend(elementBounds.getNorthEast()); + bounds.extend(elementBounds.getSouthWest()); + } + + return bounds; +}; + /** * Returns {@link AbstractCustomMap} where surface is located. *