|
@@ -388,7 +388,7 @@ var enter = ({
|
|
|
|
|
|
|
|
|
|
|
|
- let getMeasurePointsInfo = (fixPoint, onlyMoveBasePoint)=>{
|
|
|
+ /* let getMeasurePointsInfo = (fixPoint, onlyMoveBasePoint)=>{
|
|
|
let baseLine = viewer.scene.measurements.find(e=>e.isBaseLine && e.points.length == 2)
|
|
|
if(!baseLine){
|
|
|
return console.error('创建失败,因基准线不存在')
|
|
@@ -422,7 +422,7 @@ var enter = ({
|
|
|
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 */],
|
|
|
+ guideLinePoints : [foot2_P1, foot2_P2 ],
|
|
|
}
|
|
|
fixPoint.bus.emit('measureChange',[
|
|
|
{line: info.disMeasure1.points, dis: info.disMeasure1.points[0].distanceTo(info.disMeasure1.points[1])},
|
|
@@ -431,7 +431,51 @@ var enter = ({
|
|
|
|
|
|
|
|
|
return info
|
|
|
- }
|
|
|
+ } */
|
|
|
+ let getMeasurePointsInfo = (fixPoint, onlyMoveBasePoint)=>{
|
|
|
+ let baseLine = viewer.scene.measurements.find(e=>e.isBaseLine && e.points.length == 2)
|
|
|
+ if(!baseLine){
|
|
|
+ return console.error('创建失败,因基准线不存在')
|
|
|
+ }
|
|
|
+ if(!fixPoint.basePoint){
|
|
|
+ return //console.log('no basePoint')
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 foot1_P1 = new THREE.Vector3(foot1_2d.x, foot1_2d.y, baseLine.points[0].z)
|
|
|
+ let fixPointProj = fixPoint.clone().setZ(baseLine.points[0].z)
|
|
|
+
|
|
|
+ let info = {
|
|
|
+ disMeasure1:{
|
|
|
+ points: [fixPointProj, foot1_P1],
|
|
|
+ guideLinePoints : [new THREE.Vector3().copy(fixPoint), fixPointProj] //垂足上的垂线,从最低点到最高点(包含disMeasure2那一段)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let basePoint2d = new THREE.Vector2().copy(fixPoint.basePoint)
|
|
|
+ let anotherPoint2d = new THREE.Vector2().addVectors(basePoint2d, new THREE.Vector2().subVectors(baselineP12d,baselineP22d))//测量线方向上另一点
|
|
|
+ let basePointProj = fixPoint.basePoint.clone().setZ(baseLine.points[0].z)
|
|
|
+ let foot2_2d = Potree.math.getFootPoint(fixPoint2d, basePoint2d, anotherPoint2d)
|
|
|
+ let foot2_P1 = new THREE.Vector3(foot2_2d.x, foot2_2d.y, baseLine.points[0].z)
|
|
|
+ info.disMeasure2 = {
|
|
|
+ guideLinePoints : [new THREE.Vector3().copy(fixPoint.basePoint), basePointProj, foot2_P1, foot1_P1],
|
|
|
+ points : [basePointProj, foot2_P1 ],
|
|
|
+ }
|
|
|
+ fixPoint.bus.emit('measureChange',[
|
|
|
+ {line: info.disMeasure1.points, dis: info.disMeasure1.points[0].distanceTo(info.disMeasure1.points[1])},
|
|
|
+ {line: info.disMeasure2.points, dis: info.disMeasure2.points[0].distanceTo(info.disMeasure2.points[1])}
|
|
|
+ ])
|
|
|
+
|
|
|
+
|
|
|
+ return info
|
|
|
+ }
|
|
|
+ //基准点处的测量线会重叠在一起,建议错开,向道路外移动。但是容易看起来很多线,为了整齐,让最长的在最里层;但需要每次排序更新所有的线……
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
let createMeasureForPoint = (fixPoint)=>{
|