Salome HOME
Revert "Synchronize adm files"
[modules/geom.git] / src / ShHealOper / ShHealOper_Sewing.hxx
1 // Copyright (C) 2007-2014  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, or (at your option) any later version.
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 // File:      ShHealOper_Sewing.hxx
24 // Created:   29.04.04 13:29:10
25 // Author:    Galina KULIKOVA
26 //
27 #ifndef ShHealOper_Sewing_HeaderFile
28 #define ShHealOper_Sewing_HeaderFile
29
30 #include <MMgt_TShared.hxx>
31 #include <ShHealOper_Tool.hxx>
32 #include <TopoDS_Shape.hxx>
33 #include <TopAbs_ShapeEnum.hxx>
34 #include <BRepBuilderAPI_Sewing.hxx>
35 #include <TopoDS_Compound.hxx>
36 #include <TopTools_MapOfShape.hxx>
37 #include <TopTools_SequenceOfShape.hxx>
38
39 ///  Class ShHealOper_Sewing
40 //Intended for sewing of shapes.
41
42 class ShHealOper_Sewing : public ShHealOper_Tool
43 {
44  public:
45   // ---------- PUBLIC METHODS ----------
46
47   
48   Standard_EXPORT ShHealOper_Sewing () : ShHealOper_Tool() {}
49   // Empty constructor
50   
51   Standard_EXPORT ShHealOper_Sewing (const TopoDS_Shape& theShape,
52                                      const Standard_Real theTolerance);
53   //Constructor for initalization by shape and tolerance.
54
55   Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
56    //Method for initalization by whole shape.
57   
58   Standard_EXPORT Standard_Boolean Perform();
59   //Performs sewing specified whole shape.
60
61   Standard_EXPORT Standard_Boolean Perform(const TopTools_SequenceOfShape& theSeqShapes);
62   //Performs local sewing specified sub-shapes from whole shape.
63   
64   inline void SetFacesMode(const Standard_Boolean theFacesMode )
65   {
66     myFacesMode = theFacesMode;
67   }
68   //Set mode for sewing faces.(by default true)
69
70   inline Standard_Boolean GetFacesMode( )
71   {
72     return myFacesMode;
73   }
74   //Get mode for sewing of faces.
75   
76    inline void SetFloatingEdgesMode(const Standard_Boolean theEdgesMode )
77   {
78     myEdgesMode = theEdgesMode;
79   }
80   //Set mode for sewing floating edges.(by default false)
81
82   inline Standard_Boolean GetFloatingEdgesMode( )
83   {
84     return myEdgesMode;
85   }
86   //Get mode for sewing of floating edges.
87
88   inline void SetNonManifoldMode(const Standard_Boolean theNonManifoldMode )
89   {
90     myNonManifoldMode = theNonManifoldMode;
91   }
92   //Set NonManifoldMode mode  for sewing (by default false)
93
94   inline Standard_Boolean GetNonManifoldMode( )
95   {
96     return myNonManifoldMode;
97   }
98   //Get NonManifoldMode mode for sewing.
99   
100   inline void SetTolerance(const Standard_Real theToler)
101   {
102     myTolerance = theToler;
103   }
104   //set tolerance for sewing.
105
106   inline Standard_Real GetTolerance()
107   {
108     return myTolerance;
109   }
110   //get tolerance set for sewing.
111
112   inline void SetHistoryLevel(TopAbs_ShapeEnum theHistLevel)
113   {
114     myHistoryLevel =theHistLevel;
115   }
116   //set shape level (default TopAbs_FACE) for keeping modifications of the shapes.
117   
118   inline TopAbs_ShapeEnum GetHistoryLevel()
119   {
120     return myHistoryLevel;
121   }
122   //get specified shape level for keeping history.
123
124  private:
125   // ---------- PRIVATE METHODS ----------
126   
127   Standard_Boolean sewing(const TopTools_SequenceOfShape& theSeqShapes);
128   Standard_Boolean getShells(const TopoDS_Shape& theSewShape) const;
129   Standard_Boolean getWires(const TopoDS_Shape& theSewShape) const;
130   Standard_Boolean getModifications(const TopoDS_Shape& theShape,
131                                     const Handle(BRepBuilderAPI_Sewing)& theSewing) const;
132   
133   Standard_Boolean isSewed(const TopoDS_Shape& theShape) const;
134
135   void deleteFreeEdges(const TopoDS_Shape& theSewShape, 
136                        TopTools_MapOfShape& theMapEdges,
137                        TopoDS_Compound& theNewComp) const;
138  private:
139   // ---------- PRIVATE FIELDS ----------
140
141   Standard_Boolean myNonManifoldMode;
142   Standard_Boolean myEdgesMode;
143   Standard_Boolean myFacesMode;
144   Standard_Real myTolerance;
145   TopAbs_ShapeEnum myHistoryLevel;
146  public:
147 // Declaration of CASCADE RTTI
148 //DEFINE_STANDARD_RTTI (ShHealOper_Sewing)
149 };
150
151 // Definition of HANDLE object using Standard_DefineHandle.hxx
152 //DEFINE_STANDARD_HANDLE (ShHealOper_Sewing, )
153
154
155 #endif