Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/geom.git] / src / ShHealOper / ShHealOper_Sewing.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 // File:      ShHealOper_Sewing.hxx
22 // Created:   29.04.04 13:29:10
23 // Author:    Galina KULIKOVA
24
25
26 #ifndef ShHealOper_Sewing_HeaderFile
27 #define ShHealOper_Sewing_HeaderFile
28
29 #include <MMgt_TShared.hxx>
30 #include <ShHealOper_Tool.hxx>
31 #include <TopoDS_Shape.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <BRepBuilderAPI_Sewing.hxx>
34 #include <TopoDS_Compound.hxx>
35 #include <TopTools_MapOfShape.hxx>
36 #include <TopTools_SequenceOfShape.hxx>
37
38 ///  Class ShHealOper_Sewing
39 //Intended for sewing of shapes.
40
41 class ShHealOper_Sewing : public ShHealOper_Tool
42 {
43  public:
44   // ---------- PUBLIC METHODS ----------
45
46   
47   Standard_EXPORT ShHealOper_Sewing () : ShHealOper_Tool() {}
48   // Empty constructor
49   
50   Standard_EXPORT ShHealOper_Sewing (const TopoDS_Shape& theShape,
51                                      const Standard_Real theTolerance);
52   //Constructor for initalization by shape and tolerance.
53
54   Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
55    //Method for initalization by whole shape.
56   
57   Standard_EXPORT Standard_Boolean Perform();
58   //Performs sewing specified whole shape.
59
60   Standard_EXPORT Standard_Boolean Perform(const TopTools_SequenceOfShape& theSeqShapes);
61   //Performs local sewing specified sub-shapes from whole shape.
62   
63   inline void SetFacesMode(const Standard_Boolean theFacesMode )
64   {
65     myFacesMode = theFacesMode;
66   }
67   //Set mode for sewing faces.(by default true)
68
69   inline Standard_Boolean GetFacesMode( )
70   {
71     return myFacesMode;
72   }
73   //Get mode for sewing of faces.
74   
75    inline void SetFloatingEdgesMode(const Standard_Boolean theEdgesMode )
76   {
77     myEdgesMode = theEdgesMode;
78   }
79   //Set mode for sewing floating edges.(by default false)
80
81   inline Standard_Boolean GetFloatingEdgesMode( )
82   {
83     return myEdgesMode;
84   }
85   //Get mode for sewing of floating edges.
86
87   inline void SetNonManifoldMode(const Standard_Boolean theNonManifoldMode )
88   {
89     myNonManifoldMode = theNonManifoldMode;
90   }
91   //Set NonManifoldMode mode  for sewing (by default false)
92
93   inline Standard_Boolean GetNonManifoldMode( )
94   {
95     return myNonManifoldMode;
96   }
97   //Get NonManifoldMode mode for sewing.
98   
99   inline void SetTolerance(const Standard_Real theToler)
100   {
101     myTolerance = theToler;
102   }
103   //set tolerance for sewing.
104
105   inline Standard_Real GetTolerance()
106   {
107     return myTolerance;
108   }
109   //get tolerance set for sewing.
110
111   inline void SetHistoryLevel(TopAbs_ShapeEnum theHistLevel)
112   {
113     myHistoryLevel =theHistLevel;
114   }
115   //set shape level (default TopAbs_FACE) for keeping modifications of the shapes.
116   
117   inline TopAbs_ShapeEnum GetHistoryLevel()
118   {
119     return myHistoryLevel;
120   }
121   //get specified shape level for keeping history.
122
123  private:
124   // ---------- PRIVATE METHODS ----------
125   
126   Standard_Boolean sewing(const TopTools_SequenceOfShape& theSeqShapes);
127   Standard_Boolean getShells(const TopoDS_Shape& theSewShape) const;
128   Standard_Boolean getWires(const TopoDS_Shape& theSewShape) const;
129   Standard_Boolean getModifications(const TopoDS_Shape& theShape,
130                                     const Handle(BRepBuilderAPI_Sewing)& theSewing) const;
131   
132   Standard_Boolean isSewed(const TopoDS_Shape& theShape) const;
133
134   void deleteFreeEdges(const TopoDS_Shape& theSewShape, 
135                        TopTools_MapOfShape& theMapEdges,
136                        TopoDS_Compound& theNewComp) const;
137  private:
138   // ---------- PRIVATE FIELDS ----------
139
140   Standard_Boolean myNonManifoldMode;
141   Standard_Boolean myEdgesMode;
142   Standard_Boolean myFacesMode;
143   Standard_Real myTolerance;
144   TopAbs_ShapeEnum myHistoryLevel;
145  public:
146 // Declaration of CASCADE RTTI
147 //DEFINE_STANDARD_RTTI (ShHealOper_Sewing)
148 };
149
150 // Definition of HANDLE object using Standard_DefineHandle.hxx
151 //DEFINE_STANDARD_HANDLE (ShHealOper_Sewing, )
152
153
154 #endif