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