1 // Copyright (C) 2007-2011 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_CloseContour.hxx
24 // Created: 20.04.04 10:25:46
25 // Author: Galina KULIKOVA
27 #ifndef ShHealOper_CloseContour_HeaderFile
28 #define ShHealOper_CloseContour_HeaderFile
30 #include <MMgt_TShared.hxx>
31 #include <TopoDS_Shape.hxx>
32 #include <TopTools_SequenceOfShape.hxx>
33 #include <TopoDS_Wire.hxx>
34 #include <BRepTools_ReShape.hxx>
35 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
36 #include <ShapeExtend_WireData.hxx>
37 #include <ShapeAnalysis_Wire.hxx>
38 #include <TColStd_MapOfInteger.hxx>
39 #include <ShHealOper_Tool.hxx>
40 #include <TopoDS_Edge.hxx>
41 /// Class ShHealOper_CloseContour
44 class ShHealOper_CloseContour : public ShHealOper_Tool
47 // ---------- PUBLIC METHODS ----------
48 Standard_EXPORT ShHealOper_CloseContour() : ShHealOper_Tool() {}
50 Standard_EXPORT ShHealOper_CloseContour (const TopoDS_Shape& theShape);
51 //Initalizes by whole shape.
53 Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
54 //Method for initalization by whole shape.
56 Standard_EXPORT Standard_Boolean Perform(const TopTools_SequenceOfShape& theSeqEdges,
57 const Standard_Boolean theModeVertex = Standard_False,
58 const Standard_Boolean theModeFixGapsCurves = Standard_True);
60 //Build wire from specified edges and close gap between edges by segment of line
61 // or by vertex in according to specified mode.
63 Standard_EXPORT Standard_Boolean Perform(const TopoDS_Wire& theWire,
64 const Standard_Boolean theModeVertex= Standard_False,
65 const Standard_Boolean theModeFixGapsCurves = Standard_True);
67 //Close gap into specified wire by segment of line or by vertex in according
70 inline void SetTolerance(const Standard_Real theTolerance)
72 myTolerance = theTolerance;
74 //Sets tolerance for checking closure of the contour.
76 inline Standard_Real GetTolerance()
80 //Returns value of the tolerance.
82 inline void SetMaxTolerance(const Standard_Real theMaxTolerance)
84 myMaxTolerance = theMaxTolerance;
86 //Sets tolerance for checking closure of the contour.
88 inline Standard_Real GetMaxTolerance()
90 return myMaxTolerance;
92 //Returns value of the tolerance.
94 inline void SetModeVertex(const Standard_Boolean theModeVertex)
96 myModeVertex = theModeVertex;
98 //Sets mode for closure of the contour.
100 inline Standard_Boolean GetModeVertex()
104 //Get mode for closure of the contour.
108 // ---------- PRIVATE METHODS ----------
110 void build(Handle(ShapeExtend_WireData)& theSewd);
112 Standard_Boolean fixGaps(const Handle(ShapeExtend_WireData)& theWire,
113 const TopTools_SequenceOfShape& theCommonFaces);
115 Standard_Boolean checkOneFace(const Handle(ShapeExtend_WireData)& theSewd,
116 TopTools_SequenceOfShape& theCommonFaces) const;
118 void buildEdge(const TopoDS_Edge& aE1,
119 const TopoDS_Edge& aE2,
120 const TopTools_SequenceOfShape& theCommonFaces);
122 void updateWire (Handle(ShapeExtend_WireData)& sbwd);
124 // ---------- PRIVATE FIELDS ----------
127 Standard_Boolean myModeVertex;
128 Standard_Boolean myModeFixGapsCurves;
130 Standard_Real myMaxTolerance;
131 Standard_Real myTolerance;
132 TopTools_IndexedDataMapOfShapeListOfShape myMapEdgesFace;
133 TopTools_SequenceOfShape myFreeEdges;
135 // Declaration of CASCADE RTTI
136 //DEFINE_STANDARD_RTTI (ShHealOper_CloseContour)
139 // Definition of HANDLE object using Standard_DefineHandle.hxx
140 //DEFINE_STANDARD_HANDLE (ShHealOper_CloseContour, )