0027764: Visualization - add functionality for animation of 3D camera and interactive...
[occt.git] / src / AIS / AIS_Plane.hxx
1 // Created on: 1995-08-02
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_Plane_HeaderFile
18 #define _AIS_Plane_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <gp_Pnt.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <AIS_TypeOfPlane.hxx>
26 #include <Select3D_TypeOfSensitivity.hxx>
27 #include <AIS_InteractiveObject.hxx>
28 #include <Standard_Real.hxx>
29 #include <Standard_Integer.hxx>
30 #include <AIS_KindOfInteractive.hxx>
31 #include <PrsMgr_PresentationManager3d.hxx>
32 #include <SelectMgr_Selection.hxx>
33 #include <Quantity_NameOfColor.hxx>
34 class Geom_Plane;
35 class Geom_Axis2Placement;
36 class gp_Pnt;
37 class AIS_InteractiveContext;
38 class Prs3d_Presentation;
39 class Prs3d_Projector;
40 class Geom_Transformation;
41 class Quantity_Color;
42
43
44 class AIS_Plane;
45 DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject)
46
47 //! Constructs plane datums to be used in construction of
48 //! composite shapes.
49 class AIS_Plane : public AIS_InteractiveObject
50 {
51
52 public:
53
54   
55   //! initializes the plane aComponent. If
56   //! the mode aCurrentMode equals true, the drawing
57   //! tool, "Drawer" is not initialized.
58   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const Standard_Boolean aCurrentMode = Standard_False);
59   
60   //! initializes the plane aComponent and
61   //! the point aCenter. If the mode aCurrentMode
62   //! equals true, the drawing tool, "Drawer" is not
63   //! initialized. aCurrentMode equals true, the drawing
64   //! tool, "Drawer" is not initialized.
65   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const Standard_Boolean aCurrentMode = Standard_False);
66   
67   //! initializes the plane aComponent, the
68   //! point aCenter, and the minimum and maximum
69   //! points, aPmin and aPmax. If the mode
70   //! aCurrentMode equals true, the drawing tool, "Drawer" is not initialized.
71   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax, const Standard_Boolean aCurrentMode = Standard_False);
72   
73   Standard_EXPORT AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfPlane aPlaneType, const Standard_Boolean aCurrentMode = Standard_False);
74   
75   //! Same value for x and y directions
76   Standard_EXPORT void SetSize (const Standard_Real aValue);
77   
78   //! Sets the size defined by the length along the X axis
79   //! XVal and the length along the Y axis YVal.
80   Standard_EXPORT void SetSize (const Standard_Real Xval, const Standard_Real YVal);
81   
82   Standard_EXPORT void UnsetSize();
83   
84   Standard_EXPORT Standard_Boolean Size (Standard_Real& X, Standard_Real& Y) const;
85   
86     Standard_Boolean HasOwnSize() const;
87   
88   Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
89   
90   Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
91   
92   //! Returns the component specified in SetComponent.
93     const Handle(Geom_Plane)& Component();
94   
95   //! Creates an instance of the plane aComponent.
96   Standard_EXPORT void SetComponent (const Handle(Geom_Plane)& aComponent);
97   
98   //! Returns the settings for the selected plane
99   //! aComponent, provided in SetPlaneAttributes.
100   //! These include the points aCenter, aPmin, and aPmax
101   Standard_EXPORT Standard_Boolean PlaneAttributes (Handle(Geom_Plane)& aComponent, gp_Pnt& aCenter, gp_Pnt& aPmin, gp_Pnt& aPmax);
102   
103   //! Allows you to provide settings other than default ones
104   //! for the selected plane. These include: center point
105   //! aCenter, maximum aPmax and minimum aPmin.
106   Standard_EXPORT void SetPlaneAttributes (const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax);
107   
108   //! Returns the coordinates of the center point.
109     const gp_Pnt& Center() const;
110   
111
112   //! Provides settings for the center aCenter other than (0, 0, 0).
113     void SetCenter (const gp_Pnt& aCenter);
114   
115   //! Allows you to provide settings for the position and
116   //! direction of one of the plane's axes, aComponent, in
117   //! 3D space. The coordinate system used is
118   //! right-handed, and the type of plane aPlaneType is one of:
119   //! -   AIS_ TOPL_Unknown
120   //! -   AIS_ TOPL_XYPlane
121   //! -   AIS_ TOPL_XZPlane
122   //! -   AIS_ TOPL_YZPlane}.
123   Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfPlane aPlaneType);
124   
125   //! Returns the position of the plane's axis2 system
126   //! identifying the x, y, or z axis and giving the plane a
127   //! direction in 3D space. An axis2 system is a right-handed coordinate system.
128   Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement();
129   
130   //! Returns the type of plane - xy, yz, xz or unknown.
131     AIS_TypeOfPlane TypeOfPlane();
132   
133   //! Returns the type of plane - xy, yz, or xz.
134     Standard_Boolean IsXYZPlane();
135   
136   //! Returns the non-default current display mode set by SetCurrentMode.
137     Standard_Boolean CurrentMode();
138   
139
140   //! Allows you to provide settings for a non-default
141   //! current display mode.
142     void SetCurrentMode (const Standard_Boolean aCurrentMode);
143   
144   //! Returns true if the display mode selected, aMode, is valid for planes.
145   Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
146   
147   //! connection to <aCtx> default drawer implies a recomputation of Frame values.
148   Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
149   
150   //! Returns the type of sensitivity for the plane;
151     Select3D_TypeOfSensitivity TypeOfSensitivity() const;
152   
153   //! Sets the type of sensitivity for the plane.
154     void SetTypeOfSensitivity (const Select3D_TypeOfSensitivity& theTypeOfSensitivity);
155   
156   //! computes the presentation according to a point of view
157   //! given by <aProjector>.
158   //! To be Used when the associated degenerated Presentations
159   //! have been transformed by <aTrsf> which is not a Pure
160   //! Translation. The HLR Prs can't be deducted automatically
161   //! WARNING :<aTrsf> must be applied
162   //! to the object to display before computation  !!!
163   Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
164   
165   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE;
166   
167   Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
168   
169   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
170   
171   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
172
173
174
175
176   DEFINE_STANDARD_RTTIEXT(AIS_Plane,AIS_InteractiveObject)
177
178 protected:
179
180
181
182
183 private:
184
185   
186   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
187   
188   Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
189   
190   Standard_EXPORT void ComputeFrame();
191   
192   Standard_EXPORT void ComputeFields();
193   
194   Standard_EXPORT void InitDrawerAttributes();
195
196   Handle(Geom_Plane) myComponent;
197   Handle(Geom_Axis2Placement) myAx2;
198   gp_Pnt myCenter;
199   gp_Pnt myPmin;
200   gp_Pnt myPmax;
201   Standard_Boolean myCurrentMode;
202   Standard_Boolean myAutomaticPosition;
203   AIS_TypeOfPlane myTypeOfPlane;
204   Standard_Boolean myIsXYZPlane;
205   Standard_Boolean myHasOwnSize;
206   Select3D_TypeOfSensitivity myTypeOfSensitivity;
207
208
209 };
210
211
212 #include <AIS_Plane.lxx>
213
214
215
216
217
218 #endif // _AIS_Plane_HeaderFile