File indexing completed on 2026-09-12 09:18:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _ShapePersistent_TopoDS_HeaderFile
0015 #define _ShapePersistent_TopoDS_HeaderFile
0016
0017 #include <ShapePersistent_TriangleMode.hxx>
0018
0019 #include <StdPersistent_HArray1.hxx>
0020 #include <StdLPersistent_HArray1.hxx>
0021 #include <StdObject_Shape.hxx>
0022 #include <NCollection_DataMap.hxx>
0023
0024 #include <TopoDS_TWire.hxx>
0025 #include <TopoDS_TShell.hxx>
0026 #include <TopoDS_TSolid.hxx>
0027 #include <TopoDS_TCompSolid.hxx>
0028 #include <TopoDS_TCompound.hxx>
0029 class Standard_Transient;
0030 class StdObjMgt_Persistent;
0031
0032 class ShapePersistent_TopoDS : public StdPersistent_TopoDS
0033 {
0034 public:
0035 class HShape : public StdObjMgt_Persistent, public StdObject_Shape
0036 {
0037 public:
0038
0039 Standard_EXPORT void Read(StdObjMgt_ReadData& theReadData) override;
0040
0041 Standard_EXPORT void Write(StdObjMgt_WriteData& theWriteData) const override;
0042
0043 Standard_EXPORT void PChildren(SequenceOfPersistent& theChildren) const override;
0044
0045
0046 const char* PName() const override { return "PTopoDS_HShape"; }
0047
0048 private:
0049 occ::handle<StdObjMgt_Persistent> myEntry;
0050 };
0051
0052 protected:
0053 class pTBase : public pTShape
0054 {
0055 public:
0056 inline occ::handle<TopoDS_TShape> Import() const
0057 {
0058 occ::handle<TopoDS_TShape> aTShape = createTShape();
0059
0060 TopoDS_Shape aWrapperShape;
0061 aWrapperShape.TShape(aTShape);
0062 addShapes(aWrapperShape);
0063
0064 setFlags(aTShape);
0065
0066 return aTShape;
0067 }
0068
0069 private:
0070 virtual occ::handle<TopoDS_TShape> createTShape() const = 0;
0071
0072 virtual void addShapes(TopoDS_Shape& theParent) const = 0;
0073
0074 void setFlags(const occ::handle<TopoDS_TShape>& theTShape) const;
0075
0076 protected:
0077 template <class ShapesArray>
0078 void addShapesT(TopoDS_Shape& theParent) const;
0079 };
0080
0081 private:
0082 template <class Target>
0083 class pTSimple : public pTBase
0084 {
0085 occ::handle<TopoDS_TShape> createTShape() const override;
0086
0087 public:
0088 inline const char* PName() const;
0089 };
0090
0091 template <class Persistent, class ShapesArray>
0092 class pTObject : public Persistent
0093 {
0094 void addShapes(TopoDS_Shape& theParent) const override
0095 {
0096 pTBase::addShapesT<ShapesArray>(theParent);
0097 }
0098 };
0099
0100 template <class Persistent, class ShapesArray>
0101 struct tObjectT : public Delayed<DelayedBase<TShape, TopoDS_TShape, pTBase>,
0102 pTObject<Persistent, ShapesArray>>
0103 {
0104 typedef pTObject<Persistent, ShapesArray> pTObjectT;
0105 };
0106
0107 protected:
0108 template <class Persistent>
0109 struct tObject : public tObjectT<Persistent, StdLPersistent_HArray1::Persistent>
0110 {
0111 };
0112
0113 template <class Persistent>
0114 struct tObject1 : public tObjectT<Persistent, StdPersistent_HArray1::Shape1>
0115 {
0116 };
0117
0118 public:
0119 typedef tObject<pTSimple<TopoDS_TWire>> TWire;
0120 typedef tObject<pTSimple<TopoDS_TShell>> TShell;
0121 typedef tObject<pTSimple<TopoDS_TSolid>> TSolid;
0122 typedef tObject<pTSimple<TopoDS_TCompSolid>> TCompSolid;
0123 typedef tObject<pTSimple<TopoDS_TCompound>> TCompound;
0124
0125 typedef tObject1<pTSimple<TopoDS_TWire>> TWire1;
0126 typedef tObject1<pTSimple<TopoDS_TShell>> TShell1;
0127 typedef tObject1<pTSimple<TopoDS_TSolid>> TSolid1;
0128 typedef tObject1<pTSimple<TopoDS_TCompSolid>> TCompSolid1;
0129 typedef tObject1<pTSimple<TopoDS_TCompound>> TCompound1;
0130
0131 public:
0132
0133 Standard_EXPORT static occ::handle<HShape> Translate(
0134 const TopoDS_Shape& theShape,
0135 NCollection_DataMap<occ::handle<Standard_Transient>, occ::handle<StdObjMgt_Persistent>>& theMap,
0136 ShapePersistent_TriangleMode theTriangleMode);
0137 };
0138
0139 template <>
0140 inline const char* ShapePersistent_TopoDS::pTSimple<TopoDS_TWire>::PName() const
0141 {
0142 return "PTopoDS_TWire";
0143 }
0144
0145 template <>
0146 inline const char* ShapePersistent_TopoDS::pTSimple<TopoDS_TShell>::PName() const
0147 {
0148 return "PTopoDS_TShell";
0149 }
0150
0151 template <>
0152 inline const char* ShapePersistent_TopoDS::pTSimple<TopoDS_TSolid>::PName() const
0153 {
0154 return "PTopoDS_TSolid";
0155 }
0156
0157 template <>
0158 inline const char* ShapePersistent_TopoDS::pTSimple<TopoDS_TCompSolid>::PName() const
0159 {
0160 return "PTopoDS_TCompSolid";
0161 }
0162
0163 template <>
0164 inline const char* ShapePersistent_TopoDS::pTSimple<TopoDS_TCompound>::PName() const
0165 {
0166 return "PTopoDS_TCompound";
0167 }
0168
0169 #endif