|
@@ -23,7 +23,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
this[i] = prop[i]
|
|
|
}
|
|
|
|
|
|
- if(this.atPlane && this.closed && this.dimension == '2d'){
|
|
|
+ if((this.atPlane || this.showArea) && this.closed && this.dimension == '2d'){
|
|
|
this.areaPlane = this.createAreaPlane();
|
|
|
this.add(this.areaPlane)
|
|
|
}
|
|
@@ -43,7 +43,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
|
|
|
initData(prop){
|
|
|
//开始加数据
|
|
|
- if(Potree.settings.editType == 'merge'){ //融合页面没有地图,measure的不需要指定datasetId,每个点都有各自的datasetId,跟着各自的模型走
|
|
|
+ if(Potree.settings.editType == 'merge' || this.measureType == 'MulDistance Ring'){ //融合页面没有地图,measure的不需要指定datasetId,每个点都有各自的datasetId,跟着各自的模型走
|
|
|
if(this.dataset_points){
|
|
|
this.dataset_points = this.dataset_points.map(e=>{
|
|
|
return e && new THREE.Vector3().copy(e)
|
|
@@ -506,7 +506,7 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
}
|
|
|
|
|
|
getPoint2dInfo(points){ //在更新areaplane之前必须更新过point2dInfo
|
|
|
- if(this.facePlane){
|
|
|
+ if(this.facePlane && this.atPlane){
|
|
|
var originPoint0 = points[0].clone()
|
|
|
var qua = math.getQuaBetween2Vector(this.facePlane.normal, new THREE.Vector3(0,0,1), new THREE.Vector3(0,0,1));
|
|
|
let points2d = points.map(e=>e.clone().applyQuaternion(qua))
|
|
@@ -606,27 +606,40 @@ export class ctrlPolygon extends THREE.Object3D {
|
|
|
}
|
|
|
|
|
|
updateAreaPlane(){
|
|
|
- if(!this.point2dInfo)return
|
|
|
this.areaPlane.geometry.dispose()
|
|
|
+
|
|
|
+
|
|
|
if(this.points.length>2){
|
|
|
- this.areaPlane.geometry = MeshDraw.getShapeGeo(this.point2dInfo.points2d)
|
|
|
- var center = math.getCenterOfGravityPoint(this.point2dInfo.points2d) //重心
|
|
|
-
|
|
|
- var firstPos = this.point2dInfo.points2d[0].clone()
|
|
|
- firstPos.z = 0 //因为shape只读取了xy,所以位移下, 再算出最终位置,得到差距
|
|
|
- firstPos.applyQuaternion(this.point2dInfo.quaInverse)
|
|
|
- var vec = this.point2dInfo.originPoint0.clone().sub(firstPos)
|
|
|
- center = new THREE.Vector3(center.x, center.y, 0)
|
|
|
- center.applyQuaternion(this.point2dInfo.quaInverse)
|
|
|
- this.areaPlane.quaternion.copy(this.point2dInfo.quaInverse)
|
|
|
- this.areaPlane.position.copy(vec)
|
|
|
- center.add(vec)
|
|
|
- this.center = center
|
|
|
+ if(this.point2dInfo){
|
|
|
+ this.areaPlane.geometry = MeshDraw.getShapeGeo(this.point2dInfo.points2d)
|
|
|
+ let center = math.getCenterOfGravityPoint(this.point2dInfo.points2d) //重心
|
|
|
+
|
|
|
+ let firstPos = this.point2dInfo.points2d[0].clone()
|
|
|
+ firstPos.z = 0 //因为shape只读取了xy,所以位移下, 再算出最终位置,得到差距
|
|
|
+ firstPos.applyQuaternion(this.point2dInfo.quaInverse)
|
|
|
+ let vec = this.point2dInfo.originPoint0.clone().sub(firstPos)
|
|
|
+ center = new THREE.Vector3(center.x, center.y, 0)
|
|
|
+ center.applyQuaternion(this.point2dInfo.quaInverse)
|
|
|
+ this.areaPlane.quaternion.copy(this.point2dInfo.quaInverse)
|
|
|
+ this.areaPlane.position.copy(vec)
|
|
|
+ center.add(vec)
|
|
|
+ this.center = center
|
|
|
+ }else{//prism
|
|
|
+
|
|
|
+ let z = this.horizonZ || 0
|
|
|
+ let points2d = this.points.map(e=>e.clone().setZ(z))
|
|
|
+ this.areaPlane.geometry = MeshDraw.getShapeGeo(points2d) //z=0
|
|
|
+ let center = math.getCenterOfGravityPoint(points2d) //重心
|
|
|
+ this.center = new THREE.Vector3(center.x, center.y, z)
|
|
|
+ this.areaPlane.position.z = z
|
|
|
+
|
|
|
+ }
|
|
|
}else{
|
|
|
this.areaPlane.geometry = new THREE.Geometry()
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|