Skip to content

Commit 6eac00e

Browse files
committed
Fixes #2824: enable elevation layer only for cesium or when mouseposition is enabled
1 parent f595cde commit 6eac00e

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

web/client/plugins/Map.jsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ class MapPlugin extends React.Component {
152152
toolsOptions: PropTypes.object,
153153
actions: PropTypes.object,
154154
features: PropTypes.array,
155-
securityToken: PropTypes.string
155+
securityToken: PropTypes.string,
156+
elevationEnabled: PropTypes.bool
156157
};
157158

158159
static defaultProps = {
@@ -184,7 +185,8 @@ class MapPlugin extends React.Component {
184185
}
185186
},
186187
securityToken: '',
187-
additionalLayers: []
188+
additionalLayers: [],
189+
elevationEnabled: false
188190
};
189191

190192
componentWillMount() {
@@ -227,7 +229,7 @@ class MapPlugin extends React.Component {
227229

228230
renderLayers = () => {
229231
const projection = this.props.map.projection || 'EPSG:3857';
230-
return [...this.props.layers, ...this.props.additionalLayers].map((layer, index) => {
232+
return [...this.props.layers, ...this.props.additionalLayers].filter(this.filterLayer).map((layer, index) => {
231233
return (
232234
<plugins.Layer type={layer.type} srs={projection} position={index} key={layer.id || layer.name} options={layer} securityToken={this.props.securityToken}>
233235
{this.renderLayerContent(layer, projection)}
@@ -303,7 +305,9 @@ class MapPlugin extends React.Component {
303305
<Message msgId={this.props.mapLoadingMessage}/>
304306
</div>);
305307
}
306-
308+
filterLayer = (layer) => {
309+
return !layer.useForElevation || this.props.mapType === 'cesium' || this.props.elevationEnabled;
310+
};
307311
updatePlugins = (props) => {
308312
plugins = require('./map/index')(props.mapType, props.actions);
309313
};
@@ -323,15 +327,17 @@ const selector = createSelector(
323327
layerSelectorWithMarkers,
324328
selectedFeatures,
325329
(state) => state.mapInitialConfig && state.mapInitialConfig.loadingError && state.mapInitialConfig.loadingError.data,
326-
securityTokenSelector
327-
], (projectionDefs, map, mapType, layers, features, loadingError, securityToken) => ({
330+
securityTokenSelector,
331+
(state) => state.mousePosition && state.mousePosition.enabled
332+
], (projectionDefs, map, mapType, layers, features, loadingError, securityToken, elevationEnabled) => ({
328333
projectionDefs,
329334
map,
330335
mapType,
331336
layers,
332337
features,
333338
loadingError,
334-
securityToken
339+
securityToken,
340+
elevationEnabled
335341
})
336342
);
337343
module.exports = {

0 commit comments

Comments
 (0)