Salome HOME
Fit All after was added stream selection and displaying in embedded viewer.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_AISTrihedron.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23
24 #ifndef HYDROGUI_AISTRIHEDRON_H
25 #define HYDROGUI_AISTRIHEDRON_H
26
27 #include <AIS_Trihedron.hxx>
28 #include <Prs3d_LineAspect.hxx>
29
30 #include <gp_Pnt.hxx>
31 #include <gp_Dir.hxx>
32
33 /**
34  * \class HYDROGUI_AISTrihedron
35  * \brief AIS trihedron is redefined in order to show U text on the OX axis
36  * and Z text on the OY axis.
37  */
38 DEFINE_STANDARD_HANDLE(HYDROGUI_AISTrihedron, AIS_Trihedron)
39
40 class HYDROGUI_AISTrihedron : public AIS_Trihedron
41 {
42 public:
43   /**
44    * The struct to contain axis parameters. Save them in order to do not extract them
45    * on each compute call
46    */
47   struct AxisParameters
48   {
49     gp_Pnt myPfirst; // the first point of the axis
50     gp_Pnt myPlast;  // the last point of the axis
51     Standard_Real myVal; // the axis length
52     Handle(Prs3d_LineAspect) myLineAspect; // the line aspect
53     gp_Dir myDir; // the axis direction
54     Standard_CString myText; // the axis text. This is the main parameter,
55                              // that leads to the trihedron redefine
56   };
57
58 public:
59   HYDROGUI_AISTrihedron( const Handle(Geom_Axis2Placement)& thePlacement );
60
61   ~HYDROGUI_AISTrihedron() {}
62
63   /**
64    * The static method to create filled trihedron. It makes some additional settings
65    * to the trihedron: resize and set color to the axis
66    */
67   static Handle(AIS_Trihedron) createTrihedron( double theSize );
68
69   /**
70    * Updates the internal axis parameters. Should be called after the axis parameters change
71    * e.g. axis resize
72    */
73   void SetAxis2Placement();
74
75   /**
76    * AIS trihedron compute method. It removes the parent compute functionality.
77    * It add to the presentation only oX, oY axis with the corrected text, that contains
78    * "U"/"Z" labels
79    * \param thePresentationManager the prs manager
80    * \param thePresentationManager the presentation
81    * \param theMode the mode
82    */
83   void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
84                 const Handle(Prs3d_Presentation)& thePresentation, 
85                 const Standard_Integer theMode);
86
87   /**
88    * AIS trihedron compute method. It is empty. We do not apply the transformation.
89    * \param thePresentationManager the prs manager
90    * \param theTransformation the transformation
91    * \param thePresentationManager the presentation
92    */
93   void Compute( const Handle_Prs3d_Projector& theProjector,
94                 const Handle_Geom_Transformation& theTransformation,
95                 const Handle_Prs3d_Presentation& thePresentation );
96
97   /**
98    * AIS trihedron compute selection method. It is empty. We do not select the trihedron
99    * \param theSelection the selection
100    * \param theMode the mode
101    */
102   void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
103                          const Standard_Integer theMode );
104
105 private:
106   /**
107    * It adds the presentation to the DsgPrs_XYZAxisPresentation. It should be called in
108    * compute for displayed axis
109    * \param thePresentation the 3D presentation
110    * \param theParams the axis params, such as text, direction, stand and last points
111    */
112   void ComputeAxis( const Handle(Prs3d_Presentation)& thePresentation,
113                     const AxisParameters& theParams );
114   void ComputeFields();
115
116   AxisParameters myUParams; // the parameters for U axis
117   AxisParameters myZParams; // the parameters for Z axis
118 };
119
120
121 #endif