|
@@ -16,9 +16,9 @@ from "@/lang";
|
|
import libTransform from "coordtransform";
|
|
import libTransform from "coordtransform";
|
|
//交通版laser 主要适用设备:MatePad Pro 11英寸
|
|
//交通版laser 主要适用设备:MatePad Pro 11英寸
|
|
|
|
|
|
|
|
+const pointMeasureColor = "#3290ff"
|
|
|
|
|
|
-
|
|
|
|
-var CloneJson = function (data) {
|
|
|
|
|
|
+const CloneJson = function (data) {
|
|
var str = JSON.stringify(data);
|
|
var str = JSON.stringify(data);
|
|
return JSON.parse(str);
|
|
return JSON.parse(str);
|
|
};
|
|
};
|
|
@@ -374,45 +374,52 @@ var enter = ({
|
|
|
|
|
|
|
|
|
|
let getMeasurePointsInfo = (fixPoint, onlyMoveBasePoint)=>{
|
|
let getMeasurePointsInfo = (fixPoint, onlyMoveBasePoint)=>{
|
|
- let fixPoint2d = new THREE.Vector2.copy(fixPoint)
|
|
|
|
- let baselineP12d = new THREE.Vector2.copy(baseLine.points[0])
|
|
|
|
- let baselineP22d = new THREE.Vector2.copy(baseLine.points[1])
|
|
|
|
- let foot_2d = Potree.math.getFootPoint(fixPoint2d, baselineP12d, baselineP22d)
|
|
|
|
- let foot1_P1 = new THREE.Vector3(foot_2d.x, foot_2d.y, fixPoint.z)
|
|
|
|
- let foot1_P2 = new THREE.Vector3(foot_2d.x, foot_2d.y, baseLine.points[0].z)
|
|
|
|
|
|
+ let baseLine = viewer.scene.measurements.find(e=>e.isBaseLine && e.points.length == 2)
|
|
|
|
+ if(!baseLine){
|
|
|
|
+ return console.error('创建失败,因基准线不存在')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let fixPoint2d = new THREE.Vector2().copy(fixPoint)
|
|
|
|
+ let baselineP12d = new THREE.Vector2().copy(baseLine.points[0])
|
|
|
|
+ let baselineP22d = new THREE.Vector2().copy(baseLine.points[1])
|
|
|
|
+ let foot1_2d = Potree.math.getFootPoint(fixPoint2d, baselineP12d, baselineP22d)
|
|
|
|
+ let minZ = Math.min(fixPoint.basePoint.z, baseLine.points[0].z, fixPoint.z)
|
|
|
|
+ let maxZ = Math.max(fixPoint.basePoint.z, baseLine.points[0].z, fixPoint.z)
|
|
|
|
+ let foot1_P1 = new THREE.Vector3(foot1_2d.x, foot1_2d.y, fixPoint.z)
|
|
|
|
+ let foot1_P2 = new THREE.Vector3(foot1_2d.x, foot1_2d.y, minZ)
|
|
|
|
+ let foot1_P3 = new THREE.Vector3(foot1_2d.x, foot1_2d.y, maxZ)
|
|
|
|
+
|
|
|
|
+
|
|
let info = {
|
|
let info = {
|
|
disMeasure1:{
|
|
disMeasure1:{
|
|
- points: [new THREE.Vector3().copy(fixPoint), foot1_P1],
|
|
|
|
- guideLinePoints : [foot1_P1, foot1_P2], //到基准线平面的垂直辅助线
|
|
|
|
|
|
+ points: [new THREE.Vector3().copy(fixPoint), foot1_P1],
|
|
|
|
+ guideLinePoints : [foot1_P2, foot1_P3] //垂足上的垂线,从最低点到最高点(包含disMeasure2那一段)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(!onlyMoveBasePoint){
|
|
|
|
- let basePoint2d = new THREE.Vector2().copy(fixPoint.basePoint)
|
|
|
|
- let anotherPoint2d = new THREE.Vector2().addVectors(basePoint2d, basePoint2d.clone().add(new THREE.Vector2().subVectors(baselineP12d,baselineP22d)))//测量线方向上另一点
|
|
|
|
- let foot2_2d = Potree.math.getFootPoint(fixPoint2d, basePoint2d, anotherPoint2d)
|
|
|
|
- let foot2_P1 = new THREE.Vector3(foot2_2d.x, foot2_2d.y, fixPoint.basePoint.z)
|
|
|
|
- let foot2_P2 = new THREE.Vector3(foot1_2d.x, foot1_2d.y, fixPoint.basePoint.z)
|
|
|
|
- info.disMeasure2 = {
|
|
|
|
- points : new THREE.Vector3().copy(fixPoint), footP1],
|
|
|
|
- guideLinePoints : [foot2_P1, foot2_P2, foot1_P2],
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ let basePoint2d = new THREE.Vector2().copy(fixPoint.basePoint)
|
|
|
|
+ let anotherPoint2d = new THREE.Vector2().addVectors(basePoint2d, new THREE.Vector2().subVectors(baselineP12d,baselineP22d))//测量线方向上另一点
|
|
|
|
+ let foot2_2d = Potree.math.getFootPoint(fixPoint2d, basePoint2d, anotherPoint2d)
|
|
|
|
+ let foot2_P1 = new THREE.Vector3(foot2_2d.x, foot2_2d.y, fixPoint.basePoint.z)
|
|
|
|
+ let foot2_P2 = new THREE.Vector3(foot1_2d.x, foot1_2d.y, fixPoint.basePoint.z)
|
|
|
|
+ info.disMeasure2 = {
|
|
|
|
+ points : [new THREE.Vector3().copy(fixPoint.basePoint), foot2_P1],
|
|
|
|
+ guideLinePoints : [foot2_P1, foot2_P2/* , foot1_P2 */],
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
|
|
return info
|
|
return info
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
let createMeasureForPoint = (fixPoint)=>{
|
|
let createMeasureForPoint = (fixPoint)=>{
|
|
- let baseLine = viewer.scene.measurements.find(e=>e.isBaseLine && e.points.length == 2)
|
|
|
|
- if(!baseLine){
|
|
|
|
- return console.error('创建失败,因基准线不存在')
|
|
|
|
- }
|
|
|
|
|
|
|
|
- let info = getMeasurePointsInfo(fixPoint)
|
|
|
|
|
|
|
|
|
|
+ let info = getMeasurePointsInfo(fixPoint)
|
|
|
|
+ if(!info)return
|
|
|
|
|
|
let info1 = {//垂直于基准线的水平测量线
|
|
let info1 = {//垂直于基准线的水平测量线
|
|
- measureType : 'Hor Distance',
|
|
|
|
|
|
+ measureType : 'Hor Distance', color : pointMeasureColor ,
|
|
unableDrag: true,
|
|
unableDrag: true,
|
|
points: info.disMeasure1.points,
|
|
points: info.disMeasure1.points,
|
|
guideLinePoints : info.disMeasure1.guideLinePoints
|
|
guideLinePoints : info.disMeasure1.guideLinePoints
|
|
@@ -422,7 +429,7 @@ var enter = ({
|
|
|
|
|
|
|
|
|
|
let info2 = {//平行于基准线的水平测量线
|
|
let info2 = {//平行于基准线的水平测量线
|
|
- measureType : 'Hor Distance',
|
|
|
|
|
|
+ measureType : 'Hor Distance', color : pointMeasureColor ,
|
|
unableDrag: true,
|
|
unableDrag: true,
|
|
points: info.disMeasure2.points,
|
|
points: info.disMeasure2.points,
|
|
guideLinePoints : info.disMeasure2.guideLinePoints
|
|
guideLinePoints : info.disMeasure2.guideLinePoints
|
|
@@ -694,10 +701,10 @@ var enter = ({
|
|
|
|
|
|
|
|
|
|
createFixPoint({measure, graph, pos, basePoint}){//创建固定点或多线段
|
|
createFixPoint({measure, graph, pos, basePoint}){//创建固定点或多线段
|
|
-
|
|
|
|
|
|
+ console.log('createFixPoint',measure, graph, pos, basePoint)
|
|
const bus = mitt();
|
|
const bus = mitt();
|
|
let info = {
|
|
let info = {
|
|
- measureType : 'MulDistance', color : "#3290ff"
|
|
|
|
|
|
+ measureType : 'MulDistance', color : pointMeasureColor
|
|
}
|
|
}
|
|
let measureFun, fixPoint
|
|
let measureFun, fixPoint
|
|
|
|
|
|
@@ -737,33 +744,44 @@ var enter = ({
|
|
|
|
|
|
bus,
|
|
bus,
|
|
destroy : measureFun ? measureFun.clear : ()=>{
|
|
destroy : measureFun ? measureFun.clear : ()=>{
|
|
|
|
+ console.log('destroy' )
|
|
removeMeasureForPoint(fixPoint)
|
|
removeMeasureForPoint(fixPoint)
|
|
let index = viewer.fixPoints.indexOf(fixPoint)
|
|
let index = viewer.fixPoints.indexOf(fixPoint)
|
|
index > -1 && viewer.fixPoints.splice(index,1)
|
|
index > -1 && viewer.fixPoints.splice(index,1)
|
|
},
|
|
},
|
|
quitMeasure(){//退出测量模式,删除测量线
|
|
quitMeasure(){//退出测量模式,删除测量线
|
|
|
|
+ console.log('quitMeasure' )
|
|
removeMeasureForPoint(fixPoint)
|
|
removeMeasureForPoint(fixPoint)
|
|
|
|
|
|
},
|
|
},
|
|
changePos(pos){//固定点修改
|
|
changePos(pos){//固定点修改
|
|
|
|
+ console.log('changePos',pos)
|
|
fixPoint.copy(pos)
|
|
fixPoint.copy(pos)
|
|
let info = getMeasurePointsInfo(fixPoint)
|
|
let info = getMeasurePointsInfo(fixPoint)
|
|
|
|
+ if(!info)return
|
|
fixPoint.disMeasure1.points = info.disMeasure1.points
|
|
fixPoint.disMeasure1.points = info.disMeasure1.points
|
|
|
|
+ fixPoint.disMeasure1.update({ifUpdateMarkers:true})
|
|
fixPoint.disMeasure1.guideLinePoints = info.disMeasure1.guideLinePoints
|
|
fixPoint.disMeasure1.guideLinePoints = info.disMeasure1.guideLinePoints
|
|
- fixPoint.disMeasure1.guideLine.updateGuideLines()
|
|
|
|
|
|
+ fixPoint.disMeasure1.updateGuideLines()
|
|
fixPoint.disMeasure2.points = info.disMeasure2.points
|
|
fixPoint.disMeasure2.points = info.disMeasure2.points
|
|
|
|
+ fixPoint.disMeasure2.update({ifUpdateMarkers:true})
|
|
fixPoint.disMeasure2.guideLinePoints = info.disMeasure2.guideLinePoints
|
|
fixPoint.disMeasure2.guideLinePoints = info.disMeasure2.guideLinePoints
|
|
- fixPoint.disMeasure2.guideLine.updateGuideLines()
|
|
|
|
|
|
+ fixPoint.disMeasure2.updateGuideLines()
|
|
|
|
+
|
|
},
|
|
},
|
|
changeBase(pos){//基准点修改
|
|
changeBase(pos){//基准点修改
|
|
|
|
+ console.log('changeBase',pos)
|
|
fixPoint.basePoint.copy(pos)
|
|
fixPoint.basePoint.copy(pos)
|
|
- let info = getMeasurePointsInfo(fixPoint,true)
|
|
|
|
|
|
+ let info = getMeasurePointsInfo(fixPoint)
|
|
|
|
+ if(!info)return
|
|
|
|
+ fixPoint.disMeasure1.guideLinePoints = info.disMeasure1.guideLinePoints
|
|
|
|
+ fixPoint.disMeasure1.guideLine.updateGuideLines()
|
|
fixPoint.disMeasure2.points = info.disMeasure2.points
|
|
fixPoint.disMeasure2.points = info.disMeasure2.points
|
|
fixPoint.disMeasure2.guideLinePoints = info.disMeasure2.guideLinePoints
|
|
fixPoint.disMeasure2.guideLinePoints = info.disMeasure2.guideLinePoints
|
|
fixPoint.disMeasure2.guideLine.updateGuideLines()
|
|
fixPoint.disMeasure2.guideLine.updateGuideLines()
|
|
|
|
|
|
},
|
|
},
|
|
- graphDrawComplete: measureFun.end,
|
|
|
|
|
|
+ graphDrawComplete: measureFun && measureFun.end,
|
|
|
|
|
|
|
|
|
|
|
|
|