42cf5bc1 |
1 | // Created on: 1995-10-09 |
2 | // Created by: Arnaud BOUZY/Odile Olivier |
3 | // Copyright (c) 1995-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 _AIS_Trihedron_HeaderFile |
18 | #define _AIS_Trihedron_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <Quantity_NameOfColor.hxx> |
25 | #include <AIS_InteractiveObject.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <PrsMgr_PresentationManager3d.hxx> |
29 | #include <SelectMgr_Selection.hxx> |
30 | #include <AIS_KindOfInteractive.hxx> |
31 | #include <TColgp_Array1OfPnt.hxx> |
32 | class Geom_Axis2Placement; |
33 | class AIS_InteractiveObject; |
34 | class AIS_Axis; |
35 | class AIS_Point; |
36 | class AIS_Plane; |
37 | class AIS_InteractiveContext; |
38 | class Prs3d_Presentation; |
39 | class Prs3d_Projector; |
40 | class Geom_Transformation; |
41 | class gp_Trsf; |
42 | class Quantity_Color; |
43 | |
44 | |
45 | class AIS_Trihedron; |
46 | DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject) |
47 | |
48 | //! Create a selectable trihedron |
49 | //! there are 4 modes of selection : |
50 | //! mode = 0 to select triedron ,priority = 1 |
51 | //! mode = 1 to select its origine ,priority = 5 |
52 | //! mode = 2 to select its axis ,priority = 3 |
53 | //! mode = 3 to select its planes ,priority = 2 |
54 | //! a trihedron has 1 origine,3 axes,3 planes. |
55 | //! Warning |
56 | //! For the presentation of trihedra, the default unit of |
57 | //! length is the millimetre, and the default value for the |
58 | //! representation of the axes is 100. If you modify these |
59 | //! dimensions, you must temporarily recover the Drawer. |
60 | //! From inside it, you take the aspect in which the values |
61 | //! for length are stocked. For trihedra, this is |
62 | //! Prs3d_Drawer_FirstAxisAspect. You change the |
63 | //! values inside this Aspect and recalculate the presentation. |
64 | //! If you want to use extended selection modes, different than 0, |
65 | //! you should take care of removing of the shapes from the interactive |
66 | //! context that has been computed for selection; it might be necessary |
67 | //! when you change selection mode. You can use methods Axis, Point, |
68 | //! Plane to retrieve the shapes. |
69 | class AIS_Trihedron : public AIS_InteractiveObject |
70 | { |
1f7f5a90 |
71 | DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject) |
42cf5bc1 |
72 | public: |
73 | |
74 | |
75 | //! Initializes a trihedron entity. |
76 | Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent); |
77 | |
78 | //! Returns the right-handed coordinate system set in SetComponent. |
79 | const Handle(Geom_Axis2Placement)& Component() const; |
80 | |
81 | //! Constructs the right-handed coordinate system aComponent. |
82 | Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& aComponent); |
83 | |
84 | //! Returns true if the trihedron object has a size other |
85 | //! than the default size of 100 mm. along each axis. |
86 | Standard_Boolean HasOwnSize() const; |
87 | |
88 | //! Sets the size aValue for the trihedron object. |
89 | //! The default value is 100 mm. |
90 | Standard_EXPORT void SetSize (const Standard_Real aValue); |
91 | |
92 | //! Removes any non-default settings for size of this |
93 | //! trihedron object. |
94 | Standard_EXPORT void UnsetSize(); |
95 | |
96 | Standard_EXPORT Standard_Real Size() const; |
97 | |
98 | //! Returns the "XAxis". |
99 | Standard_EXPORT Handle(AIS_Axis) XAxis() const; |
100 | |
101 | //! Returns the "YAxis". |
102 | Standard_EXPORT Handle(AIS_Axis) YAxis() const; |
103 | |
104 | //! Returns the main Axis. |
105 | Standard_EXPORT Handle(AIS_Axis) Axis() const; |
106 | |
107 | //! Returns the origine. |
108 | Standard_EXPORT Handle(AIS_Point) Position() const; |
109 | |
110 | //! Returns the "XYPlane". |
111 | Standard_EXPORT Handle(AIS_Plane) XYPlane() const; |
112 | |
113 | //! Returns the "XZPlane". |
114 | Standard_EXPORT Handle(AIS_Plane) XZPlane() const; |
115 | |
116 | //! Returns the "YZPlane". |
117 | Standard_EXPORT Handle(AIS_Plane) YZPlane() const; |
118 | |
119 | //! connection to <aCtx> default drawer implies a recomputation |
120 | //! of SubObjects values. |
121 | Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE; |
122 | |
123 | //! Returns true if the display mode selected, aMode, is |
124 | //! valid for trihedron datums. |
125 | Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE; |
126 | |
127 | //! Computes the presentation according to a point of view |
128 | //! given by <aProjector>. |
129 | //! To be Used when the associated degenerated Presentations |
130 | //! have been transformed by <aTrsf> which is not a Pure |
131 | //! Translation. The HLR Prs can't be deducted automatically |
132 | //! WARNING :<aTrsf> must be applied |
133 | //! to the object to display before computation !!! |
134 | Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; |
1f7f5a90 |
135 | |
42cf5bc1 |
136 | //! Returns index 3, selection of the planes XOY, YOZ, XOZ. |
137 | Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE; |
138 | |
139 | //! Indicates that the type of Interactive Object is datum. |
140 | Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; |
141 | |
142 | Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; |
143 | |
144 | //! Sets the color aColor for this trihedron object. |
145 | Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; |
146 | |
147 | Standard_EXPORT void SetTextColor (const Quantity_NameOfColor aColor); |
148 | |
149 | Standard_EXPORT Standard_Boolean HasTextColor() const; |
150 | |
151 | Standard_EXPORT Quantity_NameOfColor TextColor() const; |
152 | |
153 | Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor aColor); |
154 | |
155 | Standard_EXPORT Standard_Boolean HasArrowColor() const; |
156 | |
157 | Standard_EXPORT Quantity_NameOfColor ArrowColor() const; |
158 | |
159 | //! Returns the four extremities of the trihedron from the |
160 | //! array of points, TheExtrem. |
161 | Standard_EXPORT void ExtremityPoints (TColgp_Array1OfPnt& TheExtrem) const; |
162 | |
163 | //! Removes the settings for color. |
164 | Standard_EXPORT void UnsetColor() Standard_OVERRIDE; |
165 | |
166 | //! Removes the non-default settings for width set in SetWidth. |
167 | Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; |
168 | |
42cf5bc1 |
169 | protected: |
170 | |
1f7f5a90 |
171 | Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE; |
42cf5bc1 |
172 | |
173 | private: |
42cf5bc1 |
174 | |
175 | Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; |
176 | |
177 | Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; |
178 | |
79104795 |
179 | Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; |
42cf5bc1 |
180 | |
181 | Standard_EXPORT void LoadSubObjects(); |
182 | |
046a1c9d |
183 | protected: |
184 | |
42cf5bc1 |
185 | Handle(Geom_Axis2Placement) myComponent; |
186 | Handle(AIS_InteractiveObject) myShapes[7]; |
187 | Standard_Boolean myHasOwnSize; |
188 | Standard_Boolean myHasOwnTextColor; |
189 | Quantity_NameOfColor myOwnTextColor; |
190 | Standard_Boolean myHasOwnArrowColor; |
191 | Quantity_NameOfColor myOwnArrowColor; |
42cf5bc1 |
192 | }; |
193 | |
194 | |
195 | #include <AIS_Trihedron.lxx> |
196 | |
197 | |
198 | |
199 | |
200 | |
201 | #endif // _AIS_Trihedron_HeaderFile |