浏览代码

fix: fix: modelpos

xzw 7 月之前
父节点
当前提交
6acdaee471
共有 3 个文件被更改,包括 48 次插入24 次删除
  1. 19 3
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 28 20
      src/sdk/cover/index.js

+ 19 - 3
public/lib/potree/potree.js

@@ -22080,6 +22080,7 @@
 	            var location = viewer.transform.lonlatToLocal.forward(locationLonLat);
 	            MergeEditor.moveBoundCenterTo(model, new Vector3().fromArray(location));
 	            model.hasLonLat = true;
+	            model.lonLatPos = model.position.clone();
 	          }
 	          MergeEditor.setModelBtmHeight(model, 0); // 离地高度为0 (因为不想在地图下方所以高程不管了,都在地面上即可)
 	        }
@@ -22274,6 +22275,7 @@
 	          pointcloud.matrixAutoUpdate = true;
 	          if (pointcloud.hasLonLat) {
 	            pointcloud.matrix.decompose(pointcloud.position, pointcloud.quaternion, pointcloud.scale); //将数据集的经纬度和旋转应用到rotation和position (注意position和translateUser并不一样)
+	            pointcloud.lonLatPos = pointcloud.position.clone();
 	          } else if (!prop.isFirstLoad) {
 	            //点云一般加载后position都不是0, 但后台初始化为0所以先归零要不然撤销后容易错
 	            pointcloud.position.set(0, 0, 0);
@@ -43320,14 +43322,16 @@
 	  }
 	  updateArrowRepeat() {
 	    if (!this.edge.material.map) return;
-	    this.edge.material.map.repeat.x = Math.round(this.totalLength / this.halfPathWidth * 0.5);
+	    this.edge.material.map.repeat.x = Math.round(this.totalLength / this.halfPathWidth * 0.5) * (this.reverse ? -1 : 1);
 	    this.edge.material.map.needsUpdate = true;
 	    this.edge.material.setUV();
 	  }
 	  setArrowDisplay(show) {
 	    if (Potree.settings.pathSmooth) {
 	      if (show) {
-	        var map = texLoader$7.load(Potree.resourcePath + '/textures/arrow.png');
+	        var map = texLoader$7.load(Potree.resourcePath + '/textures/arrow.png', () => {
+	          viewer.dispatchEvent('content_changed');
+	        });
 	        map.anisotropy = 2;
 	        map.wrapS = RepeatWrapping;
 	        map.repeat.set(10, 1.3);
@@ -43369,6 +43373,16 @@
 	    }
 	    viewer.dispatchEvent('content_changed');
 	  }
+	  setReverse(reverse) {
+	    if (this.reverse != reverse) {
+	      this.reverse = reverse;
+	      if (Potree.settings.pathSmooth) {
+	        this.updateArrowRepeat();
+	      } else {
+	        Path$1.updateArrows(true);
+	      }
+	    }
+	  }
 	  hideArrowUntilUpdate() {
 	    this.arrows && Potree.Utils.updateVisible(this.arrows, 'changing', false);
 	    Path$1.waitUpdateArrows();
@@ -81642,6 +81656,7 @@
 	          this.shelterCount.byTex++;
 	          //console.log('computeByTex direct', panoId, point, ifShelter)
 	        } else {
+	          //soon的无tex不敢写……
 	          //console.log('延迟tex',panoId, point )
 	          history.waitCompute = {
 	            panoId,
@@ -84673,7 +84688,7 @@
 	          var _facePlane2 = object.getFacePlane(target);
 	          var _normal = _facePlane2.normal.clone();
 	          var angle = this.mainViewport.view.direction.angleTo(_normal);
-	          var minDiff = MathUtils.degToRad(60);
+	          var minDiff = MathUtils.degToRad(30);
 	          //console.log('angle',angle)
 	          if (angle > minDiff && angle < Math.PI - minDiff) {
 	            //当几乎正对时就不执行
@@ -84683,6 +84698,7 @@
 	            }
 	            var _dir = new Vector3().subVectors(camera.position, target).normalize();
 	            var newDir = new Vector3().addVectors(_dir, _normal); //两个角度的中间
+	            //console.log('newDir',newDir)
 	            cameraPos.copy(target.clone().add(newDir));
 	          }
 	        } else if (object.points.length == 2) {

文件差异内容过多而无法显示
+ 1 - 1
public/lib/potree/potree.js.map


+ 28 - 20
src/sdk/cover/index.js

@@ -23,7 +23,7 @@ let cesAspect , cesImageryProvider
 let isValidPoint = (modelId)=>{//所存的modelId没被删或者它本身不在模型上
     return modelId == Id_noIntersect || viewer.objs.children.concat(viewer.scene.pointclouds).some(e=>e.dataset_id == modelId )
 }
-
+let curSelectPath
 
 {
     // 84坐标转高德 (国外地区用84,所以地理注册时填的是84,我这需要转成高德)
@@ -660,8 +660,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 }
             }
             
-             o.isFlyToTag = true
+           
             if (o.distance || o.maxDis) {
+                //o.isFlyToTag = true
                 let requestShowPano
                 let position = o.target || o.position
                 if(o.isFlyToTag){
@@ -939,7 +940,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     let msg = {}
                     if (!lastState.position || !model.position.equals(lastState.position)) {
                         lastState.position = msg.position = model.position.clone()
-                        //console.log('change pos', model.position.toArray())
+                        console.log('change pos', model.name, model.position.toArray())
                     }
                     if (!lastState.rotation || !model.rotation.equals(lastState.rotation)) {
                         lastState.rotation = msg.rotation = model.rotation.clone()
@@ -949,7 +950,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     }
 
                     msg = Potree.Common.CloneObject(msg)
-                    //console.log(msg)
+                    //console.log(model.name, msg)
                     bus.emit('transformChanged', msg)
                 })
                 spliceFromArr(model, props, true)
@@ -1088,12 +1089,17 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     model.dispatchEvent('transformChanged') //改了position */
                 },
                 changePosition(pos) {//校准取消时执行
-                    console.log('changePosition', pos.x, pos.y, pos.z)
-                    model && model.position.copy(pos)
+                    console.log('changePosition', model.name, pos.x, pos.y, pos.z) 
+                    if(pos.x == 0 && pos.y == 0 && pos.z == 0 && model.lonLatPos ){
+                        model && model.position.copy(model.lonLatPos)
+                        console.log('changePosition 使用经纬度坐标', model.name )
+                    }else{
+                        model && model.position.copy(pos)
+                    }
                     model.dispatchEvent({ type: 'position_changed' })
                 },
                 changeRotation(rot) {//校准取消时执行 
-                    console.log('changeRotation', rot.x, rot.y, rot.z)
+                    console.log('changeRotation', model.name, rot.x, rot.y, rot.z)
                     model && model.rotation.setFromVector3(rot)
                     model.dispatchEvent({ type: 'rotation_changed' })
                 },
