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

Merge branch '266-transparency-level-of-overlay' into 'master'

Resolve "transparency level of overlay"

Closes #266

See merge request piotr.gawron/minerva!193
parents f91e1021 3e509859
No related branches found
No related tags found
1 merge request!193Resolve "transparency level of overlay"
Pipeline #
......@@ -9,6 +9,7 @@ var ConfigurationType = {
MIN_COLOR_VAL: "MIN_COLOR_VAL",
MAX_COLOR_VAL: "MAX_COLOR_VAL",
NEUTRAL_COLOR_VAL: "NEUTRAL_COLOR_VAL",
OVERLAY_OPACITY: "OVERLAY_OPACITY",
REQUEST_ACCOUNT_EMAIL: "REQUEST_ACCOUNT_EMAIL",
SIMPLE_COLOR_VAL: "SIMPLE_COLOR_VAL",
SEARCH_DISTANCE: "SEARCH_DISTANCE",
......
......@@ -7,6 +7,7 @@ var logger = require('../../logger');
var functions = require('../../Functions');
var AbstractSurfaceElement = require('./AbstractSurfaceElement');
var ConfigurationType = require('../../ConfigurationType');
var IdentifiedElement = require('../data/IdentifiedElement');
/**
......@@ -22,6 +23,7 @@ function AliasSurface(params) {
// original data
this.setBioEntity(params.alias);
this.setIdentifiedElement(new IdentifiedElement(params.alias));
}
AliasSurface.prototype = Object.create(AbstractSurfaceElement.prototype);
......@@ -95,25 +97,24 @@ AliasSurface.create = function (params) {
var bounds = new google.maps.LatLngBounds();
bounds.extend(latLngA);
bounds.extend(latLngB);
var rectangle = new google.maps.Rectangle({
fillOpacity: 0.8,
strokeWeight: 1,
map: map.getGoogleMap(),
bounds: bounds
});
return functions.overlayToColor(overlayAlias).then(function (color) {
rectangle.setOptions({
fillColor: color
var fillOpacity;
return ServerConnector.getConfigurationParam(ConfigurationType.OVERLAY_OPACITY).then(function (result) {
fillOpacity = result;
return functions.overlayToColor(overlayAlias);
}).then(function (color) {
var rectangle = new google.maps.Rectangle({
fillOpacity: fillOpacity,
strokeWeight: 1,
map: map.getGoogleMap(),
fillColor: color,
bounds: bounds
});
var result = new AliasSurface({
return new AliasSurface({
map: map,
gmapObj: rectangle,
alias: alias,
onClick: params.onClick
});
result.setIdentifiedElement(new IdentifiedElement(alias));
return result;
});
};
......@@ -121,7 +122,11 @@ AliasSurface.createFromIdentifiedElement = function (params) {
var element = params.element;
var map = params.map;
var model = map.getModel().getSubmodelById(element.getModelId());
return model.getByIdentifiedElement(element).then(function (alias) {
var fillOpacity;
return ServerConnector.getConfigurationParam(ConfigurationType.OVERLAY_OPACITY).then(function (result) {
fillOpacity = result;
return model.getByIdentifiedElement(element);
}).then(function (alias) {
var pointA = new google.maps.Point(alias.getX(), alias.getY());
var pointB = new google.maps.Point(alias.getX() + alias.getWidth(), alias.getY() + alias.getHeight());
var latLngA = map.fromPointToLatLng(pointA);
......@@ -135,7 +140,6 @@ AliasSurface.createFromIdentifiedElement = function (params) {
if (element.getColor() !== undefined) {
color = element.getColor();
}
var fillOpacity = 0.8;
if (element.getOpacity() !== undefined) {
fillOpacity = element.getOpacity();
}
......@@ -163,15 +167,12 @@ AliasSurface.createFromIdentifiedElement = function (params) {
strokeWeight: strokeWeight
});
var result = new AliasSurface({
return new AliasSurface({
gmapObj: rectangle,
map: map,
onClick: params.onClick,
alias: alias
});
result.setIdentifiedElement(element);
return result;
});
};
......
......@@ -319,7 +319,7 @@ describe('AbstractCustomMap', function () {
});
var surface = new AliasSurface({
map: map,
element: ie,
alias: alias,
gmapObj: new google.maps.Rectangle({
map: map.getGoogleMap(),
bounds: new google.maps.LatLngBounds(new google.maps.LatLng(0, 0), new google.maps.LatLng(0.5, 1))
......
......@@ -24,6 +24,7 @@ describe('AliasSurface', function() {
}).then(function(result) {
assert.ok(result instanceof AliasSurface);
assert.equal(logger.getWarnings.length, 0);
assert.ok(result.getIdentifiedElement());
});
});
......@@ -44,6 +45,7 @@ describe('AliasSurface', function() {
}).then(function(result) {
assert.ok(result instanceof AliasSurface);
assert.equal(logger.getWarnings.length, 0);
assert.ok(result.getIdentifiedElement());
});
});
it("setBoundsForAlias", function() {
......
......@@ -134,12 +134,17 @@ public enum ConfigurationElementType {
* Color used for undefined overlay values.
*/
SIMPLE_COLOR_VAL("Overlay color when no values are defined", "00FF00", ConfigurationElementEditType.COLOR, false),
/**
*
* Color used for 0 overlay value.
*/
NEUTRAL_COLOR_VAL("Overlay color for value=0", "FFFFFF", ConfigurationElementEditType.COLOR, false);
NEUTRAL_COLOR_VAL("Overlay color for value=0", "FFFFFF", ConfigurationElementEditType.COLOR, false),
/**
* Opacity of data overlay objects in the frontend.
*/
OVERLAY_OPACITY("Opacity used when drwaing data overlays (value between 0.0-1.0)", "0.8",
ConfigurationElementEditType.DOUBLE, false),;
/**
* Default value of the configuration parameter (it will be used only when value
......@@ -165,7 +170,7 @@ public enum ConfigurationElementType {
* @param commonName
* common name used for this parameter
* @param editType
* type defining how we want to edit this configuration param
* type defining how we want to edit this configuration parameter
* @param defaultVal
* default value assigned to this parameter
*/
......
......@@ -275,7 +275,6 @@ public class ConfigurationRestImpl extends BaseRestImpl {
public List<Map<String, Object>> getPlugins(String token, String rootPath) {
String path = rootPath + "/resources/js/plugins/";
File folder = new File(path);
logger.debug(folder.getAbsolutePath());
List<Map<String, Object>> result = new ArrayList<>();
if (folder.exists()) {
File[] listOfFiles = folder.listFiles();
......
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