Commit 92e6d5aa authored by Piotr Gawron's avatar Piotr Gawron
Browse files

fix on visualizing overlays with values

parent a949048e
......@@ -5,41 +5,4 @@
function AbstractOverlayElement() {
};
AbstractOverlayElement.prototype.overlayToColor = function(elementOverlay) {
if (elementOverlay==null) {
logger.error("elementOverlay cannot be null!");
}
if (elementOverlay.color!=null) {
return intToColorString(elementOverlay.color.value);
} else if (elementOverlay.value!=null) {
var ratio =0;
var color;
if (elementOverlay.value<0) {
ratio = -elementOverlay.value;
color = ServerConnector.getMinOverlayColorInt();
} else {
ratio = elementOverlay.value;
color = ServerConnector.getMaxOverlayColorInt();
}
var red = color & 0xFF0000;
red = red*ratio;
red = parseInt(red);
red = red & 0xFF0000;
var green = color & 0x00FF00;
green = green*ratio;
green = parseInt(green);
green = green & 0x00FF00;
var blue = color & 0x0000FF;
blue = blue*ratio;
blue = parseInt(blue);
blue = blue & 0x0000FF;
var color = red | green | blue;
return intToColorString(color);
} else {
logger.error("elementOverlay doesn't have neither color nor value set!");
}
};
......@@ -71,7 +71,7 @@ AliasInfoWindow.prototype.createChartDiv = function() {
if (data != null) {
var value = parseFloat(data.value);
var color = intToColorString(data.color.value);
var color = overlayToColor(data);
var leftMarginDiv = document.createElement("div");
leftMarginDiv.innerHTML = "&nbsp;";
leftMarginDiv.style.float = "left";
......
......@@ -101,11 +101,9 @@ AliasOverlay.create = function(layoutAlias, aliasData, map, startX, endX) {
fillOpacity : 0.8,
strokeWeight : 1,
map : map.map,
fillColor: overlayToColor(layoutAlias),
bounds : bounds
});
var result = new AliasOverlay(rectangle, map, aliasData);
var color = result.overlayToColor(layoutAlias);
rectangle.setOptions({fillColor: color});
return result;
};
......@@ -150,3 +150,42 @@ function isDomElement(o) {
o && typeof o === "object" && o !== null && o.nodeType === 1
&& typeof o.nodeName === "string");
}
overlayToColor = function(elementOverlay) {
if (elementOverlay==null) {
logger.error("elementOverlay cannot be null!");
}
if (elementOverlay.color!=null) {
return intToColorString(elementOverlay.color.value);
} else if (elementOverlay.value!=null) {
var ratio =0;
var color;
if (elementOverlay.value<0) {
ratio = -elementOverlay.value;
color = ServerConnector.getMinOverlayColorInt();
} else {
ratio = elementOverlay.value;
color = ServerConnector.getMaxOverlayColorInt();
}
var red = color & 0xFF0000;
red = red*ratio;
red = parseInt(red);
red = red & 0xFF0000;
var green = color & 0x00FF00;
green = green*ratio;
green = parseInt(green);
green = green & 0x00FF00;
var blue = color & 0x0000FF;
blue = blue*ratio;
blue = parseInt(blue);
blue = blue & 0x0000FF;
var color = red | green | blue;
return intToColorString(color);
} else {
logger.error("elementOverlay doesn't have neither color nor value set!");
}
};
......@@ -17,7 +17,7 @@
function ReactionOverlay(layoutReaction, reactionData, map, customized, id) {
// call super constructor
AbstractOverlayElement.call();
this.color = "#FF0000";
this.width = 5.0;
// list of google map objects associated with the reaction (like lines)
......@@ -33,7 +33,7 @@ function ReactionOverlay(layoutReaction, reactionData, map, customized, id) {
if (layoutReaction.width) {
this.width = layoutReaction.width;
}
this.color = this.overlayToColor(layoutReaction);
this.color = overlayToColor(layoutReaction);
}
if (reactionData != null) {
......@@ -50,7 +50,6 @@ function ReactionOverlay(layoutReaction, reactionData, map, customized, id) {
ReactionOverlay.prototype = Object.create(AbstractOverlayElement.prototype);
ReactionOverlay.prototype.constructor = ReactionOverlay;
/**
* Returns {@link google.maps.Bounds bounds} of all google maps elements
* included in the object.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment