Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 09:04:56

0001 // Copyright (c) 2015 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _ShapePersistent_Poly_HeaderFile
0015 #define _ShapePersistent_Poly_HeaderFile
0016 
0017 #include <StdObjMgt_SharedObject.hxx>
0018 #include <NCollection_DataMap.hxx>
0019 #include <ShapePersistent_HArray1.hxx>
0020 class Standard_Transient;
0021 class StdObjMgt_Persistent;
0022 
0023 class Poly_Polygon2D;
0024 class Poly_Polygon3D;
0025 class Poly_PolygonOnTriangulation;
0026 class Poly_Triangulation;
0027 
0028 class ShapePersistent_Poly : private StdObjMgt_SharedObject
0029 {
0030   class pPolygon2D : public Standard_Transient
0031   {
0032     friend class ShapePersistent_Poly;
0033 
0034   public:
0035     pPolygon2D()
0036         : myDeflection(0.0)
0037     {
0038     }
0039 
0040     inline void Read(StdObjMgt_ReadData& theReadData) { theReadData >> myDeflection >> myNodes; }
0041 
0042     inline void Write(StdObjMgt_WriteData& theWriteData) const
0043     {
0044       theWriteData << myDeflection << myNodes;
0045     }
0046 
0047     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0048 
0049     inline const char* PName() const { return "PPoly_Polygon2D"; }
0050 
0051     occ::handle<Poly_Polygon2D> Import() const;
0052 
0053   private:
0054     double                                 myDeflection;
0055     Handle(ShapePersistent_HArray1::Pnt2d) myNodes;
0056   };
0057 
0058   class pPolygon3D : public Standard_Transient
0059   {
0060     friend class ShapePersistent_Poly;
0061 
0062   public:
0063     inline void Read(StdObjMgt_ReadData& theReadData)
0064     {
0065       theReadData >> myDeflection >> myNodes >> myParameters;
0066     }
0067 
0068     inline void Write(StdObjMgt_WriteData& theWriteData) const
0069     {
0070       theWriteData << myDeflection << myNodes << myParameters;
0071     }
0072 
0073     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0074 
0075     inline const char* PName() const { return "PPoly_Polygon3D"; }
0076 
0077     occ::handle<Poly_Polygon3D> Import() const;
0078 
0079   private:
0080     double                               myDeflection;
0081     Handle(ShapePersistent_HArray1::Pnt) myNodes;
0082     Handle(StdLPersistent_HArray1::Real) myParameters;
0083   };
0084 
0085   class pPolygonOnTriangulation : public Standard_Transient
0086   {
0087     friend class ShapePersistent_Poly;
0088 
0089   public:
0090     pPolygonOnTriangulation()
0091         : myDeflection(0.0)
0092     {
0093     }
0094 
0095     inline void Read(StdObjMgt_ReadData& theReadData)
0096     {
0097       theReadData >> myDeflection >> myNodes >> myParameters;
0098     }
0099 
0100     inline void Write(StdObjMgt_WriteData& theWriteData) const
0101     {
0102       theWriteData << myDeflection << myNodes << myParameters;
0103     }
0104 
0105     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0106 
0107     inline const char* PName() const { return "PPoly_PolygonOnTriangulation"; }
0108 
0109     occ::handle<Poly_PolygonOnTriangulation> Import() const;
0110 
0111   private:
0112     double                                  myDeflection;
0113     Handle(StdLPersistent_HArray1::Integer) myNodes;
0114     Handle(StdLPersistent_HArray1::Real)    myParameters;
0115   };
0116 
0117   class pTriangulation : public Standard_Transient
0118   {
0119     friend class ShapePersistent_Poly;
0120 
0121   public:
0122     pTriangulation()
0123         : myDeflection(0.0)
0124     {
0125     }
0126 
0127     inline void Read(StdObjMgt_ReadData& theReadData)
0128     {
0129       theReadData >> myDeflection >> myNodes >> myUVNodes >> myTriangles;
0130     }
0131 
0132     inline void Write(StdObjMgt_WriteData& theWriteData) const
0133     {
0134       theWriteData << myDeflection << myNodes << myUVNodes << myTriangles;
0135     }
0136 
0137     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0138 
0139     inline const char* PName() const { return "PPoly_Triangulation"; }
0140 
0141     occ::handle<Poly_Triangulation> Import() const;
0142 
0143   private:
0144     double                                    myDeflection;
0145     Handle(ShapePersistent_HArray1::Pnt)      myNodes;
0146     Handle(ShapePersistent_HArray1::Pnt2d)    myUVNodes;
0147     Handle(ShapePersistent_HArray1::Triangle) myTriangles;
0148   };
0149 
0150   template <class Persistent, class Transient>
0151   struct instance : public Delayed<DelayedBase<StdObjMgt_Persistent, Transient, Persistent>>
0152   {
0153   };
0154 
0155 public:
0156   typedef instance<pPolygon2D, Poly_Polygon2D>                           Polygon2D;
0157   typedef instance<pPolygon3D, Poly_Polygon3D>                           Polygon3D;
0158   typedef instance<pPolygonOnTriangulation, Poly_PolygonOnTriangulation> PolygonOnTriangulation;
0159   typedef instance<pTriangulation, Poly_Triangulation>                   Triangulation;
0160 
0161 public:
0162   //! Create a persistent object for a 2D polygon
0163   Standard_EXPORT static occ::handle<Polygon2D> Translate(
0164     const occ::handle<Poly_Polygon2D>& thePoly,
0165     NCollection_DataMap<occ::handle<Standard_Transient>, occ::handle<StdObjMgt_Persistent>>&
0166       theMap);
0167   //! Create a persistent object for a 3D polygon
0168   Standard_EXPORT static occ::handle<Polygon3D> Translate(
0169     const occ::handle<Poly_Polygon3D>& thePoly,
0170     NCollection_DataMap<occ::handle<Standard_Transient>, occ::handle<StdObjMgt_Persistent>>&
0171       theMap);
0172   //! Create a persistent object for a triangulation
0173   Standard_EXPORT static occ::handle<PolygonOnTriangulation> Translate(
0174     const occ::handle<Poly_PolygonOnTriangulation>& thePolyOnTriang,
0175     NCollection_DataMap<occ::handle<Standard_Transient>, occ::handle<StdObjMgt_Persistent>>&
0176       theMap);
0177   //! Create a persistent object for a polygon on triangulation
0178   Standard_EXPORT static occ::handle<Triangulation> Translate(
0179     const occ::handle<Poly_Triangulation>& thePolyTriang,
0180     NCollection_DataMap<occ::handle<Standard_Transient>, occ::handle<StdObjMgt_Persistent>>&
0181       theMap);
0182 };
0183 
0184 #endif