Procházet zdrojové kódy

fix: hide path point

xzw před 20 hodinami
rodič
revize
dce8631689

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

@@ -45522,8 +45522,8 @@
 	    this.pauseUpdateEdge = false;
 	    this.updateEdge();
 	  }
-	  updateEdge() {
-	    if (this.pauseUpdateEdge || this.lastUpdatePoints_ && Potree.Common.ifSame(this.lastUpdatePoints_, this.points) && this.halfPathWidth == this.lastHalfPathWidth) return; //没变 不更新
+	  updateEdge(force) {
+	    if (!force && (this.pauseUpdateEdge || this.lastUpdatePoints_ && Potree.Common.ifSame(this.lastUpdatePoints_, this.points) && this.halfPathWidth == this.lastHalfPathWidth)) return; //没变 不更新
 	    //this.edge.geometry = MeshDraw.getExtrudeGeo(edgeExtrudePoints, null,  {extrudePath: this.points, openEnded:true, shapeDontClose:true/* , dontSmooth:true, steps: this.points.length-1 */})
 	    //getExtrudeGeo是平滑过的曲线,和设计不一样,且容易翻转,转角有时候细分过少
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
public/lib/potree/potree.js.map


+ 86 - 10
src/sdk/cover/index.js

@@ -151,6 +151,14 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
     window.cesErrorCallback = ()=>{
         //sdk.setBackdrop('none')
     }
+    
+    {
+        let oldfun = Potree.Path.prototype.getDifferentPoint
+        Potree.Path.prototype.getDifferentPoint = function(points){ 
+            return oldfun.call(this, points.filter((e,i)=>{return !this.pointHideList[i]}) )
+        }
+    }
+    
    
     let { THREE } = Potree.mergeEditStart(dom, mapDom, {
         queryCloudLonLatUrl:Potree.settings.urls.prefix+"/laser/4dage/{sceneCode}/getDataSetAndControlPoint"  
@@ -434,6 +442,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                         modelId: measure.points_datasets[i] == void 0 ? Id_noIntersect : measure.points_datasets[i], 
                         name: measure.markerLabels[i].originText
                     }}))
+                    updatePathHideLine(measure)
                 }else{
                     bus.emit('update', [
                         measure.dataset_points.map(p => p.clone()),
@@ -1903,17 +1912,23 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 path = viewer.measuringTool.startInsertion( info, () => { 
                     bus.emit("drawed" ); //完成   
                 })
+                path.pointHideList = []
+                path.fakeLines = []
                 viewer.dispatchEvent({ type: 'cancel_insertions', dontRemove: true, measure:path }) //要等进入编辑才能继续编辑
-            }else{
-                
+            }else{ 
                 let originPointCount = props.points.length
-                props.points = props.points.filter(e=> isValidPoint(e.modelId))
-                info.points_datasets = props.points.map(e=> e.modelId == Id_noIntersect ? null : e.modelId) 
-                info.dataset_points = info.points = props.points.map(e=>e.position)//当该点不在任何模型上时,记录的是世界坐标,所以两个都赋值,过后根据有无datasetID选择
+                 
                 
+                props.points = props.points.filter(e=> isValidPoint(e.modelId) )
                 
-                path = viewer.measuringTool.createMeasureFromData(info);
-            
+                info.points_datasets = props.points.map(e=> e.modelId == Id_noIntersect ? null : e.modelId) 
+                info.dataset_points = info.points = props.points.map(e=>e.position)//当该点不在任何模型上时,记录的是世界坐标,所以两个都赋值,过后根据有无datasetID选择
+                info.pointHideList = props.points.map(e=>e.hide) //add  
+                info.fakeLines = []
+                path = viewer.measuringTool.createMeasureFromData(info); 
+           
+
+
                 if(props.line.position) { 
                     if(isValidPoint(props.line.modelId)){ 
                         let pos = props.line.modelId == Id_noIntersect ? new THREE.Vector3().copy(props.line.position) : 
@@ -2014,7 +2029,25 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 },
                 deletePoint(index){
                     path.removePoint(index)
+                    /* hideMarkers.forEach(e=>{
+                        if(e.index>index) e.index -= 1 //向前移动
+                    }) */
+                    path.pointHideList.splice(index, 1)
                 },
+                
+                changeHide(){},
+                changePointDisplay(index, show){
+                    /* hideMarkers.push({index , info:   {
+                        position:  (path.dataset_points[index] || path.points[index]).clone(), 
+                        modelId: path.points_datasets[index] == void 0 ? Id_noIntersect : path.points_datasets[index], 
+                        name: path.markerLabels[index].originText
+                    }}) */
+                    path.pointHideList[index] = !show
+                    updatePathHideLine(path)
+                    path.updateEdge(true)
+                    viewer.dispatchEvent('content_changed')
+                },
+                 
                 changeFontSize(fontsize){ 
                     path.setFontSize(fontsize)
                 },
@@ -2706,13 +2739,56 @@ function load4dkkMedias(model){//加载四维看看的一些媒体物品
     
     
     
-    //cutModelPath裁剪模型路径 
-   
+    //cutModelPath裁剪模型路径  
+}
+ 
+
+ 
+function updatePathHideLine(path){
+    
+    function removeLine(i){
+        if(path.fakeLines[i]){
+            line.parent.removeChild(path.fakeLines[i])
+            path.fakeLines[i] = null
+        }
+    }
+    function addLine(index){
+        if(index<0)return
+        let line = Potree.LineDraw.createFatLine([],{
+            //color: ,
+            opacity:0.8,            
+            dashSize: 0.1, 
+            gapSize: 0.1,
+            dashed: true,
+            lineWidth: 3
+        }) 
+        path.fakeLines[index] = line
+        path.add(line)
+    }
+    path.pointHideList.forEach((e,i)=>{
+        if(e){
+            if(!path.fakeLines[i-1]) addLine(i-1)
+            if(!path.fakeLines[i]) addLine(i) 
+        }
+    }) 
+
+    for(let i=path.points.length; i<path.fakeLines.length; i++ ){
+        removeLine(i)
+    }
+    path.fakeLines.length = path.points.length - 1
+     
     
     
+    path.fakeLines.forEach((line,index)=>{
+        if(line){
+            Potree.LineDraw.updateLine(line, [path.points[index], path.points[index+1]]) 
+        }
+    })
     
 }
- 
+
+
+
 /* 
 
     暂定不同场景间的漫游点不能互通。虽然它们可能是摆放正确的,如果是组成一整个场景的话还是要打通……