42cf5bc1 |
1 | // Created on: 1999-11-02 |
2 | // Created by: Peter KURNEV |
3 | // Copyright (c) 1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _TopOpeBRepBuild_Tools_HeaderFile |
18 | #define _TopOpeBRepBuild_Tools_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Integer.hxx> |
25 | #include <TopOpeBRepDS_IndexedDataMapOfShapeWithState.hxx> |
26 | #include <TopAbs_State.hxx> |
27 | #include <TopAbs_ShapeEnum.hxx> |
28 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
29 | #include <TopTools_MapOfShape.hxx> |
30 | #include <TopOpeBRepDS_DataMapOfShapeState.hxx> |
31 | #include <TopTools_IndexedMapOfShape.hxx> |
32 | #include <Standard_Boolean.hxx> |
33 | #include <TopTools_IndexedMapOfOrientedShape.hxx> |
34 | #include <TopTools_IndexedDataMapOfShapeShape.hxx> |
35 | #include <Standard_Real.hxx> |
36 | class TopoDS_Shape; |
37 | class TopOpeBRepTool_ShapeClassifier; |
38 | class TopoDS_Face; |
39 | class TopoDS_Edge; |
40 | class gp_Vec; |
41 | class TopoDS_Wire; |
42 | |
43 | |
44 | //! Auxiliary methods used in TopOpeBRepBuild_Builder1 class |
45 | class TopOpeBRepBuild_Tools |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | Standard_EXPORT static void DumpMapOfShapeWithState (const Standard_Integer iP, const TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState); |
53 | |
54 | Standard_EXPORT static void FindState (const TopoDS_Shape& aVertex, const TopAbs_State aState, const TopAbs_ShapeEnum aShapeEnum, const TopTools_IndexedDataMapOfShapeListOfShape& aMapVertexEdges, TopTools_MapOfShape& aMapProcessedVertices, TopOpeBRepDS_DataMapOfShapeState& aMapVs); |
55 | |
56 | Standard_EXPORT static void PropagateState (const TopOpeBRepDS_DataMapOfShapeState& aSplEdgesState, const TopTools_IndexedMapOfShape& anEdgesToRestMap, const TopAbs_ShapeEnum aShapeEnum1, const TopAbs_ShapeEnum aShapeEnum2, TopOpeBRepTool_ShapeClassifier& aShapeClassifier, TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState, const TopTools_MapOfShape& anUnkStateShapes); |
57 | |
58 | Standard_EXPORT static TopAbs_State FindStateThroughVertex (const TopoDS_Shape& aShape, TopOpeBRepTool_ShapeClassifier& aShapeClassifier, TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState, const TopTools_MapOfShape& anAvoidSubshMap); |
59 | |
60 | Standard_EXPORT static void PropagateStateForWires (const TopTools_IndexedMapOfShape& aFacesToRestMap, TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState); |
61 | |
62 | Standard_EXPORT static void SpreadStateToChild (const TopoDS_Shape& aShape, const TopAbs_State aState, TopOpeBRepDS_IndexedDataMapOfShapeWithState& aMapOfShapeWithState); |
63 | |
64 | Standard_EXPORT static void FindState1 (const TopoDS_Shape& anEdge, const TopAbs_State aState, const TopTools_IndexedDataMapOfShapeListOfShape& aMapEdgesFaces, TopTools_MapOfShape& aMapProcessedVertices, TopOpeBRepDS_DataMapOfShapeState& aMapVs); |
65 | |
66 | Standard_EXPORT static void FindState2 (const TopoDS_Shape& anEdge, const TopAbs_State aState, const TopTools_IndexedDataMapOfShapeListOfShape& aMapEdgesFaces, TopTools_MapOfShape& aMapProcessedEdges, TopOpeBRepDS_DataMapOfShapeState& aMapVs); |
67 | |
68 | Standard_EXPORT static Standard_Boolean GetAdjacentFace (const TopoDS_Shape& aFaceObj, const TopoDS_Shape& anEObj, const TopTools_IndexedDataMapOfShapeListOfShape& anEdgeFaceMap, TopoDS_Shape& anAdjFaceObj); |
69 | |
70 | Standard_EXPORT static void GetNormalToFaceOnEdge (const TopoDS_Face& aFObj, const TopoDS_Edge& anEdgeObj, gp_Vec& aDirNormal); |
71 | |
72 | //! This function used to compute normal in point which is located |
73 | //! near the point with param UV (used for computation of normals where the normal in the point UV equal to zero). |
74 | Standard_EXPORT static void GetNormalInNearestPoint (const TopoDS_Face& aFace, const TopoDS_Edge& anEdge, gp_Vec& aNormal); |
75 | |
76 | Standard_EXPORT static Standard_Boolean GetTangentToEdgeEdge (const TopoDS_Face& aFObj, const TopoDS_Edge& anEdgeObj, const TopoDS_Edge& aOriEObj, gp_Vec& aTangent); |
77 | |
78 | Standard_EXPORT static Standard_Boolean GetTangentToEdge (const TopoDS_Edge& anEdgeObj, gp_Vec& aTangent); |
79 | |
80 | //! Recompute PCurves of the all edges from the wire on the <toFace> |
81 | Standard_EXPORT static void UpdatePCurves (const TopoDS_Wire& aWire, const TopoDS_Face& fromFace, const TopoDS_Face& toFace); |
82 | |
83 | //! recompute PCurves of the closing (SIM , with 2 PCurves) edge on the NewFace |
84 | Standard_EXPORT static void UpdateEdgeOnPeriodicalFace (const TopoDS_Edge& aEdgeToUpdate, const TopoDS_Face& OldFace, const TopoDS_Face& NewFace); |
85 | |
86 | //! recompute PCurve of the edge on the NewFace |
87 | Standard_EXPORT static void UpdateEdgeOnFace (const TopoDS_Edge& aEdgeToUpdate, const TopoDS_Face& OldFace, const TopoDS_Face& NewFace); |
88 | |
89 | Standard_EXPORT static Standard_Boolean IsDegEdgesTheSame (const TopoDS_Shape& anE1, const TopoDS_Shape& anE2); |
90 | |
91 | //! test if <oldFace> does not contain INTERNAL or EXTERNAL edges |
92 | //! and remove such edges in case of its presence. The result is stored in <corrFace> |
93 | Standard_EXPORT static void NormalizeFace (const TopoDS_Shape& oldFace, TopoDS_Shape& corrFace); |
94 | |
95 | //! test if UV representation of <oldFace> is good (i.e. face is closed in 2d). |
96 | //! if face is not closed , this method will try to close such face and will |
97 | //! return corrected edges in the <aMapOfCorrect2dEdges>. Parameter <aSourceShapes> |
98 | //! used to fix the edge (or wires) which should be correct (Corrector used it as a start shapes). |
99 | //! NOTE : Parameter corrFace doesn't mean anything. If you want to use this method , rebuild resulting face |
100 | //! after by yourself using corrected edges. |
101 | Standard_EXPORT static void CorrectFace2d (const TopoDS_Shape& oldFace, TopoDS_Shape& corrFace, const TopTools_IndexedMapOfOrientedShape& aSourceShapes, TopTools_IndexedDataMapOfShapeShape& aMapOfCorrect2dEdges); |
102 | |
103 | Standard_EXPORT static void CorrectTolerances (const TopoDS_Shape& aS, const Standard_Real aTolMax = 0.0001); |
104 | |
105 | Standard_EXPORT static void CorrectCurveOnSurface (const TopoDS_Shape& aS, const Standard_Real aTolMax = 0.0001); |
106 | |
107 | Standard_EXPORT static void CorrectPointOnCurve (const TopoDS_Shape& aS, const Standard_Real aTolMax = 0.0001); |
108 | |
109 | //! Checks if <theFace> has the properly closed in 2D boundary(ies) |
110 | Standard_EXPORT static Standard_Boolean CheckFaceClosed2d (const TopoDS_Face& theFace); |
111 | |
112 | |
113 | |
114 | |
115 | protected: |
116 | |
117 | |
118 | |
119 | |
120 | |
121 | private: |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | }; |
128 | |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | #endif // _TopOpeBRepBuild_Tools_HeaderFile |