1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef HYDROGUI_AISTRIHEDRON_H
21 #define HYDROGUI_AISTRIHEDRON_H
23 #include <AIS_Trihedron.hxx>
24 #include <Prs3d_LineAspect.hxx>
30 * \class HYDROGUI_AISTrihedron
31 * \brief AIS trihedron is redefined in order to show U text on the OX axis
32 * and Z text on the OY axis.
35 class HYDROGUI_AISTrihedron : public AIS_Trihedron
39 * The struct to contain axis parameters. Save them in order to do not extract them
40 * on each compute call
44 gp_Pnt myPfirst; // the first point of the axis
45 gp_Pnt myPlast; // the last point of the axis
46 Standard_Real myVal; // the axis length
47 Handle(Prs3d_LineAspect) myLineAspect; // the line aspect
48 gp_Dir myDir; // the axis direction
49 Standard_CString myText; // the axis text. This is the main parameter,
50 // that leads to the trihedron redefine
54 HYDROGUI_AISTrihedron( const Handle(Geom_Axis2Placement)& thePlacement );
56 ~HYDROGUI_AISTrihedron() {}
59 * The static method to create filled trihedron. It makes some additional settings
60 * to the trihedron: resize and set color to the axis
62 static Handle(AIS_Trihedron) createTrihedron( double theSize );
65 * Updates the internal axis parameters. Should be called after the axis parameters change
68 void SetAxis2Placement();
71 * AIS trihedron compute method. It removes the parent compute functionality.
72 * It add to the presentation only oX, oY axis with the corrected text, that contains
74 * \param thePresentationManager the prs manager
75 * \param thePresentationManager the presentation
76 * \param theMode the mode
78 void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
79 const Handle(Prs3d_Presentation)& thePresentation,
80 const Standard_Integer theMode);
83 * AIS trihedron compute method. It is empty. We do not apply the transformation.
84 * \param thePresentationManager the prs manager
85 * \param theTransformation the transformation
86 * \param thePresentationManager the presentation
88 void Compute( const Handle(Prs3d_Projector)& theProjector,
89 const Handle(Geom_Transformation)& theTransformation,
90 const Handle(Prs3d_Presentation)& thePresentation );
93 * AIS trihedron compute selection method. It is empty. We do not select the trihedron
94 * \param theSelection the selection
95 * \param theMode the mode
97 void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
98 const Standard_Integer theMode );
102 * It adds the presentation to the DsgPrs_XYZAxisPresentation. It should be called in
103 * compute for displayed axis
104 * \param thePresentation the 3D presentation
105 * \param theParams the axis params, such as text, direction, stand and last points
107 void ComputeAxis( const Handle(Prs3d_Presentation)& thePresentation,
108 const AxisParameters& theParams );
109 void ComputeFields();
111 AxisParameters myUParams; // the parameters for U axis
112 AxisParameters myZParams; // the parameters for Z axis