Commit 3e509859 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

opacity of surface is taken from configuration in admin panel

parent 5d3d5961
Pipeline #3464 passed with stage
in 59 seconds
...@@ -9,6 +9,7 @@ var ConfigurationType = { ...@@ -9,6 +9,7 @@ var ConfigurationType = {
MIN_COLOR_VAL: "MIN_COLOR_VAL", MIN_COLOR_VAL: "MIN_COLOR_VAL",
MAX_COLOR_VAL: "MAX_COLOR_VAL", MAX_COLOR_VAL: "MAX_COLOR_VAL",
NEUTRAL_COLOR_VAL: "NEUTRAL_COLOR_VAL", NEUTRAL_COLOR_VAL: "NEUTRAL_COLOR_VAL",
OVERLAY_OPACITY: "OVERLAY_OPACITY",
REQUEST_ACCOUNT_EMAIL: "REQUEST_ACCOUNT_EMAIL", REQUEST_ACCOUNT_EMAIL: "REQUEST_ACCOUNT_EMAIL",
SIMPLE_COLOR_VAL: "SIMPLE_COLOR_VAL", SIMPLE_COLOR_VAL: "SIMPLE_COLOR_VAL",
SEARCH_DISTANCE: "SEARCH_DISTANCE", SEARCH_DISTANCE: "SEARCH_DISTANCE",
......
...@@ -7,6 +7,7 @@ var logger = require('../../logger'); ...@@ -7,6 +7,7 @@ var logger = require('../../logger');
var functions = require('../../Functions'); var functions = require('../../Functions');
var AbstractSurfaceElement = require('./AbstractSurfaceElement'); var AbstractSurfaceElement = require('./AbstractSurfaceElement');
var ConfigurationType = require('../../ConfigurationType');
var IdentifiedElement = require('../data/IdentifiedElement'); var IdentifiedElement = require('../data/IdentifiedElement');
/** /**
...@@ -96,16 +97,17 @@ AliasSurface.create = function (params) { ...@@ -96,16 +97,17 @@ AliasSurface.create = function (params) {
var bounds = new google.maps.LatLngBounds(); var bounds = new google.maps.LatLngBounds();
bounds.extend(latLngA); bounds.extend(latLngA);
bounds.extend(latLngB); bounds.extend(latLngB);
var rectangle = new google.maps.Rectangle({ var fillOpacity;
fillOpacity: 0.8, return ServerConnector.getConfigurationParam(ConfigurationType.OVERLAY_OPACITY).then(function (result) {
strokeWeight: 1, fillOpacity = result;
map: map.getGoogleMap(), return functions.overlayToColor(overlayAlias);
bounds: bounds }).then(function (color) {
}); var rectangle = new google.maps.Rectangle({
fillOpacity: fillOpacity,
return functions.overlayToColor(overlayAlias).then(function (color) { strokeWeight: 1,
rectangle.setOptions({ map: map.getGoogleMap(),
fillColor: color fillColor: color,
bounds: bounds
}); });
return new AliasSurface({ return new AliasSurface({
map: map, map: map,
...@@ -120,7 +122,11 @@ AliasSurface.createFromIdentifiedElement = function (params) { ...@@ -120,7 +122,11 @@ AliasSurface.createFromIdentifiedElement = function (params) {
var element = params.element; var element = params.element;
var map = params.map; var map = params.map;
var model = map.getModel().getSubmodelById(element.getModelId()); 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 pointA = new google.maps.Point(alias.getX(), alias.getY());
var pointB = new google.maps.Point(alias.getX() + alias.getWidth(), alias.getY() + alias.getHeight()); var pointB = new google.maps.Point(alias.getX() + alias.getWidth(), alias.getY() + alias.getHeight());
var latLngA = map.fromPointToLatLng(pointA); var latLngA = map.fromPointToLatLng(pointA);
...@@ -134,7 +140,6 @@ AliasSurface.createFromIdentifiedElement = function (params) { ...@@ -134,7 +140,6 @@ AliasSurface.createFromIdentifiedElement = function (params) {
if (element.getColor() !== undefined) { if (element.getColor() !== undefined) {
color = element.getColor(); color = element.getColor();
} }
var fillOpacity = 0.8;
if (element.getOpacity() !== undefined) { if (element.getOpacity() !== undefined) {
fillOpacity = element.getOpacity(); fillOpacity = element.getOpacity();
} }
......
Markdown is supported
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