瀏覽代碼

fix: recover map

xzw 7 月之前
父節點
當前提交
d56026021c
共有 3 個文件被更改,包括 25 次插入101 次删除
  1. 8 95
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 16 5
      src/sdk/cover/index.js

+ 8 - 95
public/lib/potree/potree.js

@@ -42972,95 +42972,6 @@
 	    this.lastUpdatePoints_ = this.points.map(e => e.clone());
 	  } //不使用curve的曲线是因为那种geo点数较多,且改的话不知道updateArrows怎么改,除非变为贴图,但就和需求中需要调节间距违背。
 
-	  updateEdge1() {
-	    //drawPathRibbon版
-	    if (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是平滑过的曲线,和设计不一样,且容易翻转,转角有时候细分过少
-
-	    //只允许path水平放置
-	    var geo;
-	    var points_ = this.getDifferentPoint(this.points);
-	    var len = points_.length;
-	    this.edge.geometry.dispose();
-	    if (len <= 1) {
-	      geo = voidGeometry;
-	    } else {
-	      //drawPathRibbon  setFloorCurves 
-	      var line = new CatmullRomCurve3(points_, false);
-	      var points = line.getSpacedPoints(100);
-	      var posArr = [],
-	        faceArr = [];
-	      for (var i = this.halfPathWidth, n = new Vector3(), r = new Vector3(0, 0, 0), a = new Vector3(), s = 0; s < points.length; s += 1) {
-	        a.copy(points[s]), 0 === s ? a.sub(points[s + 1]) : a.sub(points[s - 1]).negate(), a.normalize(), n.crossVectors(a, new Vector3(0, 0, 1)), n.multiplyScalar(i);
-	        var l = new Vector3().copy(points[s]).add(r);
-	        l.sub(n), posArr.push(l),
-	        //o.vertices.push(l),
-	        (l = new Vector3().copy(points[s]).add(r)).add(n), posArr.push(l); //o.vertices.push(l)
-	      } //问题:不是水平放置,高度不同时有点扭转,且宽度改变了
-
-	      var c,
-	        h,
-	        u,
-	        d = 0;
-	      for (s = 0; s < points.length - 1; s += 1) {
-	        var p = 2 * s;
-	        //  , f = d
-	        //  , g = d += points[s + 1].distanceTo(points[s])
-	        //  , m = t[s]
-	        //  , v = t[s + 1];
-	        //(c = new P.Face3(p,1 + p,2 + p)).vertexColors = [new P.Color(m), new P.Color(m), new P.Color(v)],
-	        //o.faces.push(c),
-	        faceArr.push([p, 1 + p, 2 + p]);
-	        //o.faceVertexUvs[0].push([new P.Vector2(0,f), new P.Vector2(1,f), new P.Vector2(0,g)]),
-	        //(c = new P.Face3(2 + p,1 + p,3 + p)).vertexColors = [new P.Color(v), new P.Color(m), new P.Color(v)],
-	        //o.faces.push(c),
-	        faceArr.push([2 + p, 1 + p, 3 + p]);
-	        //o.faceVertexUvs[0].push([new P.Vector2(0,g), new P.Vector2(1,f), new P.Vector2(1,g)])
-	      }
-	      //o.computeFaceNormals(),
-	      //o.computeVertexNormals(), 
-
-	      geo = MeshDraw.createGeometry(posArr, faceArr);
-	    }
-	    this.edge.geometry = geo;
-	    this.lastHalfPathWidth = this.halfPathWidth;
-	    this.lastUpdatePoints_ = this.points.map(e => e.clone());
-	  } //不使用curve的曲线是因为那种geo点数较多,且改的话不知道updateArrows怎么改,除非变为贴图,但就和需求中需要调节间距违背。
-
-	  /*  
-	   
-	   updateEdge(){
-	       if(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 })
-	       //getExtrudeGeo是平滑过的曲线,和设计不一样,且容易翻转,转角有时候细分过少
-	       
-	       //只允许path水平放置
-	       let geo
-	       let points_ = this.getDifferentPoint(this.points)
-	       let len = points_.length
-	       this.edge.geometry.dispose()
-	        
-	       if(len <= 1){
-	           geo = voidGeometry
-	       }else{
-	           //drawPathRibbon  setFloorCurves 
-	           let line = new THREE.CatmullRomCurve3(points_, false    )  
-	           let points = line.getSpacedPoints(100)
-	           let posArr = [], faceArr = [] 
-	           
-	           
-	           
-	           
-	           geo = MeshDraw.createGeometry(posArr, faceArr)
-	       }
-	       
-	       this.edge.geometry = geo
-	       
-	       this.lastHalfPathWidth = this.halfPathWidth
-	       this.lastUpdatePoints_ = this.points.map(e=>e.clone())
-	   } */
-
 	  update() {
 	    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    if (options.index == -1) return;
@@ -81804,7 +81715,8 @@
 	          if (!history.waitCompute.forceGet && (history.waitCompute.panoId != this.images360.currentPano.id || !this.images360.isAtPano(0.1))) {
 	            delete history.waitCompute; //取消计算
 	          } else {
-	            if (this.images360.currentPano.depthTex) {
+	            var _this$images360$curre;
+	            if ((_this$images360$curre = this.images360.currentPano) !== null && _this$images360$curre !== void 0 && _this$images360$curre.depthTex) {
 	              if (byTex >= maxTexCount) break;
 	              byTex++;
 	              var ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({
@@ -81818,7 +81730,8 @@
 	              delete history.waitCompute;
 	              //console.log('补1', history.point.toArray())
 	            } else {
-	              if (this.images360.currentPano.pointcloud.hasDepthTex) {
+	              var _this$images360$curre2;
+	              if ((_this$images360$curre2 = this.images360.currentPano) !== null && _this$images360$curre2 !== void 0 && _this$images360$curre2.pointcloud.hasDepthTex) {
 	                //先等待加载完深度图
 	              } else {
 	                waitCloud.push(history);
@@ -84944,7 +84857,7 @@
 	        //console.log('mapFocusOn: '+target.toArray()) 
 	        this.mapViewer.moveTo(target.clone(), null, duration);
 	      }
-	      if (Potree.settings.displayMode == 'showPointCloud') {
+	      if (Potree.settings.displayMode == 'showPointCloud' && !o.requestShowPano) {
 	        if (o.dontChangePos) {
 	          position.copy(cameraPos);
 	        } else {
@@ -84992,7 +84905,7 @@
 	            console.log('移近');
 	          }
 	        }
-	      } else if (Potree.settings.displayMode == 'showPanos') {
+	      } else {
 	        var _pano = viewer.images360.fitPanoTowardPoint({
 	          point: target,
 	          dir: this.mainViewport.view.direction,
@@ -85722,8 +85635,8 @@
 	      }
 	    });
 	    var judge = () => {
-	      var _this$images360$curre;
-	      if (!((_this$images360$curre = this.images360.currentPano) !== null && _this$images360$curre !== void 0 && _this$images360$curre.depthTex) && Potree.settings.displayMode == 'showPanos') {
+	      var _this$images360$curre3;
+	      if (!((_this$images360$curre3 = this.images360.currentPano) !== null && _this$images360$curre3 !== void 0 && _this$images360$curre3.depthTex) && Potree.settings.displayMode == 'showPanos') {
 	        Potree.Utils.updateVisible(mesh, 'show', true);
 	      } else {
 	        Potree.Utils.updateVisible(mesh, 'show', false);

File diff suppressed because it is too large
+ 1 - 1
public/lib/potree/potree.js.map


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

@@ -466,11 +466,11 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
         sceneBus, mapBus,
         
         
-        canTurnToPanoMode(pos) { 
+        canTurnToPanoMode(pos, far=Potree.config.panoFieldRadius) { 
             pos = pos ? new THREE.Vector3().copy(pos) : viewer.images360.position
 
             let pano = viewer.images360.findNearestPano(pos)
-            if (pano && pano.position.distanceTo(pos) < Potree.config.panoFieldRadius * pano.pointcloud.scale.x) {
+            if (pano && pano.position.distanceTo(pos) < far * pano.pointcloud.scale.x) {
                 return {model:pano.pointcloud.result_}
             }
             //poschange后会调用这个,如果返回false会变为点云模式,且不会自动变回原先的模式
@@ -659,10 +659,21 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 }
             }
             
-
+            //o.requestShowPano = true
             if (o.distance || o.maxDis) {
                 let position = o.target || o.position
-                return viewer.focusOnObject({ position }, 'tag', null, { distance: o.distance,  maxDis : o.maxDis }).promise
+                if(o.requestShowPano && Potree.settings.displayMode == 'showPointCloud'){
+                    let r = sdk.canTurnToPanoMode(position, o.maxDis)//热点新需求:如果附近有漫游点就飞到全景模式
+                    if(!r){
+                        o.requestShowPano = false
+                    }
+                }
+                let rusult = viewer.focusOnObject({ position }, 'tag', null, { distance: o.distance,  maxDis : o.maxDis, requestShowPano: o.requestShowPano/* , checkIntersect:true */ })
+                o.requestShowPano && rusult.promise.then(()=>{
+                    Potree.settings.displayMode = 'showPanos'
+                })
+                return rusult.promise
+               
             }
             
 
@@ -1926,7 +1937,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 minimumLevel: 0,
                 maximumLevel: satellite?18:19, 
                 credit: new Cesium.Credit('高德地图'),
-                //tilingScheme: new AmapMercatorTilingScheme(),  //修改投影,从84->高德
+                tilingScheme: new AmapMercatorTilingScheme(),  //修改投影,从84->高德
                 crossOrigin: 'anonymous',
             }) 
             cesiumViewer.imageryLayers.removeAll();