Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-31 08:31:38

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