Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-27 10:40:12

0001 // Created on: 2014-08-04
0002 // Created by: Artem NOVIKOV
0003 // Copyright (c) 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_DataSource3D_HeaderFile
0017 #define _XSDRAWSTL_DataSource3D_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <NCollection_Array1.hxx>
0024 #include <NCollection_HArray1.hxx>
0025 #include <NCollection_Array2.hxx>
0026 #include <NCollection_HArray2.hxx>
0027 #include <MeshVS_DataSource.hxx>
0028 #include <MeshVS_EntityType.hxx>
0029 #include <NCollection_Sequence.hxx>
0030 
0031 //! The sample DataSource3D for working with STLMesh_Mesh
0032 class XSDRAWSTL_DataSource3D : public MeshVS_DataSource
0033 {
0034 
0035 public:
0036   //! Constructor
0037   Standard_EXPORT XSDRAWSTL_DataSource3D();
0038 
0039   //! Returns geometry information about node (if IsElement is False) or element (IsElement is True)
0040   //! by coordinates. For element this method must return all its nodes coordinates in the strict
0041   //! order: X, Y, Z and with nodes order is the same as in wire bounding the face or link. NbNodes
0042   //! is number of nodes of element. It is recommended to return 1 for node. Type is an element
0043   //! type.
0044   Standard_EXPORT bool GetGeom(const int                   theID,
0045                                const bool                  theIsElement,
0046                                NCollection_Array1<double>& theCoords,
0047                                int&                        theNbNodes,
0048                                MeshVS_EntityType&          theType) const override;
0049 
0050   //! This method returns topology information about 3D-element
0051   //! Returns false if element with ID isn't 3D or because other troubles
0052   Standard_EXPORT bool Get3DGeom(
0053     const int                                                    theID,
0054     int&                                                         theNbNodes,
0055     occ::handle<NCollection_HArray1<NCollection_Sequence<int>>>& theData) const override;
0056 
0057   //! This method is similar to GetGeom, but returns only element or node type. This method is
0058   //! provided for a fine performance.
0059   Standard_EXPORT bool GetGeomType(const int          theID,
0060                                    const bool         theIsElement,
0061                                    MeshVS_EntityType& theType) const override;
0062 
0063   //! This method returns by number an address of any entity which represents element or node data
0064   //! structure.
0065   Standard_EXPORT void* GetAddr(const int theID, const bool theIsElement) const override;
0066 
0067   //! This method returns information about what node this element consist of.
0068   Standard_EXPORT bool GetNodesByElement(const int                theID,
0069                                          NCollection_Array1<int>& theNodeIDs,
0070                                          int&                     theNbNodes) const override;
0071 
0072   //! This method returns map of all nodes the object consist of.
0073   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const override;
0074 
0075   //! This method returns map of all elements the object consist of.
0076   Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const override;
0077 
0078   //! This method calculates normal of face, which is using for correct reflection presentation.
0079   //! There is default method, for advance reflection this method can be redefined.
0080   Standard_EXPORT bool GetNormal(const int theID,
0081                                  const int theMax,
0082                                  double&   theNx,
0083                                  double&   theNy,
0084                                  double&   theNz) const override;
0085 
0086   DEFINE_STANDARD_RTTIEXT(XSDRAWSTL_DataSource3D, MeshVS_DataSource)
0087 
0088 private:
0089   TColStd_PackedMapOfInteger               myNodes;
0090   TColStd_PackedMapOfInteger               myElements;
0091   occ::handle<NCollection_HArray1<int>>    myElemNbNodes;
0092   occ::handle<NCollection_HArray2<double>> myNodeCoords;
0093   occ::handle<NCollection_HArray2<int>>    myElemNodes;
0094 };
0095 
0096 #endif // _XSDRAWSTL_DataSource3D_HeaderFile