|
@@ -741,9 +741,9 @@ var enter = ({
|
|
|
|
|
|
console.log('createFixPoint',measure, graph, pos, basePoint)
|
|
|
const bus = mitt();
|
|
|
- let measureFun, fixPoint
|
|
|
+ let measureFun, mainPoint = new THREE.Vector3()
|
|
|
let baseLineChanged = ()=>{
|
|
|
- updateMeasureForPoint(fixPoint)
|
|
|
+ updateMeasureForPoint(mainPoint)
|
|
|
}
|
|
|
if(graph){ //多线段
|
|
|
let info = {
|
|
@@ -763,38 +763,44 @@ var enter = ({
|
|
|
info.sid = Math.random()//sid;
|
|
|
info.bus = bus;
|
|
|
measure = viewer.measuringTool.createMeasureFromData(info);
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+ bus.on("graphChange",()=>{
|
|
|
+ mainPoint.copy(measure.getCenter())
|
|
|
+ updateMeasureForPoint(mainPoint)
|
|
|
+ })
|
|
|
measureFun = getMeasureFunction(measure, bus, true)
|
|
|
//和普通MulDistance不同点:选中才能拖拽 非选中时不展示marker (clickSelected);选中后marker是非选中状态, 但是颜色一样
|
|
|
//https://lanhuapp.com/web/#/item/project/stage?tid=de3e5e3e-a489-4b19-862a-7c87ce113467&pid=fa4ff928-d61e-438a-b8ee-f848048b7f52
|
|
|
+
|
|
|
+ }else{
|
|
|
+ mainPoint.copy(pos)
|
|
|
+ mainPoint.isFixPoint = true
|
|
|
+ mainPoint.pos2d = Potree.Utils.getPos2d(fixPoint, viewer.mainViewport, viewer.renderArea )
|
|
|
|
|
|
- }else{
|
|
|
- fixPoint = new THREE.Vector3().copy(pos)
|
|
|
- fixPoint.bus = bus
|
|
|
- fixPoint.basePoint = new THREE.Vector3().copy(basePoint)
|
|
|
- fixPoint.pos2d = Potree.Utils.getPos2d(fixPoint, viewer.mainViewport, viewer.renderArea )
|
|
|
-
|
|
|
- if(measure){
|
|
|
- createMeasureForPoint(fixPoint)
|
|
|
- }
|
|
|
- viewer.fixPoints.push(fixPoint)
|
|
|
- viewer.addEventListener('baseLineChanged',baseLineChanged)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ viewer.fixPoints.push(mainPoint)
|
|
|
}
|
|
|
-
|
|
|
|
|
|
+ mainPoint.basePoint = new THREE.Vector3().copy(basePoint)
|
|
|
+ mainPoint.bus = bus
|
|
|
+ createMeasureForPoint(mainPoint)
|
|
|
+ viewer.addEventListener('baseLineChanged',baseLineChanged)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
const ret = {
|
|
|
bus,
|
|
|
- destroy : measureFun ? measureFun.clear : ()=>{
|
|
|
+ destroy : ()=>{
|
|
|
console.log('destroy' )
|
|
|
ret.quitMeasure()
|
|
|
- let index = viewer.fixPoints.indexOf(fixPoint)
|
|
|
- index > -1 && viewer.fixPoints.splice(index,1)
|
|
|
+ if(mainPoint.isFixPoint){
|
|
|
+ let index = viewer.fixPoints.indexOf(fixPoint)
|
|
|
+ index > -1 && viewer.fixPoints.splice(index,1)
|
|
|
+ }else{
|
|
|
+ measureFun.clear()
|
|
|
+ }
|
|
|
},
|
|
|
quitMeasure(){//退出测量模式,删除测量线. 基准线被删时
|
|
|
console.log('quitMeasure' )
|
|
@@ -803,8 +809,8 @@ var enter = ({
|
|
|
},
|
|
|
changePos(pos){//固定点修改
|
|
|
console.log('changePos',pos)
|
|
|
- fixPoint.copy(pos)
|
|
|
- updateMeasureForPoint(fixPoint)
|
|
|
+ mainPoint.copy(pos)
|
|
|
+ updateMeasureForPoint(mainPoint)
|
|
|
|
|
|
},
|
|
|
changeBase(pos){//基准点修改
|