Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright (c) 2021 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 _RWMesh_TriangulationSource_HeaderFile
0015 #define _RWMesh_TriangulationSource_HeaderFile
0016 
0017 #include <Poly_Triangulation.hxx>
0018 
0019 class RWMesh_TriangulationReader;
0020 
0021 //! Mesh data wrapper for delayed triangulation loading.
0022 //! Class inherits Poly_Triangulation so that it can be put temporarily into TopoDS_Face within assembly structure.
0023 class RWMesh_TriangulationSource : public Poly_Triangulation
0024 {
0025   DEFINE_STANDARD_RTTIEXT(RWMesh_TriangulationSource, Poly_Triangulation)
0026 public:
0027 
0028   //! Constructor.
0029   Standard_EXPORT RWMesh_TriangulationSource();
0030 
0031   //! Destructor.
0032   Standard_EXPORT virtual ~RWMesh_TriangulationSource();
0033 
0034   //! Returns reader allowing to read data from the buffer.
0035   const Handle(RWMesh_TriangulationReader)& Reader() const { return myReader; }
0036 
0037   //! Sets reader allowing to read data from the buffer.
0038   void SetReader (const Handle(RWMesh_TriangulationReader)& theReader) { myReader = theReader; }
0039 
0040   //! Returns number of degenerated triangles collected during data reading.
0041   //! Used for debug statistic purpose.
0042   Standard_Integer DegeneratedTriNb() const { return myStatisticOfDegeneratedTriNb; }
0043 
0044   //! Gets access to number of degenerated triangles to collect them during data reading.
0045   Standard_Integer& ChangeDegeneratedTriNb() { return myStatisticOfDegeneratedTriNb; }
0046 
0047 public: //! @name late-load deferred data interface
0048 
0049   //! Returns number of nodes for deferred loading.
0050   //! Note: this is estimated values defined in object header, which might be different from actually loaded values
0051   //! (due to broken header or extra mesh processing).
0052   //! Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
0053   virtual Standard_Integer NbDeferredNodes() const Standard_OVERRIDE { return myNbDefNodes; }
0054 
0055   //! Sets number of nodes for deferred loading.
0056   void SetNbDeferredNodes (const Standard_Integer theNbNodes) { myNbDefNodes = theNbNodes; }
0057 
0058   //! Returns number of triangles for deferred loading.
0059   //! Note: this is estimated values defined in object header, which might be different from actually loaded values
0060   //! (due to broken header or extra mesh processing).
0061   //! Always check triangulation size of actually loaded data in code to avoid out-of-range issues.
0062   virtual Standard_Integer NbDeferredTriangles() const Standard_OVERRIDE { return myNbDefTriangles; }
0063 
0064   //! Sets number of triangles for deferred loading.
0065   void SetNbDeferredTriangles (const Standard_Integer theNbTris) { myNbDefTriangles = theNbTris; }
0066 
0067 protected:
0068 
0069   //! Loads triangulation data from deferred storage using specified shared input file system.
0070   Standard_EXPORT virtual Standard_Boolean loadDeferredData (const Handle(OSD_FileSystem)& theFileSystem,
0071                                                              const Handle(Poly_Triangulation)& theDestTriangulation) const Standard_OVERRIDE;
0072 
0073 protected:
0074 
0075   Handle(RWMesh_TriangulationReader) myReader;
0076   Standard_Integer                   myNbDefNodes;
0077   Standard_Integer                   myNbDefTriangles;
0078   mutable Standard_Integer           myStatisticOfDegeneratedTriNb;
0079 
0080 };
0081 
0082 #endif // _RWMesh_TriangulationSource_HeaderFile