refactor(map): 优化倾斜摄影初始化中的viewer引用
- 将多次调用getViewer()替换为函数内单一变量viewer缓存 - 统一使用viewer参数调用createObliquePhotography函数 - 提升代码可读性及性能,避免重复获取viewer实例master
parent
477509877c
commit
f2109d6e80
|
|
@ -23,31 +23,32 @@ export default function useInitMap(options) {
|
||||||
|
|
||||||
// 倾斜摄影
|
// 倾斜摄影
|
||||||
const initObliquePhotography = () => {
|
const initObliquePhotography = () => {
|
||||||
getViewer().scene.globe.depthTestAgainstTerrain = true;
|
const viewer = getViewer();
|
||||||
|
viewer.scene.globe.depthTestAgainstTerrain = true;
|
||||||
Cesium.ExperimentalFeatures.enableModelExperimental = true;
|
Cesium.ExperimentalFeatures.enableModelExperimental = true;
|
||||||
createObliquePhotography(
|
createObliquePhotography(
|
||||||
"http://192.168.192.215:8021/ware/upload/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E4%B8%9C/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E4%B8%9C/merge_tile.json",
|
"http://192.168.192.215:8021/ware/upload/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E4%B8%9C/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E4%B8%9C/merge_tile.json",
|
||||||
getViewer(),
|
viewer,
|
||||||
);
|
);
|
||||||
createObliquePhotography(
|
createObliquePhotography(
|
||||||
"http://192.168.192.215:8021/ware/upload/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E8%A5%BF/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E8%A5%BF/merge_tile.json",
|
"http://192.168.192.215:8021/ware/upload/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E8%A5%BF/%E6%9B%B9%E5%A6%83%E7%94%B8%E6%B8%AF%E8%A5%BF/merge_tile.json",
|
||||||
getViewer(),
|
viewer,
|
||||||
);
|
);
|
||||||
createObliquePhotography(
|
createObliquePhotography(
|
||||||
"http://192.168.192.215:8021/ware/upload/qhdxys/merge_tile.json",
|
"http://192.168.192.215:8021/ware/upload/qhdxys/merge_tile.json",
|
||||||
getViewer(),
|
viewer,
|
||||||
);
|
);
|
||||||
createObliquePhotography(
|
createObliquePhotography(
|
||||||
"http://192.168.192.215:8021/ware/upload/qhdgysh/merge_tile.json",
|
"http://192.168.192.215:8021/ware/upload/qhdgysh/merge_tile.json",
|
||||||
getViewer(),
|
viewer,
|
||||||
);
|
);
|
||||||
createObliquePhotography(
|
createObliquePhotography(
|
||||||
"http://192.168.192.215:8021/ware/upload/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E8%A5%BF/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E8%A5%BF/merge_tile.json",
|
"http://192.168.192.215:8021/ware/upload/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E8%A5%BF/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E8%A5%BF/merge_tile.json",
|
||||||
getViewer(),
|
viewer,
|
||||||
);
|
);
|
||||||
createObliquePhotography(
|
createObliquePhotography(
|
||||||
"http://192.168.192.215:8021/ware/upload/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E4%B8%9C/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E4%B8%9C/merge_tile.json",
|
"http://192.168.192.215:8021/ware/upload/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E4%B8%9C/%E6%B2%A7%E5%B7%9E%E6%B8%AF%E4%B8%9C/merge_tile.json",
|
||||||
getViewer(),
|
viewer,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue