| 1 | // SMESH SMESH_MeshVSLink : Connection of SMESH with MeshVS from OCC |
| 2 | // |
| 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, |
| 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
| 5 | // |
| 6 | // This library is free software; you can redistribute it and/or |
| 7 | // modify it under the terms of the GNU Lesser General Public |
| 8 | // License as published by the Free Software Foundation; either |
| 9 | // version 2.1 of the License. |
| 10 | // |
| 11 | // This library is distributed in the hope that it will be useful, |
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | // Lesser General Public License for more details. |
| 15 | // |
| 16 | // You should have received a copy of the GNU Lesser General Public |
| 17 | // License along with this library; if not, write to the Free Software |
| 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | // |
| 20 | // See http://www.salome-platform.org/ or email : [email protected] |
| 21 | // |
| 22 | // File : SMESH_MeshVSLink.cxx |
| 23 | // Created : Mon Dec 1 09:00:00 2008 |
| 24 | // Author : Sioutis Fotios |
| 25 | // Module : SMESH |
| 26 | |
| 27 | #ifndef _SMESH_MeshVSLink_HeaderFile |
| 28 | #define _SMESH_MeshVSLink_HeaderFile |
| 29 | |
| 30 | #if OCC_VERSION_HEX < 0x070000 |
| 31 | #ifndef _Handle_SMESH_MeshVSLink_HeaderFile |
| 32 | #include <Handle_SMESH_MeshVSLink.hxx> |
| 33 | #endif |
| 34 | #endif |
| 35 | |
| 36 | #ifndef _Standard_HeaderFile |
| 37 | #include <Standard.hxx> |
| 38 | #endif |
| 39 | #ifndef _TColStd_PackedMapOfInteger_HeaderFile |
| 40 | #include <TColStd_PackedMapOfInteger.hxx> |
| 41 | #endif |
| 42 | #ifndef _TColStd_HArray2OfInteger_HeaderFile |
| 43 | #include <TColStd_HArray2OfInteger.hxx> |
| 44 | #endif |
| 45 | #ifndef _TColStd_HArray2OfReal_HeaderFile |
| 46 | #include <TColStd_HArray2OfReal.hxx> |
| 47 | #endif |
| 48 | #ifndef _MeshVS_DataSource3D_HeaderFile |
| 49 | #include <MeshVS_DataSource3D.hxx> |
| 50 | #endif |
| 51 | #ifndef _Standard_Boolean_HeaderFile |
| 52 | #include <Standard_Boolean.hxx> |
| 53 | #endif |
| 54 | #ifndef _Standard_Integer_HeaderFile |
| 55 | #include <Standard_Integer.hxx> |
| 56 | #endif |
| 57 | #ifndef _MeshVS_EntityType_HeaderFile |
| 58 | #include <MeshVS_EntityType.hxx> |
| 59 | #endif |
| 60 | #ifndef _TColStd_HArray1OfInteger_HeaderFile |
| 61 | #include <TColStd_HArray1OfInteger.hxx> |
| 62 | #endif |
| 63 | #ifndef _Standard_Real_HeaderFile |
| 64 | #include <Standard_Real.hxx> |
| 65 | #endif |
| 66 | #ifndef _SMESH_Mesh_HeaderFile |
| 67 | #include <SMESH_Mesh.hxx> |
| 68 | #endif |
| 69 | #ifndef _Standard_Version_HeaderFile |
| 70 | #include <Standard_Version.hxx> |
| 71 | #endif |
| 72 | |
| 73 | #if OCC_VERSION_HEX >= 0x070000 |
| 74 | DEFINE_STANDARD_HANDLE(SMESH_MeshVSLink, MeshVS_DataSource3D) |
| 75 | #endif |
| 76 | class SMESH_MeshVSLink : public MeshVS_DataSource3D { |
| 77 | |
| 78 | public: |
| 79 | // Methods PUBLIC |
| 80 | // |
| 81 | |
| 82 | //! Constructor <br> |
| 83 | Standard_EXPORT SMESH_MeshVSLink(const SMESH_Mesh *aMesh); |
| 84 | |
| 85 | //Not implemented yet |
| 86 | /* |
| 87 | |
| 88 | Standard_EXPORT Standard_Boolean GetNodeNormal(const Standard_Integer ranknode,const Standard_Integer ElementId,Standard_Real& nx,Standard_Real& ny,Standard_Real& nz) const; |
| 89 | Standard_EXPORT Standard_Boolean GetNormalsByElement(const Standard_Integer Id,const Standard_Boolean IsNodal,const Standard_Integer MaxNodes,Handle(TColStd_HArray1OfReal)& Normals) const; |
| 90 | Standard_EXPORT void GetAllGroups(TColStd_PackedMapOfInteger& Ids) const; |
| 91 | Standard_EXPORT Standard_Boolean GetGroup(const Standard_Integer Id,MeshVS_EntityType& Type,TColStd_PackedMapOfInteger& Ids) const; |
| 92 | Standard_EXPORT Standard_Address GetGroupAddr(const Standard_Integer ID) const; |
| 93 | Standard_EXPORT Standard_Boolean IsAdvancedSelectionEnabled() const; |
| 94 | Standard_EXPORT Bnd_Box GetBoundingBox() const; |
| 95 | Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const Standard_Real X,const Standard_Real Y,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ; |
| 96 | Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const Standard_Real XMin,const Standard_Real YMin,const Standard_Real XMax,const Standard_Real YMax,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ; |
| 97 | Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,const TColgp_Array1OfPnt2d& Polyline,const Bnd_Box2d& aBox,const Standard_Real aTol,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ; |
| 98 | Standard_EXPORT Standard_Boolean GetDetectedEntities(const Handle(MeshVS_Mesh)& Prs,Handle(TColStd_HPackedMapOfInteger)& Nodes,Handle(TColStd_HPackedMapOfInteger)& Elements) ; |
| 99 | */ |
| 100 | |
| 101 | //! Returns geometry information about node ( if IsElement is False ) or element ( IsElement is True ) <br> |
| 102 | //! by coordinates. For element this method must return all its nodes coordinates in the strict order: X, Y, Z and <br> |
| 103 | //! with nodes order is the same as in wire bounding the face or link. NbNodes is number of nodes of element. <br> |
| 104 | //! It is recommended to return 1 for node. Type is an element type. <br> |
| 105 | Standard_EXPORT Standard_Boolean GetGeom(const Standard_Integer ID,const Standard_Boolean IsElement,TColStd_Array1OfReal& Coords,Standard_Integer& NbNodes,MeshVS_EntityType& Type) const override; |
| 106 | |
| 107 | Standard_EXPORT Standard_Boolean Get3DGeom(const Standard_Integer ID,Standard_Integer& NbNodes,Handle(MeshVS_HArray1OfSequenceOfInteger)& Data) const override; |
| 108 | |
| 109 | //! This method is similar to GetGeom, but returns only element or node type. This method is provided for <br> |
| 110 | //! a fine performance. <br> |
| 111 | Standard_EXPORT Standard_Boolean GetGeomType(const Standard_Integer ID,const Standard_Boolean IsElement,MeshVS_EntityType& Type) const override; |
| 112 | |
| 113 | //! This method returns by number an address of any entity which represents element or node data structure. <br> |
| 114 | Standard_EXPORT Standard_Address GetAddr(const Standard_Integer ID,const Standard_Boolean IsElement) const override; |
| 115 | |
| 116 | //! This method returns information about what node this element consist of. <br> |
| 117 | Standard_EXPORT /*virtual*/ Standard_Boolean GetNodesByElement(const Standard_Integer ID,TColStd_Array1OfInteger& NodeIDs,Standard_Integer& NbNodes) const override; |
| 118 | |
| 119 | //! This method returns map of all nodes the object consist of. <br> |
| 120 | Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllNodes() const override; |
| 121 | |
| 122 | //! This method returns map of all elements the object consist of. <br> |
| 123 | Standard_EXPORT const TColStd_PackedMapOfInteger& GetAllElements() const override; |
| 124 | |
| 125 | //! This method calculates normal of face, which is using for correct reflection presentation. <br> |
| 126 | //! There is default method, for advance reflection this method can be redefined. <br> |
| 127 | Standard_EXPORT Standard_Boolean GetNormal(const Standard_Integer Id,const Standard_Integer Max,Standard_Real& nx,Standard_Real& ny,Standard_Real& nz) const override; |
| 128 | |
| 129 | //! This method returns map of all groups the object contains. <br> |
| 130 | Standard_EXPORT void GetAllGroups(TColStd_PackedMapOfInteger& Ids) const override; |
| 131 | |
| 132 | // Type management |
| 133 | // |
| 134 | #if OCC_VERSION_HEX >= 0x070000 |
| 135 | DEFINE_STANDARD_RTTIEXT(SMESH_MeshVSLink,MeshVS_DataSource3D) |
| 136 | #else |
| 137 | Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; |
| 138 | #endif |
| 139 | |
| 140 | protected: |
| 141 | // Methods PROTECTED |
| 142 | // |
| 143 | |
| 144 | // Fields PROTECTED |
| 145 | // |
| 146 | |
| 147 | private: |
| 148 | // Methods PRIVATE |
| 149 | // |
| 150 | |
| 151 | // Fields PRIVATE |
| 152 | // |
| 153 | SMESH_Mesh *myMesh; |
| 154 | TColStd_PackedMapOfInteger myNodes; |
| 155 | TColStd_PackedMapOfInteger myElements; |
| 156 | TColStd_PackedMapOfInteger myGroups; |
| 157 | }; |
| 158 | #include <SMESH_MeshVSLink.ixx> |
| 159 | // other Inline functions and methods (like "C++: function call" methods) |
| 160 | // |
| 161 | #endif |