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>
33 class ShapeFix_Wireframe;
34 DEFINE_STANDARD_HANDLE(ShapeFix_Wireframe, ShapeFix_Root)
36 //! Provides methods for fixing wireframe of shape
37 class ShapeFix_Wireframe : public ShapeFix_Root
43 Standard_EXPORT ShapeFix_Wireframe();
45 Standard_EXPORT ShapeFix_Wireframe(const TopoDS_Shape& shape);
47 //! Clears all statuses
48 Standard_EXPORT virtual void ClearStatuses();
50 //! Loads a shape, resets statuses
51 Standard_EXPORT void Load (const TopoDS_Shape& shape);
53 //! Fixes gaps between ends of curves of adjacent edges
54 //! (both 3d and pcurves) in wires
55 //! If precision is 0.0, uses Precision::Confusion().
56 Standard_EXPORT Standard_Boolean FixWireGaps();
58 //! Fixes small edges in shape by merging adjacent edges
59 //! If precision is 0.0, uses Precision::Confusion().
60 Standard_EXPORT Standard_Boolean FixSmallEdges();
62 //! Auxiliary tool for FixSmallEdges which checks for small edges and fills the maps.
63 //! Returns True if at least one small edge has been found.
64 Standard_EXPORT Standard_Boolean CheckSmallEdges (TopTools_MapOfShape& theSmallEdges, TopTools_DataMapOfShapeListOfShape& theEdgeToFaces, TopTools_DataMapOfShapeListOfShape& theFaceWithSmall, TopTools_MapOfShape& theMultyEdges);
66 //! Auxiliary tool for FixSmallEdges which merges small edges.
67 //! If theModeDrop is equal to Standard_True then small edges,
68 //! which cannot be connected with adjacent edges are dropped.
69 //! Otherwise they are kept.
70 //! theLimitAngle specifies maximum allowed tangency
71 //! discontinuity between adjacent edges.
72 //! If theLimitAngle is equal to -1, this angle is not taken into account.
73 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);
75 //! Decodes the status of the last FixWireGaps.
76 //! OK - No gaps were found
77 //! DONE1 - Some gaps in 3D were fixed
78 //! DONE2 - Some gaps in 2D were fixed
79 //! FAIL1 - Failed to fix some gaps in 3D
80 //! FAIL2 - Failed to fix some gaps in 2D
81 Standard_Boolean StatusWireGaps (const ShapeExtend_Status status) const;
83 //! Decodes the status of the last FixSmallEdges.
84 //! OK - No small edges were found
85 //! DONE1 - Some small edges were fixed
86 //! FAIL1 - Failed to fix some small edges
87 Standard_Boolean StatusSmallEdges (const ShapeExtend_Status status) const;
91 //! Returns mode managing removing small edges.
92 Standard_Boolean& ModeDropSmallEdges();
94 //! Set limit angle for merging edges.
95 void SetLimitAngle (const Standard_Real theLimitAngle);
97 //! Get limit angle for merging edges.
98 Standard_Real LimitAngle() const;
103 DEFINE_STANDARD_RTTIEXT(ShapeFix_Wireframe,ShapeFix_Root)
108 TopoDS_Shape myShape;
114 Standard_Boolean myModeDrop;
115 Standard_Real myLimitAngle;
116 Standard_Integer myStatusWireGaps;
117 Standard_Integer myStatusSmallEdges;
123 #include <ShapeFix_Wireframe.lxx>
129 #endif // _ShapeFix_Wireframe_HeaderFile