|
|
|||
File indexing completed on 2026-05-15 08:24:57
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 #include <NCollection_Array1.hxx> 0019 0020 class RWMesh_TriangulationReader; 0021 0022 //! Mesh data wrapper for delayed triangulation loading. 0023 //! Class inherits Poly_Triangulation so that it can be put temporarily into TopoDS_Face within 0024 //! assembly structure. 0025 class RWMesh_TriangulationSource : public Poly_Triangulation 0026 { 0027 DEFINE_STANDARD_RTTIEXT(RWMesh_TriangulationSource, Poly_Triangulation) 0028 public: 0029 //! Constructor. 0030 Standard_EXPORT RWMesh_TriangulationSource(); 0031 0032 //! Destructor. 0033 Standard_EXPORT virtual ~RWMesh_TriangulationSource(); 0034 0035 //! Returns reader allowing to read data from the buffer. 0036 const Handle(RWMesh_TriangulationReader)& Reader() const { return myReader; } 0037 0038 //! Sets reader allowing to read data from the buffer. 0039 void SetReader(const Handle(RWMesh_TriangulationReader)& theReader) { myReader = theReader; } 0040 0041 //! Returns number of degenerated triangles collected during data reading. 0042 //! Used for debug statistic purpose. 0043 Standard_Integer DegeneratedTriNb() const { return myStatisticOfDegeneratedTriNb; } 0044 0045 //! Gets access to number of degenerated triangles to collect them during data reading. 0046 Standard_Integer& ChangeDegeneratedTriNb() { return myStatisticOfDegeneratedTriNb; } 0047 0048 //! Returns TRUE if triangulation has some geometry. 0049 virtual Standard_Boolean HasGeometry() const Standard_OVERRIDE 0050 { 0051 return !myNodes.IsEmpty() && (!myTriangles.IsEmpty() || !myEdges.IsEmpty()); 0052 } 0053 0054 //! Returns the number of edges for this triangulation. 0055 Standard_Integer NbEdges() const { return myEdges.Length(); } 0056 0057 //! Returns edge at the given index. 0058 //! @param[in] theIndex edge index within [1, NbEdges()] range 0059 //! @return edge node indices, with each node defined within [1, NbNodes()] range 0060 Standard_Integer Edge(Standard_Integer theIndex) const { return myEdges.Value(theIndex); } 0061 0062 //! Sets an edge. 0063 //! @param[in] theIndex edge index within [1, NbEdges()] range 0064 //! @param[in] theEdge edge node indices, with each node defined within [1, NbNodes()] range 0065 void SetEdge(Standard_Integer theIndex, Standard_Integer theEdge) 0066 { 0067 myEdges.SetValue(theIndex, theEdge); 0068 } 0069 0070 public: //! @name late-load deferred data interface 0071 //! Returns number of nodes for deferred loading. 0072 //! Note: this is estimated values defined in object header, which might be different from 0073 //! actually loaded values (due to broken header or extra mesh processing). Always check 0074 //! triangulation size of actually loaded data in code to avoid out-of-range issues. 0075 virtual Standard_Integer NbDeferredNodes() const Standard_OVERRIDE { return myNbDefNodes; } 0076 0077 //! Sets number of nodes for deferred loading. 0078 void SetNbDeferredNodes(const Standard_Integer theNbNodes) { myNbDefNodes = theNbNodes; } 0079 0080 //! Returns number of triangles for deferred loading. 0081 //! Note: this is estimated values defined in object header, which might be different from 0082 //! actually loaded values (due to broken header or extra mesh processing). Always check 0083 //! triangulation size of actually loaded data in code to avoid out-of-range issues. 0084 virtual Standard_Integer NbDeferredTriangles() const Standard_OVERRIDE 0085 { 0086 return myNbDefTriangles; 0087 } 0088 0089 //! Sets number of triangles for deferred loading. 0090 void SetNbDeferredTriangles(const Standard_Integer theNbTris) { myNbDefTriangles = theNbTris; } 0091 0092 //! Returns an internal array of edges. 0093 //! Edge()/SetEdge() should be used instead in portable code. 0094 NCollection_Array1<Standard_Integer>& InternalEdges() { return myEdges; } 0095 0096 //! Method resizing an internal array of triangles. 0097 //! @param[in] theNbTriangles new number of triangles 0098 //! @param[in] theToCopyOld copy old triangles into the new array 0099 Standard_EXPORT void ResizeEdges(Standard_Integer theNbEdges, Standard_Boolean theToCopyOld); 0100 0101 protected: 0102 //! Loads triangulation data from deferred storage using specified shared input file system. 0103 Standard_EXPORT virtual Standard_Boolean loadDeferredData( 0104 const Handle(OSD_FileSystem)& theFileSystem, 0105 const Handle(Poly_Triangulation)& theDestTriangulation) const Standard_OVERRIDE; 0106 0107 protected: 0108 Handle(RWMesh_TriangulationReader) myReader; 0109 NCollection_Array1<Standard_Integer> myEdges; 0110 Standard_Integer myNbDefNodes; 0111 Standard_Integer myNbDefTriangles; 0112 mutable Standard_Integer myStatisticOfDegeneratedTriNb; 0113 }; 0114 0115 #endif // _RWMesh_TriangulationSource_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|