This commit is contained in:
2025-09-23 14:38:08 +08:00
parent 783de5cb7a
commit 16a04a9a90
8 changed files with 125 additions and 63 deletions

View File

@ -2,7 +2,7 @@ import Tools from "../../../Tools";
class Section extends Tools {
/**
* @constructor 剖切
* @param sdk
* @param sdk
* @param tiles3d {object} 3dtiles对象
* @param {Array.<object>} options.positions 经纬度[{lon,lat,alt},...]
* @param options.regionsType=false 裁剪类型 false:裁剪内部true:裁剪外部
@ -17,6 +17,7 @@ class Section extends Tools {
this.options.regionsType = this.options.regionsType || false
YJ.Analysis.SectionResults.push(this)
this.Planes = []
this.tools = new Tools();
Section.start(this)
}
@ -33,12 +34,13 @@ class Section extends Tools {
static start(that) {
let positions = that.options.positions || []
if(!that.isConvex(positions)) {
window.ELEMENT && window.ELEMENT.Message({
message: '不支持凹多边形',
type: 'warning',
duration: 1500
});
if (!that.isConvex(positions)) {
// window.ELEMENT && window.ELEMENT.Message({
// message: '不支持凹多边形',
// type: 'warning',
// duration: 1500
// });
that.tools.message({ type: 'warning', text: '不支持凹多边形' })
console.log('不支持凹多边形')
return
}
@ -87,13 +89,13 @@ class Section extends Tools {
}
}
if(that.tiles3d.clippingPlanes) {
if (that.tiles3d.clippingPlanes) {
that.tiles3d.clippingPlanes.removeAll()
for(let i=0;i<that.Planes.length;i++) {
for (let i = 0; i < that.Planes.length; i++) {
that.tiles3d.clippingPlanes.add(that.Planes[i])
}
that.tiles3d.clippingPlanes.enabled = true
}
else {
const PlaneCollection = new Cesium.ClippingPlaneCollection({
@ -135,11 +137,11 @@ class Section extends Tools {
destroy() {
this.Planes = []
// this.tiles3d.clippingPlanes = new Cesium.ClippingPlaneCollection()
if(this.tiles3d.clippingPlanes) {
if (this.tiles3d.clippingPlanes) {
this.tiles3d.clippingPlanes.enabled = false
this.tiles3d.clippingPlanes.removeAll()
}
}
}
export default Section;
export default Section;