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 = {
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');
/**
......@@ -96,17 +97,18 @@ AliasSurface.create = function (params) {
var bounds = new google.maps.LatLngBounds();
bounds.extend(latLngA);
bounds.extend(latLngB);
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: 0.8,
fillOpacity: fillOpacity,
strokeWeight: 1,
map: map.getGoogleMap(),
fillColor: color,
bounds: bounds
});
return functions.overlayToColor(overlayAlias).then(function (color) {
rectangle.setOptions({
fillColor: color
});
return new AliasSurface({
map: map,
gmapObj: rectangle,
......@@ -120,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);
......@@ -134,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();
}
......
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