Skip to content
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

Fixes #2824: enable elevation layer only for cesium or when mouseposition is enabled #2841

Merged
merged 1 commit into from
May 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions web/client/plugins/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ class MapPlugin extends React.Component {
toolsOptions: PropTypes.object,
actions: PropTypes.object,
features: PropTypes.array,
securityToken: PropTypes.string
securityToken: PropTypes.string,
elevationEnabled: PropTypes.bool
};

static defaultProps = {
Expand Down Expand Up @@ -184,7 +185,8 @@ class MapPlugin extends React.Component {
}
},
securityToken: '',
additionalLayers: []
additionalLayers: [],
elevationEnabled: false
};

componentWillMount() {
Expand Down Expand Up @@ -227,7 +229,7 @@ class MapPlugin extends React.Component {

renderLayers = () => {
const projection = this.props.map.projection || 'EPSG:3857';
return [...this.props.layers, ...this.props.additionalLayers].map((layer, index) => {
return [...this.props.layers, ...this.props.additionalLayers].filter(this.filterLayer).map((layer, index) => {
return (
<plugins.Layer type={layer.type} srs={projection} position={index} key={layer.id || layer.name} options={layer} securityToken={this.props.securityToken}>
{this.renderLayerContent(layer, projection)}
Expand Down Expand Up @@ -303,7 +305,9 @@ class MapPlugin extends React.Component {
<Message msgId={this.props.mapLoadingMessage}/>
</div>);
}

filterLayer = (layer) => {
return !layer.useForElevation || this.props.mapType === 'cesium' || this.props.elevationEnabled;
};
updatePlugins = (props) => {
plugins = require('./map/index')(props.mapType, props.actions);
};
Expand All @@ -323,15 +327,17 @@ const selector = createSelector(
layerSelectorWithMarkers,
selectedFeatures,
(state) => state.mapInitialConfig && state.mapInitialConfig.loadingError && state.mapInitialConfig.loadingError.data,
securityTokenSelector
], (projectionDefs, map, mapType, layers, features, loadingError, securityToken) => ({
securityTokenSelector,
(state) => state.mousePosition && state.mousePosition.enabled
], (projectionDefs, map, mapType, layers, features, loadingError, securityToken, elevationEnabled) => ({
projectionDefs,
map,
mapType,
layers,
features,
loadingError,
securityToken
securityToken,
elevationEnabled
})
);
module.exports = {
Expand Down