|
|
@@ -102,6 +102,7 @@ export class Measure extends ctrlPolygon{
|
|
|
this.add(this.areaLabel)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
//add:
|
|
|
if(this.atPlane || this.faceDirection){ //是一个平面上的话
|
|
|
@@ -341,7 +342,28 @@ export class Measure extends ctrlPolygon{
|
|
|
let tan = pTop.distanceTo(projectPos) / pBtm.distanceTo(projectPos)
|
|
|
let angle = Math.atan(tan);
|
|
|
|
|
|
- this.shouldShowHorVerGuide = angle > guideShowMinAngle.min && angle < guideShowMinAngle.max
|
|
|
+ this.shouldShowHorVerGuide = angle > guideShowMinAngle.min && angle < guideShowMinAngle.max
|
|
|
+
|
|
|
+
|
|
|
+ if(this.showAngleToGround){
|
|
|
+ let deg = math.toPrecision(THREE.Math.radToDeg(angle), 2) + '°'
|
|
|
+ this.angleToGroundLabel.setText(deg)
|
|
|
+ let vec1 = new THREE.Vector3().subVectors(pTop,pBtm).normalize()
|
|
|
+ let vec2 = new THREE.Vector3().subVectors(projectPos,pBtm).normalize()
|
|
|
+ let midVec = new THREE.Vector3().addVectors(vec1,vec2).normalize()
|
|
|
+ //this.angleToGroundLabel.lineDir = midVec
|
|
|
+ this.angleToGroundLabel.setPos(new THREE.Vector3().addVectors(pBtm, midVec.clone().multiplyScalar(0.15) ))
|
|
|
+ // 最好是让label垂直于midVec然后transform2Dpercent向上,这样无论向左看向右看都可以,但字斜着不直观
|
|
|
+
|
|
|
+
|
|
|
+ //绘制夹角弧线(省略成直线)
|
|
|
+ let midDis = 0.1
|
|
|
+ let sideLen = midDis * Math.cos(angle / 2)
|
|
|
+ let p1 = new THREE.Vector3().addVectors(pBtm, vec1.multiplyScalar(sideLen))
|
|
|
+ let p2 = new THREE.Vector3().addVectors(pBtm, vec2.multiplyScalar(sideLen))
|
|
|
+ LineDraw.updateLine(this.angleLine, [p1, p2])
|
|
|
+ this.angleLine.visible = this.angleToGroundLabel.visible = this.shouldShowHorVerGuide
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -352,6 +374,7 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
this.verGuideEdge.visible = this.horGuideEdge.visible = this.shouldShowHorVerGuide
|
|
|
this.verEdgeLabel.visible = this.horEdgeLabel.visible = this.shouldShowHorVerGuide
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -826,6 +849,10 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
if(!this.horVerShowAlways && !ignoreGuideLine && this.measureType == 'Distance'){
|
|
|
this.horEdgeLabel.visible = this.verEdgeLabel.visible = this.horGuideEdge.visible = this.verGuideEdge.visible = !!(state && this.shouldShowHorVerGuide)
|
|
|
+
|
|
|
+ if(this.showAngleToGround){
|
|
|
+ this.angleToGroundLabel.visible = this.angleLine.visible = !!(state && this.shouldShowHorVerGuide)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -995,7 +1022,17 @@ export class Measure extends ctrlPolygon{
|
|
|
this.verEdgeLabel = this.createEdgeLabel('verGuideEdge')
|
|
|
this.horEdgeLabel = this.createEdgeLabel('horGuideEdge')
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ if(this.showAngleToGround){
|
|
|
+ this.angleToGroundLabel = new TextSprite(
|
|
|
+ $.extend({}, subLabelProp, {
|
|
|
+ sizeInfo: labelSizeInfo, name:'angleToGroundLabel', transform2D:null
|
|
|
+ })
|
|
|
+ )
|
|
|
+ this.angleLine = LineDraw.createFatLine([ ],{mat:this.getMat('angle')} )
|
|
|
+ this.add(this.angleToGroundLabel)
|
|
|
+ this.add(this.angleLine)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
createEdgeLabel(name, hasHoverEvent){
|
|
|
@@ -1086,6 +1123,10 @@ export class Measure extends ctrlPolygon{
|
|
|
dashed: true,
|
|
|
lineWidth: config.measure.lineWidth/2
|
|
|
})),
|
|
|
+ angle: LineDraw.createFatLineMat($.extend({},lineDepthInfo,{
|
|
|
+ color:config.measure.guide.color,
|
|
|
+ lineWidth: config.measure.lineWidth/2
|
|
|
+ })),
|
|
|
multiColors:{}
|
|
|
}
|
|
|
{
|