Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:56

0001 // Created on: 1999-08-24
0002 // Created by: Sergei ZERTCHANINOV
0003 // Copyright (c) 1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ShapeFix_Wireframe_HeaderFile
0018 #define _ShapeFix_Wireframe_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <ShapeFix_Root.hxx>
0026 #include <TopTools_MapOfShape.hxx>
0027 #include <TopTools_DataMapOfShapeListOfShape.hxx>
0028 #include <ShapeExtend_Status.hxx>
0029 
0030 
0031 class ShapeFix_Wireframe;
0032 DEFINE_STANDARD_HANDLE(ShapeFix_Wireframe, ShapeFix_Root)
0033 
0034 //! Provides methods for fixing wireframe of shape
0035 class ShapeFix_Wireframe : public ShapeFix_Root
0036 {
0037 
0038 public:
0039 
0040   
0041   Standard_EXPORT ShapeFix_Wireframe();
0042   
0043   Standard_EXPORT ShapeFix_Wireframe(const TopoDS_Shape& shape);
0044   
0045   //! Clears all statuses
0046   Standard_EXPORT virtual void ClearStatuses();
0047   
0048   //! Loads a shape, resets statuses
0049   Standard_EXPORT void Load (const TopoDS_Shape& shape);
0050   
0051   //! Fixes gaps between ends of curves of adjacent edges
0052   //! (both 3d and pcurves) in wires
0053   //! If precision is 0.0, uses Precision::Confusion().
0054   Standard_EXPORT Standard_Boolean FixWireGaps();
0055   
0056   //! Fixes small edges in shape by merging adjacent edges
0057   //! If precision is 0.0, uses Precision::Confusion().
0058   Standard_EXPORT Standard_Boolean FixSmallEdges();
0059   
0060   //! Auxiliary tool for FixSmallEdges which checks for small edges and fills the maps.
0061   //! Returns True if at least one small edge has been found.
0062   Standard_EXPORT Standard_Boolean CheckSmallEdges (TopTools_MapOfShape& theSmallEdges, TopTools_DataMapOfShapeListOfShape& theEdgeToFaces, TopTools_DataMapOfShapeListOfShape& theFaceWithSmall, TopTools_MapOfShape& theMultyEdges);
0063   
0064   //! Auxiliary tool for FixSmallEdges which merges small edges.
0065   //! If theModeDrop is equal to Standard_True then small edges,
0066   //! which cannot be connected with adjacent edges are dropped.
0067   //! Otherwise they are kept.
0068   //! theLimitAngle specifies maximum allowed tangency
0069   //! discontinuity between adjacent edges.
0070   //! If theLimitAngle is equal to -1, this angle is not taken into account.
0071   Standard_EXPORT Standard_Boolean MergeSmallEdges (TopTools_MapOfShape& theSmallEdges, TopTools_DataMapOfShapeListOfShape& theEdgeToFaces, TopTools_DataMapOfShapeListOfShape& theFaceWithSmall, TopTools_MapOfShape& theMultyEdges, const Standard_Boolean theModeDrop = Standard_False, const Standard_Real theLimitAngle = -1);
0072   
0073   //! Decodes the status of the last FixWireGaps.
0074   //! OK - No gaps were found
0075   //! DONE1 - Some gaps in 3D were fixed
0076   //! DONE2 - Some gaps in 2D were fixed
0077   //! FAIL1 - Failed to fix some gaps in 3D
0078   //! FAIL2 - Failed to fix some gaps in 2D
0079     Standard_Boolean StatusWireGaps (const ShapeExtend_Status status) const;
0080   
0081   //! Decodes the status of the last FixSmallEdges.
0082   //! OK - No small edges were found
0083   //! DONE1 - Some small edges were fixed
0084   //! FAIL1 - Failed to fix some small edges
0085     Standard_Boolean StatusSmallEdges (const ShapeExtend_Status status) const;
0086   
0087     TopoDS_Shape Shape();
0088   
0089   //! Returns mode managing removing small edges.
0090     Standard_Boolean& ModeDropSmallEdges();
0091   
0092   //! Set limit angle for merging edges.
0093     void SetLimitAngle (const Standard_Real theLimitAngle);
0094   
0095   //! Get limit angle for merging edges.
0096     Standard_Real LimitAngle() const;
0097 
0098 
0099 
0100 
0101   DEFINE_STANDARD_RTTIEXT(ShapeFix_Wireframe,ShapeFix_Root)
0102 
0103 protected:
0104 
0105 
0106   TopoDS_Shape myShape;
0107 
0108 
0109 private:
0110 
0111 
0112   Standard_Boolean myModeDrop;
0113   Standard_Real myLimitAngle;
0114   Standard_Integer myStatusWireGaps;
0115   Standard_Integer myStatusSmallEdges;
0116 
0117 
0118 };
0119 
0120 
0121 #include <ShapeFix_Wireframe.lxx>
0122 
0123 
0124 
0125 
0126 
0127 #endif // _ShapeFix_Wireframe_HeaderFile