1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024326: Get rid of confusing extension line

1) Removed confusing part of labeled extension for 3d text.
2) Removed unused "TextOffset" property of AIS_Dimension class, revised function of "ExtensionSize" property.
3) Added options to specify automatic or user-defined arrow orientation and value label positioning to dimension aspect enumerations.
4) Use proper naming: Prs3d_DimensionTextVerticalPosition, Prs3d_DimensionTextHorizontalPosition instead of Prs3d_HorizontalTextAlignment, Prs3d_VerticalTextAlignment.
Correction of label length computing method.
This commit is contained in:
apl
2013-11-21 17:27:33 +04:00
committed by bugmaster
parent 938d454409
commit d7bffd44ea
21 changed files with 1016 additions and 1188 deletions

View File

@@ -75,18 +75,27 @@ is
-- For more details see AIS_Drawer class, AIS_Shape::Compute() method and
-- HLRAlgo package from TKHLR toolkit.
enumeration HorizontalTextAlignment is HTA_Left, HTA_Right, HTA_Center;
---Purpose: To declare horisontal alignment for dimension text.
enumeration VerticalTextAlignment is VTA_Top, VTA_Bottom, VTA_Center;
---Purpose: To declare vertical alignment for dimension text label.
enumeration DimensionArrowOrientation is DAO_Internal, DAO_External;
---Purpose: To declare arrow orientation for dimenation.
-- External orientation means that dimension has extension parts outside the measured area.
--Internal orientation means the dimension arrows are in the measured area, and no extension parts are needed.
enumeration DimensionTextHorizontalPosition is DTHP_Left, DTHP_Right, DTHP_Center, DTHP_Fit;
---Purpose: Specifies options for positioning dimension value label in horizontal direction.
-- DTHP_Left - value label located at left side on dimension extension.
-- DTHP_Right - value label located at right side on dimension extension.
-- DTHP_Center - value label located at center of dimension line.
-- DTHP_Fit - value label located automatically at left side if does not fits
-- the dimension space, otherwise the value label is placed at center.
enumeration DimensionTextVerticalPosition is DTVP_Above, DTVP_Below, DTVP_Center;
---Purpose: Specifies options for positioning dimension value label in vertical direction
-- with respect to dimension (extension) line.
-- DTVP_Above - text label is located above the dimension or extension line.
-- DTVP_Below - text label is located below the dimension or extension line.
-- DTVP_Center - the text label middle-point is in line with dimension or extension line.
enumeration DimensionArrowOrientation is DAO_Internal, DAO_External, DAO_Fit;
---Purpose: Specifies dimension arrow location and orientation.
-- DAO_Internal - arrows "inside", pointing outwards.
-- DAO_External - arrows "outside", pointing inwards.
-- DAO_Fit - arrows oriented inside if value label with arrowtips fit the dimension line,
-- otherwise - externally
class Presentation;
---Purpose: defines the presentation object. This object can be

View File

@@ -20,8 +20,8 @@ class DimensionAspect from Prs3d inherits BasicAspect from Prs3d
---Purpose: defines the attributes when drawing a Length Presentation.
uses
HorizontalTextAlignment from Prs3d,
VerticalTextAlignment from Prs3d,
DimensionTextHorizontalPosition from Prs3d,
DimensionTextVerticalPosition from Prs3d,
DimensionArrowOrientation from Prs3d,
AspectLine3d from Graphic3d,
ArrowAspect from Prs3d,
@@ -71,19 +71,19 @@ is
--- Purpose: Sets orientation of arrows (external or internal).
-- By default orientation is chosen automatically according to situation and text label size.
GetArrowOrientation (me) returns DimensionArrowOrientation from Prs3d;
ArrowOrientation (me) returns DimensionArrowOrientation from Prs3d;
--- Purpose: Gets orientation of arrows (external or internal).
SetVerticalTextAlignment(me: mutable; theVertTextAlignment: VerticalTextAlignment from Prs3d);
SetTextVerticalPosition (me: mutable; thePosition : DimensionTextVerticalPosition from Prs3d);
--- Purpose: Sets vertical text alignment for text label.
VerticalTextAlignment (me) returns VerticalTextAlignment from Prs3d;
TextVerticalPosition (me) returns DimensionTextVerticalPosition from Prs3d;
--- Purpose: Gets vertical text alignment for text label.
SetHorizontalTextAlignment (me: mutable; theHorTextAlignment: HorizontalTextAlignment from Prs3d);
SetTextHorizontalPosition (me: mutable; thePosition: DimensionTextHorizontalPosition from Prs3d);
--- Purpose: Sets horizontal text alignment for text label.
HorizontalTextAlignment (me) returns HorizontalTextAlignment from Prs3d;
TextHorizontalPosition (me) returns DimensionTextHorizontalPosition from Prs3d;
--- Purpose: Gets horizontal text alignment for text label.
ArrowAspect(me) returns mutable ArrowAspect from Prs3d is static;
@@ -95,24 +95,38 @@ is
SetCommonColor(me:mutable; theColor: Color from Quantity) is static;
---Purpose: Sets the same color for all parts of dimension: lines, arrows and text.
SetExtensionSize (me : mutable; theSize : Real from Standard) is static;
---Purpose: Sets extension size.
ExtensionSize (me) returns Real from Standard;
---Purpose: Returns extension size.
fields
myLineAspect: LineAspect from Prs3d;
---Purpose: Text style. The size for 3d (or 2d) text is also inside here.
myTextAspect: TextAspect from Prs3d;
myArrowAspect : ArrowAspect from Prs3d;
myIsText3d : Boolean from Standard;
myIsTextShaded : Boolean from Standard;
myIsArrows3d: Boolean from Standard;
myArrowOrientation : DimensionArrowOrientation from Prs3d;
---Purpose: Dimension arrow orientation
---Purpose: Dimension arrow orientation.
-- By default, it is computed automatically. Its value depends on the text
-- bouning rectangle size and distance between two flyouts.
-- By default, it is internal one.
myHorTextAlignment: HorizontalTextAlignment from Prs3d;
---Purpose:Horizontal text alignment (Prs3d_HTA_Left/Prs3d_HTA_Right/Prs3d_HTA_Center).
-- Defines horizontal position of text value label, by default it is center.
myVerTextAlignment: VerticalTextAlignment from Prs3d;
---Purpose: Vertical text alignment (Prs3d_VTA_Top, Prs3d_VTA_Bottom/Prs3d_VTA_Center)
-- Defines vertical position of text value lable, by default it is center.
-- By default, it is "fit" one.
myTextHPosition : DimensionTextHorizontalPosition from Prs3d;
---Purpose: Defines horizontal position of text value label, by default it is
-- "fit" - selected automatically depending on label-to-dimension size relation.
myTextVPosition : DimensionTextVerticalPosition from Prs3d;
---Purpose: Defines vertical position of text value label, by default it is center.
myExtensionSize : Real from Standard;
---Purpose: Size of arrow extensions.
-- The length of arrow tails if arrows are located outside dimension line.
end DimensionAspect from Prs3d;

