xzw 20 часов назад
Родитель
Сommit
cc0773ec9e
3 измененных файлов с 46 добавлено и 10 удалено
  1. 7 7
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 38 2
      src/sdk/cover/index.js

+ 7 - 7
public/lib/potree/potree.js

@@ -43233,6 +43233,7 @@
 	    //performance.mark('measureUpdate-end')
 	    //let measure = performance.measure('measure-','measureUpdate-start', 'measureUpdate-end' );
 	    //console.log('update-time', measure.duration)
+	    this.dispatchEvent('updated');
 	  }
 	  createPrismLines(color) {
 	    this.lineMesh = LineDraw.createLine([], {
@@ -44969,7 +44970,7 @@
 	var labelSizeInfo$1 = {
 	  width2d: 180
 	}; //稍微小点防止字体模糊
-
+	var quaBase = new Quaternion().setFromEuler(new Euler(-Math.PI / 2, 0, Math.PI / 2));
 	var titleLineHeight = 2;
 	var arrowCountMax = 1000; //箭头总数不能超过这个值。 The count value passed into the constructor represents the maximum number of instances of this mesh. You can change the number of instances at runtime to an integer value in the range [0, count].If you need more instances than the original count value, you have to create a new InstancedMesh.
 	var lastArrowCamPos,
@@ -45019,10 +45020,6 @@
 	  }
 	  return markerMats[name];
 	};
-	var getMeshQuaInPath = lineDir => {
-	  var quaBase = new Quaternion().setFromEuler(new Euler(-Math.PI / 2, 0, Math.PI / 2));
-	  return math.getQuaFromPosAim(new Vector3(), lineDir).multiply(quaBase);
-	};
 	var getEndCaps = function () {
 	  var endCap, map;
 	  return function (path) {
@@ -45768,7 +45765,7 @@
 	      if (len) {
 	        if (len > 1) {
 	          var dir = i == 0 ? new Vector3().subVectors(pts[1], pts[0]) : new Vector3().subVectors(pts[len2 - 2], pts[len2 - 1]);
-	          e.quaternion.copy(getMeshQuaInPath(dir));
+	          e.quaternion.copy(this.getMeshQuaInPath(dir));
 	        } else {
 	          i == 0 ? e.quaternion.set(0, 0, 0, 1) : e.quaternion.set(0, 0, 1, 0); //两个半圆拼成一个圆点
 	        }
@@ -46189,7 +46186,7 @@
 	          scaleMatrix = new Matrix4().scale(new Vector3((e.lineInfo.path.reverse ? -1 : 1) * s, s, s));
 	          scaleMap.set(e.lineInfo.path, scaleMatrix);
 	        }
-	        var qua = getMeshQuaInPath(e.lineInfo.dir); //math.getQuaFromPosAim( new THREE.Vector3, e.lineInfo.dir ).multiply(quaBase) 
+	        var qua = this.getMeshQuaInPath(e.lineInfo.dir); //math.getQuaFromPosAim( new THREE.Vector3, e.lineInfo.dir ).multiply(quaBase) 
 	        var quaMatrix = new Matrix4().makeRotationFromQuaternion(qua);
 	        scaleQuaMatrix = e.lineInfo.scaleQuaMatrix = new Matrix4().multiplyMatrices(quaMatrix, scaleMatrix);
 	      }
@@ -46201,6 +46198,9 @@
 	    lastArrowCount = waitAdd.length;
 	    //console.log('updateArrows spaceDis', spaceDis, 'count', waitAdd.length, 'cost', performance.now() - startTime)
 	  }
+	  getMeshQuaInPath(lineDir) {
+	    return math.getQuaFromPosAim(new Vector3(), lineDir).multiply(quaBase);
+	  }
 	}
 	Path$1.prototype.cloneMarker = Measure$1.prototype.cloneMarker;
 	Path$1.prototype.updateDatasetBelong = Measure$1.prototype.updateDatasetBelong;

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
public/lib/potree/potree.js.map


+ 38 - 2
src/sdk/cover/index.js

@@ -155,8 +155,36 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
     {
         let oldfun = Potree.Path.prototype.getDifferentPoint
         Potree.Path.prototype.getDifferentPoint = function(points){ 
-            return oldfun.call(this, points.filter((e,i)=>{return !this.pointHideList[i]}) )
+            return oldfun.call(this, this.getVisiPoints(points) )
+        } 
+        
+        Potree.Path.prototype.getVisiPoints = function(points=this.points){ 
+            return points.filter((e,i)=>{return !this.pointHideList[i]})
         }
+        Potree.Path.prototype.updateEndCaps = function(){
+            let points = this.getVisiPoints() //这里points改了!!!
+            let len = points.length
+            let pts = this.geoPoints.length>0 ? this.geoPoints : this.points
+            let len2 = pts.length
+            
+            
+            this.endCaps.forEach((e,i)=>{
+                Potree.Utils.updateVisible(e, 'hasPoints', len>0)
+                if(len){  
+                    if(len>1){
+                        let dir = i==0 ? new THREE.Vector3().subVectors(pts[1], pts[0]) 
+                                  : new THREE.Vector3().subVectors(pts[len2-2], pts[len2-1]) 
+                        e.quaternion.copy(this.getMeshQuaInPath(dir))
+                    }else{
+                        i==0 ? e.quaternion.set(0,0,0,1) : e.quaternion.set(0,0,1,0)   
+                    } 
+                    e.position.copy(points[i==0 ? 0 : len-1])
+                    let s = this.halfPathWidth * 2.15
+                    e.scale.set(s,s,s)
+                } 
+           })
+        } 
+        
     }
     
    
@@ -1103,7 +1131,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     }
 
                     msg = Potree.Common.CloneObject(msg) 
-                    console.log(model.name, msg)
+                    //console.log(model.name, msg)
                     bus.emit('transformChanged', msg)
                 }
                 model.addEventListener('transformChanged', (e) => {
@@ -1973,6 +2001,10 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 path.addEventListener('dragLineLen',(e)=>{ 
                     bus.emit('changeLineHeight', path.lineHeight) 
                 })
+                path.addEventListener('updated',(e)=>{ 
+                    updatePathHideLine(path)
+                })
+                  
                  
             }
             let funs = getMeasureFunction(path, bus) 
@@ -1995,6 +2027,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                         viewer.dispatchEvent({ type: 'cancel_insertions', dontRemove: true, measure:path })
                     } 
                     path.setEditEnable(state) 
+                    path.fakeLines.forEach(e=>{
+                        e && Potree.Utils.updateVisible(e,'editEnable', state)
+                    })
                 },
                  
                 changeCanEdit(state){//是否点击pen图标以加点和删点 
@@ -2045,6 +2080,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     path.pointHideList[index] = !show
                     updatePathHideLine(path)
                     path.updateEdge(true)
+                    path.updateEndCaps()
                     viewer.dispatchEvent('content_changed')
                 },