1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 <TopoDS_Shape.hxx>
31 #include <TopTools_SequenceOfShape.hxx>
32 #include <TopoDS_Wire.hxx>
33 #include <BRepTools_ReShape.hxx>
34 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
35 #include <ShapeExtend_WireData.hxx>
36 #include <ShapeAnalysis_Wire.hxx>
37 #include <TColStd_MapOfInteger.hxx>
38 #include <ShHealOper_Tool.hxx>
39 #include <TopoDS_Edge.hxx>
40 /// Class ShHealOper_CloseContour
43 class ShHealOper_CloseContour : public ShHealOper_Tool
46 // ---------- PUBLIC METHODS ----------
47 Standard_EXPORT ShHealOper_CloseContour() : ShHealOper_Tool() {}
49 Standard_EXPORT ShHealOper_CloseContour (const TopoDS_Shape& theShape);
50 //Initalizes by whole shape.
52 Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
53 //Method for initalization by whole shape.
55 Standard_EXPORT Standard_Boolean Perform(const TopTools_SequenceOfShape& theSeqEdges,
56 const Standard_Boolean theModeVertex = Standard_False,
57 const Standard_Boolean theModeFixGapsCurves = Standard_True);
59 //Build wire from specified edges and close gap between edges by segment of line
60 // or by vertex in according to specified mode.
62 Standard_EXPORT Standard_Boolean Perform(const TopoDS_Wire& theWire,
63 const Standard_Boolean theModeVertex= Standard_False,
64 const Standard_Boolean theModeFixGapsCurves = Standard_True);
66 //Close gap into specified wire by segment of line or by vertex in according
69 inline void SetTolerance(const Standard_Real theTolerance)
71 myTolerance = theTolerance;
73 //Sets tolerance for checking closure of the contour.
75 inline Standard_Real GetTolerance()
79 //Returns value of the tolerance.
81 inline void SetMaxTolerance(const Standard_Real theMaxTolerance)
83 myMaxTolerance = theMaxTolerance;
85 //Sets tolerance for checking closure of the contour.
87 inline Standard_Real GetMaxTolerance()
89 return myMaxTolerance;
91 //Returns value of the tolerance.
93 inline void SetModeVertex(const Standard_Boolean theModeVertex)
95 myModeVertex = theModeVertex;
97 //Sets mode for closure of the contour.
99 inline Standard_Boolean GetModeVertex()
103 //Get mode for closure of the contour.
107 // ---------- PRIVATE METHODS ----------
109 void build(Handle(ShapeExtend_WireData)& theSewd);
111 Standard_Boolean fixGaps(const Handle(ShapeExtend_WireData)& theWire,
112 const TopTools_SequenceOfShape& theCommonFaces);
114 Standard_Boolean checkOneFace(const Handle(ShapeExtend_WireData)& theSewd,
115 TopTools_SequenceOfShape& theCommonFaces) const;
117 void buildEdge(const TopoDS_Edge& aE1,
118 const TopoDS_Edge& aE2,
119 const TopTools_SequenceOfShape& theCommonFaces);
121 void updateWire (Handle(ShapeExtend_WireData)& sbwd);
123 // ---------- PRIVATE FIELDS ----------
126 Standard_Boolean myModeVertex;
127 Standard_Boolean myModeFixGapsCurves;
129 Standard_Real myMaxTolerance;
130 Standard_Real myTolerance;
131 TopTools_IndexedDataMapOfShapeListOfShape myMapEdgesFace;
132 TopTools_SequenceOfShape myFreeEdges;
134 // Declaration of CASCADE RTTI
135 //DEFINE_STANDARD_RTTI (ShHealOper_CloseContour)
138 // Definition of HANDLE object using Standard_DefineHandle.hxx
139 //DEFINE_STANDARD_HANDLE (ShHealOper_CloseContour, )