|
||||
File indexing completed on 2025-01-18 10:04:15
0001 // Created on: 2003-10-10 0002 // Created by: Alexander SOLOVYOV 0003 // Copyright (c) 2003-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 _MeshVS_DataSource_HeaderFile 0017 #define _MeshVS_DataSource_HeaderFile 0018 0019 #include <Standard.hxx> 0020 #include <Standard_Type.hxx> 0021 0022 #include <Standard_Transient.hxx> 0023 #include <Standard_Integer.hxx> 0024 #include <MeshVS_EntityType.hxx> 0025 #include <MeshVS_HArray1OfSequenceOfInteger.hxx> 0026 #include <TColStd_Array1OfInteger.hxx> 0027 #include <TColStd_PackedMapOfInteger.hxx> 0028 #include <TColStd_HArray1OfReal.hxx> 0029 #include <TColgp_Array1OfPnt2d.hxx> 0030 class Bnd_Box; 0031 class MeshVS_Mesh; 0032 class TColStd_HPackedMapOfInteger; 0033 class Bnd_Box2d; 0034 0035 0036 class MeshVS_DataSource; 0037 DEFINE_STANDARD_HANDLE(MeshVS_DataSource, Standard_Transient) 0038 0039 //! The deferred class using for the following tasks: 0040 //! 1) Receiving geometry data about single element of node by its number; 0041 //! 2) Receiving type of element or node by its number; 0042 //! 3) Receiving topological information about links between element and nodes it consist of; 0043 //! 4) Receiving information about what element cover this node; 0044 //! 5) Receiving information about all nodes and elements the object consist of 0045 //! 6) Activation of advanced mesh selection. In the advanced mesh selection mode there is created: 0046 //! - one owner for the whole mesh and for all selection modes 0047 //! - one sensitive entity for the whole mesh and for each selection mode 0048 //! Receiving of IDs of detected entities (nodes and elements) in a viewer is achieved by 0049 //! implementation of a group of methods GetDetectedEntities. 0050 class MeshVS_DataSource : public Standard_Transient 0051 { 0052 0053 public: 0054 0055 0056 //! Returns geometry information about node or element 0057 //! ID is the numerical identificator of node or element 0058 //! IsElement indicates this ID describe node ( if Standard_False ) or element ( if Standard_True ) 0059 //! Coords is an array of coordinates of node(s). 0060 //! For node it is only 3 numbers: X, Y, Z in the strict order 0061 //! For element it is 3*n numbers, where n is number of this element vertices 0062 //! The order is strict also: X1, Y1, Z1, X2,...., where Xi, Yi, Zi are coordinates of vertices 0063 //! NbNodes is number of nodes. It is recommended this parameter to be set to 1 for node. 0064 //! Type is type of node or element (from enumeration). It is recommended this parameter to be set to 0065 //! MeshVS_ET_Node for node. 0066 Standard_EXPORT virtual Standard_Boolean GetGeom (const Standard_Integer ID, const Standard_Boolean IsElement, TColStd_Array1OfReal& Coords, Standard_Integer& NbNodes, MeshVS_EntityType& Type) const = 0; 0067 0068 //! This method is similar to GetGeom, but returns only element or node type. 0069 Standard_EXPORT virtual Standard_Boolean GetGeomType (const Standard_Integer ID, const Standard_Boolean IsElement, MeshVS_EntityType& Type) const = 0; 0070 0071 //! This method returns topology information about 3D-element 0072 //! Returns false if element with ID isn't 3D or because other troubles 0073 Standard_EXPORT virtual Standard_Boolean Get3DGeom (const Standard_Integer ID, Standard_Integer& NbNodes, Handle(MeshVS_HArray1OfSequenceOfInteger)& Data) const; 0074 0075 //! This method returns pointer which represents element or node data structure. 0076 //! This address will be saved in MeshVS_MeshEntityOwner, so that you can access to data structure fast 0077 //! by the method Owner(). In the redefined method you can return NULL. 0078 //! ID is the numerical identificator of node or element 0079 //! IsElement indicates this ID describe node ( if Standard_False ) or element ( if Standard_True ) 0080 Standard_EXPORT virtual Standard_Address GetAddr (const Standard_Integer ID, const Standard_Boolean IsElement) const = 0; 0081 0082 //! This method returns information about nodes this element consist of. 0083 //! ID is the numerical identificator of element. 0084 //! NodeIDs is the output array of nodes IDs in correct order, 0085 //! the same as coordinates returned by GetGeom(). 0086 //! NbNodes is number of nodes (number of items set in NodeIDs). 0087 //! Returns False if element does not exist 0088 Standard_EXPORT virtual Standard_Boolean GetNodesByElement (const Standard_Integer ID, TColStd_Array1OfInteger& NodeIDs, Standard_Integer& NbNodes) const = 0; 0089 0090 //! This method returns map of all nodes the object consist of. 0091 Standard_EXPORT virtual const TColStd_PackedMapOfInteger& GetAllNodes() const = 0; 0092 0093 //! This method returns map of all elements the object consist of. 0094 Standard_EXPORT virtual const TColStd_PackedMapOfInteger& GetAllElements() const = 0; 0095 0096 //! This method calculates normal of face, which is using for correct reflection presentation. 0097 //! There is default method, for advance reflection this method can be redefined. 0098 //! Id is the numerical identificator of only element! 0099 //! Max is maximal number of nodes an element can consist of 0100 //! nx, ny, nz are values whose represent coordinates of normal (will be returned) 0101 //! In the redefined method you can return normal with length more then 1, but in this case 0102 //! the appearance of element will be more bright than usual. For ordinary brightness you must return 0103 //! normal with length 1 0104 Standard_EXPORT virtual Standard_Boolean GetNormal (const Standard_Integer Id, const Standard_Integer Max, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const; 0105 0106 //! This method return normal of node ranknode of face Id, 0107 //! which is using for smooth shading presentation. 0108 //! Returns false if normal isn't defined. 0109 Standard_EXPORT virtual Standard_Boolean GetNodeNormal (const Standard_Integer ranknode, const Standard_Integer ElementId, Standard_Real& nx, Standard_Real& ny, Standard_Real& nz) const; 0110 0111 //! This method puts components of normal vectors at each node of a mesh face (at each face of a mesh volume) 0112 //! into the output array. 0113 //! Returns false if some problem was detected during calculation of normals. 0114 //! Id is an identifier of the mesh element. 0115 //! IsNodal, when true, means that normals at mesh element nodes are needed. If nodal normals 0116 //! are not available, or IsNodal is false, or the mesh element is a volume, then the output array contents 0117 //! depend on the element type: 0118 //! face: a normal calculated by GetNormal() is duplicated for each node of the face; 0119 //! volume: normals to all faces of the volume are computed (not for each node!). 0120 //! MaxNodes is maximal number of nodes an element can consist of. 0121 //! Normals contains the result. 0122 Standard_EXPORT virtual Standard_Boolean GetNormalsByElement (const Standard_Integer Id, const Standard_Boolean IsNodal, const Standard_Integer MaxNodes, Handle(TColStd_HArray1OfReal)& Normals) const; 0123 0124 //! This method returns map of all groups the object contains. 0125 Standard_EXPORT virtual void GetAllGroups (TColStd_PackedMapOfInteger& Ids) const; 0126 0127 //! This method returns map of all group elements. 0128 Standard_EXPORT virtual Standard_Boolean GetGroup (const Standard_Integer Id, MeshVS_EntityType& Type, TColStd_PackedMapOfInteger& Ids) const; 0129 0130 //! This method returns pointer which represents group data structure. 0131 //! This address will be saved in MeshVS_MeshOwner, so that you can access to data structure fast 0132 //! by the method Owner(). In the redefined method you can return NULL. 0133 //! ID is the numerical identificator of group 0134 Standard_EXPORT virtual Standard_Address GetGroupAddr (const Standard_Integer ID) const; 0135 0136 //! Returns True if advanced mesh selection is enabled. 0137 //! Default implementation returns False. 0138 //! It should be redefined to return True for advanced 0139 //! mesh selection activation. 0140 Standard_EXPORT virtual Standard_Boolean IsAdvancedSelectionEnabled() const; 0141 0142 //! Returns the bounding box of the whole mesh. 0143 //! It is used in advanced selection mode to define roughly 0144 //! the sensitive area of the mesh. 0145 //! It can be redefined to get access to a box computed in advance. 0146 Standard_EXPORT virtual Bnd_Box GetBoundingBox() const; 0147 0148 //! Returns maps of entities (nodes and elements) detected 0149 //! by mouse click at the point (X,Y) on the current view plane, 0150 //! with the tolerance aTol. 0151 //! DMin - is out argument should return actual detection tolerance. 0152 //! Returns True if something is detected. 0153 //! It should be redefined if the advanced mesh selection is 0154 //! activated. Default implementation returns False. 0155 Standard_EXPORT virtual 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, Standard_Real& DMin); 0156 0157 //! Returns maps of entities (nodes and elements) detected 0158 //! by mouse selection with rectangular box (XMin, YMin, XMax, YMax) 0159 //! on the current view plane, with the tolerance aTol. 0160 //! Returns True if something is detected. 0161 //! It should be redefined if the advanced mesh selection is 0162 //! activated. Default implementation returns False. 0163 Standard_EXPORT virtual 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); 0164 0165 //! Returns maps of entities (nodes and elements) detected 0166 //! by mouse selection with the polyline <Polyline> 0167 //! on the current view plane, with the tolerance aTol. 0168 //! Returns True if something is detected. 0169 //! It should be redefined if the advanced mesh selection is 0170 //! activated. Default implementation returns False. 0171 Standard_EXPORT virtual 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); 0172 0173 //! Filter out the maps of mesh entities so as to keep 0174 //! only the entities that are allowed to be selected 0175 //! according to the current context. 0176 //! Returns True if any of the maps has been changed. 0177 //! It should be redefined if the advanced mesh selection is 0178 //! activated. Default implementation returns False. 0179 Standard_EXPORT virtual Standard_Boolean GetDetectedEntities (const Handle(MeshVS_Mesh)& Prs, Handle(TColStd_HPackedMapOfInteger)& Nodes, Handle(TColStd_HPackedMapOfInteger)& Elements); 0180 0181 DEFINE_STANDARD_RTTIEXT(MeshVS_DataSource,Standard_Transient) 0182 0183 }; 0184 0185 #endif // _MeshVS_DataSource_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |