Salome HOME
a8892492aeb15f5fe70a79c0f87f2f0709826f33
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_VtkDocumentGraphicView.cxx
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 //#define _DEVDEBUG_
21
22 #include <sstream>
23
24 #include <iostream>
25
26 #include <math.h>
27
28 #include "utilities.h"
29
30 #include <QtGui>
31
32
33 #include <LightApp_Application.h>
34
35 #include <SUIT_ViewManager.h>
36 #include <SUIT_ViewWindow.h>
37 #include <SVTK_ViewManager.h>
38 #include <SVTK_ViewModel.h>
39 #include <SVTK_ViewWindow.h>
40 #include <SVTK_Prs.h>
41 #include <SALOME_Actor.h>
42 #include <VTKViewer_Algorithm.h>
43 #include <SalomeApp_Study.h>
44
45 // VTK includes
46 #include <vtkRenderer.h>
47 #include <vtkActorCollection.h>
48 #include <vtkUnstructuredGrid.h>
49 #include <vtkRenderWindowInteractor.h>
50 #include <vtkSmartPointer.h>
51 #include <SVTK_View.h>
52 // test tutorial (sphere)
53 #include <vtkPolyDataMapper.h>
54 #include <vtkSphereSource.h>
55
56 // test point (cf. SMESHGUI)
57 #include <vtkIdList.h>
58 #include <vtkCellArray.h>
59 #include <vtkUnsignedCharArray.h>
60 #include <vtkUnstructuredGrid.h>
61 #include <vtkDataSetMapper.h>
62 #include <vtkProperty.h>
63 #include <vtkLineSource.h>
64
65 #include <vtkLine.h>
66 #include <vtkQuad.h>
67 #include <vtkHexahedron.h>
68
69 #include "vtkLookupTable.h"
70 #include "vtkPoints.h"
71 #include "vtkCellArray.h"
72 #include "vtkFloatArray.h"
73 #include "vtkPolyData.h"
74 #include "vtkPolyDataMapper.h"
75 #include "vtkActor.h"
76 #include "vtkPointData.h"
77 #include "vtkProperty.h"
78
79
80 // #include "vtkStructuredGridReader.h"
81 #include "vtkUnstructuredGridReader.h"
82
83 #include <VTKViewer_CellLocationsArray.h>
84
85
86
87
88
89 #ifndef M_PI
90 #define M_PI 3.1415927
91 #endif
92
93 #include "HEXABLOCKGUI_Trace.hxx"
94 #include "HEXABLOCKGUI_DocumentModel.hxx"
95 #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx"
96 #include "HEXABLOCKGUI.hxx"
97
98
99
100 using namespace std;
101 using namespace HEXABLOCK::GUI;
102 using namespace HEXA_NS;
103
104 Document_Actor::Document_Actor( Document* doc, const QString& entry ):
105           SALOME_Actor(),
106           _doc( doc )
107 {
108     DEBTRACE("Document_Actor::Document_Actor " << entry.toLatin1() );
109     Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject( entry.toLatin1(), "HEXABLOCK" );//,theName); CS_TODO
110     setIO(anIO);
111     vtkUnstructuredGrid* aGrid = getUnstructuredGrid();
112     //   std::cout << "Document_Actor aGrid->GetNumberOfCells() =>"<< aGrid->GetNumberOfCells();
113     vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
114     aMapper->SetInputData(aGrid);
115     aGrid->Delete();
116
117     SetVisibility( true );//VisibilityOff();
118     SetPickable( true ); //PickableOff();//
119     SetMapper( aMapper );
120     aMapper->Delete();
121
122     vtkProperty* aProp = vtkProperty::New();
123
124     //   aProp->SetRepresentationToSurface();
125     aProp->SetRepresentationToWireframe();
126     //   aProp->SetRepresentationToPoints();
127     aProp->EdgeVisibilityOn ();
128     aProp->SetPointSize(5);
129     SetProperty( aProp );
130     aProp->Delete();
131     //   SetPointRepresentation(true);
132
133 }
134
135 Document_Actor::~Document_Actor()
136 {
137
138 }
139
140
141 vtkUnstructuredGrid* Document_Actor::getUnstructuredGrid()
142 {
143     vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New();
144
145     _doc->reorderFaces(); //CS_TEST
146
147     map <int,vtkIdType>   vtkNodeId;
148     map <vtkIdType, int>  hexaNodeId;
149
150     // Create points
151     vtkPoints* aPoints = vtkPoints::New();
152     int nbVertex = _doc->countVertex();
153     aPoints->SetNumberOfPoints( nbVertex );
154
155     Vertex* v = NULL;
156     int vertexId;
157     for ( int i=0; i <nbVertex; ++i ){
158         v = _doc->getVertex(i);
159         aPoints->SetPoint( i, v->getX(), v->getY(), v->getZ() );
160         vertexId = reinterpret_cast<intptr_t>(v); //v->getId();
161         vtkNodeId [ vertexId ] = i;
162         hexaNodeId[ i ] = vertexId ;
163         //     vtkNodeId [ vertexId ] = i+1;
164         //     hexaNodeId[ i+1 ] = vertexId ;
165     }
166
167     theGrid->SetPoints( aPoints );
168     aPoints->Delete();
169     //   theGrid->SetCells( 0, 0, 0, 0, 0 );
170
171
172     // Calculate cells size
173     int nb0DElement = _doc->countVertex();
174     int nbEdge      = _doc->countEdge();
175     int nbFace      = _doc->countQuad();
176     int nbVolume    = _doc->countHexa();
177
178     vtkIdType aCellsSize =  2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume;
179     vtkIdType aNbCells   =  nb0DElement + nbEdge + nbFace + nbVolume;
180
181     // Create cells
182     vtkCellArray* aConnectivity = vtkCellArray::New();
183     aConnectivity->Allocate( aCellsSize, 0 );
184
185     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
186     aCellTypesArray->SetNumberOfComponents( 1 );
187     aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
188
189     vtkIdList *anIdList = vtkIdList::New();
190     vtkIdType iVtkElem = 0;
191     //   vtkIdType iVtkElem = 1; //CS_TEST
192     int       iHexaElem;
193
194     // VERTEX
195     for ( int i=0; i<nb0DElement; ++i ){
196         anIdList->SetNumberOfIds( 1 );
197         v = _doc->getVertex(i);
198         iHexaElem = reinterpret_cast<intptr_t>(v);//v->getId();
199         vtkElemsId[iHexaElem] = iVtkElem;
200         hexaElemsId[iVtkElem] = iHexaElem;
201         anIdList->SetId(0, vtkNodeId[iHexaElem]);
202         aConnectivity->InsertNextCell( anIdList );
203         aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) );
204         ++iVtkElem;
205     }
206
207     // EDGE
208     Edge* e = NULL;
209     Vertex* vertexElem = NULL;
210     for ( int i=0; i<nbEdge; ++i ){
211         anIdList->SetNumberOfIds( 2 );
212         e = _doc->getEdge(i);
213         iHexaElem = reinterpret_cast<intptr_t>(e); //e->getId();
214         vtkElemsId[iHexaElem] = iVtkElem;
215         hexaElemsId[iVtkElem] = iHexaElem;
216
217         for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){
218             vertexElem = e->getVertex( j );
219             anIdList->SetId( j, vtkNodeId[ reinterpret_cast<intptr_t>(vertexElem) ] );//vertexElem->getId() ]);
220         }
221         aConnectivity->InsertNextCell( anIdList );
222         aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) );
223         ++iVtkElem;
224     }
225
226     // QUAD
227     Quad* q = NULL;
228     for ( int i=0; i<nbFace; ++i ){
229         anIdList->SetNumberOfIds( 4 );
230         q = _doc->getQuad(i);
231         iHexaElem = reinterpret_cast<intptr_t>(q); //q->getId();
232         vtkElemsId[iHexaElem] = iVtkElem;
233         hexaElemsId[iVtkElem] = iHexaElem;
234
235         for( vtkIdType j = 0; j< 4; ++j ){
236             vertexElem = q->getVertex( j );
237             anIdList->SetId( j, vtkNodeId[ reinterpret_cast<intptr_t>(vertexElem) ] );//vertexElem->getId() ]);
238         }
239         aConnectivity->InsertNextCell( anIdList );
240         aCellTypesArray->InsertNextValue( VTK_QUAD );//getCellType( aType, anElem->IsPoly(), aNbNodes ) );
241         ++iVtkElem;
242     }
243
244     // HEXA
245     Hexa* h = NULL;
246     std::map<int, int> connectivity;
247     connectivity[0] = 0;
248     connectivity[1] = 1;
249     connectivity[2] = 3;
250     connectivity[3] = 2;
251     connectivity[4] = 4;
252     connectivity[5] = 5;
253     connectivity[6] = 7;
254     connectivity[7] = 6;
255     for ( int i=0; i<nbVolume; ++i ){
256         anIdList->SetNumberOfIds( 8 );
257         h = _doc->getHexa(i);
258         iHexaElem = reinterpret_cast<intptr_t>(h); //q->getId();
259         vtkElemsId[iHexaElem] = iVtkElem;
260         hexaElemsId[iVtkElem] = iHexaElem;
261
262         for( vtkIdType j = 0; j< 8; ++j ){
263             vertexElem = h->getVertex( j );// );
264             anIdList->SetId( connectivity[j], vtkNodeId[ reinterpret_cast<intptr_t>(vertexElem) ]);//vertexElem->getId() ]);
265         }
266         aConnectivity->InsertNextCell( anIdList );
267         aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );
268         ++iVtkElem;
269     }
270
271
272     // 0        1      2     3        4     5      6      7
273     // V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF,
274     //
275     // 0        1     3      2        4    5      7      6
276
277     // Insert cells in grid
278     VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
279     aCellLocationsArray->SetNumberOfComponents( 1 );
280     aCellLocationsArray->SetNumberOfTuples( aNbCells );
281     //   std::cout << "aNbCells =>" << aNbCells << std::endl;
282
283     aConnectivity->InitTraversal();
284     for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){
285         aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
286     }
287     theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
288
289     aCellLocationsArray->Delete();
290     aCellTypesArray->Delete();
291     aConnectivity->Delete();
292     anIdList->Delete();
293     //std::cout << "theGrid->GetNumberOfCells()" << theGrid->GetNumberOfCells() << std::endl;
294
295     return theGrid;
296 }
297
298 // =============================================================== Abu : debut
299 // ===================================================== Constructeur
300 Associate_Actor::Associate_Actor( Document* doc, const QString& entry)
301 : SALOME_Actor(), _doc( doc )
302 {
303     DEBTRACE("Associate_Actor::Associate_Actor " << entry.toLatin1() );
304     Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject( entry.toLatin1(), "HEXABLOCK" );//,theName); CS_TODO
305     setIO(anIO);
306     vtkUnstructuredGrid* aGrid = getUnstructuredGrid();
307
308     vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
309     aMapper->SetInputData(aGrid);
310     aGrid->Delete();
311
312     SetVisibility( true );//VisibilityOff();
313     SetPickable( true ); //PickableOff();//
314     SetMapper( aMapper );
315     aMapper->Delete();
316
317     vtkProperty* aProp = vtkProperty::New();
318     aProp->SetColor(0,255,0);
319     //   aProp->SetRepresentationToSurface();
320     aProp->SetRepresentationToWireframe();
321     //   aProp->SetRepresentationToPoints();
322     aProp->EdgeVisibilityOn ();
323     aProp->SetPointSize(5);
324     SetProperty( aProp );
325     aProp->Delete();
326     //   SetPointRepresentation(true);
327 }
328 // ===================================================== getUnstructuredGrid
329
330 vtkUnstructuredGrid* Associate_Actor::getUnstructuredGrid()
331 {
332     vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New();
333
334     _doc->reorderFaces(); //CS_TEST
335
336     std::map<int,vtkIdType>   vtkNodeId;
337     std::map<vtkIdType, int>  hexaNodeId;
338
339     // Create points
340     vtkPoints* aPoints = vtkPoints::New();
341     int nbVertex = _doc->countVertex();
342     aPoints->SetNumberOfPoints( nbVertex );
343
344     Vertex* v = NULL;
345     int vertexId;
346     for ( int i=0; i <nbVertex; ++i ){
347         v = _doc->getVertex(i);
348         aPoints->SetPoint( i, v->getX()+6, v->getY()+6, v->getZ() );
349         vertexId = reinterpret_cast<intptr_t>(v); //v->getId();
350         vtkNodeId [ vertexId ] = i;
351         hexaNodeId[ i ] = vertexId ;
352         //     vtkNodeId [ vertexId ] = i+1;
353         //     hexaNodeId[ i+1 ] = vertexId ;
354     }
355
356     theGrid->SetPoints( aPoints );
357     aPoints->Delete();
358     //   theGrid->SetCells( 0, 0, 0, 0, 0 );
359
360
361     // Calculate cells size
362     int nb0DElement = _doc->countVertex();
363     int nbEdge      = _doc->countEdge();
364     int nbFace      = _doc->countQuad();
365     int nbVolume    = _doc->countHexa();
366
367     vtkIdType aCellsSize =  2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume;
368     vtkIdType aNbCells   =  nb0DElement + nbEdge + nbFace + nbVolume;
369
370     // Create cells
371     vtkCellArray* aConnectivity = vtkCellArray::New();
372     aConnectivity->Allocate( aCellsSize, 0 );
373
374     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
375     aCellTypesArray->SetNumberOfComponents( 1 );
376     aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
377
378     vtkIdList *anIdList = vtkIdList::New();
379     vtkIdType iVtkElem = 0;
380     //   vtkIdType iVtkElem = 1; //CS_TEST
381     int       iHexaElem;
382
383     // VERTEX
384     for ( int i=0; i<nb0DElement; ++i ){
385         anIdList->SetNumberOfIds( 1 );
386         v = _doc->getVertex(i);
387         iHexaElem = reinterpret_cast<intptr_t>(v);//v->getId();
388         vtkElemsId[iHexaElem] = iVtkElem;
389         hexaElemsId[iVtkElem] = iHexaElem;
390         anIdList->SetId(0, vtkNodeId[iHexaElem]);
391         aConnectivity->InsertNextCell( anIdList );
392         aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) );
393         ++iVtkElem;
394     }
395
396     // EDGE
397     Edge* e = NULL;
398     Vertex* vertexElem = NULL;
399     for ( int i=0; i<nbEdge; ++i ){
400         anIdList->SetNumberOfIds( 2 );
401         e = _doc->getEdge(i);
402         iHexaElem = reinterpret_cast<intptr_t>(e); //e->getId();
403         vtkElemsId[iHexaElem] = iVtkElem;
404         hexaElemsId[iVtkElem] = iHexaElem;
405
406         for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){
407             vertexElem = e->getVertex( j );
408             anIdList->SetId( j, vtkNodeId[ reinterpret_cast<intptr_t>(vertexElem) ] );//vertexElem->getId() ]);
409         }
410         aConnectivity->InsertNextCell( anIdList );
411         aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) );
412         ++iVtkElem;
413     }
414
415     // QUAD
416     Quad* q = NULL;
417     for ( int i=0; i<nbFace; ++i ){
418         anIdList->SetNumberOfIds( 4 );
419         q = _doc->getQuad(i);
420         iHexaElem = reinterpret_cast<intptr_t>(q); //q->getId();
421         vtkElemsId[iHexaElem] = iVtkElem;
422         hexaElemsId[iVtkElem] = iHexaElem;
423
424         for( vtkIdType j = 0; j< 4; ++j ){
425             vertexElem = q->getVertex( j );
426             anIdList->SetId( j, vtkNodeId[ reinterpret_cast<intptr_t>(vertexElem) ] );//vertexElem->getId() ]);
427         }
428         aConnectivity->InsertNextCell( anIdList );
429         aCellTypesArray->InsertNextValue( VTK_QUAD );//getCellType( aType, anElem->IsPoly(), aNbNodes ) );
430         ++iVtkElem;
431     }
432
433     // HEXA
434     Hexa* h = NULL;
435     std::map<int, int> connectivity;
436     connectivity[0] = 0;
437     connectivity[1] = 1;
438     connectivity[2] = 3;
439     connectivity[3] = 2;
440     connectivity[4] = 4;
441     connectivity[5] = 5;
442     connectivity[6] = 7;
443     connectivity[7] = 6;
444     for ( int i=0; i<nbVolume; ++i ){
445         anIdList->SetNumberOfIds( 8 );
446         h = _doc->getHexa(i);
447         iHexaElem = reinterpret_cast<intptr_t>(h); //q->getId();
448         vtkElemsId[iHexaElem] = iVtkElem;
449         hexaElemsId[iVtkElem] = iHexaElem;
450
451         for( vtkIdType j = 0; j< 8; ++j ){
452             vertexElem = h->getVertex( j );// );
453             anIdList->SetId( connectivity[j], vtkNodeId[ reinterpret_cast<intptr_t>(vertexElem) ]);//vertexElem->getId() ]);
454         }
455         aConnectivity->InsertNextCell( anIdList );
456         aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON );
457         ++iVtkElem;
458     }
459
460
461     // 0        1      2     3        4     5      6      7
462     // V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF,
463     //
464     // 0        1     3      2        4    5      7      6
465
466     // Insert cells in grid
467     VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
468     aCellLocationsArray->SetNumberOfComponents( 1 );
469     aCellLocationsArray->SetNumberOfTuples( aNbCells );
470     //   std::cout << "aNbCells =>" << aNbCells << std::endl;
471
472     aConnectivity->InitTraversal();
473     for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){
474         aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
475     }
476     theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
477
478     aCellLocationsArray->Delete();
479     aCellTypesArray->Delete();
480     aConnectivity->Delete();
481     anIdList->Delete();
482
483     return theGrid;
484 }
485
486
487 // -----------------------------------------------------------------------
488 //          VtkDocumentGraphicView implementation
489 // -----------------------------------------------------------------------
490 VtkDocumentGraphicView::VtkDocumentGraphicView( DocumentModel* documentModel,
491         SVTK_ViewWindow* view, QWidget* parent ):
492         QAbstractItemView(parent),
493         viewWindow( view ),
494         documentActor( NULL ),
495         associateActor (NULL), // Abu
496         _currentChanged( false ),
497         firstUpdate(true),
498         selectionMode(-1)
499 {
500
501     //Model
502     setModel(documentModel);
503     patternDataModel     = new PatternDataModel(parent);
504     patternBuilderModel  = new PatternBuilderModel(parent);
505     patternGeomModel     = new PatternGeomModel(parent);
506     groupsModel          = new GroupsModel(parent);
507     meshModel            = new MeshModel(parent);
508     patternDataModel->setSourceModel(documentModel);
509     patternBuilderModel->setSourceModel(documentModel);
510     patternGeomModel->setSourceModel(documentModel);
511     groupsModel->setSourceModel(documentModel);
512     meshModel->setSourceModel(documentModel);
513
514     //Selection Model
515     patternDataSelectionModel    = new PatternDataSelectionModel(patternDataModel);
516     patternBuilderSelectionModel = new PatternBuilderSelectionModel(patternBuilderModel, patternDataSelectionModel);
517     patternGeomSelectionModel    = new PatternGeomSelectionModel(patternGeomModel);
518     groupsSelectionModel         = new GroupsSelectionModel(groupsModel);
519     meshSelectionModel           = new MeshSelectionModel(meshModel );
520     setSelectionModel(patternDataSelectionModel);
521 }
522
523 //Loads the graphic view document
524 void VtkDocumentGraphicView::loadDocument()
525 {
526     DocumentModel* docModel = getDocumentModel();
527     if (docModel == NULL) return;
528
529     docModel->load();
530 }
531
532 //Loads the document from the file in this graphic view
533 void VtkDocumentGraphicView::loadDocument(const QString& file)
534 {
535     if ( file.isEmpty() ) return;
536     getDocumentModel()->load(file);
537 }
538
539 //Saves the graphic view's document in the file
540 void VtkDocumentGraphicView::saveDocument(const QString& file)
541 {
542     if (file.isEmpty()) return;
543     getDocumentModel()->save(file);
544 }
545
546
547 VtkDocumentGraphicView::~VtkDocumentGraphicView()
548 {
549
550     //Delete Model
551     delete patternDataModel;
552     delete patternBuilderModel;
553     delete groupsModel;
554     delete meshModel;
555
556     //Delete Selection Model/ Disconnect signals on delete (Qt)
557 //    delete patternDataSelectionModel;
558 //    delete patternBuilderSelectionModel;
559 //    delete groupsSelectionModel;
560 //    delete meshSelectionModel;
561 }
562
563 void VtkDocumentGraphicView::setWindowTitle(const QString& title)
564 {
565     viewWindow->setWindowTitle( QString("hexablock : ") + title );
566 }
567
568 void VtkDocumentGraphicView::onPatternDatachanged()
569 {
570     update();
571 }
572
573 void VtkDocumentGraphicView::removeActor()
574 {
575     if ( documentActor != NULL && viewWindow != NULL){
576           viewWindow->RemoveActor( documentActor );
577           documentActor->Delete();
578     }
579 }
580
581 void VtkDocumentGraphicView::update()
582 {
583
584     DocumentModel*   theModel = dynamic_cast<DocumentModel*>( model() );
585     if (theModel == NULL || viewWindow == NULL) return;
586
587     Document*  theDocumentImpl  = theModel->documentImpl();
588     QString             theDocumentEntry = theModel->documentEntry();
589
590     if ( documentActor ){
591         viewWindow->RemoveActor( documentActor );
592         documentActor->Delete();
593     }
594     documentActor  = new Document_Actor( theDocumentImpl, theDocumentEntry );
595     viewWindow->AddActor( documentActor );
596
597     viewWindow->getRenderer()->Render();
598     viewWindow->Repaint();
599     if (firstUpdate)
600     {
601         viewWindow->onFitAll();
602         firstUpdate = false;
603     }
604 }
605
606 void VtkDocumentGraphicView::setVertexSelection()
607 {
608   setSelectionMode(NodeSelection);
609 // //  NodeSelection,
610 // //  CellSelection,
611 // //  EdgeOfCellSelection,
612 // //  EdgeSelection,
613 // //  FaceSelection,
614 // //  VolumeSelection,
615 // //  ActorSelection };
616   selectionMode = VERTEX_TREE;
617 }
618
619 void VtkDocumentGraphicView::setEdgeSelection()
620 {
621   setSelectionMode(EdgeSelection);
622   selectionMode = EDGE_TREE;
623 }
624
625 void VtkDocumentGraphicView::setQuadSelection()
626 {
627   setSelectionMode(FaceSelection);
628   selectionMode = QUAD_TREE;
629 }
630
631 void VtkDocumentGraphicView::setHexaSelection()
632 {
633 //  SetSelectionMode(VolumeSelection);
634   setSelectionMode(FaceSelection); //temporary for hexa selection debug
635   selectionMode = HEXA_TREE;
636 //  aProp->FaceVisibilityOff (); //would debug hexa preselection, selection???
637 }
638
639 void VtkDocumentGraphicView::setAllSelection()
640 {
641   setSelectionMode(ActorSelection);
642   selectionMode = -1;
643 }
644
645 void  VtkDocumentGraphicView::setSelectionMode(Selection_Mode theMode)
646 {
647
648   if ( viewWindow != NULL )
649   {
650       viewWindow->SetSelectionMode( theMode );
651       selectionMode = theMode;
652   }
653
654 }
655
656 void VtkDocumentGraphicView::setSelectionMode( const QModelIndex& eltIndex )
657 {
658   QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE );
659   if ( !treeVariant.isValid() ) return;
660   int eltType = treeVariant.toInt();
661
662   if ( selectionMode == eltType ) return;
663
664   switch ( eltType ){
665     case VERTEX_TREE :
666     case GEOMPOINT_TREE:
667     case GEOMPOINT_DIR_TREE:
668     case VERTEX_DIR_TREE : setVertexSelection(); break;
669     case EDGE_TREE :
670     case GEOMEDGE_TREE:
671     case GEOMEDGE_DIR_TREE:
672     case EDGE_DIR_TREE :   setEdgeSelection(); break;
673     case QUAD_TREE :
674     case GEOMFACE_TREE:
675     case GEOMFACE_DIR_TREE:
676     case QUAD_DIR_TREE :   setQuadSelection();   break;
677     case HEXA_TREE :
678     case GEOMSHAPE_TREE:
679     case GEOMSHAPE_DIR_TREE:
680     case HEXA_DIR_TREE :   setHexaSelection();  break;
681     case PROPAGATION_TREE :
682     case PROPAGATION_DIR_TREE :   setEdgeSelection(); break;
683     default: setAllSelection();
684 //  CellSelection,
685 //  EdgeOfCellSelection,
686 //  VolumeSelection,
687 //  ActorSelection
688   }
689 }
690
691 void VtkDocumentGraphicView::clearSelection()
692 {
693     if (viewWindow != NULL)
694     {
695 //        viewWindow->unHighlightAll();
696         setSelectionMode(ActorSelection);
697     }
698 }
699
700 void VtkDocumentGraphicView::highlight( const QModelIndex& ielt )
701 {
702
703     QModelIndexList indexList;
704     indexList << ielt;
705     highlight(indexList);
706
707 }
708
709 void VtkDocumentGraphicView::highlight( const QModelIndexList& elts )
710 {
711
712     if (elts.size() == 0 || viewWindow == NULL || documentActor == NULL) return;
713     SVTK_Selector* selector = viewWindow->GetSelector();
714     if ( selector == NULL ) return;
715 //    //   Set selection mode in VTK view
716 //    viewWindow->SetSelectionMode(VolumeSelection);
717
718     // --- elements highlight ---
719     TColStd_MapOfInteger aMap;
720     int vtkElemsId;
721     QString eltEntry;
722
723     foreach( const QModelIndex& iElt, elts ){
724         if (iElt.isValid())
725         {
726             eltEntry = iElt.data( HEXA_ENTRY_ROLE ).toString();
727             vtkElemsId = documentActor->vtkElemsId[ eltEntry.toInt() ];
728             if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId );
729         }
730     }
731     selector->AddOrRemoveIndex( documentActor->getIO(), aMap, false ); //true
732     viewWindow->highlight( documentActor->getIO(), true, true );
733     documentActor->highlight( false ); //unhighlight de la bounding box rouge
734
735 }
736
737
738 void VtkDocumentGraphicView::highlightGroups( const QModelIndex& eltIndex )
739 {
740     if ( groupsModel == NULL || viewWindow == NULL || documentActor == NULL) return;
741     SVTK_Selector* selector = viewWindow->GetSelector();
742     if ( selector == NULL ) return;
743
744     QVariant treeVariant        = eltIndex.data( HEXA_TREE_ROLE );
745     if ( !treeVariant.isValid())
746         //INFOS("data from model not valid");
747         return;
748
749     int eltType  = treeVariant.toInt();
750     if ( eltType != GROUP_TREE )
751         //INFOS("bad element type : not a group item" << eltType );
752         return;
753
754     //Get elements to highlight
755     DocumentModel::Group kind;
756     QModelIndexList iElements = groupsModel->getGroupElements( eltIndex, kind );
757     if (iElements.count() == 0) return;
758
759     // ---------- elements highlight --------------
760
761     // Set selection mode in VTK view
762     switch (kind){
763      case HexaCell: case HexaNode: viewWindow->SetSelectionMode(VolumeSelection); break;
764      case QuadCell: case QuadNode: viewWindow->SetSelectionMode(FaceSelection);   break;
765      case EdgeCell: case EdgeNode: viewWindow->SetSelectionMode(EdgeSelection);   break;
766      case VertexNode: viewWindow->SetSelectionMode(NodeSelection); break;
767     }
768
769     TColStd_MapOfInteger aMap;
770     int vtkElemsId;
771     QString eltEntry;
772
773     foreach( const QModelIndex& iElt, iElements ){
774         if (iElt.isValid())
775         {
776             eltEntry = iElt.data( HEXA_ENTRY_ROLE ).toString();
777             vtkElemsId = documentActor->vtkElemsId[ eltEntry.toInt() ];
778             if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId );
779         }
780     }
781
782     selector->AddOrRemoveIndex( documentActor->getIO(), aMap, false );
783     viewWindow->highlight( documentActor->getIO(), true, true );
784     documentActor->highlight( false );
785
786 }
787
788
789 void VtkDocumentGraphicView::highlightPropagation( const QModelIndex& eltIndex )
790 {
791     if ( meshModel == NULL || viewWindow == NULL || documentActor == NULL) return;
792     SVTK_Selector* selector = viewWindow->GetSelector();
793     if ( selector == NULL ) return;
794
795     QVariant treeVariant        = eltIndex.data( HEXA_TREE_ROLE );
796     if ( !treeVariant.isValid())
797         //INFOS("data from model not valid");
798         return;
799
800     int eltType  = treeVariant.toInt();
801     if ( eltType != PROPAGATION_TREE )
802         //INFOS("bad element type : not a group item" << eltType );
803         return;
804
805     // Get elements to highlight
806     QModelIndexList iEdges = meshModel->getPropagation( eltIndex );
807     if (iEdges.count() == 0) return;
808
809     // ---------- elements highlight --------------
810
811     // Set selection mode in VTK view
812     viewWindow->SetSelectionMode(EdgeSelection);
813
814     TColStd_MapOfInteger aMap;
815     int vtkElemsId;
816     QString edgeEntry;
817
818     foreach( const QModelIndex& iEdge, iEdges ){
819         if (iEdge.isValid())
820         {
821             edgeEntry = iEdge.data( HEXA_ENTRY_ROLE ).toString();
822             vtkElemsId = documentActor->vtkElemsId[ edgeEntry.toInt() ];
823             if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId );
824         }
825     }
826
827     selector->AddOrRemoveIndex( documentActor->getIO(), aMap, false );
828     viewWindow->highlight( documentActor->getIO(), true, true );
829     documentActor->highlight( false );
830
831 }
832
833
834
835
836 /********************************************************************************
837  *                   ABSTRACT METHOD ( MUST BE IMPLEMENTED )
838  ********************************************************************************/
839
840 /*
841     Returns the item that covers the coordinate given in the view.
842  */
843
844 QModelIndex VtkDocumentGraphicView::indexAt(const QPoint &point) const
845 {
846     return QModelIndex();
847 }
848
849 void VtkDocumentGraphicView::scrollTo(const QModelIndex &index, ScrollHint)
850 {
851 }
852
853
854 /*
855     Returns the position of the item in viewport coordinates.
856  */
857 QRect VtkDocumentGraphicView::visualRect(const QModelIndex &index) const
858 {
859     return QRect();
860 }
861
862 // PROTECTED :
863 int VtkDocumentGraphicView::horizontalOffset() const
864 {
865     return horizontalScrollBar()->value();
866 }
867
868 bool VtkDocumentGraphicView::isIndexHidden(const QModelIndex &index) const
869 {
870     return false;
871 }
872
873 QModelIndex VtkDocumentGraphicView::moveCursor(QAbstractItemView::CursorAction cursorAction,
874         Qt::KeyboardModifiers /*modifiers*/)
875 {
876     QModelIndex current = currentIndex();
877     return current;
878 }
879
880 /*
881     Find the indices corresponding to the extent of the selection.
882  */
883 void VtkDocumentGraphicView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)
884 {
885 }
886
887
888 int VtkDocumentGraphicView::verticalOffset() const
889 {
890     return verticalScrollBar()->value();
891 }
892
893 /*
894     Returns a region corresponding to the selection in viewport coordinates.
895  */
896 QRegion VtkDocumentGraphicView::visualRegionForSelection(const QItemSelection &selection) const
897 {
898     return QRegion();
899 }
900
901
902
903
904 /********************************************************************************
905  *                   PROTECTED SLOTS
906  ********************************************************************************/
907 void VtkDocumentGraphicView::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint )
908 {
909 }
910
911 void VtkDocumentGraphicView::commitData ( QWidget * editor )
912 {
913 }
914
915 void VtkDocumentGraphicView::currentChanged( const QModelIndex & current, const QModelIndex & previous )
916 {
917     //   openPersistentEditor( current );
918     _currentChanged = true;
919 }
920
921 void VtkDocumentGraphicView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight )
922 {
923     update();
924     _currentChanged = false;
925     //   updateObject(topLeft);
926 }
927
928 void VtkDocumentGraphicView::editorDestroyed ( QObject * editor )
929 {
930 }
931
932 void VtkDocumentGraphicView::rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int end )
933 {
934 }
935
936 void VtkDocumentGraphicView::rowsInserted ( const QModelIndex & parent, int start, int end )
937 {
938 }
939
940 void VtkDocumentGraphicView::selectionChanged( const QItemSelection & selected, const QItemSelection & deselected )
941 {
942 }
943
944 void VtkDocumentGraphicView::updateGeometries ()
945 {
946 }
947
948 // bool DocumentGraphicView::canBeDisplayed( const QString& entry, const QString& viewer_type ) const //CS_TODO
949 // {
950 //   bool result = false;
951 //
952 //   result = (viewer_type==SVTK_Viewer::Type());
953 // //   QStringList es = entry.split( "_" );22
954 // //   bool result = ( es.count() == 3 && es[ 0 ] == "ATOMSOLVGUI" && viewer_type == SVTK_Viewer::Type() );
955 // //   //  printf ( " canBeDisplayed : entry = %s, count = %d, res = %d \n", entry.latin1(), es.count(), result );
956 //   std::cout << "canBeDisplayed => "<< result << std::endl;
957 //   return result; // entry of an atom for sure
958 // }
959
960 // SALOME_Prs* HEXABLOCKGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame)
961 // {
962 //     SALOME_Prs* prs = 0;
963 //
964 //     SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView();
965 //
966 //     if ( aViewFrame )
967 //     {
968 //         SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
969 //         if (vtk_viewer)
970 //         {
971 //             SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView();
972 //             SALOME_Actor* anActor = myGraphicView->FindActorByEntry( wnd, entry.toLatin1().data() );
973 //             if (!anActor)
974 //             {
975 // //                anActor = myGraphicView->CreateActor( study()->studyDS(), entry.toLatin1().data(), true );
976 //                 anActor = myGraphicView->CreateActor(entry.toLatin1().data());
977 //             }
978 //             if (anActor)
979 //             {
980 //                 // Display actor :
981 //                 SVTK_ViewWindow* vtkWnd = dynamic_cast<SVTK_ViewWindow*> (wnd);
982 //                 if (vtkWnd != NULL)
983 //                 {
984 //                     vtkWnd->AddActor(anActor);
985 //                     vtkWnd->Repaint();
986 //                     prs = LightApp_Displayer::buildPresentation(entry.toLatin1().data(), aViewFrame);
987 //                 }
988 //             }
989 //             if (prs)
990 //             {
991 //                 UpdatePrs(prs);
992 //             }
993 //             else if (anActor)
994 //             {
995 //                 //SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor );
996 //                 std::cout << "Remove Actor" << std::endl;
997 //             }
998 //         }
999 //     }
1000 //
1001 //     return prs;
1002 // }
1003
1004 // SALOME_Prs* SMESHGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
1005 // {
1006 //   SALOME_Prs* prs = 0;
1007 //
1008 //   SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView();
1009 //
1010 //   if ( aViewFrame )
1011 //   {
1012 //     SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
1013 //     if( vtk_viewer )
1014 //     {
1015 //       SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView();
1016 //       SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.toLatin1().data() );
1017 //       if( !anActor )
1018 //         anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true );
1019 //       if( anActor )
1020 //       {
1021 //         SMESH::DisplayActor( wnd, anActor );
1022 //         prs = LightApp_Displayer::buildPresentation( entry.toLatin1().data(), aViewFrame );
1023 //       }
1024 //       if( prs )
1025 //         UpdatePrs( prs );
1026 //       else if( anActor )
1027 //         SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor );
1028 //     }
1029 //   }
1030 //
1031 //   return prs;
1032 // }
1033
1034 //
1035 // void DocumentGraphicView::RemoveActor(SUIT_ViewWindow *theWnd, SALOME_Actor* theActor)
1036 // {
1037 //     std::cout << "RemoveActor() : 1" << std::endl;
1038 //     SVTK_ViewWindow* myViewWindow = dynamic_cast<SVTK_ViewWindow*>(theWnd);
1039 // //    SVTK_ViewWindow* myViewWindow = dynamic_cast<SVTK_ViewWindow*>(_suitView);
1040 //     if (myViewWindow != NULL)
1041 //     {
1042 //         myViewWindow->RemoveActor(theActor);
1043 //         if(theActor->hasIO())
1044 //         {
1045 //             std::cout << "RemoveActor() : 2" << std::endl;
1046 //             Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
1047 //             if(anIO->hasEntry())
1048 //             {
1049 //                 std::cout << "RemoveActor() : 3" << std::endl;
1050 //                 std::string anEntry = anIO->getEntry();
1051 //                 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myViewWindow->getViewManager()->study() );
1052 //                 int aStudyId = aStudy->id();
1053 // //                 TVisualObjCont::key_type aKey(aStudyId,anEntry);
1054 // //                 VISUAL_OBJ_CONT.erase(aKey);
1055 //             }
1056 //         }
1057 //         theActor->Delete();
1058 //         myViewWindow->Repaint();
1059 //         std::cout << "RemoveActor() : 4" << std::endl;
1060 //     }
1061 // }
1062
1063 // bool DocumentGraphicView::eventFilter(QObject *obj, QEvent *event)
1064 // {
1065 //     std::cout << event->type() << std::endl;
1066 // //     if ( event->type() == QEvent::FocusIn ){ //QEvent::KeyPress) {
1067 // //         return false;
1068 // //     } else {
1069 // //          // standard event processing
1070 // // //          return QObject::eventFilter(obj, event);
1071 //
1072 //     if ( event->type() == QEvent::Paint ) { //QEvent::FocusIn ){
1073 //       std::cout << "PAINTTTTTTTTTT"<< std::endl;
1074 // //       loadVTK( "/tmp/load.vtk"); //CS_TEST
1075 //     }
1076 //     return _suitView->event(event);
1077 // //     }
1078 // }
1079 //
1080 //
1081
1082 //show the actor when show=true and hide it when show=false
1083 //void VtkDocumentGraphicView::showActor(bool show)
1084 //{
1085 //    SVTK_ViewWindow*    theVTKViewWindow = dynamic_cast<SVTK_ViewWindow*>(_suitView);
1086 //    if (theVTKViewWindow == NULL || _documentActor == NULL)
1087 //        return;
1088 //
1089 //    if (show)
1090 //    {
1091 //        _documentActor->SetVisibility(1);
1092 //        theVTKViewWindow->onFitAll();
1093 //    }
1094 //    else
1095 //    {
1096 //        _documentActor->SetVisibility(0);
1097 //        theVTKViewWindow->onResetView ();
1098 //    }
1099 //}
1100
1101 void VtkDocumentGraphicView::setModel ( QAbstractItemModel * model )
1102 {
1103     QAbstractItemView::setModel( model );
1104
1105     //   PatternDataModel* pdm = dynamic_cast<PatternDataModel*>(model);
1106     //   if (pdm){
1107     //     connect( pdm, SIGNAL(patternDataChanged() ), this,  SLOT ( onPatternDatachanged() ) );
1108     //   }
1109
1110     DocumentModel* dm = dynamic_cast<DocumentModel*>(model);
1111     if (dm){
1112         //    setWindowTitle( dm->getName() );
1113         connect( dm, SIGNAL(patternDataChanged() ), this,  SLOT ( onPatternDatachanged() ) );
1114         //    connect( dm, SIGNAL( nameChanged(const QString&) ), this,  SLOT ( setWindowTitle(const QString&) ) );
1115     }
1116 }
1117
1118 // void DocumentGraphicView::loadVTK( const QString&  path ) //CS_TEST
1119 // {
1120 //   std::cout << "DocumentGraphicView::loadVTK=>"<<std::endl;
1121 //   QFile file(path);
1122 //   if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
1123 //     return;
1124 // //   QByteArray vtkData = file.readAll ();
1125 //   QString vtkData = file.readAll ();
1126 //   vtkData.replace(",",".");
1127 //
1128 //
1129 //   SVTK_ViewWindow* myVTKViewWindow = dynamic_cast<SVTK_ViewWindow*>(_suitView);
1130 //
1131 //   // vtkStructuredGridReader
1132 //   vtkUnstructuredGridReader* r = vtkUnstructuredGridReader::New();
1133 // //   r->SetFileName( path.toLocal8Bit().constData() );
1134 //   r->SetInputString( vtkData.toLocal8Bit().constData() );
1135 //   r->SetReadFromInputString( true );
1136 //   r->Update();
1137 //
1138 //   vtkUnstructuredGrid* myGrid = r->GetOutput();//vtkUnstructuredGrid::New();
1139 //   std::cout << "GetNumberOfCells =>"<< myGrid->GetNumberOfCells();
1140 //   // Create and display actor
1141 //
1142 //   vtkDataSetMapper* myMapper = vtkDataSetMapper::New();
1143 //   myMapper->SetInput(myGrid);
1144 //
1145 // //   if ( myPreviewActor ){
1146 // //     myVTKViewWindow->RemoveActor(myPreviewActor);
1147 // //     myPreviewActor->Delete();
1148 // //   }
1149 //
1150 //   SALOME_Actor* myPreviewActor = SALOME_Actor::New();
1151 //   myPreviewActor = SALOME_Actor::New();
1152 //   Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(QString::number( reinterpret_cast<intptr_t>(_hexaDocument) ),"HEXABLOCK");//,theName);
1153 //   myPreviewActor->setIO(anIO);
1154 //
1155 // //   myPreviewActor->PickableOff();
1156 //   myPreviewActor->SetVisibility( true );//VisibilityOff();
1157 //   myPreviewActor->SetPickable( true );
1158 //   myPreviewActor->SetMapper(myMapper);
1159 //
1160 //   vtkProperty* aProp = vtkProperty::New();
1161 // //   aProp->SetRepresentationToWireframe();
1162 //   aProp->SetRepresentationToSurface();
1163 //   aProp->EdgeVisibilityOn ();
1164 //
1165 // //   aProp->SetColor(10, 10, 250);
1166 //   aProp->SetPointSize(5);
1167 //   myPreviewActor->SetProperty(aProp);
1168 //   aProp->Delete();
1169 //
1170 //   /*vtkProperty* myBackProp = vtkProperty::New();
1171 //   GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) );
1172 //   myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] );
1173 //   myPreviewActor->SetBackfaceProperty( myBackProp );
1174 //   myBackProp->Delete()*/;
1175 //   myVTKViewWindow->AddActor(myPreviewActor);
1176 //   myVTKViewWindow->getRenderer()->Render();
1177 //   myVTKViewWindow->Repaint();
1178 //   myVTKViewWindow->onFitAll();
1179 //
1180 //   myVTKViewWindow->SetSelectionMode( ActorSelection );
1181 // // myVTKViewWindow->SetSelectionMode( NodeSelection );
1182 // // myVTKViewWindow->SetSelectionMode( EdgeSelection );
1183 // // myVTKViewWindow->SetSelectionMode( FaceSelection );
1184 // }
1185
1186 // void DocumentGraphicView::rowsInserted ( const QModelIndex & parent, int start, int end )
1187 // {
1188 //
1189 // //   std::cout << "DocumentGraphicView::rowsInserted  :  " << parent.data().toString().toStdString() << std::endl;
1190 //   QModelIndex newRow;
1191 //
1192 //   SVTK_ViewWindow* myViewWindow = dynamic_cast<SVTK_ViewWindow*>(_suitView);
1193 //   SUIT_ViewManager* vman = myViewWindow->getViewManager();
1194 //   SUIT_ViewModel* vmodel = vman->getViewModel();
1195 //
1196 //   for ( int i = start; i<= end; ++i ){
1197 //     newRow = parent.child(i,0);
1198 // //     std::cout << "newRow.data().toString() =>" << newRow.data().toString().toStdString() << std::endl;
1199 //     QString entry = newRow.data(HEXA_ENTRY_ROLE).toString();//.toStdString();
1200 //     Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
1201 //     UpdateViewer();
1202 //
1203 // //     addObject(newRow);
1204 //   }
1205 // }