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