Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:37

0001 // Created on: 2004-06-10
0002 // Created by: Alexander SOLOVYOV
0003 // Copyright (c) 2004-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _XSDRAWSTL_DataSource_HeaderFile
0017 #define _XSDRAWSTL_DataSource_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <TColStd_HArray2OfInteger.hxx>
0022 #include <TColStd_HArray2OfReal.hxx>
0023 #include <MeshVS_DataSource.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <TColStd_Array1OfReal.hxx>
0026 #include <MeshVS_EntityType.hxx>
0027 #include <TColStd_Array1OfInteger.hxx>
0028 #include <Poly_Triangulation.hxx>
0029 
0030 
0031 class XSDRAWSTL_DataSource;
0032 DEFINE_STANDARD_HANDLE(XSDRAWSTL_DataSource, MeshVS_DataSource)
0033 
0034 //! The sample DataSource for working with STLMesh_Mesh
0035 class XSDRAWSTL_DataSource : public MeshVS_DataSource
0036 {
0037 
0038 public:
0039 
0040   
0041   //! Constructor
0042   Standard_EXPORT XSDRAWSTL_DataSource(const Handle(Poly_Triangulation)& aMesh);
0043   
0044   //! Returns geometry information about node (if IsElement is False) or element (IsElement is True) by coordinates.
0045   //! For element this method must return all its nodes coordinates in the strict order: X, Y, Z and
0046   //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element.
0047   //! It is recommended to return 1 for node. Type is an element type.
0048   Standard_EXPORT Standard_Boolean GetGeom (const Standard_Integer ID, const Standard_Boolean IsElement, TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes, MeshVS_EntityType& Type) const Standard_OVERRIDE;
0049   
0050   //! This method is similar to GetGeom, but returns only element or node type. This method is provided for
0051   //! a fine performance.
0052   Standard_EXPORT Standard_Boolean GetGeomType (const Standard_Integer ID, const Standard_Boolean IsElement, MeshVS_EntityType& Type) const Standard_OVERRIDE;
0053   
0054   //! This method returns by number an address of any entity which represents element or node data structure.
0055   Standard_EXPORT Standard_Address GetAddr (const Standard_Integer ID, const Standard_Boolean IsElement) const Standard_OVERRIDE;
0056   
0057   //! This method returns information about what node this element consist of.
0058   Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer ID, TColStd_Array1OfInteger& NodeIDs, Standard_Integer& NbNodes) const Standard_OVERRIDE;
0059   
0060   //! This method returns map of all nodes the object consist of.
0061   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const Standard_OVERRIDE;
0062   
0063   //! This method returns map of all elements the object consist of.
0064   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const Standard_OVERRIDE;
0065   
0066   //! This method calculates normal of face, which is using for correct reflection presentation.
0067   //! There is default method, for advance reflection this method can be redefined.
0068   Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const Standard_OVERRIDE;
0069 
0070 
0071 
0072 
0073   DEFINE_STANDARD_RTTIEXT(XSDRAWSTL_DataSource,MeshVS_DataSource)
0074 
0075 protected:
0076 
0077 
0078 
0079 
0080 private:
0081 
0082 
0083   Handle(Poly_Triangulation) myMesh;
0084   TColStd_PackedMapOfInteger myNodes;
0085   TColStd_PackedMapOfInteger myElements;
0086   Handle(TColStd_HArray2OfInteger) myElemNodes;
0087   Handle(TColStd_HArray2OfReal) myNodeCoords;
0088   Handle(TColStd_HArray2OfReal) myElemNormals;
0089 
0090 
0091 };
0092 
0093 
0094 
0095 
0096 
0097 
0098 
0099 #endif // _XSDRAWSTL_DataSource_HeaderFile