Back to index

salome-geom  6.5.0
ShHealOper_CloseContour.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File:      ShHealOper_CloseContour.hxx
00024 // Created:   20.04.04 10:25:46
00025 // Author:    Galina KULIKOVA
00026 //
00027 #ifndef ShHealOper_CloseContour_HeaderFile
00028 #define ShHealOper_CloseContour_HeaderFile
00029 
00030 #include <MMgt_TShared.hxx>
00031 #include <TopoDS_Shape.hxx>
00032 #include <TopTools_SequenceOfShape.hxx>
00033 #include <TopoDS_Wire.hxx>
00034 #include <BRepTools_ReShape.hxx>
00035 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
00036 #include <ShapeExtend_WireData.hxx>
00037 #include <ShapeAnalysis_Wire.hxx>
00038 #include <TColStd_MapOfInteger.hxx>
00039 #include <ShHealOper_Tool.hxx>
00040 #include <TopoDS_Edge.hxx>
00042 //
00043 
00044 class ShHealOper_CloseContour : public ShHealOper_Tool
00045 {
00046  public:
00047   // ---------- PUBLIC METHODS ----------
00048   Standard_EXPORT ShHealOper_CloseContour() : ShHealOper_Tool() {}
00049 
00050   Standard_EXPORT ShHealOper_CloseContour (const TopoDS_Shape& theShape);
00051   //Initalizes by whole shape.
00052 
00053   Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
00054    //Method for initalization by whole shape.
00055 
00056   Standard_EXPORT Standard_Boolean Perform(const TopTools_SequenceOfShape& theSeqEdges,
00057                           const Standard_Boolean theModeVertex = Standard_False,
00058                           const Standard_Boolean theModeFixGapsCurves = Standard_True);
00059                           
00060   //Build wire from specified edges and close gap between edges by segment of line
00061   // or by vertex in according to specified mode.
00062 
00063   Standard_EXPORT Standard_Boolean Perform(const TopoDS_Wire& theWire,
00064                           const Standard_Boolean theModeVertex= Standard_False,
00065                           const Standard_Boolean theModeFixGapsCurves = Standard_True);
00066                          
00067   //Close gap into specified wire by segment of line or by vertex in according 
00068   //to specified mode.
00069   
00070   inline void SetTolerance(const Standard_Real theTolerance)
00071   {
00072     myTolerance = theTolerance;
00073   }
00074   //Sets tolerance for checking closure of the contour.
00075  
00076   inline Standard_Real GetTolerance()
00077   {
00078     return  myTolerance;
00079   }
00080   //Returns value of the tolerance.
00081   
00082   inline void SetMaxTolerance(const Standard_Real theMaxTolerance)
00083   {
00084     myMaxTolerance = theMaxTolerance;
00085   }
00086   //Sets tolerance for checking closure of the contour.
00087  
00088   inline Standard_Real GetMaxTolerance()
00089   {
00090     return  myMaxTolerance;
00091   }
00092   //Returns value of the tolerance.
00093 
00094   inline void SetModeVertex(const Standard_Boolean theModeVertex)
00095   {
00096     myModeVertex = theModeVertex;
00097   }
00098   //Sets mode for closure of the contour.
00099 
00100   inline Standard_Boolean GetModeVertex() 
00101   {
00102     return myModeVertex;
00103   }
00104   //Get mode for closure of the contour.
00105   
00106   
00107  private:
00108   // ---------- PRIVATE METHODS ----------
00109   
00110   void build(Handle(ShapeExtend_WireData)& theSewd);
00111   
00112   Standard_Boolean fixGaps(const Handle(ShapeExtend_WireData)& theWire,
00113                            const TopTools_SequenceOfShape& theCommonFaces);
00114 
00115   Standard_Boolean checkOneFace(const Handle(ShapeExtend_WireData)& theSewd,
00116                                 TopTools_SequenceOfShape& theCommonFaces) const;
00117   
00118   void buildEdge(const TopoDS_Edge& aE1, 
00119                  const TopoDS_Edge& aE2,
00120                  const TopTools_SequenceOfShape& theCommonFaces);
00121 
00122   void updateWire (Handle(ShapeExtend_WireData)& sbwd);
00123  private:
00124   // ---------- PRIVATE FIELDS ----------
00125 
00126 
00127   Standard_Boolean myModeVertex;
00128   Standard_Boolean myModeFixGapsCurves;
00129   
00130   Standard_Real myMaxTolerance;
00131   Standard_Real myTolerance;
00132   TopTools_IndexedDataMapOfShapeListOfShape myMapEdgesFace;
00133   TopTools_SequenceOfShape myFreeEdges;
00134  public:
00135 // Declaration of CASCADE RTTI
00136 //DEFINE_STANDARD_RTTI (ShHealOper_CloseContour)
00137 };
00138 
00139 // Definition of HANDLE object using Standard_DefineHandle.hxx
00140 //DEFINE_STANDARD_HANDLE (ShHealOper_CloseContour, )
00141 
00142 
00143 #endif