xzw 2 år sedan
förälder
incheckning
d3f621ca28
4 ändrade filer med 17 tillägg och 8 borttagningar
  1. 1 1
      src/custom/modules/clipping/Clipping.js
  2. 13 4
      src/custom/start.js
  3. 2 2
      src/viewer/ExtendView.js
  4. 1 1
      src/viewer/View.js

+ 1 - 1
src/custom/modules/clipping/Clipping.js

@@ -313,7 +313,7 @@ export class Clipping extends THREE.EventDispatcher{ //实时剪裁
                     matrix : new THREE.Matrix4().elements,  //参照downloadNoCrop,给默认值,表示没有最外层裁剪
                     VisiMatrixes: cloud.material.clipBoxes_in.filter(e=>!e.box.isNew).map(e=>Clip.getTransformationMatrix(cloud, e.inverse).elements), 
                     UnVisiMatrixes: cloud.material.clipBoxes_out.filter(e=>!e.box.isNew).map(e=>Clip.getTransformationMatrix(cloud, e.inverse).elements),
-                    modelMatrix:(new THREE.Matrix4).copy(cloud.transformMatrix).transpose().elements
+                    modelMatrix:(new THREE.Matrix4).copy(cloud.transformMatrix).transpose().elements   //需要保证没有位移,否则剪裁后的模型位置会变化
                 }  
                 return data
             }) ,

+ 13 - 4
src/custom/start.js

@@ -128,13 +128,16 @@ export function start(dom, mapDom, number ){ //t-Zvd3w0m
         
         var transformPointcloud = (pointcloud, dataset)=>{
             var locationLonLat = dataset.location.slice(0,2)
+             
+           
+            //当只有一个dataset时,无论如何transform 点云和漫游点都能对应上。
             
-            /* if(window.AMapWith84){//需要转换
-                locationLonLat = AMapWith84.wgs84ToAMap({x:locationLonLat[0], y:locationLonLat[1]})
+            /* if(window.AMapWith84 && Potree.settings.mapCompany != 'google'){
+                 locationLonLat = AMapWith84.wgs84ToAMap({x:locationLonLat[0], y:locationLonLat[1]})
+                  
                 locationLonLat = [locationLonLat.x,locationLonLat.y] 
             } */
-           
-            //当只有一个dataset时,无论如何transform 点云和漫游点都能对应上。
+            
             var location = viewer.transform.lonlatToLocal.forward(locationLonLat)  //transform.inverse()
             //初始化位置 
             
@@ -166,6 +169,12 @@ export function start(dom, mapDom, number ){ //t-Zvd3w0m
         
         {//拿初始数据集作为基准。它的位置是000
             var locationLonLat = originDataset.location.slice(0,2)
+            
+            if(window.AMapWith84){//需要转换为高德的
+                locationLonLat = AMapWith84.wgs84ToAMap({x:locationLonLat[0], y:locationLonLat[1]})
+                locationLonLat = [locationLonLat.x,locationLonLat.y] 
+            } 
+            
             proj4.defs("LOCAL", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //高德坐标系
             proj4.defs("LOCAL_MAP", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15));
             proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");

+ 2 - 2
src/viewer/ExtendView.js

@@ -217,7 +217,7 @@ class ExtendView extends View {
          
 		if(info.target ){
 			endTarget = new THREE.Vector3().copy(info.target)  
-            endQuaternion = math.getQuaFromPosAim(endPosition,endTarget) //若为垂直,会自动偏向x负的方向
+            endQuaternion = math.getQuaFromPosAim(endPosition,endTarget)  
             let dir = new THREE.Vector3().subVectors(endTarget, endPosition).normalize()
            
             let view = this.clone();
@@ -228,7 +228,7 @@ class ExtendView extends View {
         }
          
         if(endQuaternion){ 
-            startQuaternion = new THREE.Quaternion().setFromEuler(this.rotation)
+            startQuaternion = this.quaternion//new THREE.Quaternion().setFromEuler(this.rotation)
            
         }
         

+ 1 - 1
src/viewer/View.js

@@ -45,7 +45,7 @@ export class View{//base
         
 		if(dir.x === 0 && dir.y === 0){
 			this.pitch = Math.PI / 2 * Math.sign(dir.z); 
-            this.yaw = 0   //add:还是要指定一下, 否则不统一
+            //this.yaw = 0   //add:还是要指定一下, 否则不统一
             
 		}else{
 			let yaw = Math.atan2(dir.y, dir.x) - Math.PI / 2;