1 // Copyright (c) 1993-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _Prs3d_DimensionAspect_HeaderFile
16 #define _Prs3d_DimensionAspect_HeaderFile
18 #include <Prs3d_ArrowAspect.hxx>
19 #include <Prs3d_DimensionArrowOrientation.hxx>
20 #include <Prs3d_DimensionTextHorizontalPosition.hxx>
21 #include <Prs3d_DimensionTextVerticalPosition.hxx>
22 #include <Prs3d_LineAspect.hxx>
23 #include <Prs3d_TextAspect.hxx>
24 #include <TCollection_AsciiString.hxx>
26 //! defines the attributes when drawing a Length Presentation.
27 class Prs3d_DimensionAspect : public Prs3d_BasicAspect
29 DEFINE_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
32 //! Constructs an empty framework to define the display of dimensions.
33 Standard_EXPORT Prs3d_DimensionAspect();
35 //! Returns the settings for the display of lines used in presentation of dimensions.
36 const Handle(Prs3d_LineAspect)& LineAspect() const { return myLineAspect; }
38 //! Sets the display attributes of lines used in presentation of dimensions.
39 void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect) { myLineAspect = theAspect; }
41 //! Returns the settings for the display of text used in presentation of dimensions.
42 const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
44 //! Sets the display attributes of text used in presentation of dimensions.
45 void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect) { myTextAspect = theAspect; }
47 //! Check if text for dimension label is 3d.
48 Standard_Boolean IsText3d() const { return myIsText3d; }
50 //! Sets type of text.
51 void MakeText3d (const Standard_Boolean isText3d) { myIsText3d = isText3d; }
53 //! Check if 3d text for dimension label is shaded.
54 Standard_Boolean IsTextShaded() const { return myIsTextShaded; }
56 //! Turns on/off text shading for 3d text.
57 void MakeTextShaded (const Standard_Boolean theIsTextShaded) { myIsTextShaded = theIsTextShaded; }
59 //! Gets type of arrows.
60 Standard_Boolean IsArrows3d() const { return myIsArrows3d; }
62 //! Sets type of arrows.
63 void MakeArrows3d (const Standard_Boolean theIsArrows3d) { myIsArrows3d = theIsArrows3d; }
65 //! Shows if Units are to be displayed along with dimension value.
66 Standard_Boolean IsUnitsDisplayed() const { return myToDisplayUnits; }
68 //! Specifies whether the units string should be displayed
69 //! along with value label or not.
70 void MakeUnitsDisplayed (const Standard_Boolean theIsDisplayed) { myToDisplayUnits = theIsDisplayed; }
72 //! Sets orientation of arrows (external or internal).
73 //! By default orientation is chosen automatically according to situation and text label size.
74 void SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient) { myArrowOrientation = theArrowOrient; }
76 //! Gets orientation of arrows (external or internal).
77 Prs3d_DimensionArrowOrientation ArrowOrientation() const { return myArrowOrientation; }
79 //! Sets vertical text alignment for text label.
80 void SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition) { myTextVPosition = thePosition; }
82 //! Gets vertical text alignment for text label.
83 Prs3d_DimensionTextVerticalPosition TextVerticalPosition() const { return myTextVPosition; }
85 //! Sets horizontal text alignment for text label.
86 void SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition) { myTextHPosition = thePosition; }
88 //! Gets horizontal text alignment for text label.
89 Prs3d_DimensionTextHorizontalPosition TextHorizontalPosition() const { return myTextHPosition; }
91 //! Returns the settings for displaying arrows.
92 const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
94 //! Sets the display attributes of arrows used in presentation of dimensions.
95 void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; }
97 //! Sets the same color for all parts of dimension: lines, arrows and text.
98 Standard_EXPORT void SetCommonColor (const Quantity_Color& theColor);
100 //! Sets extension size.
101 void SetExtensionSize (const Standard_Real theSize) { myExtensionSize = theSize; }
103 //! Returns extension size.
104 Standard_Real ExtensionSize() const { return myExtensionSize; }
106 //! Set size for arrow tail (extension without text).
107 void SetArrowTailSize (const Standard_Real theSize) { myArrowTailSize = theSize; }
109 //! Returns arrow tail size.
110 Standard_Real ArrowTailSize() const { return myArrowTailSize; }
112 //! Sets "sprintf"-syntax format for formatting dimension value labels.
113 void SetValueStringFormat (const TCollection_AsciiString& theFormat) { myValueStringFormat = theFormat; }
116 const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; }
120 Handle(Prs3d_LineAspect) myLineAspect;
121 Handle(Prs3d_TextAspect) myTextAspect;
122 Handle(Prs3d_ArrowAspect) myArrowAspect;
123 TCollection_AsciiString myValueStringFormat;
124 Standard_Real myExtensionSize;
125 Standard_Real myArrowTailSize;
126 Prs3d_DimensionArrowOrientation myArrowOrientation;
127 Prs3d_DimensionTextHorizontalPosition myTextHPosition;
128 Prs3d_DimensionTextVerticalPosition myTextVPosition;
129 Standard_Boolean myToDisplayUnits;
130 Standard_Boolean myIsText3d;
131 Standard_Boolean myIsTextShaded;
132 Standard_Boolean myIsArrows3d;
136 DEFINE_STANDARD_HANDLE(Prs3d_DimensionAspect, Prs3d_BasicAspect)
138 #endif // _Prs3d_DimensionAspect_HeaderFile