Commit | Line | Data |
---|---|---|
42cf5bc1 | 1 | // Created on: 1993-07-30 |
2 | // Created by: Jean-Louis FRENKEL | |
3 | // Copyright (c) 1993-1999 Matra Datavision | |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS | |
5 | // | |
6 | // This file is part of Open CASCADE Technology software library. | |
7 | // | |
8 | // This library is free software; you can redistribute it and/or modify it under | |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
10 | // by the Free Software Foundation, with special exception defined in the file | |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
12 | // distribution for complete text of the license and disclaimer of any warranty. | |
13 | // | |
14 | // Alternatively, this file may be used under the terms of Open CASCADE | |
15 | // commercial license or contractual agreement. | |
16 | ||
17 | #ifndef _Prs3d_DatumAspect_HeaderFile | |
18 | #define _Prs3d_DatumAspect_HeaderFile | |
19 | ||
bc001a40 | 20 | #include <NCollection_DataMap.hxx> |
21 | #include <Prs3d_ArrowAspect.hxx> | |
22 | #include <Prs3d_DatumAttribute.hxx> | |
23 | #include <Prs3d_DatumAxes.hxx> | |
24 | #include <Prs3d_DatumMode.hxx> | |
25 | #include <Prs3d_DatumParts.hxx> | |
4e1bc39a | 26 | #include <Prs3d_LineAspect.hxx> |
bc001a40 | 27 | #include <Prs3d_PointAspect.hxx> |
28 | #include <Prs3d_ShadingAspect.hxx> | |
29 | #include <Prs3d_TextAspect.hxx> | |
42cf5bc1 | 30 | |
31 | //! A framework to define the display of datums. | |
32 | class Prs3d_DatumAspect : public Prs3d_BasicAspect | |
33 | { | |
4e1bc39a | 34 | DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect) |
42cf5bc1 | 35 | public: |
36 | ||
24f9d04c | 37 | //! An empty constructor. |
42cf5bc1 | 38 | Standard_EXPORT Prs3d_DatumAspect(); |
bc001a40 | 39 | |
24f9d04c | 40 | //! Returns line aspect for specified part. |
41 | const Handle(Prs3d_LineAspect)& LineAspect (Prs3d_DatumParts thePart) const { return myLineAspects[thePart]; } | |
bc001a40 | 42 | |
24f9d04c | 43 | //! Returns shading aspect for specified part. |
44 | const Handle(Prs3d_ShadingAspect)& ShadingAspect (Prs3d_DatumParts thePart) const { return myShadedAspects[thePart]; } | |
bc001a40 | 45 | |
2108d9a2 | 46 | //! Returns the text attributes for rendering labels. |
bc001a40 | 47 | const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; } |
48 | ||
2108d9a2 | 49 | //! Sets text attributes for rendering labels. |
50 | void SetTextAspect (const Handle(Prs3d_TextAspect)& theTextAspect) { myTextAspect = theTextAspect; } | |
51 | ||
bc001a40 | 52 | //! Returns the point aspect of origin wireframe presentation |
53 | const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; } | |
54 | ||
2108d9a2 | 55 | //! Returns the point aspect of origin wireframe presentation |
56 | void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) { myPointAspect = theAspect; } | |
57 | ||
bc001a40 | 58 | //! Returns the arrow aspect of presentation |
59 | const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; } | |
60 | ||
2108d9a2 | 61 | //! Sets the arrow aspect of presentation |
62 | void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; } | |
63 | ||
bc001a40 | 64 | //! Returns true if the given part is used in axes of aspect |
65 | Standard_EXPORT Standard_Boolean DrawDatumPart (Prs3d_DatumParts thePart) const; | |
66 | ||
67 | //! Sets the axes used in the datum aspect | |
bb88f3ff | 68 | void SetDrawDatumAxes (Prs3d_DatumAxes theType) { myAxes = theType; } |
bc001a40 | 69 | |
70 | //! Returns axes used in the datum aspect | |
bb88f3ff | 71 | Prs3d_DatumAxes DatumAxes() const { return myAxes; } |
bc001a40 | 72 | |
24f9d04c | 73 | //! Returns the attribute of the datum type |
74 | Standard_Real Attribute (Prs3d_DatumAttribute theType) const { return myAttributes[theType]; } | |
75 | ||
bc001a40 | 76 | //! Sets the attribute of the datum type |
24f9d04c | 77 | void SetAttribute (Prs3d_DatumAttribute theType, const Standard_Real theValue) { myAttributes[theType] = theValue; } |
bc001a40 | 78 | |
24f9d04c | 79 | //! Returns the length of the displayed first axis. |
80 | Standard_EXPORT Standard_Real AxisLength (Prs3d_DatumParts thePart) const; | |
4e1bc39a | 81 | |
82 | //! Sets the lengths of the three axes. | |
bc001a40 | 83 | void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3) |
4e1bc39a | 84 | { |
24f9d04c | 85 | myAttributes[Prs3d_DatumAttribute_XAxisLength] = theL1; |
86 | myAttributes[Prs3d_DatumAttribute_YAxisLength] = theL2; | |
87 | myAttributes[Prs3d_DatumAttribute_ZAxisLength] = theL3; | |
4e1bc39a | 88 | } |
89 | ||
fae1ae11 ZA |
90 | //! @return true if axes labels are drawn; TRUE by default. |
91 | Standard_Boolean ToDrawLabels() const { return myToDrawLabels; } | |
92 | ||
046a1c9d | 93 | //! Sets option to draw or not to draw text labels for axes |
fae1ae11 | 94 | void SetDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; } |
bc001a40 | 95 | void SetToDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; } |
42cf5bc1 | 96 | |
fae1ae11 ZA |
97 | //! @return true if axes arrows are drawn; TRUE by default. |
98 | Standard_Boolean ToDrawArrows() const { return myToDrawArrows; } | |
99 | ||
100 | //! Sets option to draw or not arrows for axes | |
101 | void SetDrawArrows (Standard_Boolean theToDraw) { myToDrawArrows = theToDraw; } | |
42cf5bc1 | 102 | |
bc001a40 | 103 | //! Returns type of arrow for a type of axis |
104 | Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const; | |
42cf5bc1 | 105 | |
0904aa63 | 106 | //! Dumps the content of me into the stream |
bc73b006 | 107 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; |
0904aa63 | 108 | |
24f9d04c | 109 | public: |
110 | ||
111 | //! Returns the attributes for display of the first axis. | |
112 | Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") | |
113 | const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects[Prs3d_DatumParts_XAxis]; } | |
114 | ||
115 | //! Returns the attributes for display of the second axis. | |
116 | Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") | |
117 | const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects[Prs3d_DatumParts_YAxis]; } | |
118 | ||
119 | //! Returns the attributes for display of the third axis. | |
120 | Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") | |
121 | const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects[Prs3d_DatumParts_ZAxis]; } | |
122 | ||
123 | //! Sets the DrawFirstAndSecondAxis attributes to active. | |
124 | Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead") | |
125 | Standard_EXPORT void SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw); | |
126 | ||
127 | //! Returns true if the first and second axes can be drawn. | |
128 | Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead") | |
129 | Standard_Boolean DrawFirstAndSecondAxis() const | |
130 | { | |
131 | return (myAxes & Prs3d_DatumAxes_XAxis) != 0 | |
132 | && (myAxes & Prs3d_DatumAxes_YAxis) != 0; | |
133 | } | |
134 | ||
135 | //! Sets the DrawThirdAxis attributes to active. | |
136 | Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead") | |
137 | Standard_EXPORT void SetDrawThirdAxis (Standard_Boolean theToDraw); | |
138 | ||
139 | //! Returns true if the third axis can be drawn. | |
140 | Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead") | |
141 | Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DatumAxes_ZAxis) != 0; } | |
142 | ||
143 | //! Returns the length of the displayed first axis. | |
144 | Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") | |
145 | Standard_Real FirstAxisLength() const { return myAttributes[Prs3d_DatumAttribute_XAxisLength]; } | |
146 | ||
147 | //! Returns the length of the displayed second axis. | |
148 | Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") | |
149 | Standard_Real SecondAxisLength() const { return myAttributes[Prs3d_DatumAttribute_YAxisLength]; } | |
150 | ||
151 | //! Returns the length of the displayed third axis. | |
152 | Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") | |
153 | Standard_Real ThirdAxisLength() const { return myAttributes[Prs3d_DatumAttribute_ZAxisLength]; } | |
154 | ||
bc001a40 | 155 | private: |
bc001a40 | 156 | |
24f9d04c | 157 | Handle(Prs3d_ShadingAspect) myShadedAspects[Prs3d_DatumParts_NB]; |
158 | Handle(Prs3d_LineAspect) myLineAspects[Prs3d_DatumParts_NB]; | |
159 | Handle(Prs3d_TextAspect) myTextAspect; | |
160 | Handle(Prs3d_PointAspect) myPointAspect; | |
161 | Handle(Prs3d_ArrowAspect) myArrowAspect; | |
162 | Standard_Real myAttributes[Prs3d_DatumAttribute_NB]; | |
163 | Prs3d_DatumAxes myAxes; | |
164 | Standard_Boolean myToDrawLabels; | |
165 | Standard_Boolean myToDrawArrows; | |
42cf5bc1 | 166 | |
42cf5bc1 | 167 | }; |
168 | ||
4e1bc39a | 169 | DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect) |
42cf5bc1 | 170 | |
171 | #endif // _Prs3d_DatumAspect_HeaderFile |