ソースを参照

Merge branch 'dev' of http://192.168.0.115:3000/bill/traffic-laser into dev

bill 1 年間 前
コミット
c3449b0681

ファイルの差分が大きいため隠しています
+ 574 - 485
public/static/lib/potree/potree.js


ファイルの差分が大きいため隠しています
+ 1 - 1
public/static/lib/potree/potree.js.map


+ 29 - 26
src/sdk/laser/core/enter.js

@@ -391,7 +391,7 @@ var enter = ({
             return console.error('创建失败,因基准线不存在')
         }
         if(!fixPoint.basePoint){
-            return console.log('no basePoint')
+            return //console.log('no basePoint')
         }
         
         let fixPoint2d = new THREE.Vector2().copy(fixPoint)
@@ -420,11 +420,10 @@ var enter = ({
         info.disMeasure2 = {
             points : [new THREE.Vector3().copy(fixPoint.basePoint),  foot2_P1],
             guideLinePoints : [foot2_P1, foot2_P2/* , foot1_P2 */],
-        }
-        
+        } 
         fixPoint.bus.emit('measureChange',[
             {line: info.disMeasure1.points, dis: info.disMeasure1.points[0].distanceTo(info.disMeasure1.points[1])},
-            {line: info.disMeasure2.points, dis: info.disMeasure2.points[0].distanceTo(info.disMeasure1.points[1])} 
+            {line: info.disMeasure2.points, dis: info.disMeasure2.points[0].distanceTo(info.disMeasure2.points[1])} 
         ])
          
         
@@ -746,9 +745,10 @@ var enter = ({
 
 
 
-            createFixPoint({measure, graph, pos, basePoint}){//创建固定点或多线段
-             
+            createFixPoint({measure, graph, pos, basePoint}){//创建固定点或多线段   
+                
                 console.log('createFixPoint',measure, graph, pos, basePoint)
+                let ifDrawVerMeasure = measure//是否绘制垂线
                 let shape,  measureFun, mainPoint = new THREE.Vector3(), bus = mitt();  
                 basePoint && (mainPoint.basePoint = new THREE.Vector3().copy(basePoint))
                 mainPoint.bus = bus
@@ -760,7 +760,7 @@ var enter = ({
                     if(graph){
                         Potree.Utils.updateVisible(shape, "forceByUser", show); 
                     }
-                    if(mainPoint.basePoint){
+                    if(ifDrawVerMeasure){
                         Potree.Utils.updateVisible(mainPoint.disMeasure1, "forceByUser", show); 
                         Potree.Utils.updateVisible(mainPoint.disMeasure2, "forceByUser", show); 
                     } 
@@ -768,51 +768,50 @@ var enter = ({
                 } 
                 
                 
-                if(graph){ //多线段
+                if(graph){ //多线段形状
                     let info = {
                         measureType : 'MulDistance_shape', color : pointMeasureColor
                     }
                     let updateMeasure = ()=>{
-                        if(!shape.isNew){
+                        if(!shape.isNew){//更新中心点和垂线
                             mainPoint.copy(shape.getCenter())
                             updateMeasureForPoint(mainPoint) 
                         }
                     }
-                    if(graph.length == 0){
+                    if(graph.length == 0){//开始绘制
                         shape = viewer.measuringTool.startInsertion( info,
                             () => { 
                             bus.emit("end", ret); //完成
                             shape.dispatchEvent('cancelSelect')
-                            measure && createMeasureForPoint(mainPoint) 
-                            updateMeasure()
+                            ifDrawVerMeasure && (createMeasureForPoint(mainPoint) , updateMeasure()) 
+                            
                         },
                         () => { 
                             bus.emit("quit", ret); //删除
                         }); 
-                    }else{ 
+                    }else{//已经得到全部点 
                         info.points = graph;  
                         info.sid = Math.random()//sid;
                         info.bus = bus; 
                         shape = viewer.measuringTool.createMeasureFromData(info);
-                        shape && createMeasureForPoint(mainPoint)                         
-                        updateMeasure()
+                        ifDrawVerMeasure && (createMeasureForPoint(mainPoint) , updateMeasure()) 
                     }
-                    bus.on("graphChange",updateMeasure) 
+                    ifDrawVerMeasure && bus.on("graphChange",updateMeasure) 
                     
                     measureFun = getMeasureFunction(shape, bus, true) 
                     //和普通MulDistance不同点:选中才能拖拽 非选中时不展示marker (clickSelected);选中后marker是非选中状态, 但是颜色一样
                     //https://lanhuapp.com/web/#/item/project/stage?tid=de3e5e3e-a489-4b19-862a-7c87ce113467&pid=fa4ff928-d61e-438a-b8ee-f848048b7f52
                      
-                }else{ 
+                }else{//固定点
                     mainPoint.copy(pos)
                     mainPoint.isFixPoint = true  
                     mainPoint.pos2d = Potree.Utils.getPos2d(mainPoint, viewer.mainViewport, viewer.renderArea )
-                    measure && createMeasureForPoint(mainPoint)
+                    ifDrawVerMeasure && createMeasureForPoint(mainPoint)
                     viewer.fixPoints.push(mainPoint) 
                 }
                
                 
-                viewer.addEventListener('baseLineChanged',baseLineChanged)  
+                ifDrawVerMeasure && viewer.addEventListener('baseLineChanged',baseLineChanged)  
                          
                      
                  
@@ -833,20 +832,24 @@ var enter = ({
                     },
                     quitMeasure(){//退出测量模式,删除测量线. 基准线被删时
                         console.log('quitMeasure'  )
-                        removeMeasureForPoint(mainPoint) 
-                        viewer.removeEventListener('baseLineChanged',baseLineChanged) 
+                        if(ifDrawVerMeasure){
+                            ifDrawVerMeasure = false
+                            removeMeasureForPoint(mainPoint) 
+                            viewer.removeEventListener('baseLineChanged',baseLineChanged) 
+                        }
                     },
                     changePos(pos){//固定点修改 
-                        console.log('changePos',pos)
+                        console.log('changePos',pos) 
                         mainPoint.copy(pos)
-                        updateMeasureForPoint(mainPoint)
+                        ifDrawVerMeasure && updateMeasureForPoint(mainPoint)
                        
                     },
                     changeBase(pos){//基准点修改
                         console.log('changeBase',pos)
-                        mainPoint.basePoint.copy(pos) 
-                        updateMeasureForPoint(mainPoint,{onlyBasePoint:true})
-                        
+                        if(ifDrawVerMeasure){
+                            mainPoint.basePoint.copy(pos) 
+                            updateMeasureForPoint(mainPoint,{onlyBasePoint:true})
+                        }
                     },
                     graphDrawComplete: measureFun && measureFun.end,