@@ -1478,6 +1484,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 })
                 
                 path.addEventListener('chose',(e)=>{
+                    switchSelect(e.state)
                     bus.emit('focus', e.state) 
                 })
                  
@@ -1485,18 +1492,23 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
             let funs = getMeasureFunction(path, bus) 
 
 
-            //let fadeFar = -1 
-              
+         
+            let switchSelect = (state)=>{//切换选择,最多一个选中
+                if(state){ 
+                    curSelectPath && curSelectPath.setSelected('unclick' ) //取消上一个选中的
+                    curSelectPath = path 
+                }else{
+                    curSelectPath == path && (curSelectPath = null)
+                }
+            }  
             let functions = Object.assign(funs,{
                 bus,
                 
                 changeEditMode(state){//进入编辑 
                     if(!state){ 
                         viewer.dispatchEvent({ type: 'cancel_insertions', dontRemove: true, measure:path })
-                    }
- 
-                    path.setEditEnable(state)
-                    //functions.changeVisibilityRange(fadeFar)
+                    } 
+                    path.setEditEnable(state) 
                 },
                  
                 changeCanEdit(state){//是否点击pen图标以加点和删点 
@@ -1539,23 +1551,19 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     path.setPathWidth(width)
                     path.setPathColor(color)
                 },
-                changeVisibilityRange(far){//设置消失距离
-                    //fadeFar = far 
-                    //path.setFadeFar(( far== -1 || path.editEnable) ? null : far) //注意:编辑时显示全部
+                changeVisibilityRange(far){//设置消失距离 
                     path.setFadeFar(far== -1 ? 0 : far) 
                 },
                 highlight(state){ 
                     path.setSelected(state?'hover':'unhover', true)
                 },
                 focus(state){
+                    switchSelect(state)
                     path.setSelected(state?'click':'unclick', true)
                 },
                 changeDirection(show,reverse){
                     path.setArrowDisplay(show)
-                    if(path.reverse != reverse){
-                        path.reverse = reverse
-                        path.constructor.updateArrows(true)
-                    }
+                    path.setReverse(reverse) 
                 },
                 createAni(tension){
                     let distance = path.getTotalDistance()