xzw 7 月之前
父節點
當前提交
959efac10e
共有 3 個文件被更改,包括 50 次插入43 次删除
  1. 48 41
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 1 1
      src/sdk/cover/index.js

+ 48 - 41
public/lib/potree/potree.js

@@ -43150,18 +43150,10 @@
 	    viewer.mapViewer && viewer.mapViewer.dispatchEvent('content_changed');
 	    viewer.dispatchEvent('content_changed');
 	  }
-	  setSelected( /* state, hoverObject */state, byList) {
+	  setSelected(state, byList) {
 	    var _this$arrows2;
-	    /* let absoluteState = !!state  
-	    if(hoverObject){//如果没有hoverObject且state为false 就强制取消选中态
-	        this.selectStates[hoverObject] = state
-	        for(var i in this.selectStates){
-	            if(this.selectStates[i]){
-	                absoluteState = true; break;
-	            }
-	        }
-	    } 
-	    this.selected = absoluteState*/
+	    if (state == 'click' && this.selectStates.click) return; //重复点击了
+
 	    state == 'hover' && (this.selectStates.hover = true, byList || this.dispatchEvent({
 	      type: 'highlight',
 	      state: true
@@ -43178,9 +43170,11 @@
 	      type: 'chose',
 	      state: false
 	    }));
-	    this.edge.material.color.set(this.selectStates.click ? '#00C8AF' : this.pathColor);
 	    (_this$arrows2 = this.arrows) === null || _this$arrows2 === void 0 || _this$arrows2.material.color.set(this.selectStates.click ? '#ffffff' : this.pathColor);
-	    [this.edge, this.endCaps[0].children[0]].forEach(e => e.material.opacity = this.selectStates.click ? 0.8 : this.selectStates.hover ? 0.6 : 0.3);
+	    [this.edge, this.endCaps[0].children[0]].forEach(e => {
+	      e.material.opacity = this.selectStates.click ? 0.8 : this.selectStates.hover ? 0.6 : 0.3;
+	      e.material.color.set(this.selectStates.click ? '#00C8AF' : this.pathColor);
+	    });
 	    state == 'click' && setTimeout(() => {
 	      viewer.addEventListener('global_click', e => {
 	        //再点击取消 
@@ -57182,6 +57176,7 @@
 	    this.updatePose();
 	  }
 	  changePos(info) {
+	    //注:onMesh时在非平地上拖拽,热点旋转会一直变 
 	    this.position.copy(info.position);
 	    this.normal.copy(info.normal);
 	    this.root = info.root;
@@ -57192,6 +57187,7 @@
 	  }
 	  changeOnMesh(onMesh) {
 	    //是否贴在mesh上
+	    //if(this.title == 'single2') debugger
 	    this.onMesh = onMesh;
 	    if (onMesh) {
 	      //贴mesh上时不是sprite,且可设置旋转值
@@ -57206,6 +57202,7 @@
 	      this.updateTitlePos();
 	      this.spot.position.set(0, 0, 0);
 	      this.spot.quaternion.set(0, 0, 0, 1); //this.titleLabel.waitUpdate() 
+	      this.realFaceAngle = 0;
 	      this.spot.renderOrder = Potree.config.renderOrders.tag.spot; //还原
 	      this.line.renderOrder = Potree.config.renderOrders.tag.line;
 	    }
@@ -57213,6 +57210,30 @@
 	    this.updateDepthParams();
 	    viewer.dispatchEvent('content_changed');
 	  }
+	  setFaceAngle() {
+	    var faceAngle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+	    //if(this.title == 'single2') debugger 
+	    this.faceAngle = faceAngle; //先记录,但非onMesh时不会用
+	    if (!this.onMesh) return;
+	    var delta = faceAngle - (this.realFaceAngle || 0);
+	    //this.plane.quaternion.setFromAxisAngle(new THREE.Vector3(0, 0, 1), THREE.MathUtils.degToRad(-faceAngle))
+	    this.spot.rotateOnAxis(new Vector3(0, 0, 1), MathUtils.degToRad(delta));
+	    //this.updateLabelPose()
+	    this.realFaceAngle = faceAngle;
+	    viewer.dispatchEvent('content_changed');
+	  }
+	  setNorQua() {
+	    if (!this.onMesh) return;
+	    this.spot.quaternion.setFromRotationMatrix(new Matrix4().lookAt(this.normal, Vectors$2.ZERO, Vectors$2.UP)); //重算quaternion
+	    this.realFaceAngle = 0; //quaternion被重置了,所以再设置一下faceAngle
+	    this.setFaceAngle(this.faceAngle);
+	  }
+
+	  /* 
+	  如果要像四维看看那样,在地面上时保持初始转向镜头的话,需要矫正且保存quaternion。且要根据世界normal判断是否在地面, 会随着模型改变, 所以也没法仅保存normal去矫正。
+	  要不然就要直接改变faceAngle
+	   */
+
 	  setTitle() {
 	    var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
 	    this.titleLabel.setText(title);
@@ -57248,28 +57269,6 @@
 	    });
 	    this.spot.material.map = map;
 	  }
-	  setFaceAngle() {
-	    var faceAngle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
-	    //this.baseQuaternion = quaternion.clone()
-
-	    var delta = faceAngle - (this.faceAngle || 0);
-	    //this.plane.quaternion.setFromAxisAngle(new THREE.Vector3(0, 0, 1), THREE.MathUtils.degToRad(-faceAngle))
-	    this.spot.rotateOnAxis(new Vector3(0, 0, 1), MathUtils.degToRad(delta));
-	    //this.updateLabelPose()
-	    this.faceAngle = faceAngle;
-	    viewer.dispatchEvent('content_changed');
-	  }
-	  setNorQua() {
-	    if (!this.onMesh) return;
-	    this.spot.quaternion.setFromRotationMatrix(new Matrix4().lookAt(this.normal, Vectors$2.ZERO, Vectors$2.UP));
-	    this.setFaceAngle(this.faceAngle); //quaternion被重置了,所以再设置一下faceAngle
-	  }
-
-	  /* 
-	  如果要像四维看看那样,在地面上时保持初始转向镜头的话,需要矫正且保存quaternion。且要根据世界normal判断是否在地面, 会随着模型改变, 所以也没法仅保存normal去矫正。
-	  要不然就要直接改变faceAngle
-	   */
-
 	  updateMatrixWorld(force) {
 	    //重写,只为了将root当做parent
 
@@ -78512,11 +78511,19 @@
 	        var _viewer$inputHandler$, _viewer$inputHandler$2;
 	        var model = ((_viewer$inputHandler$ = viewer.inputHandler.intersect) === null || _viewer$inputHandler$ === void 0 ? void 0 : _viewer$inputHandler$.object) || ((_viewer$inputHandler$2 = viewer.inputHandler.intersect) === null || _viewer$inputHandler$2 === void 0 ? void 0 : _viewer$inputHandler$2.pointcloud);
 	        if (model) this.updateRadiusByModel(model, viewer.inputHandler.intersect.location.distanceTo(this.currentViewport.view.position));else {
-	          var disToGroundInDir = Math.abs(this.currentViewport.camera.position.z / this.currentViewport.view.direction.z); //相机和地面交点距离
-	          maxRadius = Math.max(2, disToGroundInDir * 1.5); //越靠近地面速度越慢,防止移动来移动去久了之后距离模型很近但radius很大
-
-	          minRadius = disToGroundInDir * 0.9; //防止在高空放大很慢
-	          //console.log('changeRadius common', minRadius, maxRadius)
+	          /* let disToGroundInDir = Math.abs(this.currentViewport.camera.position.z / this.currentViewport.view.direction.z)  //相机和地面交点距离
+	          maxRadius = Math.max(2, disToGroundInDir*1.5)//越靠近地面速度越慢,防止移动来移动去久了之后距离模型很近但radius很大
+	          
+	          minRadius = disToGroundInDir * 0.9 //防止在高空放大很慢(注:不要把mesh放到地平线以下,否则hover mesh时很快,不hover又很慢)
+	          console.log('changeRadius common', minRadius, maxRadius) */
+	          if (!viewer.bound || viewer.bound.boundSize.x == 0) return;
+	          var boundFloor = viewer.bound.boundingBox.clone();
+	          var dis1 = boundFloor.distanceToPoint(viewer.mainViewport.view.position);
+	          boundFloor.max.z = boundFloor.min.z;
+	          var dis2 = boundFloor.distanceToPoint(viewer.mainViewport.view.position);
+	          minRadius = Math.max(2, dis1 * 0.5);
+	          maxRadius = Math.max(4, dis2 * 1.5);
+	          console.log('changeRadius common', minRadius, maxRadius);
 	        }
 	      }
 	    });
@@ -78630,7 +78637,7 @@
 	    var distance = MathUtils.clamp(dis, 0.8 * object.scale.x, Math.max(len * 0.1, 3 * object.scale.x));
 	    minRadius = distance;
 	    maxRadius = dis * 2;
-	    //console.log('updateRadiusByModel',minRadius, maxRadius)
+	    console.log('updateRadiusByModel', minRadius, maxRadius);
 	    return distance;
 	  }
 	  stopTweens() {

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


+ 1 - 1
src/sdk/cover/index.js

@@ -1588,7 +1588,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
         createTagging(props){
             let bus = mitt()
             
-            //console.warn('createTagging', props)
+             console.warn('createTagging', props)
             let root = viewer.scene.pointclouds.concat(viewer.objs.children).find(e=>e.dataset_id == props.modelId)
             if(!root){
                 return console.error('热点没有找到该modelId,模型是否已经删除?')