-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1640 added singleTile option to Display Tab #1803
Merged
mbarto
merged 7 commits into
geosolutions-it:master
from
MV88:MV88-iss_1640_singletile_fix
May 11, 2017
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6aa1716
fixed #1640 added singleTile option to Display Tab
MV88 dd5346f
supported singleTile & cache to cesium and fixed tileprovider proxy
MV88 5880051
Merge branch 'iss_1640_singletile_fix' of https://github.com/MV88/Map…
MV88 0cdb559
fixed tileprovider proxy for cesium
MV88 4b494f5
fixed copyrights
MV88 c343e02
added transparent option check when layer updates
MV88 396707d
fixed update layer for cesium
MV88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* Copyright 2015, GeoSolutions Sas. | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
|
@@ -13,6 +13,7 @@ const L = require('leaflet'); | |
const objectAssign = require('object-assign'); | ||
const {isArray, isEqual} = require('lodash'); | ||
const SecurityUtils = require('../../../../utils/SecurityUtils'); | ||
require('leaflet.nontiledlayer'); | ||
|
||
|
||
L.TileLayer.MultipleUrlWMS = L.TileLayer.WMS.extend({ | ||
|
@@ -42,7 +43,6 @@ L.TileLayer.MultipleUrlWMS = L.TileLayer.WMS.extend({ | |
|
||
L.setOptions(this, options); | ||
}, | ||
|
||
getTileUrl: function(tilePoint) { // (Point, Number) -> String | ||
let map = this._map; | ||
let tileSize = this.options.tileSize; | ||
|
@@ -79,6 +79,7 @@ function wmsToLeafletOptions(options) { | |
transparent: options.transparent !== undefined ? options.transparent : true, | ||
tiled: options.tiled !== undefined ? options.tiled : true, | ||
opacity: opacity, | ||
"zIndex": options.zIndex, | ||
version: options.version || "1.3.0", | ||
SRS: CoordinatesUtils.normalizeSRS(options.srs || 'EPSG:3857', options.allowedSRS), | ||
CRS: CoordinatesUtils.normalizeSRS(options.srs || 'EPSG:3857', options.allowedSRS), | ||
|
@@ -95,6 +96,9 @@ Layers.registerType('wms', { | |
const urls = getWMSURLs(isArray(options.url) ? options.url : [options.url]); | ||
const queryParameters = wmsToLeafletOptions(options) || {}; | ||
urls.forEach(url => SecurityUtils.addAuthenticationParameter(url, queryParameters)); | ||
if (options.singleTile) { | ||
return L.nonTiledLayer.wms(urls, queryParameters); | ||
} | ||
return L.tileLayer.multipleUrlWMS(urls, queryParameters); | ||
}, | ||
update: function(layer, newOptions, oldOptions) { | ||
|
@@ -103,12 +107,32 @@ Layers.registerType('wms', { | |
let newQueryParameters = WMSUtils.filterWMSParamOptions(wmsToLeafletOptions(newOptions)); | ||
let newParameters = Object.keys(newQueryParameters).filter((key) => {return newQueryParameters[key] !== oldqueryParameters[key]; }); | ||
let newParams = {}; | ||
let newLayer; | ||
if (oldOptions.singleTile !== newOptions.singleTile) { | ||
const urls = getWMSURLs(isArray(newOptions.url) ? newOptions.url : [newOptions.url]); | ||
urls.forEach(url => SecurityUtils.addAuthenticationParameter(url, newQueryParameters)); | ||
if (newOptions.singleTile) { | ||
// return the nonTiledLayer | ||
newLayer = L.nonTiledLayer.wms(urls[0], newQueryParameters); | ||
} else { | ||
newLayer = L.tileLayer.multipleUrlWMS(urls, newQueryParameters); | ||
} | ||
if ( newParameters.length > 0 ) { | ||
newParameters.forEach( key => newParams[key] = newQueryParameters[key] ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. convert to map please |
||
// set new options as parameters, merged with params | ||
newLayer.setParams(objectAssign(newParams, newParams.params, newOptions.params)); | ||
} else if (!isEqual(newOptions.params, oldOptions.params)) { | ||
newLayer.setParams(newOptions.params); | ||
} | ||
return newLayer; | ||
} | ||
if ( newParameters.length > 0 ) { | ||
newParameters.forEach( key => newParams[key] = newQueryParameters[key] ); | ||
// set new options as parameters, merged with params | ||
layer.setParams(objectAssign(newParams, newParams.params, newOptions.params)); | ||
} else if (!isEqual(newOptions.params, oldOptions.params)) { | ||
layer.setParams(newOptions.params); | ||
} | ||
return null; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* Copyright 2015, GeoSolutions Sas. | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
|
@@ -35,9 +35,8 @@ var Layers = { | |
updateLayer: function(type, layer, newOptions, oldOptions, map) { | ||
var layerCreator = layerTypes[type]; | ||
if (layerCreator && layerCreator.update) { | ||
return layerCreator.update(layer, newOptions, oldOptions, map); | ||
return layerCreator.update(newOptions, oldOptions, map); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You cannot change the signature of update, other layers (e.g. MarkerLayer) expect a layer as the first parameter |
||
} | ||
|
||
} | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove double quotes