| | |
| | | value: '其他模型', |
| | | label: '其他模型' |
| | | }], |
| | | targetY: 0.0, |
| | | modelClip:false, |
| | | clippingPlanes:null, |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | // window.MXModel=null; |
| | | // } else { |
| | | var that = this; |
| | | if (window.model){ |
| | | that.modelClipping(); |
| | | }else { |
| | | var tileset = Viewer.scene.primitives.add( |
| | | new Cesium.Cesium3DTileset({ |
| | | name: res.cnName, |
| | | url: modelUrl+ "/tileset/m/SN/tileset.json", |
| | | maximumScreenSpaceError: 64, // 最大屏幕空间错误:16 |
| | | maximumMemoryUsage: 768, // 最大内存:512 |
| | | dynamicScreenSpaceError: true, // 减少离相机较远的屏幕空间错误:false |
| | | skipLevelOfDetail: true, // 在遍历时候跳过详情:false |
| | | }) |
| | | ); |
| | | tileset.readyPromise.then((tileset) => { |
| | | tileset.id = res.cnName; |
| | | tileset.layerId = res.id; |
| | | Viewer.flyTo(tileset); |
| | | that.modelClip = !that.modelClip; |
| | | if (that.modelClip){ |
| | | if (window.model){ |
| | | that.modelClipping(); |
| | | }); |
| | | window.model = tileset |
| | | } |
| | | else { |
| | | var tileset = Viewer.scene.primitives.add( |
| | | new Cesium.Cesium3DTileset({ |
| | | name: res.cnName, |
| | | url: modelUrl+ "/tileset/m/SN/tileset.json", |
| | | maximumScreenSpaceError: 64, // 最大屏幕空间错误:16 |
| | | maximumMemoryUsage: 768, // 最大内存:512 |
| | | dynamicScreenSpaceError: true, // 减少离相机较远的屏幕空间错误:false |
| | | skipLevelOfDetail: true, // 在遍历时候跳过详情:false |
| | | }) |
| | | ); |
| | | tileset.readyPromise.then((tileset) => { |
| | | tileset.id = res.cnName; |
| | | tileset.layerId = res.id; |
| | | Viewer.flyTo(tileset); |
| | | that.modelClipping(); |
| | | }); |
| | | window.model = tileset |
| | | } |
| | | } |
| | | else { |
| | | Viewer.entities.removeAll(); |
| | | } |
| | | // window.model = sgworld.Creator.create3DTilesets( |
| | | // "", |
| | |
| | | planes: [ // ClippingPlane对象数组集合 |
| | | new Cesium.ClippingPlane( // 裁切面 |
| | | new Cesium.Cartesian3(0.0, 0.0, -1.0), // 法线方向 |
| | | 0.0 // 原点到平面的最短距离,设置0就好 |
| | | 0// 原点到平面的最短距离,设置0就好 |
| | | ), |
| | | ], |
| | | enabled:true, |
| | | edgeWidth: 1.0, // 模型被裁切部分的截面线宽 |
| | | }); |
| | | let boundingSphere = window.model.boundingSphere; |
| | |
| | | }); |
| | | planeEntities.push(planeEntity); |
| | | } |
| | | this.clippingPlanes = clippingPlanes; |
| | | window.model.clippingPlanes = clippingPlanes; |
| | | |
| | | // Select plane when mouse down |