forked from geosolutions-it/MapStore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geosolutions-it#9830: Support for IFC as a further 3D model
Description: - Creating ModelTransformation component that handle moving the model center via display TOC settings for 'model' layers - Add translations - Handle show/hide the model layers via TOC - Handle logic on show/hide 'model' layers based on max/min scale in display TOC settings
- Loading branch information
1 parent
67e3f34
commit 7adaf68
Showing
11 changed files
with
196 additions
and
80 deletions.
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
108 changes: 108 additions & 0 deletions
108
web/client/components/TOC/fragments/settings/ModelTransformation.jsx
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
|
||
/* | ||
* Copyright 2023, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FormGroup, ControlLabel, InputGroup } from 'react-bootstrap'; | ||
import DebouncedFormControl from '../../../misc/DebouncedFormControl'; | ||
import Message from '../../../I18N/Message'; | ||
|
||
/** | ||
* ModelTransformation. This component shows the model transformation options available | ||
* @prop {object} layer the layer options | ||
* @prop {object} onChange callback on every on change event | ||
*/ | ||
function ModelTransformation({ | ||
layer, | ||
onChange | ||
}) { | ||
if (layer?.type !== 'model') { | ||
return null; | ||
} | ||
return ( | ||
<div style={{ margin: '0 -8px' }}> | ||
<FormGroup className="form-group-flex"> | ||
<ControlLabel><Message msgId="layerProperties.modelCenterLat"/></ControlLabel> | ||
<InputGroup style={{ maxWidth: 210 }}> | ||
<DebouncedFormControl | ||
type="number" | ||
name={"modelCenterLat"} | ||
value={layer?.center?.[1] || 0} | ||
fallbackValue={0} | ||
onChange={(val)=> { | ||
const newCenter = [ | ||
layer?.center?.[0] ?? 0, | ||
val !== undefined | ||
? parseFloat(val) : 0, | ||
layer?.center?.[2] ?? 0 | ||
]; | ||
onChange('center', newCenter); | ||
}} | ||
/> | ||
<InputGroup.Addon>DD</InputGroup.Addon> | ||
</InputGroup> | ||
</FormGroup> | ||
<FormGroup className="form-group-flex"> | ||
<ControlLabel><Message msgId="layerProperties.modelCenterLng"/></ControlLabel> | ||
<InputGroup style={{ maxWidth: 210 }}> | ||
<DebouncedFormControl | ||
type="number" | ||
name={"modelCenterLng"} | ||
value={layer?.center?.[0] || 0} | ||
fallbackValue={0} | ||
onChange={(val)=> { | ||
const newCenter = [ | ||
val !== undefined | ||
? parseFloat(val) : 0, | ||
layer?.center?.[1] ?? 0, | ||
layer?.center?.[2] ?? 0 | ||
]; | ||
onChange('center', newCenter); | ||
}} | ||
/> | ||
<InputGroup.Addon>DD</InputGroup.Addon> | ||
</InputGroup> | ||
</FormGroup> | ||
<FormGroup className="form-group-flex"> | ||
<ControlLabel><Message msgId="layerProperties.heightOffset"/></ControlLabel> | ||
<InputGroup style={{ maxWidth: 120 }}> | ||
<DebouncedFormControl | ||
type="number" | ||
name={"heightOffset"} | ||
value={layer?.center?.[2] || 0} | ||
fallbackValue={0} | ||
onChange={(val)=> { | ||
const newCenter = [ | ||
layer?.center?.[0] ?? 0, | ||
layer?.center?.[1] ?? 0, | ||
val !== undefined | ||
? parseFloat(val) : 0 | ||
]; | ||
onChange('center', newCenter); | ||
}} | ||
/> | ||
<InputGroup.Addon>m</InputGroup.Addon> | ||
</InputGroup> | ||
</FormGroup> | ||
</div> | ||
); | ||
} | ||
|
||
ModelTransformation.propTypes = { | ||
layer: PropTypes.object, | ||
onChange: PropTypes.func | ||
}; | ||
|
||
ModelTransformation.defaultProps = { | ||
layer: {}, | ||
onChange: () => {} | ||
}; | ||
|
||
export default ModelTransformation; |
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
Oops, something went wrong.