xzw 2 月之前
父节点
当前提交
beffae3975
共有 1 个文件被更改,包括 26 次插入5 次删除
  1. 26 5
      src/sdk/cover/index.js

+ 26 - 5
src/sdk/cover/index.js

@@ -18,6 +18,9 @@ const ModelTypes = {
     8 : {name:'动画模型'}
 }
 
+
+
+
 let satellite = true
 let defaultMapProps = satellite ? 
 [{url: `//wprd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x={x}&y={y}&z={z}&layer=6&token=YOUR_API_KEY`, //style=6是卫星,7是标准
@@ -84,13 +87,32 @@ let addPath = ()=>{//加个他们拍的路径
     if(spaceTime == '') spaceTime = 40 
     let height = 3.2
     
+    $('.ui-editor-head').css('pointer-events','none')
     
-    Potree.loadFile(Potree.resourcePath+'/pathPoints.json', null, (data)=>{
+    let createBtn = ()=>{
+        
+        let btn = document.createElement('button')
+        btn.innerHTML = '导出',btn.id = 'exportPath'
+        $(btn).css({
+            right: '10px', 'bottom':'10px',background:'#eee',position:'fixed','zIndex':1000
+        })
+        $('body').append($(btn))
+        btn.addEventListener('click',()=>{
+            let data = path.points.map(e=> e.toArray()) 
+            navigator.clipboard.writeText(JSON.stringify(data ) ) 
+            alert('复制成功')
+        })
+    }
+    let fileName = 'pathPointsNew'    //pathPoints.json
+    Potree.loadFile(Potree.resourcePath+'/'+fileName+'.json', null, (data)=>{
         console.log(data)
         window.pathPoints = data
         let points = []
         data.forEach((e,i)=>{
             let pos 
+            if(fileName == 'pathPointsNew'){
+                return points.push(new THREE.Vector3().fromArray(e))
+            }
             if(useLonlat){
                 pos = viewer.transform.lonlatToLocal.forward([e.longitude, e.latitude, e.relativeHeight])
                 pos = new THREE.Vector3().fromArray(pos)
@@ -108,6 +130,7 @@ let addPath = ()=>{//加个他们拍的路径
             let index = 0
             let interval = setInterval(()=>{
                 if(index == points.length) {
+                    createBtn()
                     return clearInterval(interval) 
                 }
                 path.addMarker({index,point:points[index]})
@@ -123,13 +146,11 @@ let addPath = ()=>{//加个他们拍的路径
             path.dataset_points = path.points.slice()
             path.setEditEnable(false)
             path.update()
-            
+            createBtn()
             
         }  
-    
+        addedPath = true
     })
-   
-    addedPath = true
     
     
 }