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.
34 DEFINE_STANDARD_HANDLE(HYDROGUI_AISTrihedron, AIS_Trihedron)
36 class HYDROGUI_AISTrihedron : public AIS_Trihedron
40 * The struct to contain axis parameters. Save them in order to do not extract them
41 * on each compute call
45 gp_Pnt myPfirst; // the first point of the axis
46 gp_Pnt myPlast; // the last point of the axis
47 Standard_Real myVal; // the axis length
48 Handle(Prs3d_LineAspect) myLineAspect; // the line aspect
49 gp_Dir myDir; // the axis direction
50 Standard_CString myText; // the axis text. This is the main parameter,
51 // that leads to the trihedron redefine
55 HYDROGUI_AISTrihedron( const Handle(Geom_Axis2Placement)& thePlacement );
57 ~HYDROGUI_AISTrihedron() {}
60 * The static method to create filled trihedron. It makes some additional settings
61 * to the trihedron: resize and set color to the axis
63 static Handle(AIS_Trihedron) createTrihedron( double theSize );
66 * Updates the internal axis parameters. Should be called after the axis parameters change
69 void SetAxis2Placement();
72 * AIS trihedron compute method. It removes the parent compute functionality.
73 * It add to the presentation only oX, oY axis with the corrected text, that contains
75 * \param thePresentationManager the prs manager
76 * \param thePresentationManager the presentation
77 * \param theMode the mode
79 void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
80 const Handle(Prs3d_Presentation)& thePresentation,
81 const Standard_Integer theMode);
84 * AIS trihedron compute method. It is empty. We do not apply the transformation.
85 * \param thePresentationManager the prs manager
86 * \param theTransformation the transformation
87 * \param thePresentationManager the presentation
89 void Compute( const Handle_Prs3d_Projector& theProjector,
90 const Handle_Geom_Transformation& theTransformation,
91 const Handle_Prs3d_Presentation& thePresentation );
94 * AIS trihedron compute selection method. It is empty. We do not select the trihedron
95 * \param theSelection the selection
96 * \param theMode the mode
98 void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
99 const Standard_Integer theMode );
103 * It adds the presentation to the DsgPrs_XYZAxisPresentation. It should be called in
104 * compute for displayed axis
105 * \param thePresentation the 3D presentation
106 * \param theParams the axis params, such as text, direction, stand and last points
108 void ComputeAxis( const Handle(Prs3d_Presentation)& thePresentation,
109 const AxisParameters& theParams );
110 void ComputeFields();
112 AxisParameters myUParams; // the parameters for U axis
113 AxisParameters myZParams; // the parameters for Z axis