File indexing completed on 2026-07-05 08:37:46
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 class ShapeUpgrade_UnifySameDomain;
0036 DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, Standard_Transient)
0037
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 class ShapeUpgrade_UnifySameDomain : public Standard_Transient
0067 {
0068
0069 public:
0070 typedef NCollection_DataMap<TopoDS_Shape, Handle(Geom_Plane), TopTools_ShapeMapHasher>
0071 DataMapOfFacePlane;
0072 typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher>
0073 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(const TopoDS_Shape& aShape,
0091 const Standard_Boolean UnifyEdges = Standard_True,
0092 const Standard_Boolean UnifyFaces = Standard_True,
0093 const Standard_Boolean ConcatBSplines = Standard_False);
0094
0095
0096
0097
0098
0099 Standard_EXPORT void AllowInternalEdges(const Standard_Boolean theValue);
0100
0101
0102
0103
0104
0105
0106 Standard_EXPORT void KeepShape(const TopoDS_Shape& theShape);
0107
0108
0109
0110
0111 Standard_EXPORT void KeepShapes(const TopTools_MapOfShape& theShapes);
0112
0113
0114
0115
0116
0117 Standard_EXPORT void SetSafeInputMode(Standard_Boolean theValue);
0118
0119
0120
0121 void SetLinearTolerance(const Standard_Real theValue) { myLinTol = theValue; }
0122
0123
0124
0125 void SetAngularTolerance(const Standard_Real theValue)
0126 {
0127 myAngTol = (theValue < Precision::Angular() ? Precision::Angular() : theValue);
0128 }
0129
0130
0131 Standard_EXPORT void Build();
0132
0133
0134 const TopoDS_Shape& Shape() const { return myShape; }
0135
0136
0137 const Handle(BRepTools_History)& History() const { return myHistory; }
0138
0139
0140 Handle(BRepTools_History)& History() { return myHistory; }
0141
0142 DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain, Standard_Transient)
0143
0144 protected:
0145 struct SubSequenceOfEdges;
0146
0147 protected:
0148
0149
0150 Standard_EXPORT void UnifyFaces();
0151
0152
0153
0154 Standard_EXPORT void UnifyEdges();
0155
0156 void IntUnifyFaces(const TopoDS_Shape& theInpShape,
0157 const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
0158 const DataMapOfShapeMapOfShape& theGMapFaceShells,
0159 const TopTools_MapOfShape& theFreeBoundMap);
0160
0161
0162 Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
0163 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
0164 NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
0165 const TopTools_MapOfShape& NonMergVrt);
0166
0167
0168
0169 Standard_Boolean MergeSeq(TopTools_SequenceOfShape& SeqEdges,
0170 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
0171 const TopTools_MapOfShape& nonMergVert);
0172
0173
0174 Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
0175 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
0176 TopoDS_Edge& OutEdge);
0177
0178
0179 void UnionPCurves(const TopTools_SequenceOfShape& theChain, TopoDS_Edge& theEdge);
0180
0181
0182 Standard_EXPORT void FillHistory();
0183
0184 private:
0185
0186
0187 static void generateSubSeq(const TopTools_SequenceOfShape& anInpEdgeSeq,
0188 NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
0189 Standard_Boolean IsClosed,
0190 double theAngTol,
0191 double theLinTol,
0192 const TopTools_MapOfShape& AvoidEdgeVrt,
0193 const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap);
0194
0195 private:
0196 TopoDS_Shape myInitShape;
0197 Standard_Real myLinTol;
0198 Standard_Real myAngTol;
0199 Standard_Boolean myUnifyFaces;
0200 Standard_Boolean myUnifyEdges;
0201 Standard_Boolean myConcatBSplines;
0202 Standard_Boolean myAllowInternal;
0203 Standard_Boolean mySafeInputMode;
0204 TopoDS_Shape myShape;
0205 Handle(ShapeBuild_ReShape) myContext;
0206 TopTools_MapOfShape myKeepShapes;
0207 DataMapOfFacePlane myFacePlaneMap;
0208 TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
0209 TopTools_DataMapOfShapeShape myFaceNewFace;
0210
0211 Handle(BRepTools_History) myHistory;
0212 };
0213
0214 #endif