]> SALOME platform Git repositories - modules/hexablock.git/blob - src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx
Salome HOME
Merge from V6_main 01/04/2013
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_DocumentItem.hxx
1 // Copyright (C) 2009-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _HEXABLOCKGUI_DOCUMENTITEM_HXX_
21 #define _HEXABLOCKGUI_DOCUMENTITEM_HXX_
22
23
24 #include <QStandardItem>
25
26 #include <HexVertex.hxx>
27 #include <HexEdge.hxx>
28 #include <HexQuad.hxx>
29 #include <HexHexa.hxx>
30
31
32 #include <HexVector.hxx>
33 #include <HexCylinder.hxx>
34 #include <HexPipe.hxx>
35 #include <HexElements.hxx>
36 #include <HexCrossElements.hxx>
37 #include <HexNewShape.hxx>
38 #include <HexVertexShape.hxx>
39 #include <HexEdgeShape.hxx>
40 #include <HexFaceShape.hxx>
41
42
43
44 #include <HexGroup.hxx>
45 #include <HexLaw.hxx>
46 #include <HexPropagation.hxx>
47
48 #include "vtkActor.h"
49
50
51 Q_DECLARE_METATYPE( HEXA_NS::EltBase* );
52 Q_DECLARE_METATYPE( HEXA_NS::Vertex* );
53 Q_DECLARE_METATYPE( HEXA_NS::Edge* );
54 Q_DECLARE_METATYPE( HEXA_NS::Quad* );
55 Q_DECLARE_METATYPE( HEXA_NS::Hexa* );
56
57 Q_DECLARE_METATYPE( HEXA_NS::Vector* );
58 Q_DECLARE_METATYPE( HEXA_NS::Cylinder* );
59 Q_DECLARE_METATYPE( HEXA_NS::Pipe* );
60 Q_DECLARE_METATYPE( HEXA_NS::Elements* );
61 Q_DECLARE_METATYPE( HEXA_NS::CrossElements* );
62 Q_DECLARE_METATYPE( HEXA_NS::NewShape* );
63 Q_DECLARE_METATYPE( HEXA_NS::VertexShape* );
64 Q_DECLARE_METATYPE( HEXA_NS::EdgeShape* );
65 Q_DECLARE_METATYPE( HEXA_NS::FaceShape* );
66
67 Q_DECLARE_METATYPE( HEXA_NS::Group* );
68 Q_DECLARE_METATYPE( HEXA_NS::Law* );
69 Q_DECLARE_METATYPE( HEXA_NS::Propagation* );
70
71
72
73 // Q_DECLARE_METATYPE( QList<HEXA_NS::Shape*> ); // association
74
75 namespace HEXABLOCK
76 {
77   namespace GUI
78   {
79     enum HexaType {
80       VERTEXITEM = QStandardItem::UserType + 1,
81       EDGEITEM,
82       QUADITEM,
83       HEXAITEM,
84
85       VECTORITEM,
86       CYLINDERITEM,
87       PIPEITEM,
88       ELEMENTSITEM,
89       CROSSELEMENTSITEM,
90
91       EXPSHAPEITEM,
92       IMPSHAPEITEM,
93       CLOUDOFPOINTSITEM,
94       GEOMSHAPEITEM,
95       GEOMPOINTITEM,
96       GEOMEDGEITEM,
97       GEOMFACEITEM,
98
99       GROUPITEM,
100       LAWITEM,
101       PROPAGATIONITEM,
102     };
103
104     enum HexaTreeRole { 
105       VERTEX_TREE = 10,
106       EDGE_TREE,
107       QUAD_TREE,
108       HEXA_TREE,
109
110       VECTOR_TREE,
111       CYLINDER_TREE,
112       PIPE_TREE,
113       ELEMENTS_TREE,
114       CROSSELEMENTS_TREE,
115
116       EXPLICIT_SHAPES_TREE,
117       IMPLICIT_SHAPES_TREE,
118       CLOUD_OF_POINTS_TREE,
119       GEOMSHAPE_TREE,
120       GEOMPOINT_TREE,
121       GEOMEDGE_TREE,
122       GEOMFACE_TREE,
123
124
125       GROUP_TREE,
126       LAW_TREE,
127       PROPAGATION_TREE,
128
129       VERTEX_DIR_TREE,
130       EDGE_DIR_TREE,
131       QUAD_DIR_TREE,
132       HEXA_DIR_TREE,
133
134       VECTOR_DIR_TREE,
135       CYLINDER_DIR_TREE,
136       PIPE_DIR_TREE,
137       ELEMENTS_DIR_TREE,
138       CROSSELEMENTS_DIR_TREE,
139
140       EXPLICIT_SHAPES_DIR_TREE,
141       IMPLICIT_SHAPES_DIR_TREE,
142       CLOUD_OF_POINTS_DIR_TREE,
143       GEOMSHAPE_DIR_TREE,
144       GEOMPOINT_DIR_TREE,
145       GEOMEDGE_DIR_TREE,
146       GEOMFACE_DIR_TREE,
147
148       GROUP_DIR_TREE,
149       LAW_DIR_TREE,
150       PROPAGATION_DIR_TREE
151
152     }; //HEXA_TREE_ROLE
153
154     enum {
155       HEXA_DATA_ROLE = Qt::UserRole + 1,
156       HEXA_DATA_ASSOC,
157       HEXA_TREE_ROLE,
158       HEXA_ENTRY_ROLE,
159       HEXA_DOC_ENTRY_ROLE,
160       HEXA_ASSOC_ENTRY_ROLE,
161     };
162
163 // QVariant::UserType
164
165     //===================================================================================
166     class ElementItem : public QStandardItem
167     {
168       public:
169         ElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole);
170         ElementItem( HEXA_NS::EltBase* docElement, HexaType ttype, HexaTreeRole treeRole);
171         virtual QVariant data( int role ) const;
172         virtual void     setData ( const QVariant& valcont, int role );
173         int      type () const;
174         virtual bool     isAssoc() const;
175         virtual QString  IDptr() const;
176
177       private:
178         int                m_type;
179         HEXA_NS::EltBase*  m_DocElt; // Vertex and so.
180     };
181     //===================================================================================
182
183     class GraphicElementItem : public ElementItem
184     {
185       public:
186         GraphicElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole):
187                 ElementItem( docElement, entry, ttype, treeRole)
188         {
189         }
190
191       private:
192         vtkActor* actor;
193         int       IDinActor;
194     };
195
196     class StandardElementItem : public ElementItem
197     {
198        public:
199         StandardElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole):
200                 ElementItem( docElement, entry, ttype, treeRole)
201         {
202         }
203     };
204
205     class VertexItem : public GraphicElementItem
206     {
207       public:
208         VertexItem( HEXA_NS::Vertex* hexaVertex, QString entry = "");
209     };
210
211     class EdgeItem : public GraphicElementItem
212     {
213       public:
214         EdgeItem( HEXA_NS::Edge* hexaEdge, QString entry = "");
215     };
216     //-----------------------------------------
217     class QuadItem : public GraphicElementItem
218     {
219       public:
220         QuadItem( HEXA_NS::Quad* hexaQuad, QString entry = "");
221     };
222     //-----------------------------------------
223
224     class HexaItem : public GraphicElementItem
225     {
226       public:
227         HexaItem( HEXA_NS::Hexa* hexaHexa, QString entry = "");
228     };
229     //-----------------------------------------
230
231     class VectorItem : public StandardElementItem
232     {
233       public:
234         VectorItem( HEXA_NS::Vector* hexaVector, QString entry = "");
235     };
236     //-----------------------------------------
237
238     class CylinderItem : public StandardElementItem
239     {
240       public:
241         CylinderItem( HEXA_NS::Cylinder* hexaCyl, QString entry = "");
242     };
243     //-----------------------------------------
244
245     class PipeItem : public StandardElementItem
246     {
247       public:
248         PipeItem( HEXA_NS::Pipe* hexaPipe, QString entry = "");
249     };
250     //-----------------------------------------
251
252     class ElementsItem : public StandardElementItem
253     {
254       public:
255         ElementsItem( HEXA_NS::Elements* hexaElements, QString entry = "" );
256     };
257     //-----------------------------------------
258     class CrossElementsItem : public StandardElementItem
259     {
260       public:
261         CrossElementsItem( HEXA_NS::CrossElements* hexaCrossElts, QString entry = "");
262     };
263
264     //------------------------------------------------
265     class GeomItem: public StandardElementItem
266     {
267     public:
268         GeomItem( HEXA_NS::EltBase* geomShape, QString entry, HexaType ttype, HexaTreeRole treeRole, HEXA_NS::EltBase* assoc = NULL );
269         HEXA_NS::EltBase* getAssociation() const { return association; }
270         void setAssociation(HEXA_NS::EltBase* assoc) { association = assoc; }
271
272     private:
273         HEXA_NS::EltBase* association;
274     };
275
276     //------------------------------------------------
277     class GeomShapeItem: public GeomItem
278     {
279     public:
280         GeomShapeItem( HEXA_NS::NewShape* shape, HEXA_NS::EltBase* assoc = NULL);
281     };
282
283     //------------------------------------------------
284     class GeomPointItem: public GeomItem
285     {
286     public:
287         GeomPointItem( HEXA_NS::VertexShape* geomPoint, HEXA_NS::Vertex* associatedVertex = NULL);
288     };
289
290     //------------------------------------------------
291     class GeomEdgeItem: public GeomItem
292     {
293     public:
294         GeomEdgeItem( HEXA_NS::EdgeShape* geomEdge, HEXA_NS::Edge* associatedEdge = NULL);
295     };
296
297     //------------------------------------------------
298     class GeomFaceItem: public GeomItem
299     {
300     public:
301         GeomFaceItem( HEXA_NS::FaceShape* geomFace, HEXA_NS::Quad* associatedQuad = NULL);
302     };
303
304     //-----------------------------------------
305     class GroupItem : public QStandardItem
306     {
307     public:
308         GroupItem( HEXA_NS::Group* hexaGroup );
309         virtual int type () const;
310         virtual QVariant data ( int role ) const;
311         virtual void setData ( const QVariant & value, int role ); //= Qt::UserRole + 1 )
312     private:
313         HEXA_NS::Group* _hexaGroup;
314     };
315
316
317     class LawItem : public QStandardItem
318     {
319     public:
320         LawItem( HEXA_NS::Law* hexaLaw );
321         virtual int type () const;
322         virtual QVariant data ( int role ) const;
323         virtual void setData ( const QVariant & value, int role ); //= Qt::UserRole + 1 )
324     private:
325         HEXA_NS::Law* _hexaLaw;
326     };
327
328
329     class PropagationItem : public QStandardItem
330     {
331     public:
332         PropagationItem( HEXA_NS::Propagation* hexaPropagation );
333         virtual int type () const;
334         virtual QVariant data ( int role ) const;
335         virtual void setData ( const QVariant & value, int role ); //= Qt::UserRole + 1 )
336     private:
337         HEXA_NS::Propagation* _hexaPropagation;
338     };
339     //-------------------------------------------------
340
341   }
342 }
343
344 #endif
345