42cf5bc1 |
1 | // Created on: 1995-08-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_Axis_HeaderFile |
18 | #define _AIS_Axis_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <gp_Pnt.hxx> |
24 | #include <AIS_TypeOfAxis.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <gp_Dir.hxx> |
27 | #include <Standard_Real.hxx> |
28 | #include <Standard_CString.hxx> |
29 | #include <AIS_InteractiveObject.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | #include <PrsMgr_PresentationManager3d.hxx> |
32 | #include <SelectMgr_Selection.hxx> |
33 | #include <AIS_KindOfInteractive.hxx> |
34 | #include <Quantity_NameOfColor.hxx> |
35 | class Geom_Line; |
36 | class Geom_Axis2Placement; |
37 | class Prs3d_LineAspect; |
38 | class Geom_Axis1Placement; |
39 | class Prs3d_Presentation; |
40 | class Prs3d_Projector; |
41 | class Geom_Transformation; |
42 | class Quantity_Color; |
43 | |
44 | |
45 | class AIS_Axis; |
46 | DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject) |
47 | |
48 | //! Locates the x, y and z axes in an Interactive Object. |
49 | //! These are used to orient it correctly in presentations |
50 | //! from different viewpoints, or to construct a revolved |
51 | //! shape, for example, from one of the axes. Conversely, |
52 | //! an axis can be created to build a revolved shape and |
53 | //! then situated relative to one of the axes of the view. |
54 | class AIS_Axis : public AIS_InteractiveObject |
55 | { |
56 | |
57 | public: |
58 | |
59 | |
60 | //! Initializes the line aComponent |
61 | Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent); |
62 | |
63 | //! initializes the axis2 position |
64 | //! aComponent. The coordinate system used is right-handed. |
65 | Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType); |
66 | |
67 | //! Initializes the axis1 position anAxis. |
68 | Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis); |
69 | |
70 | |
71 | //! Returns the axis entity aComponent and identifies it |
72 | //! as a component of a shape. |
73 | const Handle(Geom_Line)& Component() const; |
74 | |
75 | //! Sets the coordinates of the lin aComponent. |
76 | Standard_EXPORT void SetComponent (const Handle(Geom_Line)& aComponent); |
77 | |
78 | |
79 | //! Returns the position of axis2 and positions it by |
80 | //! identifying it as the x, y, or z axis and giving its |
81 | //! direction in 3D space. The coordinate system used is right-handed. |
82 | const Handle(Geom_Axis2Placement)& Axis2Placement() const; |
83 | |
84 | |
85 | //! Allows you to provide settings for aComponent:the |
86 | //! position and direction of an axis in 3D space. The |
87 | //! coordinate system used is right-handed. |
88 | Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType); |
89 | |
90 | //! Constructs a new line to serve as the axis anAxis in 3D space. |
91 | Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis); |
92 | |
93 | //! Returns the type of axis. |
94 | AIS_TypeOfAxis TypeOfAxis() const; |
95 | |
96 | |
97 | //! Constructs the entity aTypeAxis to stock information |
98 | //! concerning type of axis. |
99 | void SetTypeOfAxis (const AIS_TypeOfAxis aTypeAxis); |
100 | |
101 | |
102 | //! Returns a signature of 2 for axis datums. When you |
103 | //! activate mode 2 by a signature, you pick AIS objects |
104 | //! of type AIS_Axis. |
105 | Standard_Boolean IsXYZAxis() const; |
106 | |
107 | //! Returns true if the interactive object accepts the display mode aMode. |
108 | Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE; |
109 | |
110 | //! computes the presentation according to a point of view |
111 | //! given by <aProjector>. |
112 | //! To be Used when the associated degenerated Presentations |
113 | //! have been transformed by <aTrsf> which is not a Pure |
114 | //! Translation. The HLR Prs can't be deducted automatically |
115 | //! WARNING :<aTrsf> must be applied |
116 | //! to the object to display before computation !!! |
117 | Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; |
118 | |
119 | virtual Standard_Integer Signature() const Standard_OVERRIDE; |
120 | |
121 | virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; |
122 | |
123 | Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; |
124 | |
125 | Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; |
126 | |
127 | Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; |
128 | |
129 | Standard_EXPORT void UnsetColor() Standard_OVERRIDE; |
130 | |
131 | Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; |
132 | |
133 | |
134 | |
135 | |
92efcf78 |
136 | DEFINE_STANDARD_RTTIEXT(AIS_Axis,AIS_InteractiveObject) |
42cf5bc1 |
137 | |
138 | protected: |
139 | |
140 | |
141 | |
142 | |
143 | private: |
144 | |
145 | |
146 | Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; |
147 | |
148 | Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; |
149 | |
79104795 |
150 | Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; |
42cf5bc1 |
151 | |
152 | Standard_EXPORT void ComputeFields(); |
153 | |
154 | Handle(Geom_Line) myComponent; |
155 | Handle(Geom_Axis2Placement) myAx2; |
156 | gp_Pnt myPfirst; |
157 | gp_Pnt myPlast; |
158 | AIS_TypeOfAxis myTypeOfAxis; |
159 | Standard_Boolean myIsXYZAxis; |
160 | gp_Dir myDir; |
161 | Standard_Real myVal; |
162 | Standard_CString myText; |
163 | Handle(Prs3d_LineAspect) myLineAspect; |
164 | |
165 | |
166 | }; |
167 | |
168 | |
169 | #include <AIS_Axis.lxx> |
170 | |
171 | |
172 | |
173 | |
174 | |
175 | #endif // _AIS_Axis_HeaderFile |