Fix : #11455 Added a new Plugin called CameraPosition.#11514
Fix : #11455 Added a new Plugin called CameraPosition.#11514allyoucanmap merged 20 commits intogeosolutions-it:masterfrom
Conversation
| export default { | ||
| CameraPositionPlugin: Object.assign(CameraPositionPlugin, { | ||
| disablePluginIf: "{state('mapType') !== 'cesium'}" | ||
| }, | ||
| { | ||
| MapFooter: { name: 'cameraPosition', position: 3, target: 'right-footer', | ||
| priority: 1} | ||
| }) | ||
| }; |
There was a problem hiding this comment.
Please use the createPlugin function
web/client/actions/map.js
Outdated
| export function changeCameraPositionCrs(crs) { | ||
| return { | ||
| type: CHANGE_CAMERA_POSITION_CRS, | ||
| crs | ||
| }; | ||
| } | ||
|
|
||
| export function changeCameraPositionHeightType(heightType) { | ||
| return { | ||
| type: CHANGE_CAMERA_POSITION_HEIGHT_TYPE, | ||
| heightType | ||
| }; | ||
| } |
There was a problem hiding this comment.
I think this should be part of a new cameraposition state and not included inside the Map, this is valid for actions, reducers and selectors
| height: cameraPosition.height | ||
| height: cameraPosition.height, | ||
| crs: this.props.viewerOptions?.cameraPosition?.crs || "EPSG:4326", | ||
| heightType: this.props.viewerOptions?.cameraPosition?.heightType || 'Ellipsoidal' |
There was a problem hiding this comment.
Please remove all this change this should not be part of the Map state
| <ControlLabel style={{ margin: 0, fontWeight: 'normal', minWidth: 'max-content' }}> | ||
| {label} | ||
| </ControlLabel> | ||
| <FormControl | ||
| componentClass="select" | ||
| id={id} | ||
| value={crs} | ||
| onChange={launchNewCRSAction} | ||
| bsSize="small" | ||
| style={{ borderRadius: 4 }} |
| const availableHeightTypes = [ | ||
| { value: "Ellipsoidal", label: "Ellipsoidal" }, | ||
| { value: "MSL", label: "MSL" } | ||
| ]; | ||
|
|
||
| const filteredHeightTypes = filterAllowedHeight && filterAllowedHeight.length > 0 | ||
| ? availableHeightTypes.filter((height) => filterAllowedHeight.includes(height.value)) | ||
| : availableHeightTypes; |
There was a problem hiding this comment.
I think the filterAllowed... props are not clear so at least for the new configuration introduced in this PR we should avoid them. Please remove filterAllowedHeight
In this case it would be enough to override the full list with the availableHeightTypes as prop
"cfg": {
"availableHeightTypes": [
{ "value": "Ellipsoidal", label: "Ellipsoidal" },
{ "value": "MSL", label: "MSL" }
]
}
| /** | ||
| * CameraPosition Plugin is a plugin that shows the coordinate of the camera position in a selected crs along with the height above ellipsoid or mean sea level. | ||
| * it gets displayed into the mapFooter plugin | ||
| * @name CameraPosition | ||
| * @memberof plugins | ||
| * @class | ||
| * @prop {string} cfg.editCRS if true shows a combobox to select the crs of the camera position. | ||
| * @prop {string} cfg.showLabels if true shows the labels of the coordinates. | ||
| * @prop {string} cfg.showToggle if true shows a toggle button to enable/disable the plugin. | ||
| * @prop {boolean} cfg.showElevation shows elevation in Ellipsoidal or MSL in 3D map. | ||
| * @prop {function} cfg.elevationTemplate custom template to show the elevation if showElevation is true (default template shows the elevation number with no formatting) | ||
| * @prop {object[]} projectionDefs list of additional project definitions | ||
| * @prop {string[]} cfg.filterAllowedCRS list of allowed crs in the combobox list to used as filter for the one of retrieved proj4.defs() | ||
| * @prop {string[]} cfg.filterAllowedHeight list of allowed height type in the combobox list. Accepted values are "Ellipsoidal" and "MSL" | ||
| * @prop {object} cfg.additionalCRS additional crs added to the list. The label param is used after in the combobox. | ||
| * @example | ||
| * // If you want to add some crs you need to provide a definition and adding it in the additionalCRS property | ||
| * // Put the following lines at the first level of the localconfig | ||
| * { | ||
| * "projectionDefs": [{ | ||
| * "code": "EPSG:3003", | ||
| * "def": "+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl+towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m +no_defs", | ||
| * "extent": [1241482.0019, 973563.1609, 1830078.9331, 5215189.0853], | ||
| * "worldExtent": [6.6500, 8.8000, 12.0000, 47.0500] | ||
| * }] | ||
| * } | ||
| * @example | ||
| * // And configure the mouse position plugin as below: | ||
| * { | ||
| * "cfg": { | ||
| * "additionalCRS": { | ||
| * "EPSG:3003": { "label": "EPSG:3003" } | ||
| * }, | ||
| * "filterAllowedCRS": ["EPSG:4326", "EPSG:3857"] | ||
| * } | ||
| * } | ||
| * @example | ||
| * // to show elevation and (optionally) use a custom template configure the plugin this way: | ||
| * { | ||
| * "cfg": { | ||
| * ... | ||
| * "showElevation": true, | ||
| * "elevationTemplate": "{(function(elevation) {return 'myelev: ' + (elevation || 0);})}", | ||
| * ... | ||
| * } | ||
| * } | ||
| * @example | ||
| * // to filter the height type list configure the plugin this way: | ||
| * { | ||
| * "cfg": { | ||
| * ... | ||
| * "filterAllowedHeight": ["Ellipsoidal", "MSL"], | ||
| * ... | ||
| * } | ||
| * } | ||
| * @example | ||
| * // to show the crs and height type labels configure the plugin this way: | ||
| * { | ||
| * "cfg": { | ||
| * ... | ||
| * "showLabels": true, | ||
| * ... | ||
| * } | ||
| * } | ||
| * @example | ||
| * // to show the toggle button configure the plugin this way: | ||
| * { | ||
| * "cfg": { | ||
| * ... | ||
| * "showToggle": true, | ||
| * ... | ||
| * } | ||
| * } | ||
| * @example | ||
| * // to show the crs selector configure the plugin this way: | ||
| * { | ||
| * "cfg": { | ||
| * ... | ||
| * "editCRS": true, | ||
| * ... | ||
| * } | ||
| * } | ||
| */ |
There was a problem hiding this comment.
Please review the documentation based on requested changes
web/client/product/plugins.js
Outdated
| MediaEditorPlugin: toModulePlugin('MediaEditor', () => import(/* webpackChunkName: 'plugins/mediaEditor' */ '../plugins/MediaEditor')), | ||
| MetadataExplorerPlugin: toModulePlugin('MetadataExplorer', () => import(/* webpackChunkName: 'plugins/metadataExplorer' */ '../plugins/MetadataExplorer')), | ||
| MousePositionPlugin: toModulePlugin('MousePosition', () => import(/* webpackChunkName: 'plugins/mousePosition' */ '../plugins/MousePosition')), | ||
| CameraPositionPlugin: toModulePlugin('CameraPosition', () => import(/* webpackChunkName: 'plugins/cameraPosition' */ '../plugins/CameraPosition')), |
There was a problem hiding this comment.
Let's import this plugin without toModulePlugin
web/client/reducers/map.js
Outdated
| case CHANGE_CAMERA_POSITION_CRS: | ||
| return { | ||
| ...state, | ||
| viewerOptions: { | ||
| ...state.viewerOptions, | ||
| cameraPosition: { | ||
| ...state?.viewerOptions?.cameraPosition, | ||
| crs: action.crs | ||
| } | ||
| } | ||
| }; | ||
| case CHANGE_CAMERA_POSITION_HEIGHT_TYPE: | ||
| return { | ||
| ...state, | ||
| viewerOptions: { | ||
| ...state.viewerOptions, | ||
| cameraPosition: { | ||
| ...state?.viewerOptions?.cameraPosition, | ||
| heightType: action.heightType | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
as mentioned in previous comment this should be moved in a specific reducers
web/client/selectors/map.js
Outdated
| export const cameraPositionCrsSelector = (state) => state.map?.present?.viewerOptions?.cameraPosition.crs || 'EPSG:4326'; | ||
| export const cameraPositionHeightTypeSelector = (state) => state.map?.present?.viewerOptions?.cameraPosition.heightType || 'Ellipsoidal'; |
There was a problem hiding this comment.
as mentioned in previous comment this should be moved in a specific selector
web/client/selectors/map.js
Outdated
| export const mouseLeftDragListenerSelector = (state) => get(mapSelector(state), 'eventListeners.leftdrag', []); | ||
|
|
||
| export const isMouseMoveActiveSelector = (state) => !!mouseMoveListenerSelector(state).length; | ||
| export const isMouseLeftDragActiveSelector = (state) => !!mouseLeftDragListenerSelector(state).length; | ||
|
|
||
| export const isMouseMoveCoordinatesActiveSelector = (state) => mouseMoveListenerSelector(state).includes('mouseposition'); | ||
| export const isMouseLeftDragCoordinatesActiveSelector = (state) => mouseLeftDragListenerSelector(state).includes('cameraposition'); |
There was a problem hiding this comment.
What's the usage of these new selectors?
…x_cameraposition_11455
|
@ElenaGallo please test this new plugin on dev, thanks |
|
@anup after merging I noticed few thing to update:
Please open a new PR with the above changes, thanks |
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-11514-to-2026.01.xx
git worktree add --checkout .worktree/backport-11514-to-2026.01.xx backport-11514-to-2026.01.xx
cd .worktree/backport-11514-to-2026.01.xx
git reset --hard HEAD^
git cherry-pick -x 1dee3e81e7fd28a77722d9d00973cf6a00d30d38
git push --force-with-lease |

Description
This PR add new plugin called CameraPosition. In 3D mode it shows the camera position along with the height . The camera position plugin is now rendered in MapFooter. The following changes are made :
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
#11455
What is the new behavior?
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information
This plugin style needs to be further revised again after MapFooter refactor PR is merged . #11492