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

implementation of getModelId and getBounds

parent afe0313f
No related branches found
No related tags found
1 merge request!99Resolve "Link from literature file to the related reaction in the map does not work"
......@@ -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.
*
......
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