Skip to content

Fix #11258 :For clipping/masking 3D tiles and terrain removed ClippingPlaneCollection and introduced ClippingPolygonCollection#11352

Merged
allyoucanmap merged 5 commits intogeosolutions-it:masterfrom
anup39:fix_tileclipping3d_11258
Aug 28, 2025
Merged

Fix #11258 :For clipping/masking 3D tiles and terrain removed ClippingPlaneCollection and introduced ClippingPolygonCollection#11352
allyoucanmap merged 5 commits intogeosolutions-it:masterfrom
anup39:fix_tileclipping3d_11258

Conversation

@anup39
Copy link
Copy Markdown
Member

@anup39 anup39 commented Jul 23, 2025

Description

Since the update to Cesium 1.131.0 (latest stable version), support for clipping 3D Tiles using polygons has been introduced.
This significantly reduces the effort compared to our previous approach, where we manually created clipping planes from positions and had to carefully align them with the 3D Tiles by updating their transformation.
Internally, ClippingPolygon also generates clipping planes, but this implementation is more efficient and streamlined.

  • Removed ClippingPlaneCollection and added ClippingPolygonCollection for clipping/masking 3D tiles.
  • Removed ClippingPlaneCollection and added ClippingPolygonCollection for clipping/masking terrain.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Minor changes to existing features

Issue

What is the current behavior?

#11258

What is the new behavior?

Clip
Screenshot 2025-07-23 at 19 29 09

Clip Inverse
Screenshot 2025-07-23 at 19 29 52

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • No

Other useful information

…eCollection and introduced ClippingPolygonCollection
@anup39 anup39 added this to the 2025.02.00 milestone Jul 23, 2025
@anup39 anup39 self-assigned this Jul 23, 2025
@anup39 anup39 added enhancement 3D All issues related to the 3D rendering in CesiumJs labels Jul 23, 2025
@anup39 anup39 linked an issue Jul 23, 2025 that may be closed by this pull request
1 task
@tdipisa tdipisa requested a review from allyoucanmap July 24, 2025 08:12
@anup39 anup39 changed the title Fix #11258 :For clipping/masking 3D tiles removed ClippingPlaneCollection and introduced ClippingPolygonCollection Fix #11258 :For clipping/masking 3D tiles and terrain removed ClippingPlaneCollection and introduced ClippingPolygonCollection Jul 28, 2025
@anup39
Copy link
Copy Markdown
Member Author

anup39 commented Jul 28, 2025

@allyoucanmap As discussed, I have changed the logic of clipping terrain with ClippingPolygonCollection .

import isNaN from 'lodash/isNaN';
import { getProxyUrl } from "../../../../utils/ProxyUtils";
import { getStyleParser } from '../../../../utils/VectorStyleUtils';
import { polygonToClippingPlanes } from '../../../../utils/cesium/PrimitivesUtils';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if polygonToClippingPlanes is not used anymore, if that the case remove it, all the dependent private function not used anymore and related unit tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +66 to +78
const polygons = [];
const geojson_ = options.clippingPolygon;
const coordinates_ = geojson_?.geometry?.coordinates?.[0] || []; // Outer ring for the polygon
if (coordinates_.length > 0) {
const positions = coordinates_.map((coord) => {
const [lng, lat, height = 0] = coord;
return Cesium.Cartesian3.fromDegrees(lng, lat, height);
});
const clippingPolygon = new Cesium.ClippingPolygon({
positions: positions
});
polygons.push(clippingPolygon);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possoble to create a utils function to centralize common logic between 3D Tiles and Globe (eg. polygons computation from the GeoJSON)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

anup39 added 2 commits August 26, 2025 19:25
…pletely the usage of clippingPlaneCollection and related dependencies
@anup39 anup39 requested a review from allyoucanmap August 26, 2025 13:46
@allyoucanmap allyoucanmap merged commit c25da52 into geosolutions-it:master Aug 28, 2025
6 checks passed
@allyoucanmap
Copy link
Copy Markdown
Contributor

@ElenaGallo please test this improvement on dev, thanks

dsuren1 added a commit to dsuren1/MapStore2 that referenced this pull request Sep 9, 2025
…tinerary

* commit 'ea419127df12f794a56f234f5660632511df7484':
  Update README.md
  Proj4 upgrade and include support for "Grid Based Datum Adjustments" geosolutions-it#11423 (geosolutions-it#11424)
  Bom versions for maven-war-plugin in all POMs.xml (geosolutions-it#11413)
  Fix geosolutions-it#11419 fixed group translation files (geosolutions-it#11420)
  Update geoserver.md (geosolutions-it#11399)
  Bump org.apache.tomcat:tomcat-coyote from 9.0.105 to 9.0.108 in /binary (geosolutions-it#11384)
  Update on the Swedish translation file for MapStore (geosolutions-it#11412)
  Fix geosolutions-it#11258 :For clipping/masking 3D tiles and terrain removed ClippingPlaneCollection and introduced ClippingPolygonCollection (geosolutions-it#11352)
  Fix : geosolutions-it#11400 Added quickFilters also  when exporting data from TableWidget (geosolutions-it#11401)
  Fix geosolutions-it#11404 Problem with user permissions still involving the "Save As" (geosolutions-it#11408)
  Fix geosolutions-it#11406 Pending changes prompt shows up after save as (geosolutions-it#11407)
  Fix geosolutions-it#11374 Improve the Street Smart plugin view for 3D maps visualization (geosolutions-it#11375)
  Update i18n showEmptyMessageGFI (geosolutions-it#11392)
  geosolutions-it#11369: Enhance non hyperlink query field to have spacing (geosolutions-it#11370)
  Bump org.apache.tomcat:tomcat-util from 9.0.105 to 9.0.107 in /binary (geosolutions-it#11305)
  chore: Remove element-closest dependency (geosolutions-it#11251)
  Fix the widget support for the WFS layer with no geom (geosolutions-it#11379)
  Support of widget in map even when layer have no geometry and fix time dependencies for the widget (geosolutions-it#11377)
  Performace Lag when there is a layer with very large geomerty geosolutions-it#11358 (geosolutions-it#11359)
  skip click on layer should return intersected features test on Cesium tests (geosolutions-it#11365)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3D All issues related to the 3D rendering in CesiumJs enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve 3D Tiles clipping

4 participants