|
|
|
@ -93,9 +93,10 @@ export default class LayerMgr {
|
|
|
|
async getQxsy(viewer) {
|
|
|
|
async getQxsy(viewer) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
let tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
|
|
let tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
|
|
'http://res3d.oss-cn-shenzhen.aliyuncs.com/macheng/xiaoyutan/Scene/3DTILE.json',
|
|
|
|
// 'http://res3d.oss-cn-shenzhen.aliyuncs.com/macheng/xiaoyutan/Scene/3DTILE.json',
|
|
|
|
|
|
|
|
'https://map1.oss-cn-shenzhen.aliyuncs.com/tsg/tiles/tileset.json',
|
|
|
|
{
|
|
|
|
{
|
|
|
|
maximumScreenSpaceError: 1, //精细程度越小越精细
|
|
|
|
maximumScreenSpaceError: 20, //精细程度越小越精细
|
|
|
|
maximumMemoryUsage: 1000, //不可设置太高,目标机子空闲内存值以内,防止浏览器过于卡
|
|
|
|
maximumMemoryUsage: 1000, //不可设置太高,目标机子空闲内存值以内,防止浏览器过于卡
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -103,14 +104,14 @@ export default class LayerMgr {
|
|
|
|
viewer.scene.primitives.add(tileset);
|
|
|
|
viewer.scene.primitives.add(tileset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const offsetHeight = 15
|
|
|
|
const offsetHeight = 10
|
|
|
|
const boundingSphere = tileset.boundingSphere
|
|
|
|
const boundingSphere = tileset.boundingSphere
|
|
|
|
const cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center)
|
|
|
|
const cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center)
|
|
|
|
const surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0)
|
|
|
|
const surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0)
|
|
|
|
const offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, offsetHeight)
|
|
|
|
const offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, offsetHeight)
|
|
|
|
const translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3())
|
|
|
|
const translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3())
|
|
|
|
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation)
|
|
|
|
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation)
|
|
|
|
viewer.flyTo(tileset)
|
|
|
|
// viewer.flyTo(tileset)
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
console.error(`Error creating tileset: ${error}`);
|
|
|
|
console.error(`Error creating tileset: ${error}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|