mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Corrected text position for multi-line labels
This commit is contained in:
@@ -813,9 +813,11 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta
|
||||
if (hasLabel && myLeaderSegmentLength > 0 && myIsTextAligned)
|
||||
{
|
||||
gp_Lin aSegmentLine (anExtEnd, aTextDir);
|
||||
Standard_Real aSegmentLength = (theLabelPosition & LabelPosition_VCenter) ? myLeaderSegmentLength : theLabelWidth + myLeaderSegmentLength;
|
||||
Standard_Real aSegmentLength = !(theLabelPosition & LabelPosition_Above || theLabelPosition & LabelPosition_Below)
|
||||
? myLeaderSegmentLength : theLabelWidth + myLeaderSegmentLength;
|
||||
aSegmentPoint = ElCLib::Value (aSegmentLength, aSegmentLine);
|
||||
aTextPos = (theLabelPosition & LabelPosition_VCenter) ? aSegmentPoint : ElCLib::Value (myLeaderSegmentLength, aSegmentLine);
|
||||
aTextPos = !(theLabelPosition & LabelPosition_Above || theLabelPosition & LabelPosition_Below)
|
||||
? aSegmentPoint : ElCLib::Value (myLeaderSegmentLength, aSegmentLine);
|
||||
}
|
||||
|
||||
DrawText (thePresentation,
|
||||
|
@@ -25,7 +25,7 @@ vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -text 3d -aligntext
|
||||
vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 5 -label left
|
||||
|
||||
# Text on the left side - it is aligned
|
||||
vdimension dim4 -length -plane xoy -shapes lengthP2 lengthP4 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 25 -label left
|
||||
vdimension dim4 -length -plane xoy -shapes lengthP2 lengthP4 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 25 -label right
|
||||
|
||||
# Text on the left side - it is aligned
|
||||
vdimension dim5 -length -plane xoy -shapes lengthP4 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -label left above -segment 10
|
||||
|
34
tests/bugs/vis/bug26507_5
Normal file
34
tests/bugs/vis/bug26507_5
Normal file
@@ -0,0 +1,34 @@
|
||||
puts "================================================================"
|
||||
puts "CR26507"
|
||||
puts "Visualization - Improved presentations of dimensions"
|
||||
puts "================================================================"
|
||||
puts ""
|
||||
puts "User-defined orientation of text label"
|
||||
puts "Line segment aligned with text"
|
||||
|
||||
#set anImage1 $imagedir/${casename}_1.png
|
||||
|
||||
vinit Viewer1/View
|
||||
vbottom
|
||||
|
||||
vpoint lengthP1 0 0 0
|
||||
vpoint lengthP2 100 0 0
|
||||
vpoint lengthP3 100 100 0
|
||||
vpoint lengthP4 0 100 0
|
||||
# Text in center - custom aligment does not taken into account
|
||||
#vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2 -text 3d -aligntext 1.0 0.0 0.0 -flyout -10
|
||||
|
||||
# Text on the right side - it is aligned
|
||||
#vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -text 3d -aligntext 1.0 0.0 0.0 -segment 0 -label right
|
||||
|
||||
# Text on the left side - it is aligned
|
||||
#vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 5 -label left
|
||||
|
||||
# Text on the left side - it is aligned
|
||||
vdimension dim4 -length -plane xoy -shapes lengthP4 lengthP1 -text 3d -valuetext "0.6\n1.58\nTHICKNESS" -flyout -10 -aligntext 1.0 0.0 0.0 -segment 10 -label right firstline
|
||||
|
||||
# Text on the left side - it is aligned
|
||||
#vdimension dim5 -length -plane xoy -shapes lengthP4 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -label left above -segment 10
|
||||
vfit
|
||||
#finalize and dump
|
||||
set only_screen 1
|
Reference in New Issue
Block a user