Salome HOME
patch for correct bathymetry visualization in HYDRO
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_AISTrihedron.h
1 // Copyright (C) 2007-2013  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.
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 #ifndef HYDROGUI_AISTRIHEDRON_H
24 #define HYDROGUI_AISTRIHEDRON_H
25
26 #include <AIS_Trihedron.hxx>
27 #include <Prs3d_LineAspect.hxx>
28
29 #include <gp_Pnt.hxx>
30 #include <gp_Dir.hxx>
31
32 /**
33  * \class HYDROGUI_AISTrihedron
34  * \brief AIS trihedron is redefined in order to show U text on the OX axis
35  * and Z text on the OY axis.
36  */
37 DEFINE_STANDARD_HANDLE(HYDROGUI_AISTrihedron, AIS_Trihedron)
38
39 class HYDROGUI_AISTrihedron : public AIS_Trihedron
40 {
41 public:
42   /**
43    * The struct to contain axis parameters. Save them in order to do not extract them
44    * on each compute call
45    */
46   struct AxisParameters
47   {
48     gp_Pnt myPfirst; // the first point of the axis
49     gp_Pnt myPlast;  // the last point of the axis
50     Standard_Real myVal; // the axis length
51     Handle(Prs3d_LineAspect) myLineAspect; // the line aspect
52     gp_Dir myDir; // the axis direction
53     Standard_CString myText; // the axis text. This is the main parameter,
54                              // that leads to the trihedron redefine
55   };
56
57 public:
58   HYDROGUI_AISTrihedron( const Handle(Geom_Axis2Placement)& thePlacement );
59
60   ~HYDROGUI_AISTrihedron() {}
61
62   /**
63    * The static method to create filled trihedron. It makes some additional settings
64    * to the trihedron: resize and set color to the axis
65    */
66   static Handle(AIS_Trihedron) createTrihedron( double theSize );
67
68   /**
69    * Updates the internal axis parameters. Should be called after the axis parameters change
70    * e.g. axis resize
71    */
72   void SetAxis2Placement();
73
74   /**
75    * AIS trihedron compute method. It removes the parent compute functionality.
76    * It add to the presentation only oX, oY axis with the corrected text, that contains
77    * "U"/"Z" labels
78    * \param thePresentationManager the prs manager
79    * \param thePresentationManager the presentation
80    * \param theMode the mode
81    */
82   void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
83                 const Handle(Prs3d_Presentation)& thePresentation, 
84                 const Standard_Integer theMode);
85
86   /**
87    * AIS trihedron compute method. It is empty. We do not apply the transformation.
88    * \param thePresentationManager the prs manager
89    * \param theTransformation the transformation
90    * \param thePresentationManager the presentation
91    */
92   void Compute( const Handle_Prs3d_Projector& theProjector,
93                 const Handle_Geom_Transformation& theTransformation,
94                 const Handle_Prs3d_Presentation& thePresentation );
95
96   /**
97    * AIS trihedron compute selection method. It is empty. We do not select the trihedron
98    * \param theSelection the selection
99    * \param theMode the mode
100    */
101   void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
102                          const Standard_Integer theMode );
103
104 private:
105   /**
106    * It adds the presentation to the DsgPrs_XYZAxisPresentation. It should be called in
107    * compute for displayed axis
108    * \param thePresentation the 3D presentation
109    * \param theParams the axis params, such as text, direction, stand and last points
110    */
111   void ComputeAxis( const Handle(Prs3d_Presentation)& thePresentation,
112                     const AxisParameters& theParams );
113   void ComputeFields();
114
115   AxisParameters myUParams; // the parameters for U axis
116   AxisParameters myZParams; // the parameters for Z axis
117 };
118
119
120 #endif