1 // Copyright (C) 2009-2012 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _HEXABLOCKGUI_DOCUMENTITEM_HXX_
21 #define _HEXABLOCKGUI_DOCUMENTITEM_HXX_
24 #include <QStandardItem>
26 #include <HexVertex.hxx>
27 #include <HexEdge.hxx>
28 #include <HexQuad.hxx>
29 #include <HexHexa.hxx>
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>
44 #include <HexGroup.hxx>
46 #include <HexPropagation.hxx>
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* );
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* );
67 Q_DECLARE_METATYPE( HEXA_NS::Group* );
68 Q_DECLARE_METATYPE( HEXA_NS::Law* );
69 Q_DECLARE_METATYPE( HEXA_NS::Propagation* );
73 // Q_DECLARE_METATYPE( QList<HEXA_NS::Shape*> ); // association
80 VERTEXITEM = QStandardItem::UserType + 1,
116 EXPLICIT_SHAPES_TREE,
117 IMPLICIT_SHAPES_TREE,
118 CLOUD_OF_POINTS_TREE,
138 CROSSELEMENTS_DIR_TREE,
140 EXPLICIT_SHAPES_DIR_TREE,
141 IMPLICIT_SHAPES_DIR_TREE,
142 CLOUD_OF_POINTS_DIR_TREE,
155 HEXA_DATA_ROLE = Qt::UserRole + 1,
160 HEXA_ASSOC_ENTRY_ROLE,
163 // QVariant::UserType
165 //===================================================================================
166 class ElementItem : public QStandardItem
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 );
174 virtual bool isAssoc() const;
175 virtual QString IDptr() const;
179 HEXA_NS::EltBase* m_DocElt; // Vertex and so.
181 //===================================================================================
183 class GraphicElementItem : public ElementItem
186 GraphicElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole):
187 ElementItem( docElement, entry, ttype, treeRole)
196 class StandardElementItem : public ElementItem
199 StandardElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole):
200 ElementItem( docElement, entry, ttype, treeRole)
205 class VertexItem : public GraphicElementItem
208 VertexItem( HEXA_NS::Vertex* hexaVertex, QString entry = "");
211 class EdgeItem : public GraphicElementItem
214 EdgeItem( HEXA_NS::Edge* hexaEdge, QString entry = "");
216 //-----------------------------------------
217 class QuadItem : public GraphicElementItem
220 QuadItem( HEXA_NS::Quad* hexaQuad, QString entry = "");
222 //-----------------------------------------
224 class HexaItem : public GraphicElementItem
227 HexaItem( HEXA_NS::Hexa* hexaHexa, QString entry = "");
229 //-----------------------------------------
231 class VectorItem : public StandardElementItem
234 VectorItem( HEXA_NS::Vector* hexaVector, QString entry = "");
236 //-----------------------------------------
238 class CylinderItem : public StandardElementItem
241 CylinderItem( HEXA_NS::Cylinder* hexaCyl, QString entry = "");
243 //-----------------------------------------
245 class PipeItem : public StandardElementItem
248 PipeItem( HEXA_NS::Pipe* hexaPipe, QString entry = "");
250 //-----------------------------------------
252 class ElementsItem : public StandardElementItem
255 ElementsItem( HEXA_NS::Elements* hexaElements, QString entry = "" );
257 //-----------------------------------------
258 class CrossElementsItem : public StandardElementItem
261 CrossElementsItem( HEXA_NS::CrossElements* hexaCrossElts, QString entry = "");
264 //------------------------------------------------
265 class GeomItem: public StandardElementItem
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; }
273 HEXA_NS::EltBase* association;
276 //------------------------------------------------
277 class GeomShapeItem: public GeomItem
280 GeomShapeItem( HEXA_NS::NewShape* shape, HEXA_NS::EltBase* assoc = NULL);
283 //------------------------------------------------
284 class GeomPointItem: public GeomItem
287 GeomPointItem( HEXA_NS::VertexShape* geomPoint, HEXA_NS::Vertex* associatedVertex = NULL);
290 //------------------------------------------------
291 class GeomEdgeItem: public GeomItem
294 GeomEdgeItem( HEXA_NS::EdgeShape* geomEdge, HEXA_NS::Edge* associatedEdge = NULL);
297 //------------------------------------------------
298 class GeomFaceItem: public GeomItem
301 GeomFaceItem( HEXA_NS::FaceShape* geomFace, HEXA_NS::Quad* associatedQuad = NULL);
304 //-----------------------------------------
305 class GroupItem : public QStandardItem
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 )
313 HEXA_NS::Group* _hexaGroup;
317 class LawItem : public QStandardItem
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 )
325 HEXA_NS::Law* _hexaLaw;
329 class PropagationItem : public QStandardItem
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 )
337 HEXA_NS::Propagation* _hexaPropagation;
339 //-------------------------------------------------