File indexing completed on 2025-01-18 10:04:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _ShapeUpgrade_UnifySameDomain_HeaderFile
0018 #define _ShapeUpgrade_UnifySameDomain_HeaderFile
0019
0020 #include <BRepTools_History.hxx>
0021 #include <Standard.hxx>
0022 #include <Standard_Type.hxx>
0023
0024 #include <TopoDS_Shape.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <TopTools_DataMapOfShapeShape.hxx>
0028 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0029 #include <TopTools_MapOfShape.hxx>
0030 #include <TopTools_SequenceOfShape.hxx>
0031 #include <Geom_Plane.hxx>
0032 #include <Precision.hxx>
0033 class ShapeBuild_ReShape;
0034
0035
0036 class ShapeUpgrade_UnifySameDomain;
0037 DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, Standard_Transient)
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 class ShapeUpgrade_UnifySameDomain : public Standard_Transient
0068 {
0069
0070 public:
0071
0072 typedef NCollection_DataMap<TopoDS_Shape, Handle(Geom_Plane), TopTools_ShapeMapHasher> DataMapOfFacePlane;
0073 typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> DataMapOfShapeMapOfShape;
0074
0075
0076 Standard_EXPORT ShapeUpgrade_UnifySameDomain();
0077
0078
0079
0080 Standard_EXPORT ShapeUpgrade_UnifySameDomain
0081 (const TopoDS_Shape& aShape,
0082 const Standard_Boolean UnifyEdges = Standard_True,
0083 const Standard_Boolean UnifyFaces = Standard_True,
0084 const Standard_Boolean ConcatBSplines = Standard_False);
0085
0086
0087
0088
0089
0090 Standard_EXPORT void Initialize
0091 (const TopoDS_Shape& aShape,
0092 const Standard_Boolean UnifyEdges = Standard_True,
0093 const Standard_Boolean UnifyFaces = Standard_True,
0094 const Standard_Boolean ConcatBSplines = Standard_False);
0095
0096
0097
0098
0099
0100 Standard_EXPORT void AllowInternalEdges (const Standard_Boolean theValue);
0101
0102
0103
0104
0105
0106
0107 Standard_EXPORT void KeepShape(const TopoDS_Shape& theShape);
0108
0109
0110
0111
0112 Standard_EXPORT void KeepShapes(const TopTools_MapOfShape& theShapes);
0113
0114
0115
0116
0117
0118 Standard_EXPORT void SetSafeInputMode(Standard_Boolean theValue);
0119
0120
0121
0122 void SetLinearTolerance(const Standard_Real theValue)
0123 {
0124 myLinTol = theValue;
0125 }
0126
0127
0128
0129 void SetAngularTolerance(const Standard_Real theValue)
0130 {
0131 myAngTol = (theValue < Precision::Angular() ? Precision::Angular() : theValue);
0132 }
0133
0134
0135 Standard_EXPORT void Build();
0136
0137
0138 const TopoDS_Shape& Shape() const
0139 {
0140 return myShape;
0141 }
0142
0143
0144 const Handle(BRepTools_History)& History() const
0145 {
0146 return myHistory;
0147 }
0148
0149
0150 Handle(BRepTools_History)& History()
0151 {
0152 return myHistory;
0153 }
0154
0155 DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain,Standard_Transient)
0156
0157 protected:
0158
0159 struct SubSequenceOfEdges;
0160
0161 protected:
0162
0163
0164
0165 Standard_EXPORT void UnifyFaces();
0166
0167
0168
0169 Standard_EXPORT void UnifyEdges();
0170
0171 void IntUnifyFaces(const TopoDS_Shape& theInpShape,
0172 const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
0173 const DataMapOfShapeMapOfShape& theGMapFaceShells,
0174 const TopTools_MapOfShape& theFreeBoundMap);
0175
0176
0177 Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
0178 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
0179 NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
0180 const TopTools_MapOfShape& NonMergVrt);
0181
0182
0183
0184 Standard_Boolean MergeSeq(TopTools_SequenceOfShape& SeqEdges,
0185 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
0186 const TopTools_MapOfShape& nonMergVert);
0187
0188
0189 Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
0190 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
0191 TopoDS_Edge& OutEdge);
0192
0193
0194 void UnionPCurves(const TopTools_SequenceOfShape& theChain,
0195 TopoDS_Edge& theEdge);
0196
0197
0198 Standard_EXPORT void FillHistory();
0199
0200 private:
0201
0202
0203
0204 static void generateSubSeq (const TopTools_SequenceOfShape& anInpEdgeSeq,
0205 NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
0206 Standard_Boolean IsClosed, double theAngTol, double theLinTol,
0207 const TopTools_MapOfShape& AvoidEdgeVrt,
0208 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap);
0209
0210 private:
0211
0212 TopoDS_Shape myInitShape;
0213 Standard_Real myLinTol;
0214 Standard_Real myAngTol;
0215 Standard_Boolean myUnifyFaces;
0216 Standard_Boolean myUnifyEdges;
0217 Standard_Boolean myConcatBSplines;
0218 Standard_Boolean myAllowInternal;
0219 Standard_Boolean mySafeInputMode;
0220 TopoDS_Shape myShape;
0221 Handle(ShapeBuild_ReShape) myContext;
0222 TopTools_MapOfShape myKeepShapes;
0223 DataMapOfFacePlane myFacePlaneMap;
0224 TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
0225 TopTools_DataMapOfShapeShape myFaceNewFace;
0226
0227 Handle(BRepTools_History) myHistory;
0228 };
0229
0230 #endif