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