Salome HOME
Porting HEXABLOCK module on WIN32 platform.
[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 #include "HEXABLOCKGUI_Export.hxx"
24
25 #include <QStandardItem>
26
27 #include <HexVertex.hxx>
28 #include <HexEdge.hxx>
29 #include <HexQuad.hxx>
30 #include <HexHexa.hxx>
31
32
33 #include <HexVector.hxx>
34 #include <HexCylinder.hxx>
35 #include <HexPipe.hxx>
36 #include <HexElements.hxx>
37 #include <HexCrossElements.hxx>
38 #include <HexNewShape.hxx>
39 #include <HexVertexShape.hxx>
40 #include <HexEdgeShape.hxx>
41 #include <HexFaceShape.hxx>
42
43
44
45 #include <HexGroup.hxx>
46 #include <HexLaw.hxx>
47 #include <HexPropagation.hxx>
48
49 #include "vtkActor.h"
50
51
52 Q_DECLARE_METATYPE( HEXA_NS::EltBase* );
53 Q_DECLARE_METATYPE( HEXA_NS::Vertex* );
54 Q_DECLARE_METATYPE( HEXA_NS::Edge* );
55 Q_DECLARE_METATYPE( HEXA_NS::Quad* );
56 Q_DECLARE_METATYPE( HEXA_NS::Hexa* );
57
58 Q_DECLARE_METATYPE( HEXA_NS::Vector* );
59 Q_DECLARE_METATYPE( HEXA_NS::Cylinder* );
60 Q_DECLARE_METATYPE( HEXA_NS::Pipe* );
61 Q_DECLARE_METATYPE( HEXA_NS::Elements* );
62 Q_DECLARE_METATYPE( HEXA_NS::CrossElements* );
63 Q_DECLARE_METATYPE( HEXA_NS::NewShape* );
64 Q_DECLARE_METATYPE( HEXA_NS::SubShape* );
65 Q_DECLARE_METATYPE( HEXA_NS::VertexShape* );
66 Q_DECLARE_METATYPE( HEXA_NS::EdgeShape* );
67 Q_DECLARE_METATYPE( HEXA_NS::FaceShape* );
68
69 Q_DECLARE_METATYPE( HEXA_NS::Group* );
70 Q_DECLARE_METATYPE( HEXA_NS::Law* );
71 Q_DECLARE_METATYPE( HEXA_NS::Propagation* );
72
73
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       ELEMENTSITEM,
87       CROSSELEMENTSITEM,
88
89       EXPSHAPEITEM,
90       IMPSHAPEITEM,
91       CLOUDOFPOINTSITEM,
92       GEOMSHAPEITEM,
93       GEOMPOINTITEM,
94       GEOMEDGEITEM,
95       GEOMFACEITEM,
96
97       GROUPITEM,
98       LAWITEM,
99       PROPAGATIONITEM,
100     };
101
102     enum HexaTreeRole { 
103       VERTEX_TREE = 10,
104       EDGE_TREE,
105       QUAD_TREE,
106       HEXA_TREE,
107
108       VECTOR_TREE,
109       ELEMENTS_TREE,
110       CROSSELEMENTS_TREE,
111
112       EXPLICIT_SHAPES_TREE,
113       IMPLICIT_SHAPES_TREE,
114       CLOUD_OF_POINTS_TREE,
115       GEOMSHAPE_TREE,
116       GEOMPOINT_TREE,
117       GEOMEDGE_TREE,
118       GEOMFACE_TREE,
119
120
121       GROUP_TREE,
122       LAW_TREE,
123       PROPAGATION_TREE,
124
125       VERTEX_DIR_TREE,
126       EDGE_DIR_TREE,
127       QUAD_DIR_TREE,
128       HEXA_DIR_TREE,
129
130       VECTOR_DIR_TREE,
131       ELEMENTS_DIR_TREE,
132       CROSSELEMENTS_DIR_TREE,
133
134       EXPLICIT_SHAPES_DIR_TREE,
135       IMPLICIT_SHAPES_DIR_TREE,
136       CLOUD_OF_POINTS_DIR_TREE,
137       GEOMSHAPE_DIR_TREE,
138       GEOMPOINT_DIR_TREE,
139       GEOMEDGE_DIR_TREE,
140       GEOMFACE_DIR_TREE,
141
142       GROUP_DIR_TREE,
143       LAW_DIR_TREE,
144       PROPAGATION_DIR_TREE
145
146     }; //HEXA_TREE_ROLE
147
148     enum {
149       HEXA_DATA_ROLE = Qt::UserRole + 1,
150       HEXA_DATA_ASSOC,
151       HEXA_TREE_ROLE,
152       HEXA_ENTRY_ROLE,
153       HEXA_DOC_ENTRY_ROLE,
154       HEXA_ASSOC_ENTRY_ROLE,
155     };
156
157 // QVariant::UserType
158
159     //===================================================================================
160     class HEXABLOCK_EXPORT ElementItem : public QStandardItem
161     {
162       public:
163         ElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole);
164         ElementItem( HEXA_NS::EltBase* docElement, HexaType ttype, HexaTreeRole treeRole);
165         virtual QVariant data( int role ) const;
166         virtual void     setData ( const QVariant& valcont, int role );
167         int      type () const;
168         virtual bool     isAssoc() const;
169         virtual QString  IDptr() const;
170         HEXA_NS::EltBase* getEltBase() const { return m_DocElt;}
171
172       private:
173         int                m_type;
174         HEXA_NS::EltBase*  m_DocElt;
175     };
176     //===================================================================================
177
178     class HEXABLOCK_EXPORT GraphicElementItem : public ElementItem
179     {
180       public:
181         GraphicElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole):
182                 ElementItem( docElement, entry, ttype, treeRole)
183         {
184         }
185
186       private:
187         vtkActor* actor;
188         int       IDinActor;
189     };
190
191     class HEXABLOCK_EXPORT StandardElementItem : public ElementItem
192     {
193        public:
194         StandardElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole):
195                 ElementItem( docElement, entry, ttype, treeRole)
196         {
197         }
198     };
199
200     class HEXABLOCK_EXPORT VertexItem : public GraphicElementItem
201     {
202       public:
203         VertexItem( HEXA_NS::Vertex* hexaVertex, QString entry = "");
204     };
205
206     class HEXABLOCK_EXPORT EdgeItem : public GraphicElementItem
207     {
208       public:
209         EdgeItem( HEXA_NS::Edge* hexaEdge, QString entry = "");
210     };
211     //-----------------------------------------
212     class HEXABLOCK_EXPORT QuadItem : public GraphicElementItem
213     {
214       public:
215         QuadItem( HEXA_NS::Quad* hexaQuad, QString entry = "");
216     };
217     //-----------------------------------------
218
219     class HEXABLOCK_EXPORT HexaItem : public GraphicElementItem
220     {
221       public:
222         HexaItem( HEXA_NS::Hexa* hexaHexa, QString entry = "");
223     };
224     //-----------------------------------------
225
226     class HEXABLOCK_EXPORT VectorItem : public StandardElementItem
227     {
228       public:
229         VectorItem( HEXA_NS::Vector* hexaVector, QString entry = "");
230     };
231     //-----------------------------------------
232
233 //    class HEXABLOCK_EXPORT CylinderItem : public StandardElementItem
234 //    {
235 //      public:
236 //        CylinderItem( HEXA_NS::Cylinder* hexaCyl, QString entry = "");
237 //    };
238     //-----------------------------------------
239
240 //    class PipeItem : public StandardElementItem
241 //    {
242 //      public:
243 //        PipeItem( HEXA_NS::Pipe* hexaPipe, QString entry = "");
244 //    };
245     //-----------------------------------------
246
247     class HEXABLOCK_EXPORT ElementsItem : public StandardElementItem
248     {
249       public:
250         ElementsItem( HEXA_NS::Elements* hexaElements, QString entry = "" );
251     };
252     //-----------------------------------------
253 //    class CrossElementsItem : public StandardElementItem
254 //    {
255 //      public:
256 //        CrossElementsItem( HEXA_NS::CrossElements* hexaCrossElts, QString entry = "");
257 //    };
258
259     //------------------------------------------------
260     class HEXABLOCK_EXPORT GeomItem: public StandardElementItem
261     {
262     public:
263         GeomItem( HEXA_NS::EltBase* geomShape, QString entry, HexaType ttype, HexaTreeRole treeRole, HEXA_NS::EltBase* assoc = NULL );
264         HEXA_NS::EltBase* getAssociation() const { return association; }
265         void setAssociation(HEXA_NS::EltBase* assoc) { association = assoc; }
266
267     private:
268         HEXA_NS::EltBase* association;
269     };
270
271     //------------------------------------------------
272     class HEXABLOCK_EXPORT GeomShapeItem: public GeomItem
273     {
274     public:
275         GeomShapeItem( HEXA_NS::NewShape* shape, HEXA_NS::EltBase* assoc = NULL);
276     };
277
278     //------------------------------------------------
279     class HEXABLOCK_EXPORT GeomPointItem: public GeomItem
280     {
281     public:
282         GeomPointItem( HEXA_NS::VertexShape* geomPoint, HEXA_NS::Vertex* associatedVertex = NULL);
283     };
284
285     //------------------------------------------------
286     class HEXABLOCK_EXPORT GeomEdgeItem: public GeomItem
287     {
288     public:
289         GeomEdgeItem( HEXA_NS::EdgeShape* geomEdge, HEXA_NS::Edge* associatedEdge = NULL);
290     };
291
292     //------------------------------------------------
293     class HEXABLOCK_EXPORT GeomFaceItem: public GeomItem
294     {
295     public:
296         GeomFaceItem( HEXA_NS::FaceShape* geomFace, HEXA_NS::Quad* associatedQuad = NULL);
297     };
298
299     //-----------------------------------------
300     class HEXABLOCK_EXPORT GroupItem : public QStandardItem
301     {
302     public:
303         GroupItem( HEXA_NS::Group* hexaGroup );
304         virtual int type () const;
305         virtual QVariant data ( int role ) const;
306         virtual void setData ( const QVariant & value, int role ); //= Qt::UserRole + 1 )
307     private:
308         HEXA_NS::Group* _hexaGroup;
309     };
310
311
312     class HEXABLOCK_EXPORT LawItem : public QStandardItem
313     {
314     public:
315         LawItem( HEXA_NS::Law* hexaLaw );
316         virtual int type () const;
317         virtual QVariant data ( int role ) const;
318         virtual void setData ( const QVariant & value, int role ); //= Qt::UserRole + 1 )
319     private:
320         HEXA_NS::Law* _hexaLaw;
321     };
322
323
324     class HEXABLOCK_EXPORT PropagationItem : public QStandardItem
325     {
326     public:
327         PropagationItem( HEXA_NS::Propagation* hexaPropagation );
328         virtual int type () const;
329         virtual QVariant data ( int role ) const;
330         virtual void setData ( const QVariant & value, int role ); //= Qt::UserRole + 1 )
331     private:
332         HEXA_NS::Propagation* _hexaPropagation;
333     };
334     //-------------------------------------------------
335
336   }
337 }
338
339 #endif
340