Commit 65d739c4 by wanghao

同步代码

parent cd6fe1b3
......@@ -873,7 +873,6 @@
"name": "合肥市区",
"url": "{dataServer}/3dtiles/jzw-hefei/tileset.json",
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"marsJzwStyle": true,
"highlight": { "type": "click", "color": "#FFFF00" },
"popup": [
......@@ -890,7 +889,6 @@
"name": "上海市区",
"url": "{dataServer}/3dtiles/jzw-shanghai/tileset.json",
"maximumScreenSpaceError": 4,
"maximumMemoryUsage": 1024,
"style": {
"color": {
"conditions": [
......@@ -971,7 +969,6 @@
"position": { "lng": 117.096906, "lat": 31.851564, "alt": 45 },
"rotation": { "z": 17.5 },
"maximumScreenSpaceError": 16,
"maximumMemoryUsage": 1024,
"skipLevelOfDetail": true,
"loadSiblings": true,
"cullRequestsWhileMoving": true,
......@@ -995,7 +992,6 @@
"position": { "lng": 117.215457, "lat": 31.843363, "alt": -3.6 },
"rotation": { "z": 336.7 },
"maximumScreenSpaceError": 2,
"maximumMemoryUsage": 1024,
"highlight": { "type": "click", "color": "#00FF00" },
"popup": "all",
"center": { "lat": 31.838821, "lng": 117.216402, "alt": 461, "heading": 0, "pitch": -46 },
......@@ -1009,7 +1005,6 @@
"url": "{dataServer}/3dtiles/max-shihua/tileset.json",
"position": { "lng": 117.077158, "lat": 31.659116, "alt": 24.6 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"highlight": { "type": "click", "color": "#00FF00" },
"popup": "all",
"scenetree": "scenetree.json",
......@@ -1046,7 +1041,6 @@
"url": "{dataServer}/3dtiles/max-fsdzm/tileset.json",
"position": { "alt": 15.2 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"center": { "lat": 29.792675, "lng": 121.480207, "alt": 190.8, "heading": 196.1, "pitch": -49 }
},
{ "id": 2030, "pid": 20, "name": "倾斜摄影", "type": "group" },
......@@ -1058,7 +1052,6 @@
"url": "{dataServer}/3dtiles/qx-shequ/tileset.json",
"position": { "alt": 11.5 },
"maximumScreenSpaceError": 2,
"maximumMemoryUsage": 2048,
"dynamicScreenSpaceError": true,
"cullWithChildrenBounds": false,
"center": { "lat": 28.440864, "lng": 119.486477, "alt": 588.23, "heading": 268.6, "pitch": -37.8 },
......@@ -1073,7 +1066,6 @@
"url": "{dataServer}/3dtiles/qx-teh/tileset.json",
"position": { "lng": 117.218434, "lat": 31.81807, "alt": 163 },
"maximumScreenSpaceError": 16,
"maximumMemoryUsage": 1024,
"dynamicScreenSpaceError": true,
"cullWithChildrenBounds": false,
"skipLevelOfDetail": true,
......@@ -1087,7 +1079,6 @@
"url": "{dataServer}/3dtiles/qx-dyt/tileset.json",
"position": { "alt": -27 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"center": { "lat": 34.215516, "lng": 108.960251, "alt": 834, "heading": 4, "pitch": -48 },
"flat": {
"enabled": true,
......@@ -1129,7 +1120,6 @@
"url": "{dataServer}/3dtiles/qx-simiao/tileset.json",
"position": { "alt": 80.6 },
"maximumScreenSpaceError": 2,
"maximumMemoryUsage": 2048,
"dynamicScreenSpaceError": true,
"cullWithChildrenBounds": false,
"skipLevelOfDetail": true,
......
......@@ -8,7 +8,6 @@
"name": "合肥市区",
"url": "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"marsJzwStyle": true,
"highlight": { "type": "click", "color": "#FFFF00" },
"popup": [
......@@ -24,7 +23,6 @@
"name": "合肥市区2",
"url": "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"style": {
"color": {
"conditions": [["true", "color('rgba(42, 160, 224, 1)')"]]
......@@ -46,7 +44,6 @@
"name": "上海市区",
"url": "//data.mars3d.cn/3dtiles/jzw-shanghai/tileset.json",
"maximumScreenSpaceError": 4,
"maximumMemoryUsage": 1024,
"style": {
"color": {
"conditions": [
......@@ -112,7 +109,6 @@
"position": { "lng": 117.203994, "lat": 31.857999, "alt": 28.9 },
"rotation": { "z": 168.1 },
"maximumScreenSpaceError": 8,
"maximumMemoryUsage": 2048,
"skipLevelOfDetail": true,
"loadSiblings": true,
"cullRequestsWhileMoving": true,
......@@ -135,7 +131,6 @@
"position": { "lng": 117.096906, "lat": 31.851564, "alt": 45 },
"rotation": { "z": 17.5 },
"maximumScreenSpaceError": 16,
"maximumMemoryUsage": 1024,
"skipLevelOfDetail": true,
"loadSiblings": true,
"cullRequestsWhileMoving": true,
......@@ -156,7 +151,6 @@
"name": "居民楼(分层分户)",
"url": "//data.mars3d.cn/3dtiles/max-fcfh/tileset.json",
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"highlight": { "type": "click", "color": "#00FF00" },
"popup": "all",
"scenetree": "scenetree.json",
......@@ -170,7 +164,6 @@
"position": { "lng": 117.094224, "lat": 31.815859, "alt": 26.4 },
"rotation": { "z": 116.2 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"highlight": { "type": "click", "color": "#00FF00" },
"popup": "all",
"scenetree": "scenetree.json",
......@@ -185,7 +178,6 @@
"position": { "lng": 117.215457, "lat": 31.843363, "alt": -3.6 },
"rotation": { "z": 336.7 },
"maximumScreenSpaceError": 2,
"maximumMemoryUsage": 1024,
"highlight": { "type": "click", "color": "#ffff00" },
"popup": "all",
"center": { "lat": 31.838821, "lng": 117.216402, "alt": 461, "heading": 0, "pitch": -46 },
......@@ -199,7 +191,6 @@
"url": "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
"position": { "lng": 117.077158, "lat": 31.659116, "alt": 24.6 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"highlight": { "type": "click", "color": "#00FF00" },
"popup": "all",
"scenetree": "scenetree.json",
......@@ -236,7 +227,6 @@
"url": "//data.mars3d.cn/3dtiles/max-fsdzm/tileset.json",
"position": { "alt": 15.2 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"center": { "lat": 29.792675, "lng": 121.480207, "alt": 190.8, "heading": 196.1, "pitch": -49 }
},
{ "id": 2030, "pid": 20, "name": "倾斜摄影", "type": "group" },
......@@ -247,7 +237,6 @@
"url": "//data.mars3d.cn/3dtiles/qx-dyt/tileset.json",
"position": { "alt": -27 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"center": {
"lat": 34.214367,
"lng": 108.959067,
......@@ -291,8 +280,7 @@
"name": "校园",
"url": "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
"position": { "alt": 15.8 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024
"maximumScreenSpaceError": 1
}
]
},
......@@ -304,7 +292,6 @@
"url": "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
"position": { "alt": -24 },
"maximumScreenSpaceError": 1,
"maximumMemoryUsage": 1024,
"center": { "lat": 31.841523, "lng": 117.205761, "alt": 166, "heading": 1, "pitch": -33 }
},
{
......@@ -315,7 +302,6 @@
"url": "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
"position": { "alt": 11.5 },
"maximumScreenSpaceError": 2,
"maximumMemoryUsage": 2048,
"dynamicScreenSpaceError": true,
"cullWithChildrenBounds": false,
"center": { "lat": 28.440864, "lng": 119.486477, "alt": 588.23, "heading": 268.6, "pitch": -37.8 },
......@@ -329,7 +315,6 @@
"url": "//data.mars3d.cn/3dtiles/qx-teh/tileset.json",
"position": { "lng": 117.218434, "lat": 31.81807, "alt": 163 },
"maximumScreenSpaceError": 16,
"maximumMemoryUsage": 1024,
"dynamicScreenSpaceError": true,
"cullWithChildrenBounds": false,
"skipLevelOfDetail": true,
......@@ -371,7 +356,6 @@
"url": "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
"position": { "alt": 80.6 },
"maximumScreenSpaceError": 2,
"maximumMemoryUsage": 2048,
"dynamicScreenSpaceError": true,
"cullWithChildrenBounds": false,
"skipLevelOfDetail": true,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.106.1
* Version 1.107
*
* Copyright 2011-2022 Cesium Contributors
*
......
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.106.1
* Version 1.107
*
* Copyright 2011-2022 Cesium Contributors
*
......
/**
* @license
* Cesium - https://github.com/CesiumGS/cesium
* Version 1.106.1
* Version 1.107
*
* Copyright 2011-2022 Cesium Contributors
*
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* Mars3D三维可视化平台 mars3d
*
* 版本信息:v3.5.14
* 编译日期:2023-07-03 18:40:07
* 版本信息:v3.5.15
* 编译日期:2023-07-10 19:15:42
* 版权所有:Copyright by 火星科技 http://mars3d.cn
* 使用单位:免费公开版 ,2023-03-17
*/
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("mars3d")):"function"==typeof define&&define.amd?define(["exports","mars3d"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["mars3d-supermap"]={},e.mars3d)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,t}var o=r(t);const s=o.Cesium,i=o.layer.BaseLayer;class a extends i{get layer(){return this._layerArr}get s3mOptions(){return this.options.s3mOptions}set s3mOptions(e){for(const t in e){let r=e[t];this.options.s3mOptions[t]=r,"transparentBackColor"===t?r=s.Color.fromCssColorString(r):"transparentBackColorTolerance"===t&&(r=Number(r));for(let e=0;e<this._layerArr.length;e++){const o=this._layerArr[e];null!=o&&(o[t]=r)}}}_showHook(e){this.eachLayer((t=>{t.visible=e,t.show=e}),this)}_mountedHook(){if(!this._map.scene.open)throw new Error("请引入 超图版本Cesium库 或 超图S3M插件 ");const e=this._map.getCameraView();let t;t=this.options.layername?this._map.scene.addS3MTilesLayerByScp(this.options.url,{name:this.options.layername,autoSetView:this.options.flyTo,cullEnabled:this.options.cullEnabled}):this._map.scene.open(this.options.url,this.options.sceneName,{autoSetView:this.options.flyTo}),t.then((t=>{Array.isArray(t)?this._layerArr=t:this._layerArr=[t];for(let e=0;e<this._layerArr.length;e++){const t=this._layerArr[e];if(t)try{this._initModelItem(t)}catch(e){o.Log.logError("s3m图层初始化出错",e)}}this._showHook(this.show),this.options.flyTo?this.flyToByAnimationEnd():!1===this.options.flyTo&&this._map.setCameraView(e,{duration:0}),this._readyPromise.resolve(this),this.fire(o.EventType.load,{layers:this._layerArr})}),(e=>{var t;null!==(t=this._readyPromise)&&void 0!==t&&t.reject&&this._readyPromise.reject(e)}))}_initModelItem(e){var t,r;if(this.options.s3mOptions)for(const t in this.options.s3mOptions){const r=this.options.s3mOptions[t];e[t]="transparentBackColor"===t?s.Color.fromCssColorString(r):"transparentBackColorTolerance"===t?Number(r):r}this.options.highlight&&(e.selectedColor=o.Util.getColorByStyle(this.options.highlight)),null!==(t=this.options)&&void 0!==t&&null!==(r=t.position)&&void 0!==r&&r.alt&&(e.style3D.altitudeMode=s.HeightReference.NONE,e.style3D.bottomAltitude=this.options.position.alt,e.refresh&&e.refresh())}_addedHook(){this._showHook(this.show)}_removedHook(){this._showHook(!1)}eachLayer(e,t){if(this._layerArr)return this._layerArr.forEach((r=>{e.call(t,r)})),this}setOpacity(e){this.eachLayer((t=>{t.style3D.fillForeColor.alpha=e}),this)}flyTo(e={}){return this.options.center?this._map.setCameraView(this.options.center,e):this.options.extent?this._map.flyToExtent(this.options.extent,e):void 0}}o.layer.S3MLayer=a,o.LayerUtil.register("supermap_s3m",a);const n=o.Cesium,l=o.layer.BaseTileLayer;class h extends l{async _createImageryProvider(e){return await p(e)}_addedHook(){super._addedHook(),n.defined(this.options.transparentBackColor)&&(this._imageryLayer.transparentBackColor=o.Util.getCesiumColor(this.options.transparentBackColor),this._imageryLayer.transparentBackColorTolerance=this.options.transparentBackColorTolerance)}}async function p(e){return(e=o.LayerUtil.converOptions(e)).url instanceof n.Resource&&(e.url=e.url.url),n.defined(e.transparentBackColor)&&(delete e.transparentBackColor,delete e.transparentBackColorTolerance),new n.SuperMapImageryProvider(e)}h.createImageryProvider=p,o.layer.SmImgLayer=h;const c="supermap_img";o.LayerUtil.register(c,h),o.LayerUtil.registerImageryProvider(c,p);const y=o.Cesium,m=o.layer.BaseLayer;class d extends m{get layer(){return this._mvtLayer}_mountedHook(){this._mvtLayer=this._map.scene.addVectorTilesMap({viewer:this._map.viewer,canvasWidth:512,...this.options});const e=this._map.scene,t=new y.ScreenSpaceEventHandler(e.canvas);t.setInputAction((t=>{if(!this.show)return;const r=o.PointUtil.getCurrentMousePosition(e,t.position);this._mvtLayer.queryRenderedFeatures([r],{}).reduce(((e,s)=>{const i=s.feature.properties;if(!i)return;const a=o.Util.getPopupForConfig(this.options,i),n={data:i,event:t};this._map.openPopup(r,a,n)}))}),y.ScreenSpaceEventType.LEFT_CLICK),this.handler=t}_addedHook(){this._mvtLayer.show=!0}_removedHook(){this._mvtLayer&&(this._mvtLayer.show=!1)}setOpacity(e){this._mvtLayer&&(this._mvtLayer.alpha=parseFloat(e))}flyTo(e={}){return this.options.center?this._map.setCameraView(this.options.center,e):this.options.extent?this._map.flyToExtent(this.options.extent,e):this._mvtLayer?this._map.camera.flyTo({...e,destination:this._mvtLayer.rectangle}):Promise.resolve(!1)}}o.layer.SmMvtLayer=d,o.LayerUtil.register("supermap_mvt",d),e.S3MLayer=a,e.SmImgLayer=h,e.SmMvtLayer=d,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("mars3d")):"function"==typeof define&&define.amd?define(["exports","mars3d"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["mars3d-supermap"]={},e.mars3d)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,t}var o=r(t);const s=o.Cesium,i=o.layer.BaseLayer;class a extends i{get layer(){return this._layerArr}get s3mOptions(){return this.options.s3mOptions}set s3mOptions(e){for(const t in e){let r=e[t];this.options.s3mOptions[t]=r,"transparentBackColor"===t?r=s.Color.fromCssColorString(r):"transparentBackColorTolerance"===t&&(r=Number(r));for(let e=0;e<this._layerArr.length;e++){const o=this._layerArr[e];null!=o&&(o[t]=r)}}}_showHook(e){this.eachLayer((t=>{t.visible=e,t.show=e}),this)}_mountedHook(){if(!this._map.scene.open)throw new Error("请引入 超图版本Cesium库 或 超图S3M插件 ");const e=this._map.getCameraView();let t;t=this.options.layername?this._map.scene.addS3MTilesLayerByScp(this.options.url,{name:this.options.layername,autoSetView:this.options.flyTo,cullEnabled:this.options.cullEnabled}):this._map.scene.open(this.options.url,this.options.sceneName,{autoSetView:this.options.flyTo}),t.then((t=>{Array.isArray(t)?this._layerArr=t:this._layerArr=[t];for(let e=0;e<this._layerArr.length;e++){const t=this._layerArr[e];if(t)try{this._initModelItem(t)}catch(e){o.Log.logError("s3m图层初始化出错",e)}}this._showHook(this.show),this.options.flyTo?this.flyToByAnimationEnd():!1===this.options.flyTo&&this._map.setCameraView(e,{duration:0}),this._readyPromise.resolve(this),this.fire(o.EventType.load,{layers:this._layerArr})}),(e=>{var t;null!==(t=this._readyPromise)&&void 0!==t&&t.reject&&this._readyPromise.reject(e)}))}_initModelItem(e){var t;if(this.options.s3mOptions)for(const t in this.options.s3mOptions){const r=this.options.s3mOptions[t];e[t]="transparentBackColor"===t?s.Color.fromCssColorString(r):"transparentBackColorTolerance"===t?Number(r):r}this.options.highlight&&(e.selectedColor=o.Util.getColorByStyle(this.options.highlight)),null!==(t=this.options)&&void 0!==t&&null!==(t=t.position)&&void 0!==t&&t.alt&&(e.style3D.altitudeMode=s.HeightReference.NONE,e.style3D.bottomAltitude=this.options.position.alt,e.refresh&&e.refresh())}_addedHook(){this._showHook(this.show)}_removedHook(){this._showHook(!1)}eachLayer(e,t){if(this._layerArr)return this._layerArr.forEach((r=>{e.call(t,r)})),this}setOpacity(e){this.eachLayer((t=>{t.style3D.fillForeColor.alpha=e}),this)}flyTo(e={}){return this.options.center?this._map.setCameraView(this.options.center,e):this.options.extent?this._map.flyToExtent(this.options.extent,e):void 0}}o.layer.S3MLayer=a,o.LayerUtil.register("supermap_s3m",a);const n=o.Cesium,l=o.layer.BaseTileLayer;class h extends l{async _createImageryProvider(e){return await p(e)}_addedHook(){super._addedHook(),n.defined(this.options.transparentBackColor)&&(this._imageryLayer.transparentBackColor=o.Util.getCesiumColor(this.options.transparentBackColor),this._imageryLayer.transparentBackColorTolerance=this.options.transparentBackColorTolerance)}}async function p(e){return(e=o.LayerUtil.converOptions(e)).url instanceof n.Resource&&(e.url=e.url.url),n.defined(e.transparentBackColor)&&(delete e.transparentBackColor,delete e.transparentBackColorTolerance),new n.SuperMapImageryProvider(e)}h.createImageryProvider=p,o.layer.SmImgLayer=h;const c="supermap_img";o.LayerUtil.register(c,h),o.LayerUtil.registerImageryProvider(c,p);const y=o.Cesium,m=o.layer.BaseLayer;class d extends m{get layer(){return this._mvtLayer}_mountedHook(){this._mvtLayer=this._map.scene.addVectorTilesMap({viewer:this._map.viewer,canvasWidth:512,...this.options});const e=this._map.scene,t=new y.ScreenSpaceEventHandler(e.canvas);t.setInputAction((t=>{if(!this.show)return;const r=o.PointUtil.getCurrentMousePosition(e,t.position);this._mvtLayer.queryRenderedFeatures([r],{}).reduce(((e,s)=>{const i=s.feature.properties;if(!i)return;const a=o.Util.getPopupForConfig(this.options,i),n={data:i,event:t};this._map.openPopup(r,a,n)}))}),y.ScreenSpaceEventType.LEFT_CLICK),this.handler=t}_addedHook(){this._mvtLayer.show=!0}_removedHook(){this._mvtLayer&&(this._mvtLayer.show=!1)}setOpacity(e){this._mvtLayer&&(this._mvtLayer.alpha=parseFloat(e))}flyTo(e={}){return this.options.center?this._map.setCameraView(this.options.center,e):this.options.extent?this._map.flyToExtent(this.options.extent,e):this._mvtLayer?this._map.camera.flyTo({...e,destination:this._mvtLayer.rectangle}):Promise.resolve(!1)}}o.layer.SmMvtLayer=d,o.LayerUtil.register("supermap_mvt",d),e.S3MLayer=a,e.SmImgLayer=h,e.SmMvtLayer=d,Object.defineProperty(e,"__esModule",{value:!0})}));
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// import * as mars3d from "mars3d"
// const Cesium = mars3d.Cesium
//按mars3d规范,封装的pbf图层
;(function (window) {
let BasicRenderer = window.mapboxRenderer.BasicRenderer
// 按mars3d规范,封装的pbf图层
(function (window) {
const BasicRenderer = window.mapboxRenderer.BasicRenderer
// 创建一个全局变量作为pbfBasicRenderer渲染模板,避免出现16个canvas上下文的浏览器限制,以便Cesium ImageLayer.destory()正常工作。
// https://github.com/mapbox/mapbox-gl-js/issues/7332
const OFFSCREEN_CANV_SIZE = 1024
const baseCanv = document.createElement("canvas")
baseCanv.style.imageRendering = "pixelated"
baseCanv.addEventListener("webglcontextlost", () => console.log("webglcontextlost"), false)
baseCanv.width = OFFSCREEN_CANV_SIZE
baseCanv.height = OFFSCREEN_CANV_SIZE
class MVTImageryProvider {
/**
......@@ -19,10 +28,29 @@
*
*/
constructor(options) {
this.mapboxRenderer = new BasicRenderer({ style: options.style })
this.options = options
let pbfStyle = options.style
this.mapboxRenderer = new BasicRenderer({
style: pbfStyle
})
this.mapboxRenderer._transformRequest = (url, resourceType) => {
return this.transformRequest(url, resourceType)
}
this.mapboxRenderer._canvas = baseCanv
this.mapboxRenderer._canvas.addEventListener("webglcontextrestored", () => this.mapboxRenderer._createGlContext(), false)
this.mapboxRenderer._createGlContext()
if (options.showCanvas) {
this.mapboxRenderer.showCanvasForDebug()
}
this.ready = false
this.readyPromise = this.mapboxRenderer._style.loadedPromise.then(() => (this.ready = true))
this.tilingScheme = new Cesium.WebMercatorTilingScheme()
this.readyPromise = this.mapboxRenderer._style.loadedPromise.then(() => {
this.ready = true
})
this.tilingScheme = options.tilingScheme ?? new Cesium.WebMercatorTilingScheme()
this.rectangle = this.tilingScheme.rectangle
this.tileSize = this.tileWidth = this.tileHeight = options.tileSize || 512
this.maximumLevel = options.maximumLevel || Number.MAX_SAFE_INTEGER
......@@ -31,20 +59,30 @@
this.errorEvent = new Cesium.Event()
this.credit = new Cesium.Credit(options.credit || "", false)
this.proxy = new Cesium.DefaultProxy("")
this.hasAlphaChannel = options.hasAlphaChannel !== undefined ? options.hasAlphaChannel : true
this.hasAlphaChannel = options.hasAlphaChannel ?? true
this.sourceFilter = options.sourceFilter
}
transformRequest = (url) => {
if (this.options.transformUrl) {
url = this.options.transformUrl(url)
}
return { url: url, headers: this.options.headers || {}, credentials: "" }
}
getTileCredits(x, y, level) {
return []
}
createTile() {
let canv = document.createElement("canvas")
const canv = document.createElement("canvas")
canv.width = this.tileSize
canv.height = this.tileSize
canv.style.imageRendering = "pixelated"
canv.getContext("2d").globalCompositeOperation = "copy"
const ctx = canv.getContext("2d")
if (ctx) {
ctx.globalCompositeOperation = "copy"
}
return canv
}
......@@ -52,16 +90,24 @@
const { x, y, zoom } = coord
const TILE_SIZE = this.tileSize
// 3x3 grid of source tiles, where the region of interest is that corresponding to the central source tile
let ret = []
const ret = []
const maxTile = (1 << zoom) - 1
for (let xx = -1; xx <= 1; xx++) {
let newx = x + xx
if (newx < 0) newx = maxTile
if (newx > maxTile) newx = 0
if (newx < 0) {
newx = maxTile
}
if (newx > maxTile) {
newx = 0
}
for (let yy = -1; yy <= 1; yy++) {
let newy = y + yy
if (newy < 0) continue
if (newy > maxTile) continue
const newy = y + yy
if (newy < 0) {
continue
}
if (newy > maxTile) {
continue
}
ret.push({
source: source,
z: zoom,
......@@ -77,7 +123,9 @@
}
requestImage(x, y, zoom, releaseTile = true) {
if (zoom > this.maximumLevel || zoom < this.minimumLevel) return Promise.reject(undefined)
if (zoom > this.maximumLevel || zoom < this.minimumLevel) {
return Promise.reject(undefined)
}
this.mapboxRenderer.filterForZoom(zoom)
const tilesSpec = this.mapboxRenderer.getVisibleSources().reduce((a, s) => a.concat(this._getTilesSpec({ x, y, zoom }, s)), [])
......@@ -108,6 +156,7 @@
resolve(canv)
// releaseTile默认为true,对应Cesium请求图像的情形
this.mapboxRenderer.releaseRender(renderRef)
this.mapboxRenderer._style.sourceCaches?.origin?._tileCache.reset()
} else {
// releaseTile为false时在由pickFeature手动调用,在渲染完成之后在pickFeature里边手动释放tile
resolve(renderRef)
......@@ -119,7 +168,7 @@
pickFeatures(x, y, zoom, longitude, latitude) {
return this.requestImage(x, y, zoom, false).then((renderRef) => {
let targetSources = this.mapboxRenderer.getVisibleSources()
let targetSources = this.mapboxRenderer.getVisibleSources(zoom)
targetSources = this.sourceFilter ? this.sourceFilter(targetSources) : targetSources
const queryResult = []
......@@ -128,7 +177,7 @@
latitude = Cesium.Math.toDegrees(latitude)
targetSources.forEach((s) => {
let data = this.mapboxRenderer.queryRenderedFeatures({
const data = this.mapboxRenderer.queryRenderedFeatures({
source: s,
renderedZoom: zoom,
lng: longitude,
......@@ -136,8 +185,8 @@
tileZ: zoom
})
for (let key in data) {
let item = data[key]
for (const key in data) {
const item = data[key]
for (let index = 0; index < item.length; index++) {
const element = item[index]
element.layer = key
......@@ -149,7 +198,7 @@
// release tile
renderRef.consumer.ctx = undefined
this.mapboxRenderer.releaseRender(renderRef)
this.mapboxRenderer._style.sourceCaches?.origin?._tileCache.reset()
return queryResult
})
}
......@@ -162,7 +211,7 @@
}
class PbfLayer extends mars3d.layer.BaseTileLayer {
//构建ImageryProvider
// 构建ImageryProvider
_createImageryProvider(options) {
return createImageryProvider(options)
}
......@@ -188,8 +237,8 @@
PbfLayer.createImageryProvider = createImageryProvider
//注册下
const layerType = "pbf" //图层类型
// 注册下
const layerType = "pbf" // 图层类型
mars3d.LayerUtil.register(layerType, PbfLayer)
mars3d.LayerUtil.registerImageryProvider(layerType, createImageryProvider)
......
......@@ -28,7 +28,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -21,7 +21,6 @@ export const mapOptions = {
url: "//data.mars3d.cn/3dtiles/bim-daxue/tileset.json",
position: { lng: 117.251229, lat: 31.844015, alt: 31.2 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
show: true
}
]
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -14,7 +14,6 @@ export const mapOptions = {
name: "合肥市区2",
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [["true", "color('rgba(42, 160, 224, 1)')"]]
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
flyTo: true
})
map.addLayer(tiles3dLayer)
......
......@@ -14,7 +14,6 @@ export const mapOptions = {
name: "合肥市区2",
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [["true", "color('rgba(42, 160, 224, 1)')"]]
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -28,7 +28,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
flyTo: true
})
map.addLayer(tiles3dLayer)
......
......@@ -32,7 +32,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -38,7 +38,6 @@ function addTilesetLayer() {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
marsJzwStyle: true, // 打开建筑物特效(内置Shader代码)
style: {
color: {
......
......@@ -13,7 +13,6 @@ export const mapOptions = {
name: "上海市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-shanghai/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: "rgb(0, 99, 255)"
},
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
name: "上海市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-shanghai/tileset.json",
maximumScreenSpaceError: 8,
maximumMemoryUsage: 1024,
marsJzwStyle: true,
style: {
color: {
......
......@@ -23,7 +23,6 @@ export function onMounted(mapInstance) {
const tilesetLayer = new mars3d.layer.TilesetLayer({
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]]
......
......@@ -20,7 +20,6 @@ export const mapOptions = {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 120 },
maximumScreenSpaceError: 2,
maximumMemoryUsage: 1024,
flyTo: true,
show: true
}
......
......@@ -20,7 +20,6 @@ export const mapOptions = {
url: "//data.mars3d.cn/3dtiles/bim-daxue/tileset.json",
position: { lng: 117.251229, lat: 31.844015, alt: 31.2 },
maximumScreenSpaceError: 8,
maximumMemoryUsage: 1024,
show: true
}
]
......
......@@ -20,7 +20,6 @@ export const mapOptions = {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 120 },
maximumScreenSpaceError: 2,
maximumMemoryUsage: 1024,
show: true
}
]
......
......@@ -32,7 +32,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
luminanceAtZenith: 0.6
......
......@@ -40,7 +40,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-teh/tileset.json",
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
popup: "all"
})
map.addLayer(tiles3dLayer)
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
popup: "all"
})
map.addLayer(tiles3dLayer)
......
......@@ -24,7 +24,6 @@ export function onMounted(mapInstance) {
url: "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
popup: "all"
})
map.addLayer(tiles3dLayer)
......
......@@ -26,8 +26,7 @@ export function onMounted(mapInstance) {
name: "文庙",
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -25,8 +25,7 @@ export function onMounted(mapInstance) {
name: "水利闸门",
url: "//data.mars3d.cn/3dtiles/max-fsdzm/tileset.json",
position: { alt: 15.2 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -26,8 +26,7 @@ export function onMounted(mapInstance) {
name: "文庙",
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -25,7 +25,6 @@ export function onMounted(mapInstance) {
name: "上海市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-shanghai/tileset.json",
maximumScreenSpaceError: 8,
maximumMemoryUsage: 1024,
marsJzwStyle: true,
style: {
color: {
......
......@@ -27,7 +27,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-teh/tileset.json",
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -26,7 +26,6 @@ export function onMounted(mapInstance) {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]]
......
......@@ -25,8 +25,7 @@ export function onMounted(mapInstance) {
name: "水利闸门",
url: "//data.mars3d.cn/3dtiles/max-fsdzm/tileset.json",
position: { alt: 15.2 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -27,8 +27,7 @@ export function onMounted(mapInstance) {
name: "县城社区",
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -26,8 +26,7 @@ export function onMounted(mapInstance) {
name: "县城社区",
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -27,8 +27,7 @@ export function onMounted(mapInstance) {
name: "县城社区",
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -30,8 +30,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -30,8 +30,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -29,8 +29,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -33,8 +33,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -33,8 +33,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -34,8 +34,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -42,7 +42,6 @@ function addLayer() {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
marsJzwStyle: true, // 打开建筑物特效(内置Shader代码)
popup: [
{ field: "objectid", name: "编号" },
......
......@@ -509,7 +509,6 @@ export function showMonomer() {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
show: true
})
map.addLayer(tilesetLayer)
......
......@@ -17,7 +17,6 @@ export const mapOptions = {
url: "//data.mars3d.cn/3dtiles/max-fsdzm/tileset.json",
position: { alt: 15.2 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
show: true
},
{
......
......@@ -23,8 +23,7 @@ export function onMounted(mapInstance) {
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: 80 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -36,7 +36,6 @@ function addLayer() {
const tilesetLayer = new mars3d.layer.TilesetLayer({
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]]
......
......@@ -36,7 +36,6 @@ function addLayer() {
url: "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
center: {
lat: 31.654436,
lng: 117.083883,
......
......@@ -66,7 +66,6 @@ export function showModel(url) {
name: "模型名称",
url: url,
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
popup: "all",
flyTo: true
})
......
......@@ -32,8 +32,7 @@ export function onMounted(mapInstance) {
name: "校园",
url: "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
position: { alt: 15.8 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tilesetLayer)
......
......@@ -25,8 +25,7 @@ export function onMounted(mapInstance) {
name: "校园",
url: "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
position: { alt: 15.8 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tilesetLayer)
......
......@@ -27,7 +27,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
position: { alt: 15.8 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
center: { lat: 43.821193, lng: 125.143124, alt: 990, heading: 342, pitch: -50 }
})
map.addLayer(tiles3dLayer)
......
......@@ -27,7 +27,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
position: { alt: 15.8 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
center: { lat: 43.821193, lng: 125.143124, alt: 990, heading: 342, pitch: -50 }
})
map.addLayer(tiles3dLayer)
......
......@@ -27,7 +27,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
position: { alt: 15.8 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
center: { lat: 43.821193, lng: 125.143124, alt: 990, heading: 342, pitch: -50 }
})
map.addLayer(tiles3dLayer)
......
......@@ -24,8 +24,7 @@ export function onMounted(mapInstance) {
name: "校园",
url: "//data.mars3d.cn/3dtiles/qx-xuexiao/tileset.json",
position: { alt: 15.8 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......@@ -48,7 +47,6 @@ export function onMounted(mapInstance) {
}
},
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
highlight: {
type: mars3d.EventType.click,
color: "#00ff00",
......
......@@ -26,7 +26,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
highlight: { type: "click", color: "#00ffff" },
popup: "all"
})
......
......@@ -25,7 +25,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: -24 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
show: true
})
map.addLayer(tilesetLayer)
......
......@@ -25,7 +25,6 @@ export function onMounted(mapInstance) {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [
......
......@@ -29,7 +29,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/bim-daxue/tileset.json",
position: { lng: 117.251229, lat: 31.844015, alt: 31.2 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
highlight: {
type: mars3d.EventType.click, // 默认为鼠标移入高亮,也可以指定click单击高亮
color: "#00FF00"
......
......@@ -27,7 +27,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
highlight: { type: "click", outlineEffect: true, width: 8, color: "#FFFF00" },
popup: "all"
})
......
......@@ -25,7 +25,6 @@ export function onMounted(mapInstance) {
name: "上海市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-shanghai/tileset.json",
maximumScreenSpaceError: 8,
maximumMemoryUsage: 1024,
popup: "all"
})
map.addLayer(tiles3dLayer)
......
......@@ -166,14 +166,6 @@ function removeLayer() {
}
}
/**
maximumMemoryUsage 参数详细解释:这个参数默认是512,也即是当几何体和纹理资源大于512MB的时候,Cesium就会淘汰掉当前帧中没有visited的所有块,这个值其实很小,也是cesium为了避免资源占用过高的一个保障,不过上述我们也估算过最差情况下,没有做纹理crn压缩的情况下,这个值很容易被超过,导致很多人误以为cesium的淘汰没有效果。
这个值如果设置的过小,导致cesium几乎每帧都在尝试淘汰数据,增加了遍历的时间,也同时增加了崩溃的风险。
这个值如果设置的过大,cesium的淘汰机制失效,那么容易导致显存超过显卡内存,也会导致崩溃。
这个值应该处于最差视角下资源占用 和 显存最大量之间。结论:这个参数要根据当前显卡显存来配置,如果我们场景只显示这一个倾斜数据,这个可以设置到显存的50 % 左右,比如我的显存是6G,这个可以设置到3000左右。那么既保证不超过显存限制,又可以最大利用显存缓存,配合crn压缩之后,这个几乎可以保证你第二次查看倾斜同一位置的时候,看不到加载过程,非常棒。
*/
/**
* 倾斜摄影 县城社区
......@@ -189,7 +181,6 @@ export function showQxShequDemo() {
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......@@ -242,7 +233,6 @@ export function showQxSimiaoDemo() {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
// "skipLevelOfDetail": true,
// "loadSiblings": true,
// "cullRequestsWhileMoving": true,
......@@ -288,7 +278,6 @@ export function showJzwHefeiDemo() {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
// marsJzwStyle: true, // 打开建筑物特效(内置Shader代码)
marsJzwStyle: `
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
......@@ -386,7 +375,6 @@ export function showMaxShihuaDemo() {
url: "//data.mars3d.cn/3dtiles/max-shihua/tileset.json",
position: { lng: 117.077158, lat: 31.659116, alt: 24.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
// 以下参数可以参考用于3dtiles总数据大,清晰度过高情况下进行性能优化。这不是一个通用的解决方案,但可以以此为参考。
skipLevelOfDetail: true,
......@@ -439,7 +427,6 @@ export function showBimQiaoliangDemo() {
// 以下参数可以参考用于3dtiles总数据大,清晰度过高情况下进行性能优化。这不是一个通用的解决方案,但可以以此为参考。
maximumScreenSpaceError: 16, // 【重要】数值加大,能让最终成像变模糊
maximumMemoryUsage: 512, // 【重要】内存建议显存大小的50%左右,内存分配变小有利于倾斜摄影数据回收,提升性能体验
skipLevelOfDetail: true, // 是Cesium在1.5x 引入的一个优化参数,这个参数在金字塔数据加载中,可以跳过一些级别,这样整体的效率会高一些,数据占用也会小一些。但是带来的异常是:1) 加载过程中闪烁,看起来像是透过去了,数据载入完成后正常。2,有些异常的面片,这个还是因为两级LOD之间数据差异较大,导致的。当这个参数设置false,两级之间的变化更平滑,不会跳跃穿透,但是清晰的数据需要更长,而且还有个致命问题,一旦某一个tile数据无法请求到或者失败,导致一直不清晰。所以我们建议:对于网络条件好,并且数据总量较小的情况下,可以设置false,提升数据显示质量。
loadSiblings: true, // 如果为true则不会在已加载完模型后,自动从中心开始超清化模型
......@@ -490,7 +477,6 @@ export function showBimDitiezhanDemo() {
name: "轻轨地铁站",
url: "//data.mars3d.cn/3dtiles/bim-ditiezhan/tileset.json",
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
position: { lng: 117.203994, lat: 31.857999, alt: 28.9 },
rotation: { z: 168.1 },
......
......@@ -23,7 +23,6 @@ export const mapOptions = {
url: "//data.mars3d.cn/3dtiles/bim-daxue/tileset.json",
position: { lng: 117.251229, lat: 31.844015, alt: 31.2 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
highlight: {
type: mars3d.EventType.click, // 默认为鼠标移入高亮,也可以指定click单击高亮
color: "#00FF00"
......
......@@ -35,11 +35,9 @@ export function onMounted(mapInstance) {
name: "桥梁",
url: "//data.mars3d.cn/3dtiles/bim-qiaoliang/tileset.json",
maximumScreenSpaceError: 16,
maximumMemoryUsage: 2048,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
position: { lng: 117.096906, lat: 31.851564, alt: 45 },
rotation: { z: 17.5 },
// 高亮时的样式
......
......@@ -117,7 +117,6 @@ export function setStyleDef() {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
popup: [
{ field: "objectid", name: "编号" },
{ field: "name", name: "名称" },
......@@ -137,7 +136,6 @@ export function setStyle1() {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
marsJzwStyle: true, // 打开建筑物特效(内置Shader代码)
popup: [
{ field: "objectid", name: "编号" },
......@@ -194,7 +192,6 @@ export function setStyle3() {
name: "合肥市建筑物",
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
customShader: new Cesium.CustomShader({
lightingModel: Cesium.LightingModel.UNLIT,
varyings: {
......
......@@ -33,7 +33,6 @@ export function onMounted(mapInstance) {
position: { lng: 117.215457, lat: 31.843363, alt: -3.6 },
rotation: { z: 336.7 },
maximumScreenSpaceError: 2,
maximumMemoryUsage: 1024,
highlight: { type: "click", outlineEffect: true, width: 8, color: "#FFFF00" },
popup: "all",
center: { lat: 31.838081, lng: 117.216584, alt: 406, heading: 1, pitch: -34 }
......
......@@ -85,7 +85,6 @@ function addTestData() {
position: { lng: 116.267315, lat: 31.457617, alt: 103 },
scale: 100,
maximumScreenSpaceError: 2,
maximumMemoryUsage: 2048,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false
})
......
......@@ -41,8 +41,7 @@ export function onMounted(mapInstance) {
const tilesetLayer = new mars3d.layer.TilesetLayer({
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tilesetLayer)
......
......@@ -22,8 +22,7 @@ export function onMounted(mapInstance) {
name: "大雁塔",
url: "//data.mars3d.cn/3dtiles/qx-dyt/tileset.json",
position: { alt: -27 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
......
......@@ -14,7 +14,6 @@ export const mapOptions = {
name: "合肥市区2",
url: "//data.mars3d.cn/3dtiles/jzw-hefei2/tileset.json",
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
style: {
color: {
conditions: [["true", "color('rgba(42, 160, 224, 1)')"]]
......
......@@ -40,7 +40,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-teh/tileset.json",
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -35,7 +35,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-simiao/tileset.json",
position: { alt: 80.6 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
shadows: Cesium.ShadowMode.ENABLED
})
map.addLayer(tilesetLayer)
......
......@@ -28,7 +28,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
show: true
})
map.addLayer(tiles3dLayer)
......
......@@ -60,7 +60,6 @@ function addLayer() {
position: { lng: 117.215457, lat: 31.843363, alt: -3.6 },
rotation: { z: 336.7 },
maximumScreenSpaceError: 2,
maximumMemoryUsage: 1024,
highlight: { type: "click", color: "#00FFFF" },
popup: "all",
center: { lat: 31.838081, lng: 117.216584, alt: 406, heading: 1, pitch: -34 }
......
......@@ -25,7 +25,6 @@ export function onMounted(mapInstance) {
// const tiles3dLayer = new mars3d.layer.TilesetLayer({
// url: "//data.mars3d.cn/3dtiles/max-ditiezhan/tileset.json",
// maximumScreenSpaceError: 1,
// maximumMemoryUsage: 1024,
// popup: "all"
// })
// map.addLayer(tiles3dLayer)
......
......@@ -42,7 +42,6 @@ export function addLayer(height) {
position: { lng: 117.215457, lat: 31.843363, alt: -3.6 },
rotation: { z: 336.7 },
maximumScreenSpaceError: 2,
maximumMemoryUsage: 1024,
highlight: { type: "click", color: "#00FFFF" },
popup: "all",
center: { lat: 31.840525, lng: 117.217024, alt: 495.12, heading: 0, pitch: -59.3, roll: 0 }
......
......@@ -42,7 +42,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-teh/tileset.json",
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -28,7 +28,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/bim-daxue/tileset.json",
position: { lng: 117.251229, lat: 31.844015, alt: 31.2 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
flyTo: true
})
map.addLayer(tilesetLayer)
......
......@@ -43,7 +43,6 @@ export function showDytDemo() {
url: "//data.mars3d.cn/3dtiles/qx-dyt/tileset.json",
position: { alt: -27 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
flyTo: true
})
map.addLayer(tilesetLayer)
......@@ -61,7 +60,6 @@ export function showTehDemo() {
url: "//data.mars3d.cn/3dtiles/qx-teh/tileset.json",
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......@@ -101,7 +99,6 @@ export function showXianDemo() {
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
skipLevelOfDetail: true,
preferLeaves: true,
dynamicScreenSpaceError: true,
......
......@@ -49,7 +49,6 @@ export function showDytDemo() {
url: "//data.mars3d.cn/3dtiles/qx-dyt/tileset.json",
position: { lng: 108.963363, lat: 34.221298, alt: -27 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
// 可传入TilesetFlat构造参数,下面是演示压平区域
flat: {
......@@ -83,7 +82,6 @@ export function showTehDemo() {
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
editHeight: -130.0, // 相对高度 (单位:米),基于 压平/淹没区域 最低点高度的偏移量
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -46,7 +46,6 @@ export function showDytDemo() {
url: "//data.mars3d.cn/3dtiles/qx-dyt/tileset.json",
position: { alt: -27 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
editHeight: 420, // 相对高度 (单位:米),基于 压平/淹没区域 最低点高度的偏移量
flyTo: true
})
......@@ -77,7 +76,6 @@ export function showTehDemo() {
position: { lng: 117.218434, lat: 31.81807, alt: 163 },
editHeight: -130.0, // 相对高度 (单位:米),基于 压平/淹没区域 最低点高度的偏移量
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024,
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
......
......@@ -20,7 +20,6 @@ export function onMounted(mapInstance) {
url: "//data.mars3d.cn/3dtiles/qx-shequ/tileset.json",
position: { alt: 11.5 },
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
skipLevelOfDetail: true,
preferLeaves: true,
dynamicScreenSpaceError: true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论