File indexing completed on 2026-07-05 08:37:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _ShapePersistent_BRep_HeaderFile
0015 #define _ShapePersistent_BRep_HeaderFile
0016
0017 #include <ShapePersistent_TopoDS.hxx>
0018 #include <ShapePersistent_Geom2d.hxx>
0019 #include <ShapePersistent_Poly.hxx>
0020 #include <StdObjMgt_TransientPersistentMap.hxx>
0021 #include <StdObject_Location.hxx>
0022 #include <StdObject_gp_Vectors.hxx>
0023
0024 #include <BRep_ListOfPointRepresentation.hxx>
0025 #include <BRep_ListOfCurveRepresentation.hxx>
0026
0027 #include <gp_Pnt.hxx>
0028 #include <gp_Pnt2d.hxx>
0029
0030 class BRep_PointRepresentation;
0031 class BRep_CurveRepresentation;
0032 class TopoDS_Vertex;
0033 class TopoDS_Edge;
0034 class TopoDS_Face;
0035
0036 class ShapePersistent_BRep : public ShapePersistent_TopoDS
0037 {
0038 public:
0039 class PointRepresentation : public StdObjMgt_Persistent
0040 {
0041 friend class ShapePersistent_BRep;
0042
0043 public:
0044
0045 PointRepresentation()
0046 : myParameter(0.0)
0047 {
0048 }
0049
0050
0051 Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData);
0052
0053 Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0054
0055 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0056
0057
0058 virtual Standard_CString PName() const { return "PBRep_PointRepresentation"; }
0059
0060
0061 Standard_EXPORT void Import(BRep_ListOfPointRepresentation& thePoints) const;
0062
0063 protected:
0064 virtual Handle(BRep_PointRepresentation) import() const;
0065
0066 protected:
0067 StdObject_Location myLocation;
0068 Standard_Real myParameter;
0069
0070 private:
0071 Handle(PointRepresentation) myNext;
0072 };
0073
0074 class PointOnCurve : public PointRepresentation
0075 {
0076 friend class ShapePersistent_BRep;
0077
0078 public:
0079 virtual void Read(StdObjMgt_ReadData& theReadData);
0080 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0081 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0082
0083 virtual Standard_CString PName() const { return "PBRep_PointOnCurve"; }
0084
0085 virtual Handle(BRep_PointRepresentation) import() const;
0086
0087 private:
0088 Handle(ShapePersistent_Geom::Curve) myCurve;
0089 };
0090
0091 class PointsOnSurface : public PointRepresentation
0092 {
0093 friend class ShapePersistent_BRep;
0094
0095 public:
0096 virtual void Read(StdObjMgt_ReadData& theReadData);
0097 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0098 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0099
0100 virtual Standard_CString PName() const { return "PBRep_PointsOnSurface"; }
0101
0102 protected:
0103 Handle(ShapePersistent_Geom::Surface) mySurface;
0104 };
0105
0106 class PointOnCurveOnSurface : public PointsOnSurface
0107 {
0108 friend class ShapePersistent_BRep;
0109
0110 public:
0111 virtual void Read(StdObjMgt_ReadData& theReadData);
0112 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0113 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0114
0115 virtual Standard_CString PName() const { return "PBRep_PointOnCurveOnSurface"; }
0116
0117 virtual Handle(BRep_PointRepresentation) import() const;
0118
0119 private:
0120 Handle(ShapePersistent_Geom2d::Curve) myPCurve;
0121 };
0122
0123 class PointOnSurface : public PointsOnSurface
0124 {
0125 friend class ShapePersistent_BRep;
0126
0127 public:
0128 PointOnSurface()
0129 : myParameter2(0.0)
0130 {
0131 }
0132
0133 virtual void Read(StdObjMgt_ReadData& theReadData);
0134 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0135
0136 virtual Standard_CString PName() const { return "PBRep_PointOnSurface"; }
0137
0138 virtual Handle(BRep_PointRepresentation) import() const;
0139
0140 private:
0141 Standard_Real myParameter2;
0142 };
0143
0144 class CurveRepresentation : public StdObjMgt_Persistent
0145 {
0146 friend class ShapePersistent_BRep;
0147
0148 public:
0149
0150 Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData);
0151
0152 Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0153
0154 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0155
0156
0157 virtual Standard_CString PName() const { return "PBRep_CurveRepresentation"; }
0158
0159
0160 Standard_EXPORT void Import(BRep_ListOfCurveRepresentation& theCurves) const;
0161
0162 protected:
0163 virtual Handle(BRep_CurveRepresentation) import() const;
0164
0165 protected:
0166 StdObject_Location myLocation;
0167
0168 private:
0169 Handle(CurveRepresentation) myNext;
0170 };
0171
0172 class GCurve : public CurveRepresentation
0173 {
0174 friend class ShapePersistent_BRep;
0175
0176 public:
0177 GCurve()
0178 : myFirst(0.0),
0179 myLast(0.0)
0180 {
0181 }
0182
0183 virtual void Read(StdObjMgt_ReadData& theReadData);
0184 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0185
0186 virtual Standard_CString PName() const { return "PBRep_GCurve"; }
0187
0188 protected:
0189 Standard_Real myFirst;
0190 Standard_Real myLast;
0191 };
0192
0193 class Curve3D : public GCurve
0194 {
0195 friend class ShapePersistent_BRep;
0196
0197 public:
0198 virtual void Read(StdObjMgt_ReadData& theReadData);
0199 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0200 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0201
0202 virtual Standard_CString PName() const { return "PBRep_Curve3D"; }
0203
0204 virtual Handle(BRep_CurveRepresentation) import() const;
0205
0206 private:
0207 Handle(ShapePersistent_Geom::Curve) myCurve3D;
0208 };
0209
0210 class CurveOnSurface : public GCurve
0211 {
0212 friend class ShapePersistent_BRep;
0213
0214 public:
0215 virtual void Read(StdObjMgt_ReadData& theReadData);
0216 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0217 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0218
0219 virtual Standard_CString PName() const { return "PBRep_CurveOnSurface"; }
0220
0221 virtual Handle(BRep_CurveRepresentation) import() const;
0222
0223 protected:
0224 Handle(ShapePersistent_Geom2d::Curve) myPCurve;
0225 Handle(ShapePersistent_Geom::Surface) mySurface;
0226 gp_Pnt2d myUV1;
0227 gp_Pnt2d myUV2;
0228 };
0229
0230 class CurveOnClosedSurface : public CurveOnSurface
0231 {
0232 friend class ShapePersistent_BRep;
0233
0234 public:
0235 CurveOnClosedSurface()
0236 : myContinuity(0)
0237 {
0238 }
0239
0240 virtual void Read(StdObjMgt_ReadData& theReadData);
0241 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0242 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0243
0244 virtual Standard_CString PName() const { return "PBRep_CurveOnClosedSurface"; }
0245
0246 virtual Handle(BRep_CurveRepresentation) import() const;
0247
0248 private:
0249 Handle(ShapePersistent_Geom2d::Curve) myPCurve2;
0250 Standard_Integer myContinuity;
0251 gp_Pnt2d myUV21;
0252 gp_Pnt2d myUV22;
0253 };
0254
0255 class Polygon3D : public CurveRepresentation
0256 {
0257 friend class ShapePersistent_BRep;
0258
0259 public:
0260 virtual void Read(StdObjMgt_ReadData& theReadData);
0261 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0262 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0263
0264 virtual Standard_CString PName() const { return "PBRep_Polygon3D"; }
0265
0266 virtual Handle(BRep_CurveRepresentation) import() const;
0267
0268 private:
0269 Handle(ShapePersistent_Poly::Polygon3D) myPolygon3D;
0270 };
0271
0272 class PolygonOnTriangulation : public CurveRepresentation
0273 {
0274 friend class ShapePersistent_BRep;
0275
0276 public:
0277 virtual void Read(StdObjMgt_ReadData& theReadData);
0278 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0279 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0280
0281 virtual Standard_CString PName() const { return "PBRep_PolygonOnTriangulation"; }
0282
0283 virtual Handle(BRep_CurveRepresentation) import() const;
0284
0285 protected:
0286 Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon;
0287 Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
0288 };
0289
0290 class PolygonOnClosedTriangulation : public PolygonOnTriangulation
0291 {
0292 friend class ShapePersistent_BRep;
0293
0294 public:
0295 virtual void Read(StdObjMgt_ReadData& theReadData);
0296 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0297 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0298
0299 virtual Standard_CString PName() const { return "PBRep_PolygonOnClosedTriangulation"; }
0300
0301 virtual Handle(BRep_CurveRepresentation) import() const;
0302
0303 private:
0304 Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon2;
0305 };
0306
0307 class PolygonOnSurface : public CurveRepresentation
0308 {
0309 friend class ShapePersistent_BRep;
0310
0311 public:
0312 virtual void Read(StdObjMgt_ReadData& theReadData);
0313 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0314 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0315
0316 virtual Standard_CString PName() const { return "PBRep_PolygonOnSurface"; }
0317
0318 virtual Handle(BRep_CurveRepresentation) import() const;
0319
0320 protected:
0321 Handle(ShapePersistent_Poly::Polygon2D) myPolygon2D;
0322 Handle(ShapePersistent_Geom::Surface) mySurface;
0323 };
0324
0325 class PolygonOnClosedSurface : public PolygonOnSurface
0326 {
0327 friend class ShapePersistent_BRep;
0328
0329 public:
0330 virtual void Read(StdObjMgt_ReadData& theReadData);
0331 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0332 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0333
0334 virtual Standard_CString PName() const { return "PBRep_PolygonOnClosedSurface"; }
0335
0336 virtual Handle(BRep_CurveRepresentation) import() const;
0337
0338 private:
0339 Handle(ShapePersistent_Poly::Polygon2D) myPolygon2;
0340 };
0341
0342 class CurveOn2Surfaces : public CurveRepresentation
0343 {
0344 friend class ShapePersistent_BRep;
0345
0346 public:
0347 CurveOn2Surfaces()
0348 : myContinuity(0)
0349 {
0350 }
0351
0352 virtual void Read(StdObjMgt_ReadData& theReadData);
0353 virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0354 virtual void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0355
0356 virtual Standard_CString PName() const { return "PBRep_CurveOn2Surfaces"; }
0357
0358 virtual Handle(BRep_CurveRepresentation) import() const;
0359
0360 private:
0361 Handle(ShapePersistent_Geom::Surface) mySurface;
0362 Handle(ShapePersistent_Geom::Surface) mySurface2;
0363 StdObject_Location myLocation2;
0364 Standard_Integer myContinuity;
0365 };
0366
0367 private:
0368 class pTVertex : public pTBase
0369 {
0370 friend class ShapePersistent_BRep;
0371
0372 public:
0373 pTVertex()
0374 : myTolerance(0.0)
0375 {
0376 }
0377
0378 inline void Read(StdObjMgt_ReadData& theReadData)
0379 {
0380 pTBase::Read(theReadData);
0381 theReadData >> myTolerance >> myPnt >> myPoints;
0382 }
0383
0384 inline void Write(StdObjMgt_WriteData& theWriteData) const
0385 {
0386 pTBase::Write(theWriteData);
0387 theWriteData << myTolerance << myPnt << myPoints;
0388 }
0389
0390 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0391 {
0392 pTBase::PChildren(theChildren);
0393 theChildren.Append(myPoints);
0394 }
0395
0396 inline Standard_CString PName() const { return "PBRep_TVertex"; }
0397
0398 private:
0399 virtual Handle(TopoDS_TShape) createTShape() const;
0400
0401 private:
0402 Standard_Real myTolerance;
0403 gp_Pnt myPnt;
0404 Handle(PointRepresentation) myPoints;
0405 };
0406
0407 class pTEdge : public pTBase
0408 {
0409 friend class ShapePersistent_BRep;
0410
0411 public:
0412 pTEdge()
0413 : myTolerance(0.0),
0414 myFlags(0)
0415 {
0416 }
0417
0418 inline void Read(StdObjMgt_ReadData& theReadData)
0419 {
0420 pTBase::Read(theReadData);
0421 theReadData >> myTolerance >> myFlags >> myCurves;
0422 }
0423
0424 inline void Write(StdObjMgt_WriteData& theWriteData) const
0425 {
0426 pTBase::Write(theWriteData);
0427 theWriteData << myTolerance << myFlags << myCurves;
0428 }
0429
0430 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0431 {
0432 pTBase::PChildren(theChildren);
0433 theChildren.Append(myCurves);
0434 }
0435
0436 inline Standard_CString PName() const { return "PBRep_TEdge"; }
0437
0438 private:
0439 virtual Handle(TopoDS_TShape) createTShape() const;
0440
0441 private:
0442 Standard_Real myTolerance;
0443 Standard_Integer myFlags;
0444 Handle(CurveRepresentation) myCurves;
0445 };
0446
0447 class pTFace : public pTBase
0448 {
0449 friend class ShapePersistent_BRep;
0450
0451 public:
0452 pTFace()
0453 : myTolerance(0.0),
0454 myNaturalRestriction(Standard_False)
0455 {
0456 }
0457
0458 inline void Read(StdObjMgt_ReadData& theReadData)
0459 {
0460 pTBase::Read(theReadData);
0461 theReadData >> mySurface >> myTriangulation >> myLocation;
0462 theReadData >> myTolerance >> myNaturalRestriction;
0463 }
0464
0465 inline void Write(StdObjMgt_WriteData& theWriteData) const
0466 {
0467 pTBase::Write(theWriteData);
0468 theWriteData << mySurface << myTriangulation << myLocation;
0469 theWriteData << myTolerance << myNaturalRestriction;
0470 }
0471
0472 inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
0473 {
0474 pTBase::PChildren(theChildren);
0475 theChildren.Append(mySurface);
0476 theChildren.Append(myTriangulation);
0477 myLocation.PChildren(theChildren);
0478 }
0479
0480 inline Standard_CString PName() const { return "PBRep_TFace"; }
0481
0482 private:
0483 virtual Handle(TopoDS_TShape) createTShape() const;
0484
0485 private:
0486 Handle(ShapePersistent_Geom::Surface) mySurface;
0487 Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
0488 StdObject_Location myLocation;
0489 Standard_Real myTolerance;
0490 Standard_Boolean myNaturalRestriction;
0491 };
0492
0493 public:
0494 typedef tObject<pTVertex> TVertex;
0495 typedef tObject<pTEdge> TEdge;
0496 typedef tObject<pTFace> TFace;
0497
0498 typedef tObject1<pTVertex> TVertex1;
0499 typedef tObject1<pTEdge> TEdge1;
0500 typedef tObject1<pTFace> TFace1;
0501
0502 public:
0503
0504 Standard_EXPORT static Handle(TVertex::pTObjectT) Translate(
0505 const TopoDS_Vertex& theVertex,
0506 StdObjMgt_TransientPersistentMap& theMap);
0507
0508 Standard_EXPORT static Handle(TEdge::pTObjectT) Translate(
0509 const TopoDS_Edge& theEdge,
0510 StdObjMgt_TransientPersistentMap& theMap,
0511 ShapePersistent_TriangleMode theTriangleMode);
0512
0513 Standard_EXPORT static Handle(TFace::pTObjectT) Translate(
0514 const TopoDS_Face& theFace,
0515 StdObjMgt_TransientPersistentMap& theMap,
0516 ShapePersistent_TriangleMode theTriangleMode);
0517
0518 Standard_EXPORT static Handle(PointOnCurve) Translate(Standard_Real theParam,
0519 const Handle(Geom_Curve)& theCurve,
0520 const TopLoc_Location& theLoc,
0521 StdObjMgt_TransientPersistentMap& theMap);
0522
0523 Standard_EXPORT static Handle(PointOnCurveOnSurface) Translate(
0524 Standard_Real theParam,
0525 const Handle(Geom2d_Curve)& theCurve,
0526 const Handle(Geom_Surface)& theSurf,
0527 const TopLoc_Location& theLoc,
0528 StdObjMgt_TransientPersistentMap& theMap);
0529
0530 Standard_EXPORT static Handle(PointOnSurface) Translate(Standard_Real theParam,
0531 Standard_Real theParam2,
0532 const Handle(Geom_Surface)& theSurf,
0533 const TopLoc_Location& theLoc,
0534 StdObjMgt_TransientPersistentMap& theMap);
0535
0536 Standard_EXPORT static Handle(CurveOnSurface) Translate(const Handle(Geom2d_Curve)& theCurve,
0537 const Standard_Real theFirstParam,
0538 const Standard_Real theLastParam,
0539 const Handle(Geom_Surface)& theSurf,
0540 const TopLoc_Location& theLoc,
0541 StdObjMgt_TransientPersistentMap& theMap);
0542
0543 Standard_EXPORT static Handle(CurveOnClosedSurface) Translate(
0544 const Handle(Geom2d_Curve)& theCurve,
0545 const Handle(Geom2d_Curve)& theCurve2,
0546 const Standard_Real theFirstParam,
0547 const Standard_Real theLastParam,
0548 const Handle(Geom_Surface)& theSurf,
0549 const TopLoc_Location& theLoc,
0550 const GeomAbs_Shape theContinuity,
0551 StdObjMgt_TransientPersistentMap& theMap);
0552
0553 Standard_EXPORT static Handle(CurveOn2Surfaces) Translate(
0554 const Handle(Geom_Surface)& theSurf,
0555 const Handle(Geom_Surface)& theSurf2,
0556 const TopLoc_Location& theLoc,
0557 const TopLoc_Location& theLoc2,
0558 const GeomAbs_Shape theContinuity,
0559 StdObjMgt_TransientPersistentMap& theMap);
0560
0561 Standard_EXPORT static Handle(Curve3D) Translate(const Handle(Geom_Curve)& theCurve,
0562 const Standard_Real theFirstParam,
0563 const Standard_Real theLastParam,
0564 const TopLoc_Location& theLoc,
0565 StdObjMgt_TransientPersistentMap& theMap);
0566
0567 Standard_EXPORT static Handle(Polygon3D) Translate(const Handle(Poly_Polygon3D)& thePoly,
0568 const TopLoc_Location& theLoc,
0569 StdObjMgt_TransientPersistentMap& theMap);
0570
0571 Standard_EXPORT static Handle(PolygonOnClosedSurface) Translate(
0572 const Handle(Poly_Polygon2D)& thePoly,
0573 const Handle(Poly_Polygon2D)& thePoly2,
0574 const Handle(Geom_Surface)& theSurf,
0575 const TopLoc_Location& theLoc,
0576 StdObjMgt_TransientPersistentMap& theMap);
0577
0578 Standard_EXPORT static Handle(PolygonOnSurface) Translate(
0579 const Handle(Poly_Polygon2D)& thePoly,
0580 const Handle(Geom_Surface)& theSurf,
0581 const TopLoc_Location& theLoc,
0582 StdObjMgt_TransientPersistentMap& theMap);
0583
0584 Standard_EXPORT static Handle(PolygonOnClosedTriangulation) Translate(
0585 const Handle(Poly_PolygonOnTriangulation)& thePolyOnTriang,
0586 const Handle(Poly_PolygonOnTriangulation)& thePolyOnTriang2,
0587 const Handle(Poly_Triangulation)& thePolyTriang,
0588 const TopLoc_Location& theLoc,
0589 StdObjMgt_TransientPersistentMap& theMap);
0590
0591 Standard_EXPORT static Handle(PolygonOnTriangulation) Translate(
0592 const Handle(Poly_PolygonOnTriangulation)& thePolyOnTriang,
0593 const Handle(Poly_Triangulation)& thePolyTriang,
0594 const TopLoc_Location& theLoc,
0595 StdObjMgt_TransientPersistentMap& theMap);
0596 };
0597
0598 #endif