|
@@ -360,11 +360,11 @@ var enter = ({
|
|
},
|
|
},
|
|
//手动开启或关闭:
|
|
//手动开启或关闭:
|
|
show: () => {
|
|
show: () => {
|
|
- Potree.Utils.updateVisible(measure, "inListByUser", true);
|
|
|
|
|
|
+ Potree.Utils.updateVisible(measure, "forceByUser", true);
|
|
viewer.dispatchEvent('content_changed')
|
|
viewer.dispatchEvent('content_changed')
|
|
},
|
|
},
|
|
hide: () => {
|
|
hide: () => {
|
|
- Potree.Utils.updateVisible(measure, "inListByUser", false);
|
|
|
|
|
|
+ Potree.Utils.updateVisible(measure, "forceByUser", false);
|
|
viewer.dispatchEvent('content_changed')
|
|
viewer.dispatchEvent('content_changed')
|
|
},
|
|
},
|
|
/* highlight: (isHight) => {
|
|
/* highlight: (isHight) => {
|
|
@@ -749,20 +749,42 @@ var enter = ({
|
|
createFixPoint({measure, graph, pos, basePoint}){//创建固定点或多线段
|
|
createFixPoint({measure, graph, pos, basePoint}){//创建固定点或多线段
|
|
|
|
|
|
console.log('createFixPoint',measure, graph, pos, basePoint)
|
|
console.log('createFixPoint',measure, graph, pos, basePoint)
|
|
- const bus = mitt();
|
|
|
|
- let measureFun, mainPoint = new THREE.Vector3()
|
|
|
|
- let baseLineChanged = ()=>{
|
|
|
|
|
|
+ let shape, measureFun, mainPoint = new THREE.Vector3(), bus = mitt();
|
|
|
|
+ mainPoint.basePoint = new THREE.Vector3().copy(basePoint)
|
|
|
|
+ mainPoint.bus = bus
|
|
|
|
+
|
|
|
|
+ const baseLineChanged = ()=>{
|
|
updateMeasureForPoint(mainPoint)
|
|
updateMeasureForPoint(mainPoint)
|
|
}
|
|
}
|
|
|
|
+ const setDisplay = (show)=>{
|
|
|
|
+ if(graph){
|
|
|
|
+ Potree.Utils.updateVisible(shape, "forceByUser", show);
|
|
|
|
+ }
|
|
|
|
+ if(mainPoint.basePoint){
|
|
|
|
+ Potree.Utils.updateVisible(mainPoint.disMeasure1, "forceByUser", show);
|
|
|
|
+ Potree.Utils.updateVisible(mainPoint.disMeasure2, "forceByUser", show);
|
|
|
|
+ }
|
|
|
|
+ viewer.dispatchEvent('content_changed')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
if(graph){ //多线段
|
|
if(graph){ //多线段
|
|
let info = {
|
|
let info = {
|
|
measureType : 'MulDistance_shape', color : pointMeasureColor
|
|
measureType : 'MulDistance_shape', color : pointMeasureColor
|
|
}
|
|
}
|
|
|
|
+ let updateMeasure = ()=>{
|
|
|
|
+ if(!shape.isNew){
|
|
|
|
+ mainPoint.copy(shape.getCenter())
|
|
|
|
+ updateMeasureForPoint(mainPoint)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if(graph.length == 0){
|
|
if(graph.length == 0){
|
|
- measure = viewer.measuringTool.startInsertion( info,
|
|
|
|
|
|
+ shape = viewer.measuringTool.startInsertion( info,
|
|
() => {
|
|
() => {
|
|
bus.emit("end", ret); //完成
|
|
bus.emit("end", ret); //完成
|
|
- measure.dispatchEvent('cancelSelect')
|
|
|
|
|
|
+ shape.dispatchEvent('cancelSelect')
|
|
|
|
+ measure && createMeasureForPoint(mainPoint)
|
|
|
|
+ updateMeasure()
|
|
},
|
|
},
|
|
() => {
|
|
() => {
|
|
bus.emit("quit", ret); //删除
|
|
bus.emit("quit", ret); //删除
|
|
@@ -771,14 +793,13 @@ var enter = ({
|
|
info.points = graph;
|
|
info.points = graph;
|
|
info.sid = Math.random()//sid;
|
|
info.sid = Math.random()//sid;
|
|
info.bus = bus;
|
|
info.bus = bus;
|
|
- measure = viewer.measuringTool.createMeasureFromData(info);
|
|
|
|
-
|
|
|
|
|
|
+ shape = viewer.measuringTool.createMeasureFromData(info);
|
|
|
|
+ shape && createMeasureForPoint(mainPoint)
|
|
|
|
+ updateMeasure()
|
|
}
|
|
}
|
|
- bus.on("graphChange",()=>{
|
|
|
|
- mainPoint.copy(measure.getCenter())
|
|
|
|
- updateMeasureForPoint(mainPoint)
|
|
|
|
- })
|
|
|
|
- measureFun = getMeasureFunction(measure, bus, true)
|
|
|
|
|
|
+ bus.on("graphChange",updateMeasure)
|
|
|
|
+
|
|
|
|
+ measureFun = getMeasureFunction(shape, bus, true)
|
|
//和普通MulDistance不同点:选中才能拖拽 非选中时不展示marker (clickSelected);选中后marker是非选中状态, 但是颜色一样
|
|
//和普通MulDistance不同点:选中才能拖拽 非选中时不展示marker (clickSelected);选中后marker是非选中状态, 但是颜色一样
|
|
//https://lanhuapp.com/web/#/item/project/stage?tid=de3e5e3e-a489-4b19-862a-7c87ce113467&pid=fa4ff928-d61e-438a-b8ee-f848048b7f52
|
|
//https://lanhuapp.com/web/#/item/project/stage?tid=de3e5e3e-a489-4b19-862a-7c87ce113467&pid=fa4ff928-d61e-438a-b8ee-f848048b7f52
|
|
|
|
|
|
@@ -786,18 +807,15 @@ var enter = ({
|
|
mainPoint.copy(pos)
|
|
mainPoint.copy(pos)
|
|
mainPoint.isFixPoint = true
|
|
mainPoint.isFixPoint = true
|
|
mainPoint.pos2d = Potree.Utils.getPos2d(mainPoint, viewer.mainViewport, viewer.renderArea )
|
|
mainPoint.pos2d = Potree.Utils.getPos2d(mainPoint, viewer.mainViewport, viewer.renderArea )
|
|
-
|
|
|
|
|
|
+ measure && createMeasureForPoint(mainPoint)
|
|
viewer.fixPoints.push(mainPoint)
|
|
viewer.fixPoints.push(mainPoint)
|
|
}
|
|
}
|
|
- mainPoint.bus = bus
|
|
|
|
- if(measure && basePoint){
|
|
|
|
- mainPoint.basePoint = new THREE.Vector3().copy(basePoint)
|
|
|
|
- createMeasureForPoint(mainPoint)
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
viewer.addEventListener('baseLineChanged',baseLineChanged)
|
|
viewer.addEventListener('baseLineChanged',baseLineChanged)
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
const ret = {
|
|
const ret = {
|
|
@@ -805,12 +823,13 @@ var enter = ({
|
|
destroy : ()=>{
|
|
destroy : ()=>{
|
|
console.log('destroy' )
|
|
console.log('destroy' )
|
|
ret.quitMeasure()
|
|
ret.quitMeasure()
|
|
- if(mainPoint.isFixPoint){
|
|
|
|
|
|
+
|
|
|
|
+ if(graph){
|
|
|
|
+ measureFun.clear()
|
|
|
|
+ }else{
|
|
let index = viewer.fixPoints.indexOf(mainPoint)
|
|
let index = viewer.fixPoints.indexOf(mainPoint)
|
|
index > -1 && viewer.fixPoints.splice(index,1)
|
|
index > -1 && viewer.fixPoints.splice(index,1)
|
|
- }else{
|
|
|
|
- measureFun.clear()
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
quitMeasure(){//退出测量模式,删除测量线. 基准线被删时
|
|
quitMeasure(){//退出测量模式,删除测量线. 基准线被删时
|
|
console.log('quitMeasure' )
|
|
console.log('quitMeasure' )
|
|
@@ -831,8 +850,12 @@ var enter = ({
|
|
},
|
|
},
|
|
graphDrawComplete: measureFun && measureFun.end,
|
|
graphDrawComplete: measureFun && measureFun.end,
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ show:()=>{
|
|
|
|
+ setDisplay(true)
|
|
|
|
+ },
|
|
|
|
+ hide:()=>{
|
|
|
|
+ setDisplay(false)
|
|
|
|
+ },
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|