Commit 8926e977 authored by Sergio Adrian Gongora Euan's avatar Sergio Adrian Gongora Euan
parents bd994e7f 8ef1753a
...@@ -35,6 +35,8 @@ const map = new ol.Map({ ...@@ -35,6 +35,8 @@ const map = new ol.Map({
// show first date and current date // show first date and current date
let currentDate; let currentDate;
let currentOpacity = 1;
if (labels && labels.length > 0) { if (labels && labels.length > 0) {
currentDate = labels[0]; currentDate = labels[0];
addImageLayer(currentDate) addImageLayer(currentDate)
...@@ -49,15 +51,15 @@ function addImageLayer(labelDate) { ...@@ -49,15 +51,15 @@ function addImageLayer(labelDate) {
url: '/reports/tiles/tileinfo', url: '/reports/tiles/tileinfo',
success: function (data) { success: function (data) {
const layer_types = getSelectedCheckbox(); const layer_types = getSelectedCheckbox();
currentDate = labelDate;
currentDate = labelDate;
removeImageLayers() removeImageLayers()
// add layer // add layer
layer_types.forEach(layer_type => { layer_types.forEach(layer_type => {
const xyz = new ol.layer.Tile({ const xyz = new ol.layer.Tile({
opacity: 1,
name: layer_type, name: layer_type,
opacity: currentOpacity,
source: new ol.source.XYZ({ source: new ol.source.XYZ({
projection: 'EPSG:3857', projection: 'EPSG:3857',
url: '/reports/tiles/'+purchase_id+'/'+zone+'/'+layer_type+'/'+labelDate+'/{z}/{x}/{-y}.png', url: '/reports/tiles/'+purchase_id+'/'+zone+'/'+layer_type+'/'+labelDate+'/{z}/{x}/{-y}.png',
...@@ -67,6 +69,10 @@ function addImageLayer(labelDate) { ...@@ -67,6 +69,10 @@ function addImageLayer(labelDate) {
}) })
}); });
if (layer_type == 'TCI') {
xyz.setOpacity(1)
}
map.addLayer(xyz); map.addLayer(xyz);
}) })
...@@ -91,6 +97,8 @@ function removeImageLayers() { ...@@ -91,6 +97,8 @@ function removeImageLayers() {
function setOpacity(value) { function setOpacity(value) {
var imageLayers = map.getLayers().getArray().slice(); var imageLayers = map.getLayers().getArray().slice();
currentOpacity = value;
imageLayers.forEach(layer => { imageLayers.forEach(layer => {
if(layer.get('name') != 'mapbox' && layer.get('name') != 'polygon' && layer.get('name') != 'TCI') { if(layer.get('name') != 'mapbox' && layer.get('name') != 'polygon' && layer.get('name') != 'TCI') {
console.log(layer.get('name'), layer); console.log(layer.get('name'), layer);
......
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