Salome HOME
Merge from BR_imps_2013 14/01/2014
[modules/geom.git] / src / MeasureGUI / MeasureGUI_DimensionCreateTool.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 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : MeasureGUI_DimensionCreateTool.h
25 // Author : Anton POLETAEV, Open CASCADE S.A.S.
26 //
27 #ifndef MEASUREGUI_DIMENSIONCREATETOOL_H
28 #define MEASUREGUI_DIMENSIONCREATETOOL_H
29
30 // GEOM includes
31 #include <GeometryGUI.h>
32 #include <GEOM_GenericObjPtr.h>
33
34 // OCCT includes
35 #include <AIS_LengthDimension.hxx>
36 #include <AIS_DiameterDimension.hxx>
37 #include <AIS_AngleDimension.hxx>
38 #include <Bnd_Box.hxx>
39 #include <gp_Dir.hxx>
40 #include <TopoDS_Face.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TColgp_SequenceOfDir.hxx>
43
44 //=================================================================================
45 // class    : MeasureGUI_DimensionCreateTool
46 // purpose  :
47 //=================================================================================
48 class MeasureGUI_DimensionCreateTool
49 {
50 public:
51   MeasureGUI_DimensionCreateTool( GeometryGUI* );
52
53 /* construction methods */
54 public:
55   Handle(AIS_LengthDimension)   LengthOnEdge( const GEOM::GeomObjPtr& );
56
57   Handle(AIS_LengthDimension)   LengthByPoints( const GEOM::GeomObjPtr&,
58                                                 const GEOM::GeomObjPtr& );
59
60   Handle(AIS_LengthDimension)   LengthByParallelEdges( const GEOM::GeomObjPtr&,
61                                                        const GEOM::GeomObjPtr& );
62
63   Handle(AIS_DiameterDimension) Diameter( const GEOM::GeomObjPtr& );
64
65   Handle(AIS_AngleDimension)    AngleByTwoEdges( const GEOM::GeomObjPtr&,
66                                                  const GEOM::GeomObjPtr& );
67
68   Handle(AIS_AngleDimension)    AngleByThreePoints( const GEOM::GeomObjPtr&,
69                                                     const GEOM::GeomObjPtr&,
70                                                     const GEOM::GeomObjPtr& );
71
72 /* selecting flyout direction for length dimensions */
73 protected:
74
75   void ChooseLengthFlyoutsFromShape( TColgp_SequenceOfDir&,
76                                      const TopoDS_Vertex&,
77                                      const TopoDS_Vertex&,
78                                      const TopoDS_Shape& );
79
80   void ChooseLengthFlyoutsFromShape( TColgp_SequenceOfDir&,
81                                      const TopoDS_Edge&,
82                                      const TopoDS_Shape& );
83
84   void ChooseLengthFlyoutsFromBnd( TColgp_SequenceOfDir&,
85                                    const gp_Pnt&,
86                                    const gp_Pnt&,
87                                    const Bnd_Box& );
88
89 /* selecting best flyout direction taking into account view projection */
90 protected:
91
92   gp_Pln SelectPlaneForProjection( const NCollection_Sequence<gp_Pln>&,
93                                    const Handle(V3d_View)& );
94
95 /* utility */
96 protected:
97   GEOM::GeomObjPtr              GetMainShape( const GEOM::GeomObjPtr& );
98   bool                          GetFaceSide( const TopoDS_Face&,
99                                              const TopoDS_Edge&,
100                                              gp_Dir& );
101
102 private:
103   GeometryGUI*                  myGeomGUI;
104 };
105
106 #endif