diff --git a/src/pages/views/WatershedOneMap/modalPart/legend.vue b/src/pages/views/WatershedOneMap/modalPart/legend.vue index b9a5284..481c94d 100644 --- a/src/pages/views/WatershedOneMap/modalPart/legend.vue +++ b/src/pages/views/WatershedOneMap/modalPart/legend.vue @@ -970,15 +970,15 @@ id: 'HXHGBZOUT', url: '/3dtiles/与数公基平台对接3dtiles/黄孝河钢坝闸——out/tileset.json', }); - newfiberMap.loadCesium3DTileSet({ + newfiberMap.loadCesium3DTileSetBuilding({ id: 'jianzhu5', url: '/models-rest/rest/models/preview/CIM3-5/tileset.json', }); - newfiberMap.loadCesium3DTileSet({ + newfiberMap.loadCesium3DTileSetBuilding({ id: 'jianzhu7', url: '/models-rest/rest/models/preview/CIM3-7/tileset.json', }); - newfiberMap.loadCesium3DTileSet({ + newfiberMap.loadCesium3DTileSetBuilding({ id: 'jianzhu8', url: '/models-rest/rest/models/preview/CIM3-8/tileset.json', }); diff --git a/src/pages/views/WatershedOneMap/modalPart/legend.vue b/src/pages/views/WatershedOneMap/modalPart/legend.vue index b9a5284..481c94d 100644 --- a/src/pages/views/WatershedOneMap/modalPart/legend.vue +++ b/src/pages/views/WatershedOneMap/modalPart/legend.vue @@ -970,15 +970,15 @@ id: 'HXHGBZOUT', url: '/3dtiles/与数公基平台对接3dtiles/黄孝河钢坝闸——out/tileset.json', }); - newfiberMap.loadCesium3DTileSet({ + newfiberMap.loadCesium3DTileSetBuilding({ id: 'jianzhu5', url: '/models-rest/rest/models/preview/CIM3-5/tileset.json', }); - newfiberMap.loadCesium3DTileSet({ + newfiberMap.loadCesium3DTileSetBuilding({ id: 'jianzhu7', url: '/models-rest/rest/models/preview/CIM3-7/tileset.json', }); - newfiberMap.loadCesium3DTileSet({ + newfiberMap.loadCesium3DTileSetBuilding({ id: 'jianzhu8', url: '/models-rest/rest/models/preview/CIM3-8/tileset.json', }); diff --git a/src/utils/gis/NewfiberMap.js b/src/utils/gis/NewfiberMap.js index c73f192..3c3475f 100644 --- a/src/utils/gis/NewfiberMap.js +++ b/src/utils/gis/NewfiberMap.js @@ -177,12 +177,84 @@ // a // ); } + //添加3Dtiles建筑模型 + async loadCesium3DTileSetBuilding(e = {}) { + let { url: o, id: a = _.uniqueId(), style: l = {}, show: i = !0, customShader: s = void 0 } = e; + const tileset = await Cesium.Cesium3DTileset.fromUrl(o, { + url: o, + show: i, + customShader: s, + shadows: !1, + skipLevelOfDetail: !0, + baseScreenSpaceError: 1024, + maximumScreenSpaceError: 64, + skipScreenSpaceErrorFactor: 16, + skipLevels: 1, + immediatelyLoadDesiredLevelOfDetail: !1, + loadSiblings: !1, + cullWithChildrenBounds: !0, + cullRequestsWhileMoving: !0, + cullRequestsWhileMovingMultiplier: 10, + preloadWhenHidden: !0, + preloadFlightDestinations: !0, + preferLeaves: !0, + maximumMemoryUsage: 1024, + progressiveResolutionHeightFraction: 0.5, + dynamicScreenSpaceErrorDensity: 1, + dynamicScreenSpaceErrorFactor: 4, + dynamicScreenSpaceErrorHeightFalloff: 0.25, + foveatedScreenSpaceError: !0, + foveatedConeSize: 0.1, + foveatedMinimumScreenSpaceErrorRelaxation: 0, + foveatedTimeDelay: 0, + luminanceAtZenith: 0, + backFaceCulling: !0, + debugFreezeFrame: !1, + debugColorizeTiles: !1, + debugWireframe: !1, + debugShowBoundingVolume: !1, + debugShowContentBoundingVolume: !1, + debugShowViewerRequestVolume: !1, + debugShowGeometricError: !1, + debugShowRenderingStatistics: !1, + debugShowMemoryUsage: !1, + debugShowUrl: !1, + dynamicScreenSpaceError: !0, + }); + this.map.scene.primitives.add(tileset); + var boundingSphere = tileset.boundingSphere; + var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center); + var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0); + var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 20); + var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3()); + tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); + //不能每个模型都跳一此,首次缩放改为所选的回调 + // this.map.zoomTo(tileset) + + // return ( + // (e.key = a), + // e.readyPromise.then(function (e) { + // var t = Cesium.Cartographic.fromCartesian(e.boundingSphere.center), + // o = Cesium.Cartesian3.fromRadians(t.longitude, t.latitude, 0); + // let a = Cesium.Cartesian3.fromRadians(t.longitude, t.latitude, 0); + // t = Cesium.Cartesian3.subtract(a, o, new Cesium.Cartesian3()); + // (e.modelMatrix = Cesium.Matrix4.fromTranslation(t)), + // l.color && + // (e.style = new Cesium.Cesium3DTileStyle({ + // color: { + // conditions: [['true', l.color]], + // }, + // })), + // l.isEffects && e.tileVisible.addEventListener(r.modelEffect); + // }), + // a + // ); + } /**由经纬度拼接geojson * */ getgeojson(data) { - let arr = []; if (data.length > 0) { for (var i = 0; i < data.length; i++) {