0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / Prs3d / Prs3d_DimensionAspect.hxx
CommitLineData
42cf5bc1 1// Copyright (c) 1993-1999 Matra Datavision
2// Copyright (c) 1999-2014 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
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.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _Prs3d_DimensionAspect_HeaderFile
16#define _Prs3d_DimensionAspect_HeaderFile
17
4e1bc39a 18#include <Prs3d_ArrowAspect.hxx>
42cf5bc1 19#include <Prs3d_DimensionArrowOrientation.hxx>
20#include <Prs3d_DimensionTextHorizontalPosition.hxx>
21#include <Prs3d_DimensionTextVerticalPosition.hxx>
4e1bc39a 22#include <Prs3d_LineAspect.hxx>
23#include <Prs3d_TextAspect.hxx>
42cf5bc1 24#include <TCollection_AsciiString.hxx>
42cf5bc1 25
26//! defines the attributes when drawing a Length Presentation.
27class Prs3d_DimensionAspect : public Prs3d_BasicAspect
28{
4e1bc39a 29 DEFINE_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
42cf5bc1 30public:
31
42cf5bc1 32 //! Constructs an empty framework to define the display of dimensions.
33 Standard_EXPORT Prs3d_DimensionAspect();
34
35 //! Returns the settings for the display of lines used in presentation of dimensions.
4e1bc39a 36 const Handle(Prs3d_LineAspect)& LineAspect() const { return myLineAspect; }
37
42cf5bc1 38 //! Sets the display attributes of lines used in presentation of dimensions.
4e1bc39a 39 void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect) { myLineAspect = theAspect; }
40
42cf5bc1 41 //! Returns the settings for the display of text used in presentation of dimensions.
4e1bc39a 42 const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
43
42cf5bc1 44 //! Sets the display attributes of text used in presentation of dimensions.
4e1bc39a 45 void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect) { myTextAspect = theAspect; }
46
42cf5bc1 47 //! Check if text for dimension label is 3d.
4e1bc39a 48 Standard_Boolean IsText3d() const { return myIsText3d; }
49
42cf5bc1 50 //! Sets type of text.
4e1bc39a 51 void MakeText3d (const Standard_Boolean isText3d) { myIsText3d = isText3d; }
52
42cf5bc1 53 //! Check if 3d text for dimension label is shaded.
4e1bc39a 54 Standard_Boolean IsTextShaded() const { return myIsTextShaded; }
55
42cf5bc1 56 //! Turns on/off text shading for 3d text.
4e1bc39a 57 void MakeTextShaded (const Standard_Boolean theIsTextShaded) { myIsTextShaded = theIsTextShaded; }
58
42cf5bc1 59 //! Gets type of arrows.
4e1bc39a 60 Standard_Boolean IsArrows3d() const { return myIsArrows3d; }
61
42cf5bc1 62 //! Sets type of arrows.
4e1bc39a 63 void MakeArrows3d (const Standard_Boolean theIsArrows3d) { myIsArrows3d = theIsArrows3d; }
64
42cf5bc1 65 //! Shows if Units are to be displayed along with dimension value.
4e1bc39a 66 Standard_Boolean IsUnitsDisplayed() const { return myToDisplayUnits; }
42cf5bc1 67
68 //! Specifies whether the units string should be displayed
69 //! along with value label or not.
4e1bc39a 70 void MakeUnitsDisplayed (const Standard_Boolean theIsDisplayed) { myToDisplayUnits = theIsDisplayed; }
42cf5bc1 71
72 //! Sets orientation of arrows (external or internal).
73 //! By default orientation is chosen automatically according to situation and text label size.
4e1bc39a 74 void SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient) { myArrowOrientation = theArrowOrient; }
75
42cf5bc1 76 //! Gets orientation of arrows (external or internal).
4e1bc39a 77 Prs3d_DimensionArrowOrientation ArrowOrientation() const { return myArrowOrientation; }
78
42cf5bc1 79 //! Sets vertical text alignment for text label.
4e1bc39a 80 void SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition) { myTextVPosition = thePosition; }
81
42cf5bc1 82 //! Gets vertical text alignment for text label.
4e1bc39a 83 Prs3d_DimensionTextVerticalPosition TextVerticalPosition() const { return myTextVPosition; }
84
42cf5bc1 85 //! Sets horizontal text alignment for text label.
4e1bc39a 86 void SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition) { myTextHPosition = thePosition; }
87
42cf5bc1 88 //! Gets horizontal text alignment for text label.
4e1bc39a 89 Prs3d_DimensionTextHorizontalPosition TextHorizontalPosition() const { return myTextHPosition; }
90
42cf5bc1 91 //! Returns the settings for displaying arrows.
4e1bc39a 92 const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
93
42cf5bc1 94 //! Sets the display attributes of arrows used in presentation of dimensions.
4e1bc39a 95 void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; }
96
42cf5bc1 97 //! Sets the same color for all parts of dimension: lines, arrows and text.
98 Standard_EXPORT void SetCommonColor (const Quantity_Color& theColor);
99
100 //! Sets extension size.
4e1bc39a 101 void SetExtensionSize (const Standard_Real theSize) { myExtensionSize = theSize; }
102
42cf5bc1 103 //! Returns extension size.
4e1bc39a 104 Standard_Real ExtensionSize() const { return myExtensionSize; }
105
42cf5bc1 106 //! Set size for arrow tail (extension without text).
4e1bc39a 107 void SetArrowTailSize (const Standard_Real theSize) { myArrowTailSize = theSize; }
108
42cf5bc1 109 //! Returns arrow tail size.
4e1bc39a 110 Standard_Real ArrowTailSize() const { return myArrowTailSize; }
42cf5bc1 111
112 //! Sets "sprintf"-syntax format for formatting dimension value labels.
4e1bc39a 113 void SetValueStringFormat (const TCollection_AsciiString& theFormat) { myValueStringFormat = theFormat; }
42cf5bc1 114
4e1bc39a 115 //! Returns format.
116 const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; }
42cf5bc1 117
118protected:
119
4e1bc39a 120 Handle(Prs3d_LineAspect) myLineAspect;
121 Handle(Prs3d_TextAspect) myTextAspect;
42cf5bc1 122 Handle(Prs3d_ArrowAspect) myArrowAspect;
4e1bc39a 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;
42cf5bc1 130 Standard_Boolean myIsText3d;
131 Standard_Boolean myIsTextShaded;
132 Standard_Boolean myIsArrows3d;
42cf5bc1 133
134};
135
4e1bc39a 136DEFINE_STANDARD_HANDLE(Prs3d_DimensionAspect, Prs3d_BasicAspect)
42cf5bc1 137
138#endif // _Prs3d_DimensionAspect_HeaderFile