1 // Created on: 1999-08-24
2 // Created by: Sergei ZERTCHANINOV
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _ShapeFix_Wireframe_HeaderFile
18 #define _ShapeFix_Wireframe_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TopoDS_Shape.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Integer.hxx>
27 #include <ShapeFix_Root.hxx>
28 #include <TopTools_MapOfShape.hxx>
29 #include <TopTools_DataMapOfShapeListOfShape.hxx>
30 #include <ShapeExtend_Status.hxx>
34 class ShapeFix_Wireframe;
35 DEFINE_STANDARD_HANDLE(ShapeFix_Wireframe, ShapeFix_Root)
37 //! Provides methods for fixing wireframe of shape
38 class ShapeFix_Wireframe : public ShapeFix_Root
44 Standard_EXPORT ShapeFix_Wireframe();
46 Standard_EXPORT ShapeFix_Wireframe(const TopoDS_Shape& shape);
48 //! Clears all statuses
49 Standard_EXPORT virtual void ClearStatuses();
51 //! Loads a shape, resets statuses
52 Standard_EXPORT void Load (const TopoDS_Shape& shape);
54 //! Fixes gaps between ends of curves of adjacent edges
55 //! (both 3d and pcurves) in wires
56 //! If precision is 0.0, uses Precision::Confusion().
57 Standard_EXPORT Standard_Boolean FixWireGaps();
59 //! Fixes small edges in shape by merging adjacent edges
60 //! If precision is 0.0, uses Precision::Confusion().
61 Standard_EXPORT Standard_Boolean FixSmallEdges();
63 //! Auxiliary tool for FixSmallEdges which checks for small edges and fills the maps.
64 //! Returns True if at least one small edge has been found.
65 Standard_EXPORT Standard_Boolean CheckSmallEdges (TopTools_MapOfShape& theSmallEdges, TopTools_DataMapOfShapeListOfShape& theEdgeToFaces, TopTools_DataMapOfShapeListOfShape& theFaceWithSmall, TopTools_MapOfShape& theMultyEdges);
67 //! Auxiliary tool for FixSmallEdges which merges small edges.
68 //! If theModeDrop is equal to Standard_True then small edges,
69 //! which cannot be connected with adjacent edges are dropped.
70 //! Otherwise they are kept.
71 //! theLimitAngle specifies maximum allowed tangency
72 //! discontinuity between adjacent edges.
73 //! If theLimitAngle is equal to -1, this angle is not taken into account.
74 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);
76 //! Decodes the status of the last FixWireGaps.
77 //! OK - No gaps were found
78 //! DONE1 - Some gaps in 3D were fixed
79 //! DONE2 - Some gaps in 2D were fixed
80 //! FAIL1 - Failed to fix some gaps in 3D
81 //! FAIL2 - Failed to fix some gaps in 2D
82 Standard_Boolean StatusWireGaps (const ShapeExtend_Status status) const;
84 //! Decodes the status of the last FixSmallEdges.
85 //! OK - No small edges were found
86 //! DONE1 - Some small edges were fixed
87 //! FAIL1 - Failed to fix some small edges
88 Standard_Boolean StatusSmallEdges (const ShapeExtend_Status status) const;
92 //! Returns mode managing removing small edges.
93 Standard_Boolean& ModeDropSmallEdges();
95 //! Set limit angle for merging edges.
96 void SetLimitAngle (const Standard_Real theLimitAngle);
98 //! Get limit angle for merging edges.
99 Standard_Real LimitAngle() const;
104 DEFINE_STANDARD_RTTIEXT(ShapeFix_Wireframe,ShapeFix_Root)
109 TopoDS_Shape myShape;
115 Standard_Boolean myModeDrop;
116 Standard_Real myLimitAngle;
117 Standard_Integer myStatusWireGaps;
118 Standard_Integer myStatusSmallEdges;
124 #include <ShapeFix_Wireframe.lxx>
130 #endif // _ShapeFix_Wireframe_HeaderFile