View File

@@ -18,11 +18,12 @@
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Quantity_Color.hxx>
IMPLEMENT_STANDARD_HANDLE (Prs3d_DimensionAspect, Prs3d_BasicAspect)
@@ -33,13 +34,12 @@ IMPLEMENT_STANDARD_RTTIEXT (Prs3d_DimensionAspect, Prs3d_BasicAspect)
//purpose :
//=======================================================================
Prs3d_DimensionAspect::Prs3d_DimensionAspect ()
Prs3d_DimensionAspect::Prs3d_DimensionAspect()
{
// Text alignment
myHorTextAlignment = Prs3d_HTA_Center;
myVerTextAlignment = Prs3d_VTA_Center;
// Arrow orientation, will be computed on further steps, by default it is internal.
myArrowOrientation = Prs3d_DAO_Internal;
myTextHPosition = Prs3d_DTHP_Fit;
myTextVPosition = Prs3d_DTVP_Center;
myArrowOrientation = Prs3d_DAO_Fit;
myLineAspect = new Prs3d_LineAspect (Quantity_NOC_LAWNGREEN,Aspect_TOL_SOLID,1.);
myTextAspect = new Prs3d_TextAspect;
myTextAspect->Aspect()->SetTextZoomable (Standard_False);
@@ -48,7 +48,8 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect ()
myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER);
myArrowAspect = new Prs3d_ArrowAspect;
myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
myArrowAspect->SetLength (6.);
myArrowAspect->SetLength (6.0);
myExtensionSize = 6.0;
}
//=======================================================================
@@ -176,49 +177,49 @@ void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrien
//purpose :
//=======================================================================
Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::GetArrowOrientation () const
Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
{
return myArrowOrientation;
}
//=======================================================================
//function : VerticalTextAlignment
//function : SetTextVerticalPosition
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition)
{
myTextVPosition = thePosition;
}
//=======================================================================
//function : TextVerticalPosition
//purpose :
//=======================================================================
Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition() const
{
return myTextVPosition;
}
//=======================================================================
//function : SetTextHorizontalPosition
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition)
{
myTextHPosition = thePosition;
}
//=======================================================================
//function : TextHorizontalPosition
//purpose :
//=======================================================================
Prs3d_VerticalTextAlignment Prs3d_DimensionAspect::VerticalTextAlignment () const
Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosition() const
{
return myVerTextAlignment;
}
//=======================================================================
//function : SetVerticalTextAlignment
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetVerticalTextAlignment (const Prs3d_VerticalTextAlignment theVertTextAlignment)
{
myVerTextAlignment = theVertTextAlignment;
}
//=======================================================================
//function : HorizontalTextAlignment
//purpose :
//=======================================================================
Prs3d_HorizontalTextAlignment Prs3d_DimensionAspect::HorizontalTextAlignment () const
{
return myHorTextAlignment;
}
//=======================================================================
//function : SetHorizontalTextAlignment
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetHorizontalTextAlignment (const Prs3d_HorizontalTextAlignment theHorTextAlignment)
{
myHorTextAlignment = theHorTextAlignment;
return myTextHPosition;
}
//=======================================================================
@@ -240,3 +241,23 @@ void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& the
{
myArrowAspect = theAspect;
}
//=======================================================================
//function : SetExtensioSize
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
{
myExtensionSize = theSize;
}
//=======================================================================
//function : ExtensionSize
//purpose :
//=======================================================================
Standard_Real Prs3d_DimensionAspect::ExtensionSize() const
{
return myExtensionSize;
}