Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:57

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 
0015 #ifndef _ShapePersistent_Poly_HeaderFile
0016 #define _ShapePersistent_Poly_HeaderFile
0017 
0018 #include <StdObjMgt_SharedObject.hxx>
0019 #include <StdObjMgt_TransientPersistentMap.hxx>
0020 #include <ShapePersistent_HArray1.hxx>
0021 
0022 class Poly_Polygon2D;
0023 class Poly_Polygon3D;
0024 class Poly_PolygonOnTriangulation;
0025 class Poly_Triangulation;
0026 
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     inline void Read (StdObjMgt_ReadData& theReadData)
0040       { theReadData >> myDeflection >> myNodes; }
0041     inline void Write (StdObjMgt_WriteData& theWriteData) const
0042       { theWriteData << myDeflection << myNodes; }
0043     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0044     inline Standard_CString PName() const { return "PPoly_Polygon2D"; }
0045 
0046     Handle(Poly_Polygon2D) Import() const;
0047 
0048   private:
0049     Standard_Real                          myDeflection;
0050     Handle(ShapePersistent_HArray1::Pnt2d) myNodes;
0051   };
0052 
0053   class pPolygon3D : public Standard_Transient
0054   {
0055     friend class ShapePersistent_Poly;
0056 
0057   public:
0058     inline void Read (StdObjMgt_ReadData& theReadData)
0059       { theReadData >> myDeflection >> myNodes >> myParameters; }
0060     inline void Write (StdObjMgt_WriteData& theWriteData) const
0061       { theWriteData << myDeflection << myNodes << myParameters; }
0062     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0063     inline Standard_CString PName() const { return "PPoly_Polygon3D"; }
0064 
0065     Handle(Poly_Polygon3D) Import() const;
0066 
0067   private:
0068     Standard_Real                        myDeflection;
0069     Handle(ShapePersistent_HArray1::Pnt) myNodes;
0070     Handle(StdLPersistent_HArray1::Real) myParameters;
0071   };
0072 
0073   class pPolygonOnTriangulation : public Standard_Transient
0074   {
0075     friend class ShapePersistent_Poly;
0076 
0077   public:
0078     pPolygonOnTriangulation()
0079     : myDeflection(0.0)
0080     {
0081     }
0082     inline void Read (StdObjMgt_ReadData& theReadData)
0083       { theReadData >> myDeflection >> myNodes >> myParameters; }
0084     inline void Write (StdObjMgt_WriteData& theWriteData) const
0085       { theWriteData << myDeflection << myNodes << myParameters; }
0086     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0087     inline Standard_CString PName() const { return "PPoly_PolygonOnTriangulation"; }
0088 
0089     Handle(Poly_PolygonOnTriangulation) Import() const;
0090 
0091   private:
0092     Standard_Real                           myDeflection;
0093     Handle(StdLPersistent_HArray1::Integer) myNodes;
0094     Handle(StdLPersistent_HArray1::Real)    myParameters;
0095   };
0096 
0097   class pTriangulation : public Standard_Transient
0098   {
0099     friend class ShapePersistent_Poly;
0100 
0101   public:
0102     pTriangulation()
0103     : myDeflection(0.0)
0104     {
0105     }
0106     inline void Read (StdObjMgt_ReadData& theReadData)
0107       { theReadData >> myDeflection >> myNodes >> myUVNodes >> myTriangles; }
0108     inline void Write (StdObjMgt_WriteData& theWriteData) const
0109       { theWriteData << myDeflection << myNodes << myUVNodes << myTriangles; }
0110     Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
0111     inline Standard_CString PName() const { return "PPoly_Triangulation"; }
0112 
0113     Handle(Poly_Triangulation) Import() const;
0114 
0115   private:
0116     Standard_Real                             myDeflection;
0117     Handle(ShapePersistent_HArray1::Pnt)      myNodes;
0118     Handle(ShapePersistent_HArray1::Pnt2d)    myUVNodes;
0119     Handle(ShapePersistent_HArray1::Triangle) myTriangles;
0120   };
0121 
0122   template <class Persistent, class Transient>
0123   struct instance
0124     : public Delayed <DelayedBase<StdObjMgt_Persistent, Transient, Persistent> > {};
0125 
0126 public:
0127   typedef instance <pPolygon2D, Poly_Polygon2D>         Polygon2D;
0128   typedef instance <pPolygon3D, Poly_Polygon3D>         Polygon3D;
0129   typedef instance <pPolygonOnTriangulation,
0130                     Poly_PolygonOnTriangulation>        PolygonOnTriangulation;
0131   typedef instance <pTriangulation, Poly_Triangulation> Triangulation;
0132 
0133 public:
0134   //! Create a persistent object for a 2D polygon
0135   Standard_EXPORT static Handle(Polygon2D) Translate (const Handle(Poly_Polygon2D)& thePoly,
0136                                                       StdObjMgt_TransientPersistentMap& theMap);
0137   //! Create a persistent object for a 3D polygon
0138   Standard_EXPORT static Handle(Polygon3D) Translate (const Handle(Poly_Polygon3D)& thePoly,
0139                                                       StdObjMgt_TransientPersistentMap& theMap);
0140   //! Create a persistent object for a triangulation
0141   Standard_EXPORT static Handle(PolygonOnTriangulation) Translate (const Handle(Poly_PolygonOnTriangulation)& thePolyOnTriang,
0142                                                                    StdObjMgt_TransientPersistentMap& theMap);
0143   //! Create a persistent object for a polygon on triangulation
0144   Standard_EXPORT static Handle(Triangulation) Translate(const Handle(Poly_Triangulation)& thePolyTriang,
0145                                                          StdObjMgt_TransientPersistentMap& theMap);
0146 };
0147 
0148 #endif