|
@@ -28,11 +28,26 @@ let defaultMapProps = [{url: `//wprd04.is.autonavi.com/appmaptile?lang=zh_cn&siz
|
|
|
name:'高德textLayer'
|
|
|
}]
|
|
|
let cesAspect , cesImageryProvider, mapProps = defaultMapProps
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+let cesMath = {
|
|
|
+ fromCes(cartesian, getLonlat){
|
|
|
+ var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
|
|
+ var lng = Cesium.Math.toDegrees(cartographic.longitude);
|
|
|
+ var lat = Cesium.Math.toDegrees(cartographic.latitude);
|
|
|
+ var height = cartographic.height;
|
|
|
+ let loc = new THREE.Vector3(lng, lat, height)
|
|
|
+ if(getLonlat)return loc
|
|
|
+ return viewer.transform.lonlatToLocal.forward(loc)
|
|
|
+ },
|
|
|
+ toCes(pos){
|
|
|
+ let xy = [pos.x, pos.y];
|
|
|
+ let height = pos.z;
|
|
|
+ let deg = viewer.transform.lonlatToLocal.inverse(xy) // toMap.forward(xy);
|
|
|
+ let cPos = Cesium.Cartesian3.fromDegrees(...deg, height);//console.log('toCes',cPos,height) //数字过大如e35会崩溃
|
|
|
+
|
|
|
+ return cPos;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
const Id_noIntersect = -100 //path绘制在地图上的点,modelId传这个值,勿更改
|
|
|
let isValidPoint = (modelId)=>{//所存的modelId没被删或者它本身不在模型上
|
|
@@ -508,9 +523,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
|
|
|
|
|
|
|
|
|
- let sdk = {
|
|
|
+ let sdk = Potree.sdk = {
|
|
|
sceneBus, mapBus,
|
|
|
-
|
|
|
+ cesMath,
|
|
|
|
|
|
canTurnToPanoMode(pos, far=Potree.config.panoFieldRadius) {
|
|
|
pos = pos ? new THREE.Vector3().copy(pos) : viewer.images360.position
|
|
@@ -842,7 +857,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
changeMapTile(urls){
|
|
|
//'http:/a.xxx.com/{x}/{y}/{z}.png'
|
|
|
console.log('changeMapTile', urls )
|
|
|
-
|
|
|
+ if(window.location.href.includes('localhost:7173') || window.location.href.includes('192.168.0.59') ) return
|
|
|
mapProps = urls.map(e=>{
|
|
|
return {
|
|
|
maximumLevel : e.maximumLevel,
|
|
@@ -961,8 +976,10 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
//if (props.type == 'obj') props.type = 'glb'
|
|
|
props.scale && (props.scale /= 100)
|
|
|
|
|
|
+ /* if(props.title == 'caijain'){
|
|
|
+ props.url = [`${Potree.resourcePath}/models/tiles_2/tileset.json` ]
|
|
|
+ } */
|
|
|
|
|
|
-
|
|
|
let getBaseRotation = () => {
|
|
|
if(ModelTypes[props.fromType]?.rot90 && props.type != 'obj'){
|
|
|
return new THREE.Euler(Math.PI / 2, 0, 0)
|
|
@@ -2144,7 +2161,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -2497,16 +2514,16 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
let pPos = new THREE.Vector3(0, 0, 0).applyMatrix4(camera.matrixWorld);
|
|
|
|
|
|
let orientation
|
|
|
- let toCes = (pos) => {
|
|
|
+ /* let toCes = (pos) => {
|
|
|
let xy = [pos.x, pos.y];
|
|
|
let height = pos.z;
|
|
|
let deg = viewer.transform.lonlatToLocal.inverse(xy) // toMap.forward(xy);
|
|
|
let cPos = Cesium.Cartesian3.fromDegrees(...deg, height);
|
|
|
//console.log('toCes',cPos,height) //数字过大如e35会崩溃
|
|
|
return cPos;
|
|
|
- };
|
|
|
+ }; */
|
|
|
|
|
|
- let cPos = toCes(pPos);
|
|
|
+ let cPos = cesMath.toCes(pPos);
|
|
|
|
|
|
|
|
|
|
|
@@ -2541,8 +2558,8 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
|
|
|
let pUp = new THREE.Vector3(0, 600, 0).applyMatrix4(camera.matrixWorld);
|
|
|
let pTarget = viewer.scene.view.getPivot();
|
|
|
|
|
|
- let cUpTarget = toCes(pUp);
|
|
|
- let cTarget = toCes(pTarget);
|
|
|
+ let cUpTarget = cesMath.toCes(pUp);
|
|
|
+ let cTarget = cesMath.toCes(pTarget);
|
|
|
|
|
|
let cDir = Cesium.Cartesian3.subtract(cTarget, cPos, new Cesium.Cartesian3());
|
|
|
let cUp = Cesium.Cartesian3.subtract(cUpTarget, cPos, new Cesium.Cartesian3());
|