1 -- Created on: 2003-10-10
2 -- Created by: Alexander SOLOVYOV
3 -- Copyright (c) 2003-2014 OPEN CASCADE SAS
5 -- This file is part of Open CASCADE Technology software library.
7 -- This library is free software; you can redistribute it and / or modify it
8 -- under the terms of the GNU Lesser General Public version 2.1 as published
9 -- by the Free Software Foundation, with special exception defined in the file
10 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 -- distribution for complete text of the license and disclaimer of any warranty.
13 -- Alternatively, this file may be used under the terms of Open CASCADE
14 -- commercial license or contractual agreement.
16 deferred class DataSource from MeshVS inherits TShared from MMgt
18 ---Purpose: The deferred class using for the following tasks:
19 -- 1) Receiving geometry data about single element of node by its number;
20 -- 2) Receiving type of element or node by its number;
21 -- 3) Receiving topological information about links between element and nodes it consist of;
22 -- 4) Receiving information about what element cover this node;
23 -- 5) Receiving information about all nodes and elements the object consist of
24 -- 6) Activation of advanced mesh selection. In the advanced mesh selection mode there is created:
25 -- - one owner for the whole mesh and for all selection modes
26 -- - one sensitive entity for the whole mesh and for each selection mode
27 -- Receiving of IDs of detected entities (nodes and elements) in a viewer is achieved by
28 -- implementation of a group of methods GetDetectedEntities.
31 Integer from Standard,
32 Boolean from Standard,
33 Address from Standard,
35 Array1OfReal from TColStd,
36 Array1OfInteger from TColStd,
37 PackedMapOfInteger from TColStd,
38 HPackedMapOfInteger from TColStd,
39 HArray1OfReal from TColStd,
40 Array1OfPnt2d from TColgp,
42 EntityType from MeshVS,
43 HArray1OfSequenceOfInteger from MeshVS,
52 GetGeom ( me; ID : Integer;
54 Coords : out Array1OfReal from TColStd;
55 NbNodes : out Integer;
56 Type : out EntityType from MeshVS ) returns Boolean is deferred;
57 ---Purpose: Returns geometry information about node or element
58 -- ID is the numerical identificator of node or element
59 -- IsElement indicates this ID describe node ( if Standard_False ) or element ( if Standard_True )
60 -- Coords is an array of co-ordinates of node(s).
61 -- For node it is only 3 numbers: X, Y, Z in the strict order
62 -- For element it is 3*n numbers, where n is number of this element vertices
63 -- The order is strict also: X1, Y1, Z1, X2,...., where Xi, Yi, Zi are co-ordinates of vertices
64 -- NbNodes is number of nodes. It is recommended this parameter to be set to 1 for node.
65 -- Type is type of node or element (from enumeration). It is recommended this parameter to be set to
66 -- MeshVS_ET_Node for node.
68 GetGeomType ( me; ID : Integer;
70 Type : out EntityType from MeshVS ) returns Boolean is deferred;
71 ---Purpose: This method is similar to GetGeom, but returns only element or node type.
72 --This method is provided for finer performance.
74 Get3DGeom( me; ID : Integer;
75 NbNodes : out Integer;
76 Data : out HArray1OfSequenceOfInteger from MeshVS ) returns Boolean is virtual;
77 ---Purpose: This method returns topology information about 3D-element
78 -- Returns false if element with ID isn't 3D or because other troubles
81 GetAddr ( me; ID : Integer;
82 IsElement : Boolean ) returns Address is deferred;
83 ---Purpose: This method returns pointer which represents element or node data structure.
84 -- This address will be saved in MeshVS_MeshEntityOwner, so that you can access to data structure fast
85 -- by the method Owner(). In the redefined method you can return NULL.
86 -- ID is the numerical identificator of node or element
87 -- IsElement indicates this ID describe node ( if Standard_False ) or element ( if Standard_True )
89 GetNodesByElement ( me; ID : Integer;
90 NodeIDs : out Array1OfInteger from TColStd;
91 NbNodes : out Integer ) returns Boolean is deferred;
92 ---Purpose: This method returns information about nodes this element consist of.
93 -- ID is the numerical identificator of element.
94 -- NodeIDs is the output array of nodes IDs in correct order,
95 -- the same as coordinates returned by GetGeom().
96 -- NbNodes is number of nodes (number of items set in NodeIDs).
97 -- Returns False if element does not exist
99 GetAllNodes ( me ) returns PackedMapOfInteger from TColStd is deferred;
100 ---C++: return const &
101 ---Purpose: This method returns map of all nodes the object consist of.
103 GetAllElements ( me ) returns PackedMapOfInteger from TColStd is deferred;
104 ---C++: return const &
105 ---Purpose: This method returns map of all elements the object consist of.
107 GetNormal ( me; Id : Integer; Max : Integer;
108 nx, ny, nz : out Real ) returns Boolean is virtual;
109 ---Purpose: This method calculates normal of face, which is using for correct reflection presentation.
110 -- There is default method, for advance reflection this method can be redefined.
111 -- Id is the numerical identificator of only element!
112 -- Max is maximal number of nodes an element can consist of
113 -- nx, ny, nz are values whose represent co-ordinates of normal (will be returned)
114 -- In the redefined method you can return normal with length more then 1, but in this case
115 -- the appearance of element will be more bright than usual. For ordinary brightness you must return
116 -- normal with length 1
118 GetNodeNormal ( me; ranknode : Integer; ElementId : Integer;
119 nx, ny, nz : out Real ) returns Boolean is virtual;
120 ---Purpose: This method return normal of node ranknode of face Id,
121 -- which is using for smooth shading presentation.
122 -- Returns false if normal isn't defined.
124 GetNormalsByElement( me; Id : Integer;
127 Normals : out HArray1OfReal from TColStd ) returns Boolean is virtual;
128 ---Purpose: This method puts components of normal vectors at each node of a mesh face (at each face of a mesh volume)
129 -- into the output array.
130 -- Returns false if some problem was detected during calculation of normals.
131 -- Id is an identifier of the mesh element.
132 -- IsNodal, when true, means that normals at mesh element nodes are needed. If nodal normals
133 -- are not available, or IsNodal is false, or the mesh element is a volume, then the output array contents
134 -- depend on the element type:
135 -- face: a normal calculated by GetNormal() is duplicated for each node of the face;
136 -- volume: normals to all faces of the volume are computed (not for each node!).
137 -- MaxNodes is maximal number of nodes an element can consist of.
138 -- Normals contains the result.
140 GetAllGroups ( me; Ids : out PackedMapOfInteger from TColStd ) is virtual;
141 ---Purpose: This method returns map of all groups the object contains.
143 GetGroup ( me; Id : Integer; Type : out EntityType from MeshVS;
144 Ids : out PackedMapOfInteger from TColStd ) returns Boolean is virtual;
145 ---Purpose: This method returns map of all group elements.
147 GetGroupAddr ( me; ID : Integer ) returns Address is virtual;
148 ---Purpose: This method returns pointer which represents group data structure.
149 -- This address will be saved in MeshVS_MeshOwner, so that you can access to data structure fast
150 -- by the method Owner(). In the redefined method you can return NULL.
151 -- ID is the numerical identificator of group
153 IsAdvancedSelectionEnabled( me )
154 returns Boolean from Standard is virtual;
155 ---Purpose: Returns True if advanced mesh selection is enabled.
156 -- Default implementation returns False.
157 -- It should be redefined to return True for advanced
158 -- mesh selection activation.
160 GetBoundingBox( me ) returns Box from Bnd is virtual;
161 ---Purpose: Returns the bounding box of the whole mesh.
162 -- It is used in advanced selection mode to define roughly
163 -- the sensitive area of the mesh.
164 -- It can be redefined to get access to a box computed in advance.
166 GetDetectedEntities( me : mutable; Prs : Mesh from MeshVS;
167 X,Y : Real from Standard;
168 aTol : Real from Standard;
169 Nodes : out HPackedMapOfInteger from TColStd;
170 Elements : out HPackedMapOfInteger from TColStd;
171 DMin : out Real from Standard )
172 returns Boolean is virtual;
173 ---Purpose: Returns maps of entities (nodes and elements) detected
174 -- by mouse click at the point (X,Y) on the current view plane,
175 -- with the tolerance aTol.
176 -- DMin - is out argument should return actual detection tolerance.
177 -- Returns True if something is detected.
178 -- It should be redefined if the advanced mesh selection is
179 -- activated. Default implementation returns False.
181 GetDetectedEntities( me : mutable; Prs : Mesh from MeshVS;
182 XMin, YMin, XMax, YMax : Real;
184 Nodes : out HPackedMapOfInteger from TColStd;
185 Elements : out HPackedMapOfInteger from TColStd )
186 returns Boolean is virtual;
187 ---Purpose: Returns maps of entities (nodes and elements) detected
188 -- by mouse selection with rectangular box (XMin, YMin, XMax, YMax)
189 -- on the current veiw plane, with the tolerance aTol.
190 -- Returns True if something is detected.
191 -- It should be redefined if the advanced mesh selection is
192 -- activated. Default implementation returns False.
194 GetDetectedEntities( me : mutable; Prs : Mesh from MeshVS;
195 Polyline : Array1OfPnt2d from TColgp;
198 Nodes : out HPackedMapOfInteger from TColStd;
199 Elements : out HPackedMapOfInteger from TColStd )
200 returns Boolean is virtual;
201 ---Purpose: Returns maps of entities (nodes and elements) detected
202 -- by mouse selection with the polyline <Polyline>
203 -- on the current veiw plane, with the tolerance aTol.
204 -- Returns True if something is detected.
205 -- It should be redefined if the advanced mesh selection is
206 -- activated. Default implementation returns False.
208 GetDetectedEntities( me : mutable; Prs : Mesh from MeshVS;
209 Nodes : in out HPackedMapOfInteger from TColStd;
210 Elements : in out HPackedMapOfInteger from TColStd )
211 returns Boolean is virtual;
212 ---Purpose: Filter out the maps of mesh entities so as to keep
213 -- only the entities that are allowed to be selected
214 -- according to the current context.
215 -- Returns True if any of the maps has been changed.
216 -- It should be redefined if the advanced mesh selection is
217 -- activated. Default implementation returns False.