215c568c64d80e9922cf07e4ab015cd61cab4204
[occt.git] / src / AIS / AIS_PlaneTrihedron.hxx
1 // Created on: 1996-12-13
2 // Created by: Jean-Pierre COMBE/Odile Olivier
3 // Copyright (c) 1996-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_PlaneTrihedron_HeaderFile
18 #define _AIS_PlaneTrihedron_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TCollection_AsciiString.hxx>
24 #include <AIS_InteractiveObject.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 #include <PrsMgr_PresentationManager3d.hxx>
29 #include <SelectMgr_Selection.hxx>
30 #include <AIS_KindOfInteractive.hxx>
31 #include <Quantity_NameOfColor.hxx>
32 class Geom_Plane;
33 class AIS_InteractiveObject;
34 class AIS_Line;
35 class AIS_Point;
36 class Prs3d_Presentation;
37 class Prs3d_Projector;
38 class Geom_Transformation;
39 class Quantity_Color;
40 class TCollection_AsciiString;
41
42
43 class AIS_PlaneTrihedron;
44 DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject)
45
46 //! To construct a selectable 2d axis system in a 3d
47 //! drawing. This can be placed anywhere in the 3d
48 //! system, and provides a coordinate system for
49 //! drawing curves and shapes in a plane.
50 //! There are 3 selection modes:
51 //! -   mode 0   selection of the whole plane "trihedron"
52 //! -   mode 1   selection of the origin of the plane "trihedron"
53 //! -   mode 2   selection of the axes.
54 //! Warning
55 //! For the presentation of planes and trihedra, the
56 //! millimetre is default unit of length, and 100 the default
57 //! value for the representation of the axes. If you modify
58 //! these dimensions, you must temporarily recover the
59 //! Drawer object. From inside it, take the Aspects in
60 //! which   the values for length are stocked, for example,
61 //! PlaneAspect for planes and LineAspect for
62 //! trihedra. Change these values and recalculate the presentation.
63 class AIS_PlaneTrihedron : public AIS_InteractiveObject
64 {
65
66 public:
67
68   
69   //! Initializes the plane aPlane. The plane trihedron is
70   //! constructed from this and an axis.
71   Standard_EXPORT AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane);
72   
73   //! Returns the component specified in SetComponent.
74   Standard_EXPORT Handle(Geom_Plane) Component();
75   
76   //! Creates an instance of the component object aPlane.
77   Standard_EXPORT void SetComponent (const Handle(Geom_Plane)& aPlane);
78   
79   //! Returns the "XAxis".
80   Standard_EXPORT Handle(AIS_Line) XAxis() const;
81   
82   //! Returns the "YAxis".
83   Standard_EXPORT Handle(AIS_Line) YAxis() const;
84   
85   //! Returns the point of origin of the plane trihedron.
86   Standard_EXPORT Handle(AIS_Point) Position() const;
87   
88   //! Sets the length of the X and Y axes.
89   Standard_EXPORT void SetLength (const Standard_Real theLength);
90   
91   //! Returns the length of X and Y axes.
92   Standard_EXPORT Standard_Real GetLength() const;
93   
94   //! Returns true if the display mode selected, aMode, is valid.
95   Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
96   
97   //! computes the presentation according to a point of view
98   //! given by <aProjector>.
99   //! To be Used when the associated degenerated Presentations
100   //! have been transformed by <aTrsf> which is not a Pure
101   //! Translation. The HLR Prs can't be deducted automatically
102   //! WARNING :<aTrsf> must be applied
103   //! to the object to display before computation  !!!
104   Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
105   
106     virtual Standard_Integer Signature() const Standard_OVERRIDE;
107   
108   //! Returns datum as the type of Interactive Object.
109     virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
110   
111   //! Allows you to provide settings for the color aColor.
112   Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
113   
114   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
115   
116     void SetXLabel (const TCollection_AsciiString& aLabel);
117   
118     void SetYLabel (const TCollection_AsciiString& aLabel);
119
120
121
122
123   DEFINE_STANDARD_RTTIEXT(AIS_PlaneTrihedron,AIS_InteractiveObject)
124
125 protected:
126
127   
128   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
129
130
131
132 private:
133
134   
135   Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
136   
137   Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
138
139   Handle(Geom_Plane) myPlane;
140   Handle(AIS_InteractiveObject) myShapes[3];
141   TCollection_AsciiString myXLabel;
142   TCollection_AsciiString myYLabel;
143
144
145 };
146
147
148 #include <AIS_PlaneTrihedron.lxx>
149
150
151
152
153
154 #endif // _AIS_PlaneTrihedron_HeaderFile