Warning, file /include/opencascade/BRepTools_ReShape.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _BRepTools_ReShape_HeaderFile
0018 #define _BRepTools_ReShape_HeaderFile
0019
0020 #include <BRepTools_History.hxx>
0021
0022 #include <TopTools_DataMapOfShapeShape.hxx>
0023 #include <TopTools_MapOfShape.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <Standard_Transient.hxx>
0026 #include <TopAbs_ShapeEnum.hxx>
0027
0028 class TopoDS_Vertex;
0029
0030
0031 #ifdef Status
0032 #undef Status
0033 #endif
0034
0035 class BRepTools_ReShape;
0036 DEFINE_STANDARD_HANDLE(BRepTools_ReShape, Standard_Transient)
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 class BRepTools_ReShape : public Standard_Transient
0053 {
0054 public:
0055
0056 Standard_EXPORT BRepTools_ReShape();
0057
0058
0059 Standard_EXPORT virtual void Clear();
0060
0061
0062 Standard_EXPORT virtual void Remove (const TopoDS_Shape& shape);
0063
0064
0065 virtual void Replace (const TopoDS_Shape& shape, const TopoDS_Shape& newshape)
0066 {
0067 replace (shape, newshape, TReplacementKind_Modify);
0068 }
0069
0070
0071
0072
0073
0074 template<typename TCollection> void Merge(
0075 const TCollection& theParts, const TopoDS_Shape& theProduct)
0076 {
0077 typename TCollection::Iterator aPIt(theParts);
0078
0079 if (aPIt.More())
0080 {
0081 replace(aPIt.Value(), theProduct, TReplacementKind_Merge_Main);
0082
0083 aPIt.Next();
0084 }
0085
0086 const TReplacementKind aKind = TReplacementKind_Merge_Ordinary;
0087 for (; aPIt.More(); aPIt.Next())
0088 {
0089 replace(aPIt.Value(), theProduct, aKind);
0090 }
0091 }
0092
0093
0094 Standard_EXPORT virtual Standard_Boolean IsRecorded (const TopoDS_Shape& shape) const;
0095
0096
0097
0098
0099
0100 Standard_EXPORT virtual TopoDS_Shape Value (const TopoDS_Shape& shape) const;
0101
0102
0103
0104
0105
0106
0107
0108
0109 Standard_EXPORT virtual Standard_Integer Status (const TopoDS_Shape& shape, TopoDS_Shape& newsh, const Standard_Boolean last = Standard_False);
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& theShape,
0122 const TopAbs_ShapeEnum theUntil = TopAbs_SHAPE);
0123
0124
0125
0126 virtual Standard_Boolean& ModeConsiderLocation()
0127 {
0128 return myConsiderLocation;
0129 }
0130
0131
0132
0133
0134 Standard_EXPORT TopoDS_Vertex CopyVertex(const TopoDS_Vertex& theV,
0135 const Standard_Real theTol = -1.0);
0136
0137
0138
0139
0140
0141 Standard_EXPORT TopoDS_Vertex CopyVertex(const TopoDS_Vertex& theV,
0142 const gp_Pnt& theNewPos,
0143 const Standard_Real aTol);
0144
0145
0146
0147 Standard_EXPORT Standard_Boolean IsNewShape(const TopoDS_Shape& theShape) const;
0148
0149
0150 Standard_EXPORT Handle(BRepTools_History) History() const;
0151
0152 DEFINE_STANDARD_RTTIEXT(BRepTools_ReShape,Standard_Transient)
0153
0154 protected:
0155
0156 enum TReplacementKind
0157 {
0158 TReplacementKind_Remove = 1,
0159 TReplacementKind_Modify = 2,
0160 TReplacementKind_Merge_Main = 4,
0161 TReplacementKind_Merge_Ordinary = 8
0162 };
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173 Standard_EXPORT virtual void replace (
0174 const TopoDS_Shape& shape,
0175 const TopoDS_Shape& newshape,
0176 const TReplacementKind theKind);
0177
0178 private:
0179
0180 static Standard_Boolean isOrdinaryMerged(const TReplacementKind theKind)
0181 {
0182 return (theKind == TReplacementKind_Merge_Ordinary);
0183 }
0184
0185
0186 struct TReplacement
0187 {
0188 public:
0189
0190 TReplacement() : myKind(TReplacementKind_Remove)
0191 {
0192 }
0193
0194
0195 TReplacement(
0196 const TopoDS_Shape& theResult, const TReplacementKind theKind) :
0197 myResult(theResult), myKind(theKind)
0198 {
0199 }
0200
0201
0202 TopoDS_Shape Result() const
0203 {
0204 return (myKind != TReplacementKind_Merge_Ordinary) ?
0205 myResult : TopoDS_Shape();
0206 }
0207
0208
0209 const TopoDS_Shape& RelationResult() const
0210 {
0211 return myResult;
0212 }
0213
0214
0215
0216 BRepTools_History::TRelationType RelationKind() const
0217 {
0218 return (myKind == TReplacementKind_Remove) ?
0219 BRepTools_History::TRelationType_Removed :
0220 BRepTools_History::TRelationType_Modified;
0221 }
0222
0223 private:
0224 TopoDS_Shape myResult;
0225 TReplacementKind myKind;
0226 };
0227
0228 typedef NCollection_DataMap<TopoDS_Shape, TReplacement,
0229 TopTools_ShapeMapHasher> TShapeToReplacement;
0230
0231 private:
0232
0233
0234 TShapeToReplacement myShapeToReplacement;
0235
0236 protected:
0237 TopTools_MapOfShape myNewShapes;
0238 Standard_Integer myStatus;
0239
0240
0241 private:
0242
0243
0244 Standard_Boolean myConsiderLocation;
0245
0246
0247 };
0248
0249
0250
0251
0252
0253
0254
0255 #endif