1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: ShHealOper_Sewing.hxx
24 // Created: 29.04.04 13:29:10
25 // Author: Galina KULIKOVA
27 #ifndef ShHealOper_Sewing_HeaderFile
28 #define ShHealOper_Sewing_HeaderFile
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>
39 /// Class ShHealOper_Sewing
40 //Intended for sewing of shapes.
42 class ShHealOper_Sewing : public ShHealOper_Tool
45 // ---------- PUBLIC METHODS ----------
48 Standard_EXPORT ShHealOper_Sewing () : ShHealOper_Tool() {}
51 Standard_EXPORT ShHealOper_Sewing (const TopoDS_Shape& theShape,
52 const Standard_Real theTolerance);
53 //Constructor for initalization by shape and tolerance.
55 Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
56 //Method for initalization by whole shape.
58 Standard_EXPORT Standard_Boolean Perform();
59 //Performs sewing specified whole shape.
61 Standard_EXPORT Standard_Boolean Perform(const TopTools_SequenceOfShape& theSeqShapes);
62 //Performs local sewing specified sub-shapes from whole shape.
64 inline void SetFacesMode(const Standard_Boolean theFacesMode )
66 myFacesMode = theFacesMode;
68 //Set mode for sewing faces.(by default true)
70 inline Standard_Boolean GetFacesMode( )
74 //Get mode for sewing of faces.
76 inline void SetFloatingEdgesMode(const Standard_Boolean theEdgesMode )
78 myEdgesMode = theEdgesMode;
80 //Set mode for sewing floating edges.(by default false)
82 inline Standard_Boolean GetFloatingEdgesMode( )
86 //Get mode for sewing of floating edges.
88 inline void SetNonManifoldMode(const Standard_Boolean theNonManifoldMode )
90 myNonManifoldMode = theNonManifoldMode;
92 //Set NonManifoldMode mode for sewing (by default false)
94 inline Standard_Boolean GetNonManifoldMode( )
96 return myNonManifoldMode;
98 //Get NonManifoldMode mode for sewing.
100 inline void SetTolerance(const Standard_Real theToler)
102 myTolerance = theToler;
104 //set tolerance for sewing.
106 inline Standard_Real GetTolerance()
110 //get tolerance set for sewing.
112 inline void SetHistoryLevel(TopAbs_ShapeEnum theHistLevel)
114 myHistoryLevel =theHistLevel;
116 //set shape level (default TopAbs_FACE) for keeping modifications of the shapes.
118 inline TopAbs_ShapeEnum GetHistoryLevel()
120 return myHistoryLevel;
122 //get specified shape level for keeping history.
125 // ---------- PRIVATE METHODS ----------
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;
133 Standard_Boolean isSewed(const TopoDS_Shape& theShape) const;
135 void deleteFreeEdges(const TopoDS_Shape& theSewShape,
136 TopTools_MapOfShape& theMapEdges,
137 TopoDS_Compound& theNewComp) const;
139 // ---------- PRIVATE FIELDS ----------
141 Standard_Boolean myNonManifoldMode;
142 Standard_Boolean myEdgesMode;
143 Standard_Boolean myFacesMode;
144 Standard_Real myTolerance;
145 TopAbs_ShapeEnum myHistoryLevel;
147 // Declaration of CASCADE RTTI
148 //DEFINE_STANDARD_RTTI (ShHealOper_Sewing)
151 // Definition of HANDLE object using Standard_DefineHandle.hxx
152 //DEFINE_STANDARD_HANDLE (ShHealOper_Sewing, )