1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Laurent CORNABE
34 #include <qptrvector.h>
35 #include <qcolordialog.h>
37 #include <vtkRenderer.h>
38 #include <vtkRenderWindow.h>
39 #include <vtkActorCollection.h>
41 #include "SALOME_LifeCycleCORBA.hxx"
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_MessageBox.h"
46 #include "SUIT_ViewWindow.h"
47 #include "SUIT_ViewManager.h"
49 #include "CAM_Module.h"
51 #include "SVTK_RenderWindow.h"
52 #include "SVTK_ViewWindow.h"
53 #include "SVTK_ViewModel.h"
54 #include "SVTK_Functor.h"
56 #include "SPlot2d_ViewModel.h"
57 #include "SPlot2d_SetupPlot2dDlg.h"
58 #include "Plot2d_SetupCurveDlg.h"
60 #include "OB_Browser.h"
62 #include "SALOME_ListIO.hxx"
63 #include "SALOME_ListIteratorOfListIO.hxx"
65 #include "SalomeApp_Application.h"
66 #include "SalomeApp_DataModel.h"
67 #include "SalomeApp_Study.h"
68 #include "SalomeApp_SelectionMgr.h"
69 #include "SalomeApp_Selection.h"
71 #include "VISUConfig.hh"
72 #include "VISU_Gen_i.hh"
73 #include "VISU_Mesh_i.hh"
74 #include "VISU_Table_i.hh"
75 #include "VISU_Result_i.hh"
76 #include "VISU_View_i.hh"
77 #include "VISU_ViewManager_i.hh"
79 #include "VISU_Actor.h"
82 #include "VisuGUI_Tools.h"
83 #include "VisuGUI_PopupTools.h"
84 #include "VisuGUI_NameDlg.h"
85 #include "VisuGUI_FileDlg.h"
86 #include "VisuGUI_CursorDlg.h"
87 #include "VisuGUI_Selection.h"
88 #include "VisuGUI_TimeAnimation.h"
89 #include "VisuGUI_EditContainerDlg.h"
90 #include "VisuGUI_NonIsometricDlg.h"
92 #include "VISU_ScalarMap_i.hh"
93 #include "VisuGUI_ScalarBarDlg.h"
95 #include "VISU_DeformedShape_i.hh"
96 #include "VisuGUI_DeformedShapeDlg.h"
98 #include "VISU_IsoSurfaces_i.hh"
99 #include "VisuGUI_IsoSurfacesDlg.h"
101 #include "VISU_CutPlanes_i.hh"
102 #include "VisuGUI_CutPlanesDlg.h"
104 #include "VISU_CutLines_i.hh"
105 #include "VisuGUI_CutLinesDlg.h"
107 #include "VISU_StreamLines_i.hh"
108 #include "VisuGUI_StreamLinesDlg.h"
110 #include "VISU_Vectors_i.hh"
111 #include "VisuGUI_VectorsDlg.h"
113 #include "VisuGUI_TableDlg.h"
115 #include "SALOMEconfig.h"
116 #include CORBA_SERVER_HEADER(MED_Gen)
118 #include "utilities.h"
120 #include "VisuGUI_ActionsDef.h"
122 using namespace VISU;
125 static int MYDEBUG = 1;
127 static int MYDEBUG = 0;
130 //////////////////////////////////////////////////
132 //////////////////////////////////////////////////
135 SalomeApp_Module( "VISU" )
149 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
150 CheckLock(GetCStudy(GetAppStudy(this)));
151 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
154 aFilter.append( tr("FLT_MED_FILES") );
155 aFilter.append( tr("FLT_ALL_FILES") );
157 QFileInfo aFileInfo =
158 SUIT_FileDlg::getFileName(GetDesktop(this),
161 tr("MEN_IMPORT_FROM_FILE"),
163 if(aFileInfo.exists()){
164 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
166 VISU::Result_var aResult;
167 bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
168 if(VisuGUI_FileDlg::IsBuild){
169 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
170 if(!CORBA::is_nil(aResult.in()))
171 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
172 if(!aRes->IsPossible())
173 SUIT_MessageBox::warn1(GetDesktop(this),
175 tr("ERR_CANT_BUILD_PRESENTATION"),
181 aResourceMgr->setValue("Visu:BuildResult",false);
182 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
183 aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
186 if(CORBA::is_nil(aResult.in())) {
187 SUIT_MessageBox::warn1(GetDesktop(this),
189 tr("ERR_ERROR_IN_THE_FILE"),
192 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
203 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
204 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
207 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
210 aFilter.append( tr("FLT_MED_FILES") );
211 aFilter.append( tr("FLT_ALL_FILES") );
213 QFileInfo aFileInfo =
214 SUIT_FileDlg::getFileName(GetDesktop(this),
217 tr("MEN_EXPLORE_MED_FILE"),
219 if(aFileInfo.exists()){
220 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
221 std::string aStudyName = aStudy->Name();
222 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
223 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
231 OnImportTableFromFile()
233 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
234 CheckLock(GetCStudy(GetAppStudy(this)));
237 aFilter.append( tr("FLT_TABLE_FILES") );
238 aFilter.append( tr("FLT_ALL_FILES") );
240 QFileInfo aFileInfo =
241 SUIT_FileDlg::getFileName(GetDesktop(this),
244 tr("MEN_IMPORT_TABLE"),
246 if(aFileInfo.exists()){
247 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
249 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
251 if(CORBA::is_nil(anObject.in())) {
252 SUIT_MessageBox::warn1(GetDesktop(this),
254 tr("ERR_ERROR_IN_THE_FILE"),
257 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
265 OnExportTableToFile()
267 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
271 CreateCurves( SalomeApp_Module* theModule,
272 VISU::CutLines_i* thePrs,
274 const bool theCreate = true )
278 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
282 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
283 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
285 if ( !theCreate && aSObject ){
287 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
288 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
289 _PTR(SObject) aTblObj = aIter->Value();
291 _PTR(GenericAttribute) anAttr;
292 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
293 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
300 if ( aCutDlg->isGenerateTable() ) {
301 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
302 if ( aCutDlg->isGenerateCurves() ) {
304 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
305 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
306 _PTR(SObject) aTblObj = aIter->Value();
308 _PTR(GenericAttribute) anAttr;
309 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
310 CreatePlot( theModule, aTblObj );
319 template<class TPrs3d_i>
321 CreatePrs3d(SalomeApp_Module* theModule,
322 SALOMEDS::SObject_var theTimeStamp,
323 const char* theMeshName,
324 VISU::Entity theEntity,
325 const char* theFieldName,
328 VISU::Result_var aResult;
329 if(CheckResult(theModule,theTimeStamp,aResult)){
330 QApplication::setOverrideCursor(Qt::waitCursor);
331 typedef typename TPrs3d_i::TInterface TPrs3d;
332 typename TPrs3d::_var_type aPrs3d =
333 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
334 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
335 QApplication::restoreOverrideCursor();
336 if(!CORBA::is_nil(aPrs3d.in()))
337 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
339 SUIT_MessageBox::warn1(GetDesktop(theModule),
340 QObject::tr("WRN_VISU"),
341 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
342 QObject::tr("BUT_OK") );
347 template<class TPrs3d_i, class TDlg, int IsDlgModal>
349 CreatePrs3d(SalomeApp_Module* theModule,
350 SALOMEDS::SObject_var theTimeStamp,
351 const Handle(SALOME_InteractiveObject)& theIO)
353 using namespace VISU;
354 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
356 QString aType = Storable::FindValue(aMap,"myType",&isExist);
357 if(!isExist || aType.toInt() != TTIMESTAMP )
359 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
360 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
361 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
362 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
363 QApplication::setOverrideCursor(Qt::waitCursor);
365 CreatePrs3d<TPrs3d_i>(theModule,
368 (Entity)anEntity.toInt(),
370 aTimeStampId.toInt());
371 QApplication::restoreOverrideCursor();
373 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
374 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
376 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode
377 aDlg->initFromPrsObject(aPrs3d);
379 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
380 // Optionally, create table and curves for cut lines
381 QApplication::setOverrideCursor(Qt::waitCursor);
382 CreateCurves( theModule, dynamic_cast<VISU::CutLines_i*>( aPrs3d ), aDlg, true ); // in creation mode
383 QApplication::restoreOverrideCursor();
386 DeletePrs3d(theModule,aPrs3d,theIO);
396 PublishInView(theModule,aPrs3d);
403 template<class TPrs3d_i, class TDlg, int IsDlgModal>
405 CreatePrs3d(SalomeApp_Module* theModule)
407 if(CheckLock(GetCStudy(GetAppStudy(theModule))))
410 SALOMEDS::SObject_var aTimeStampSObj;
411 Handle(SALOME_InteractiveObject) anIO;
412 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
415 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
418 theModule->application()->putInfo(QObject::tr("INF_DONE"));
419 theModule->updateObjBrowser();
421 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
425 void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
427 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
428 //if (CheckLock(aStudy))
431 SALOMEDS::SObject_var aResultSObj =
432 GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
435 VISU::Result_var aResult;
436 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
440 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
442 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
446 CORBA::Object_var aMesh;
447 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
452 if (aComment == "ENTITY") {
453 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
454 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
455 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
456 } else if (aComment == "FAMILY") {
457 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
458 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
459 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
460 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
461 } else if (aComment == "GROUP") {
462 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
463 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
464 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
468 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
472 QApplication::restoreOverrideCursor();
473 VISU::Mesh_i* pPresent = NULL;
474 if (!CORBA::is_nil(aMesh))
475 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
476 if (pPresent == NULL) {
477 SUIT_MessageBox::warn1 (GetDesktop(this),
479 tr("ERR_CANT_BUILD_PRESENTATION"),
484 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
490 PublishInView(this, pPresent);
494 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
497 application()->putInfo(QObject::tr("INF_DONE"));
498 } catch (std::runtime_error& exc) {
500 SUIT_MessageBox::warn1 (GetDesktop(this),
502 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
512 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
513 if (CheckLock(aStudy))
516 // Get selected SObject
517 SALOMEDS::SObject_var aResultSObj;
518 Handle(SALOME_InteractiveObject) anIO;
519 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
520 if (anIO.IsNull() || !anIO->hasEntry())
530 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
531 if (CheckLock(aStudy))
534 // Get selected SObject
535 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
536 SALOME_ListIO aListIO;
537 aSelectionMgr->selectedObjects(aListIO);
538 SALOME_ListIteratorOfListIO anIter (aListIO);
539 for (; anIter.More(); anIter.Next()) {
540 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
541 if (anIO.IsNull() || !anIO->hasEntry())
552 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
558 OnCreateDeformedShape()
560 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
567 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
572 OnCreateIsoSurfaces()
574 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
581 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
588 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
593 OnCreateStreamLines()
595 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
602 CheckLock(GetCStudy(GetAppStudy(this)));
603 GetVisuGen( this )->CreateContainer();
611 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
613 QApplication::setOverrideCursor(Qt::waitCursor);
615 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
616 mgr->selectedObjects(aList);
618 Handle(SALOME_InteractiveObject) anIO;
619 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
621 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
622 if ( !CORBA::is_nil( anObject ) ) {
623 // is it Prs3d object ?
624 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
626 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
627 UpdateViewer( this, aPrsObject );
628 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
629 vw->highlight(anIO, 1);
634 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
636 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
637 PlotCurve( this, aCurve, VISU::eDisplay );
641 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
643 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
644 PlotContainer( this, aContainer, VISU::eDisplay );
648 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
650 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
651 PlotTable( this, aTable, VISU::eDisplay );
656 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
657 vw->getRenderer()->ResetCameraClippingRange();
660 QApplication::restoreOverrideCursor();
671 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject, bool theUpdate)
673 if (MYDEBUG) MESSAGE("ErasePrs");
675 if ( !CORBA::is_nil( theObject ) ) {
676 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
677 if ( CORBA::is_nil( aBase ) ) return;
678 VISU::VISUType aType = aBase->GetType();
681 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
682 PlotCurve(this, aCurve, VISU::eErase );
685 case VISU::TCONTAINER:{
686 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
687 PlotContainer(this, aContainer, VISU::eErase );
691 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
692 PlotTable(this, aTable, VISU::eErase );
696 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
697 ErasePrs3d( this, aPrsObject );
699 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
712 if(MYDEBUG) MESSAGE("OnErasePrs");
714 QApplication::setOverrideCursor(Qt::waitCursor);
716 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
717 mgr->selectedObjects(aList);
719 Handle(SALOME_InteractiveObject) anIO;
720 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
722 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
723 ErasePrs(anObject, false);
725 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
727 QApplication::restoreOverrideCursor();
730 template<class TPrs3d_i, class TDlg>
732 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
734 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
736 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
737 TDlg* aDlg = new TDlg (GetDesktop(theModule));
738 aDlg->initFromPrsObject(aPrsObject);
740 if (!(aDlg->storeToPrsObject(aPrsObject))) {
744 RecreateActor(theModule, aPrsObject);
745 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
746 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
747 vw->getRenderer()->ResetCameraClippingRange();
760 if (CheckLock(GetCStudy(GetAppStudy(this))))
763 Handle(SALOME_InteractiveObject) anIO;
764 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
765 if (CORBA::is_nil(anObject)) return;
766 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
767 if (!aServant.in()) return;
769 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
772 switch (aPrs3d->GetType()) {
775 case VISU::TSCALARMAP:
776 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
778 case VISU::TDEFORMEDSHAPE:
779 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
781 case VISU::TCUTPLANES:
782 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
784 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
786 VisuGUI_CutPlanesDlg* aDlg =
787 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
788 aDlg->initFromPrsObject(aPrsObject);
793 case VISU::TCUTLINES:
794 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
796 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
798 VisuGUI_CutLinesDlg* aDlg =
799 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
800 aDlg->initFromPrsObject(aPrsObject);
805 case VISU::TISOSURFACE:
806 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
809 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
811 case VISU::TSTREAMLINES:
812 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
818 if (SVTK_ViewWindow* vw = GetViewWindow())
819 vw->highlight(anIO, 1);
826 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
827 if (CheckLock(aCStudy))
829 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
831 Handle(SALOME_InteractiveObject) anIO;
832 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
836 // There is a transaction
837 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
838 aStudyBuilder->NewCommand();
840 // is it Prs3d object ?
841 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
843 DeletePrs3d(this, aPrsObject, anIO);
846 // is it Curve object ?
847 VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
849 //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
852 aStudyBuilder->CommitCommand();
860 if (SVTK_ViewWindow* vw = GetViewWindow()) {
861 vw->unHighlightAll();
862 if (vtkRenderer *aRen = vw->getRenderer()) {
864 vtkActorCollection *anActColl = aRen->GetActors();
865 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
866 if (anActor->GetVisibility() > 0)
867 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
868 anVISUActor = anVISUActor->GetParent();
869 anVISUActor->VisibilityOff();
874 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
879 void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
881 SUIT_ViewWindow* aView = GetActiveView(this, VTKViewer_Viewer::Type());
883 SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView;
885 Handle(SALOME_InteractiveObject) anIO;
886 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
887 if (CORBA::is_nil(anObject)) return;
888 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
889 if (!aServant.in()) return;
891 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
893 if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
896 if (anActor->IsShrunk())
899 anActor->SetShrink();
902 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
903 aMesh->SetPresentationType(theType);
904 RecreateActor(this, aMesh);
906 anActor->SetRepresentation(theType);
918 ChangeRepresentation(VISU::SURFACEFRAME);
925 ChangeRepresentation(VISU::INSIDEFRAME);
932 ChangeRepresentation(VISU::WIREFRAME);
939 ChangeRepresentation(VISU::SHADED);
946 ChangeRepresentation(VISU::POINT);
953 ChangeRepresentation(VISU::SHRINK);
960 Handle(SALOME_InteractiveObject) anIO;
961 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
962 if (CORBA::is_nil(anObject)) return;
963 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
964 if (!aServant.in()) return;
966 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
969 SVTK_ViewWindow* vw = GetViewWindow();
972 VISU_Actor* anActor = GetActor(aPrs3d, vw);
973 if (!anActor) return;
975 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
976 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
977 SALOMEDS::Color anOldColor, aNewColor;
978 int aRepresent = anActor->GetRepresentation();
980 switch (aRepresent) {
982 anOldColor = aMesh->GetNodeColor();
984 case VISU::WIREFRAME :
985 case VISU::INSIDEFRAME :
986 anOldColor = aMesh->GetLinkColor();
989 case VISU::SURFACEFRAME :
990 anOldColor = aMesh->GetCellColor();
993 } else if (aDeformedShape) {
994 anOldColor = aDeformedShape->GetColor();
999 QColor aColor (int(255*anOldColor.R),
1000 int(255*anOldColor.G),
1001 int(255*anOldColor.B));
1002 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1003 if (aColorNew.isValid()) {
1004 aNewColor.R = aColorNew.red()/255.;
1005 aNewColor.G = aColorNew.green()/255.;
1006 aNewColor.B = aColorNew.blue()/255.;
1008 switch (aRepresent) {
1010 aMesh->SetNodeColor(aNewColor);
1012 case VISU::WIREFRAME :
1013 case VISU::INSIDEFRAME :
1014 aMesh->SetLinkColor(aNewColor);
1017 case VISU::SURFACEFRAME :
1018 aMesh->SetCellColor(aNewColor);
1022 aDeformedShape->SetColor(aNewColor);
1024 RecreateActor(this, aPrs3d);
1030 OnChangeWireframeColor()
1032 Handle(SALOME_InteractiveObject) anIO;
1033 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1034 if (CORBA::is_nil(anObject)) return;
1035 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1036 if (!aServant.in()) return;
1038 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1039 if (!aPrs3d) return;
1041 SVTK_ViewWindow* vw = GetViewWindow();
1044 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1045 if (!anActor) return;
1047 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
1048 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1049 QColor aColor (int(255*anOldColor.R),
1050 int(255*anOldColor.G),
1051 int(255*anOldColor.B));
1052 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1053 if (aColorNew.isValid()) {
1054 aNewColor.R = aColorNew.red()/255.;
1055 aNewColor.G = aColorNew.green()/255.;
1056 aNewColor.B = aColorNew.blue()/255.;
1057 aMesh->SetLinkColor(aNewColor);
1058 RecreateActor(this, aMesh);
1067 Handle(SALOME_InteractiveObject) anIO;
1068 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1069 if (CORBA::is_nil(anObject)) return;
1070 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1071 if (!aServant.in()) return;
1073 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1074 if (!aPrsObject) return;
1076 SVTK_ViewWindow* vw = GetViewWindow();
1079 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1080 if (!anActor) return;
1082 VisuGUI_CursorDlg* CursorDlg =
1083 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1085 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1086 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1087 CursorDlg->SpinBox1->setMinValue(0);
1088 CursorDlg->SpinBox1->setMaxValue(100);
1090 float oldopac = anActor->GetOpacity();
1091 int intopac = int(oldopac*100. + 0.5);
1092 CursorDlg->SpinBox1->setValue(intopac);
1094 int ret = CursorDlg->exec();
1096 intopac = CursorDlg->SpinBox1->value();
1097 float newopac = intopac/100.;
1098 anActor->SetOpacity(newopac);
1107 Handle(SALOME_InteractiveObject) anIO;
1108 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1109 if (CORBA::is_nil(anObject)) return;
1110 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1111 if (!aServant.in()) return;
1113 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1114 if (!aPrsObject) return;
1116 SVTK_ViewWindow* vw = GetViewWindow();
1119 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1120 if (!anActor) return;
1122 VisuGUI_CursorDlg* CursorDlg =
1123 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1125 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1126 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1127 CursorDlg->SpinBox1->setMinValue(1);
1128 CursorDlg->SpinBox1->setMaxValue(10);
1130 float oldlwid = anActor->GetLineWidth();
1131 int intlwid = int(oldlwid);
1132 CursorDlg->SpinBox1->setValue(intlwid);
1134 int ret = CursorDlg->exec();
1136 intlwid = CursorDlg->SpinBox1->value();
1137 float newlwid = intlwid;
1138 anActor->SetLineWidth(newlwid);
1147 Handle(SALOME_InteractiveObject) anIO;
1148 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1150 if ( !CORBA::is_nil( anObject ) ) {
1151 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1152 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1153 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1154 if( !CORBA::is_nil( aTable ) ) {
1155 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1157 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1162 // possibly this is Table SObject
1163 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1166 if( !IsSObjectTable( SO ) )
1169 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1172 //SAL2670 Orientation of show tables
1173 VisuGUI_TableDlg::ttAuto,
1182 Handle(SALOME_InteractiveObject) anIO;
1183 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1184 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1185 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1186 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1187 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1188 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1197 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1198 if (CheckLock(aCStudy))
1200 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1202 Handle(SALOME_InteractiveObject) anIO;
1203 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1204 if (anIO.IsNull() || !anIO->hasEntry())
1207 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
1208 if (!aSObject->_is_nil()) {
1209 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1210 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1211 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1212 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1213 ErasePrs(aChildObj);
1215 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
1216 // There is a transaction
1217 aStudyBuilder->NewCommand();
1218 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
1219 if (!CORBA::is_nil(anObj)) {
1220 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
1221 if (!CORBA::is_nil(aBase)) {
1222 VISU::VISUType aType = aBase->GetType();
1226 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1227 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1228 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1229 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1230 if (CORBA::is_nil(aChildObj)) continue;
1231 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
1232 if (CORBA::is_nil(aPrs3d)) continue;
1233 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
1234 DeletePrs3d(this, pPrs3d, NULL);
1240 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1241 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1242 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1243 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1244 if (CORBA::is_nil(aChildObj)) continue;
1245 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
1246 if (CORBA::is_nil(aCurve)) continue;
1247 //VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1248 //jfa tmp:DeleteCurve(this, pCurve, NULL);
1255 aStudyBuilder->RemoveObjectWithChildren(aSObject);
1256 aStudyBuilder->CommitCommand();
1257 //jfa tmp:GetActiveStudy()->unHighlightAll();
1258 updateObjBrowser(true);
1266 Handle(SALOME_InteractiveObject) anIO;
1267 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1269 _PTR(GenericAttribute) anAttr;
1270 _PTR(AttributeName) aName;
1272 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1274 if ( !CORBA::is_nil( anObject ) ) {
1275 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1276 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1277 // Table (VISU object) is selected
1278 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1279 if( !CORBA::is_nil( aTbl ) ) {
1280 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1282 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1283 if ( IsSObjectTable(SO) ) {
1284 // get name of SObject
1285 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1287 SOName = QString( aName->Value().c_str() );
1289 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1290 if ( dlg->exec() == QDialog::Accepted ) {
1291 if ( !IsStudyLocked( aStudy ) ) {
1292 // if study is not locked - create new container, create curves
1293 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1295 QValueList<int> verIndices;
1296 dlg->getCurvesSource( horIndex, verIndices );
1297 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1298 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1299 if( !CORBA::is_nil( aContainer ) ) {
1300 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1302 for ( int i = 0; i < verIndices.count(); i++ ) {
1303 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1304 if( !CORBA::is_nil( aNewCurve ) ) {
1305 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1308 int marker, line, lineWidth;
1310 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1311 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1312 pCrv->SetColor( c );
1313 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1314 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1316 pContainer->AddCurve( pCrv->_this() );
1321 PlotContainer( this, pContainer, VISU::eDisplay );
1327 // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
1328 QPtrList<Plot2d_Curve> container;
1329 dlg->getCurves( container );
1330 if ( !container.isEmpty() ) {
1331 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1332 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1342 else if ( !anIO.IsNull() ) {
1343 // check if Table SObject is selected
1344 SO = aStudy->FindObjectID( anIO->getEntry() );
1345 if ( IsSObjectTable(SO) ) {
1346 // get name of SObject
1347 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1349 SOName = QString( aName->Value().c_str() );
1351 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1352 if ( dlg->exec() == QDialog::Accepted ) {
1353 if ( !IsStudyLocked( aStudy ) ) {
1354 // if study is not locked - create new table and container objects, create curves
1355 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1357 QValueList<int> verIndices;
1358 dlg->getCurvesSource( horIndex, verIndices );
1359 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1360 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1361 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1362 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1363 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1364 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1366 if ( pContainer && pTable ) {
1367 for ( int i = 0; i < verIndices.count(); i++ ) {
1368 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
1369 if( !CORBA::is_nil( aNewCurve ) ) {
1370 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1373 int marker, line, lineWidth;
1375 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1376 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1377 pCrv->SetColor( c );
1378 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1379 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1381 pContainer->AddCurve( pCrv->_this() );
1386 PlotContainer( this, pContainer, VISU::eDisplay );
1391 // if study is locked just get curves info and plot them
1392 QPtrList<Plot2d_Curve> container;
1393 dlg->getCurves( container );
1394 if ( !container.isEmpty() ) {
1395 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1396 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1409 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1410 SALOME_ListIO aListIO;
1411 aSelectionMgr->selectedObjects(aListIO);
1412 if (aListIO.Extent() != 1) return;
1414 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1415 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1416 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1417 if (CORBA::is_nil( anObject )) return;
1419 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1420 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1422 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1423 if( !CORBA::is_nil( aCurve ) ) {
1424 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1425 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1426 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1428 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1429 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1430 SALOMEDS::Color aColor = aDSCurve->GetColor();
1431 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1432 if( aDlg.exec() == QDialog::Accepted ) {
1433 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1434 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1435 SALOMEDS::Color newColor;
1436 newColor.R = aDlg.getColor().red()/255.;
1437 newColor.G = aDlg.getColor().green()/255.;
1438 newColor.B = aDlg.getColor().blue()/255.;
1439 aDSCurve->SetColor( newColor );
1440 PlotCurve(this, aDSCurve, VISU::eDisplay);
1451 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1452 if (CheckLock(aCStudy))
1454 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1455 Handle(SALOME_InteractiveObject) anIO;
1456 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1457 if (anIO.IsNull() || CORBA::is_nil(anObject))
1460 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1461 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1463 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1464 if (!CORBA::is_nil(aCnt)) {
1465 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1466 if (container && container->GetNbCurves() > 0) {
1478 Handle(SALOME_InteractiveObject) anIO;
1479 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1480 if (CORBA::is_nil(anObject)) return;
1482 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1483 if (!aServant.in()) return;
1484 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1485 if (!aContainer) return;
1487 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1488 aDlg->initFromPrsObject(aContainer);
1490 aDlg->storeToPrsObject(aContainer);
1491 updateObjBrowser(true);
1500 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1501 if (CheckLock(aCStudy))
1503 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1505 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1506 if (aViewMgr->getType() != SVTK_Viewer::Type())
1509 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1510 SALOME_ListIO aListIO;
1511 aSelectionMgr->selectedObjects(aListIO);
1512 if (aListIO.Extent() > 1)
1515 if (aListIO.Extent() == 0) {
1516 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1518 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1519 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1526 OnRestoreViewParams()
1528 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1529 if (aViewMgr->getType() != SVTK_Viewer::Type())
1532 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1533 SALOME_ListIO aListIO;
1534 aSelectionMgr->selectedObjects(aListIO);
1535 if (aListIO.Extent() != 1)
1538 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1539 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1540 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1541 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1542 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1547 OnDeleteViewParams()
1549 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1550 if (CheckLock(aCStudy))
1552 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1554 Handle(SALOME_InteractiveObject) anIO;
1555 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1556 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1557 if (!aSObject) return;
1559 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
1560 if (aType == VISU::TVIEW3D) {
1561 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1562 SALOME_ListIO aListIO, aNewListIO;
1563 aSelectionMgr->selectedObjects(aListIO);
1564 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
1565 if (it.Value()->getEntry() != anIO->getEntry()) {
1566 aNewListIO.Append(it.Value());
1569 aSelectionMgr->setSelectedObjects(aNewListIO);
1571 aCStudy->NewBuilder()->RemoveObject(aSObject);
1581 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1582 if (CheckLock(aCStudy))
1585 Handle(SALOME_InteractiveObject) anIO;
1586 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1588 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1591 //TEST DU PARENT == VISU
1592 _PTR(GenericAttribute) anAttr;
1593 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1594 _PTR(AttributeName) aName (anAttr);
1595 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1596 if (!Name.isEmpty()) {
1597 QApplication::setOverrideCursor(Qt::waitCursor);
1599 // rename specific objects
1600 if (!CORBA::is_nil(anObject)) {
1601 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1602 if (!CORBA::is_nil(aVisuObj)) {
1603 switch (aVisuObj->GetType()) {
1604 case VISU::TCURVE: // Curve object
1606 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1607 if (!CORBA::is_nil(aCurve)) {
1608 VISU::Curve_i* curve =
1609 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1611 curve->SetName(Name.latin1());
1615 case VISU::TTABLE: // Table object
1617 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1618 if (!CORBA::is_nil(aTable)) {
1619 VISU::Table_i* table =
1620 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1622 table->SetName(Name.latin1());
1626 case VISU::TCONTAINER: // Container object
1628 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1629 if (!CORBA::is_nil(aContainer)) {
1630 VISU::Container_i* container =
1631 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1633 container->SetName(Name.latin1());
1644 // rename the study object
1645 //getApp()->activeStudy()->renameIObject(anIO, Name);
1646 aName->SetValue(Name.latin1()); // rename the SObject
1647 anIO->setName(Name.latin1()); // rename the InteractiveObject
1648 updateObjBrowser(false);
1650 QApplication::restoreOverrideCursor();
1660 Handle(SALOME_InteractiveObject) anIO;
1661 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1662 if (CORBA::is_nil(anObject)) return;
1663 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1664 if (!aServant.in()) return;
1666 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1667 if (!aPrsObject) return;
1669 SVTK_ViewWindow* vw = GetViewWindow();
1672 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1673 if (!aActor) return;
1675 if (!aActor->GetVisibility()) {
1676 aActor->VisibilityOn();
1679 // Get sweep parameters
1680 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1682 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
1683 int aTemp = int(1.E6 * aTempoDbl);
1685 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
1686 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
1689 QApplication::setOverrideCursor(Qt::waitCursor);
1691 for (int j = 0; j < aCycles; j++) {
1692 for (int i = 0; i <= aSteps; i++) {
1693 float aPercents = float(i)/aSteps;
1694 aPrsObject->SetMapScale(aPercents);
1695 aPrsObject->UpdateActor(aActor);
1696 vw->getRenderWindow()->getRenderWindow()->Render();
1700 } catch (std::exception& exc) {
1701 INFOS("Follow exception was occured :\n" << exc.what());
1703 INFOS("Unknown exception was occured!");
1705 QApplication::restoreOverrideCursor();
1712 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1713 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1714 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1716 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1717 SALOME_ListIO aListIO;
1718 aSelectionMgr->selectedObjects(aListIO);
1720 bool isDefined = false;
1722 SALOME_ListIteratorOfListIO It (aListIO);
1723 for (; It.More(); It.Next()) {
1724 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1725 if (!aSObject) continue;
1726 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1727 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1731 aAnimationDlg->addField(aSObject);
1733 } else if (aNbTimes == aNumber) {
1734 aAnimationDlg->addField(aSObject);
1739 if (isDefined) aAnimationDlg->show();
1740 else delete aAnimationDlg;
1745 OnCopyPresentation()
1747 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1748 if (CheckLock(aCStudy))
1751 //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
1752 Handle(SALOME_InteractiveObject) anIO;
1753 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1754 if (CORBA::is_nil(anObject)) return;
1755 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1756 if (!aServant.in()) return;
1758 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1759 if (!aPrsObject) return;
1761 switch (aPrsObject->GetType()) {
1764 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1765 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1766 aSameMesh->SameAs(aMeshPrs);
1767 UpdateViewer(this, aSameMesh);
1770 case VISU::TSCALARMAP:
1772 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1773 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1774 aSameScalar->SameAs(aScalarPrs);
1775 UpdateViewer(this, aSameScalar);
1778 case VISU::TDEFORMEDSHAPE:
1780 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1781 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1782 aSameDeformed->SameAs(aDefPrs);
1783 UpdateViewer(this, aSameDeformed);
1786 case VISU::TCUTPLANES:
1788 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1789 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1790 aSameCut->SameAs(aCutPrs);
1791 UpdateViewer(this, aSameCut);
1794 case VISU::TCUTLINES:
1796 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1797 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1798 aSameCut->SameAs(aCutPrs);
1799 UpdateViewer(this, aSameCut);
1802 case VISU::TISOSURFACE:
1804 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1805 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1806 aSameIso->SameAs(aIsoPrs);
1807 UpdateViewer(this, aSameIso);
1810 case VISU::TSTREAMLINES:
1812 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1813 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1814 aSameLines->SameAs(aLinesPrs);
1815 UpdateViewer(this, aSameLines);
1818 case VISU::TVECTORS:
1820 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1821 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1822 aSameVectors->SameAs(aVectorsPrs);
1823 UpdateViewer(this, aSameVectors);
1834 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1841 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1842 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1843 false, Qt::WDestructiveClose);
1844 m_NonIsoDlg->show();
1849 initialize( CAM_Application* theApp )
1851 SalomeApp_Module::initialize( theApp );
1864 QWidget* aParent = application()->desktop();
1865 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1868 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1869 this, SLOT(OnImportFromFile()));
1870 createAction( VISU_EXPLORE_MED, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1871 this, SLOT(OnExploreMEDFile()));
1872 createAction( VISU_IMPORT_TABLE, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1873 this, SLOT(OnImportTableFromFile()));
1875 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1876 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1877 this, SLOT(OnCreateScalarMap()));
1879 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1880 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1881 this, SLOT(OnCreateDeformedShape()));
1883 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1884 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1885 this, SLOT(OnCreateVectors()));
1887 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1888 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1889 this, SLOT(OnCreateIsoSurfaces()));
1891 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1892 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1893 this, SLOT(OnCreateCutPlanes()));
1895 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1896 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1897 this, SLOT(OnCreateStreamLines()));
1899 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1900 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1901 this, SLOT(OnCreateCutLines()));
1903 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
1904 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1905 this, SLOT(OnCreatePlot2dView()));
1907 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1908 createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1909 this, SLOT(OnDeleteObject()));
1911 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1912 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1913 //this, SLOT(OnRenameTable()));
1915 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1916 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1917 this, SLOT(OnShowTable()));
1919 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1920 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1921 this, SLOT(OnPlotData()));
1923 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1924 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1925 this, SLOT(OnExportTableToFile()));
1927 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1928 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
1929 this, SLOT(OnCreateMesh()));
1931 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1932 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
1933 this, SLOT(OnCreateManyMesh()));
1935 //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE"));
1936 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(), tr("MEN_ERASE"), "", 0, aParent, false,
1937 this, SLOT(OnErasePrs()));
1939 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1940 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(), tr("MEN_DISPLAY"), "", 0, aParent, false,
1941 this, SLOT(OnDisplayPrs()));
1943 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1944 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1945 this, SLOT(OnDisplayOnlyPrs()));
1947 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1948 createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1949 this, SLOT(OnDeletePrs()));
1951 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1952 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false,
1953 this, SLOT(OnCopyPresentation()));
1955 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1956 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
1957 this, SLOT(OnCurveProperties()));
1959 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1960 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
1961 this, SLOT(OnRename()));
1963 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1964 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
1965 this, SLOT(OnEditContainer()));
1967 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1968 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
1969 //this, SLOT(OnRenameContainer()));
1971 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1972 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
1973 this, SLOT(OnClearContainer()));
1975 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1976 createAction( VISU_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
1977 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
1978 this, SLOT(OnSaveViewParams()));
1980 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1981 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
1982 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
1983 this, SLOT(OnRestoreViewParams()));
1985 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1986 createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
1987 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
1988 this, SLOT(OnDeleteViewParams()));
1990 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
1991 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
1992 this, SLOT(OnMakePoints()));
1994 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
1995 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
1996 this, SLOT(OnMakeWireframe()));
1998 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
1999 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
2000 this, SLOT(OnMakeSurface()));
2002 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2003 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2004 this, SLOT(OnMakeInsideframe()));
2006 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2007 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2008 this, SLOT(OnMakeSurfaceframe()));
2010 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2011 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(), tr("MEN_SHRINK"), "", 0, aParent, false,
2012 this, SLOT(OnMakeShrink()));
2014 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2015 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(), tr("MEN_UNSHRINK"), "", 0, aParent, false,
2016 this, SLOT(OnMakeShrink()));
2018 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2019 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2020 this, SLOT(OnChangeColor()));
2022 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2023 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(), tr("MEN_COLOR"), "", 0, aParent, false,
2024 this, SLOT(OnChangeColor()));
2026 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2027 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2028 this, SLOT(OnChangeWireframeColor()));
2030 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2031 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(), tr("MEN_OPACITY"), "", 0, aParent, false,
2032 this, SLOT(OnChangeOpacity()));
2034 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2035 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2036 this, SLOT(OnChangeLines()));
2038 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2039 createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2040 this, SLOT(OnEditPrs()));
2042 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2043 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2044 this, SLOT(OnCreateTable()));
2046 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2047 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
2048 this, SLOT(OnSweep()));
2050 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2051 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2052 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2053 this, SLOT(OnSelectionInfo()));
2055 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2056 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
2057 this, SLOT(OnTimeAnimation()));
2059 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2060 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2061 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2062 this, SLOT(OnEraseAll()));
2064 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2065 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2066 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2067 //this, SLOT(OnEraseAll()));
2070 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2071 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2072 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2073 //this, SLOT(OnEraseAll()));
2076 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
2077 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2078 tr("MEN_SCALING"), "", 0, aParent, false,
2079 this, SLOT(OnScaling()));
2086 // Add actions to menus
2088 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
2089 createMenu( separator(), aMenuId, -1, 10 );
2090 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2091 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2092 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2094 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2095 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2096 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2097 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2098 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2099 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2100 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2101 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2103 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2104 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2106 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2108 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2109 createMenu( VISU_POINTS, parentId, 10 ); // points
2110 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2111 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2112 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2113 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2114 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2115 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2122 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2123 createTool( VISU_SCALAR_MAP, aToolId );
2124 createTool( VISU_DEFORMED_SHAPE, aToolId );
2125 createTool( VISU_VECTORS, aToolId );
2126 createTool( VISU_ISO_SURFACES, aToolId );
2127 createTool( VISU_CUT_PLANES, aToolId );
2128 createTool( VISU_STREAM_LINES, aToolId );
2129 createTool( VISU_CUT_LINES, aToolId );
2136 // Prepare popup menus
2137 QtxPopupMgr* mgr = popupMgr();
2139 // VISU root commands
2140 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
2141 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED
2142 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2143 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables
2144 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2145 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d
2146 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2147 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
2148 mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // delete object
2149 mgr->setRule( action( VISU_DELETE ), aRule, true );
2151 // timestamp commands
2152 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2153 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2154 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2155 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2156 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2157 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2158 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2159 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2160 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2161 aRule += " and nbComponents>1";
2162 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2163 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2164 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2165 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2166 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2167 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2169 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
2170 //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
2171 //mgr->setRule( action( 4022 ), aRule, true );
2172 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2173 mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
2174 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2175 mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
2176 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2177 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
2178 mgr->insert( separator(), -1, -1, -1 );
2179 aRule = "(client='ObjectBrowser' and selcount>0 and ((type='VISU::TTABLE' and nbChildren>0) "
2180 "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) "
2181 " or (selcount>0 and $type in {"
2182 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2183 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
2184 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2185 mgr->setRule( action( VISU_ERASE ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=1"), true );
2186 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2187 mgr->setRule( action( VISU_DISPLAY ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=0"), true );
2188 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2189 mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule.arg(""), true );
2191 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
2192 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2193 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2194 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2195 mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // delete presentation
2196 mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
2199 mgr->insert ( action( VISU_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2200 //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
2201 mgr->setRule( action( VISU_VIEW_PARAMS ), "selcount=0", true ); //jfa tmp
2202 mgr->insert ( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2203 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2204 mgr->insert ( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2205 mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2207 // 3D presentations commands
2208 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2209 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2210 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2211 QString aSurfType = " and $type in {'VISU::TMESH'}";
2212 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2213 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
2214 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2215 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
2216 aRule = "selcount=1";
2218 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
2219 mgr->insert( action( VISU_POINTS ), parentId, -1, -1 ); // points
2220 mgr->setRule( action( VISU_POINTS ), aRule + aPrsType +
2221 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2222 mgr->insert( action( VISU_WIREFRAME ), parentId, -1, -1 ); // wireframe
2223 mgr->setRule( action( VISU_WIREFRAME ), aRule + aPrsType +
2224 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2225 mgr->insert( action( VISU_SURFACE ), parentId, -1, -1 ); // surface
2226 mgr->setRule( action( VISU_SURFACE ), aRule + aPrsType +
2227 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2228 mgr->insert( action( VISU_INSIDEFRAME ), parentId, -1, -1 ); // insideframe
2229 mgr->setRule( action( VISU_INSIDEFRAME ), aRule + aInsideType +
2230 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
2231 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2232 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType +
2233 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
2234 mgr->insert( action( VISU_SHRINK ), parentId, -1, -1 ); // shrink
2235 mgr->setRule( action( VISU_SHRINK ), aRule + aShrinkType + " and isShrunk=0", true );
2236 mgr->insert( action( VISU_UNSHRINK ), parentId, -1, -1 ); // unshrink
2237 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2239 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
2240 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2241 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2242 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2243 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2244 mgr->insert( action( VISU_COLOR ), parentId, -1, -1 ); // color
2245 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2246 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2247 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2248 mgr->insert( action( VISU_OPACITY ), parentId, -1, -1 ); // opacity
2249 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2250 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2251 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2254 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
2255 aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2256 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2258 aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
2259 mgr->insert ( action( VISU_RENAME ), -1, -1, -1 ); // rename
2260 mgr->setRule( action( VISU_RENAME ), aRule, true );
2262 // copy presentation command
2263 aRule = "selcount=1 and " + aPrsType;
2264 mgr->insert ( action( VISU_COPY_PRS ), -1, -1, -1 ); // copy
2265 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2268 aRule = "selcount=1 and type='VISU::TCURVE'";
2269 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2270 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2272 // curve container commands
2273 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2274 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); // edit container
2275 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2276 //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
2277 //mgr->setRule( action( 4043 ), aRule, true );
2278 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // clear container
2279 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2281 aRule = "selcount=1 and ";
2282 mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); // edit prs
2283 mgr->setRule( action( VISU_EDIT_PRS ), aRule + aPrsType, true );
2285 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2286 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2287 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2289 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
2290 mgr->insert ( action( VISU_SWEEP ), -1, -1, -1 ); // sweep
2291 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2293 // Selection info popup item
2294 // aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
2295 // mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2296 // mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2298 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2299 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); // animation
2300 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2302 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2303 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2304 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2305 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2306 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2309 //***************************************************************************
2310 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2312 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2314 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2315 SALOME_ListIO aListIO;
2316 aSelectionMgr->selectedObjects(aListIO);
2317 if (aListIO.Extent() != 1) return;
2319 Handle(SALOME_InteractiveObject) anIO;
2320 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
2321 _PTR(SObject) SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
2322 if (IsSObjectTable(SO)) {
2323 action( VISU_SHOW_TABLE )->addTo(theMenu);
2324 action( VISU_CREATE_CURVES )->addTo(theMenu);
2325 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2326 theMenu->insertSeparator();
2327 action( VISU_DELETE )->addTo(theMenu);
2332 //***************************************************************************
2335 windows( QMap<int, int>& theMap ) const
2338 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2339 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2345 viewManagers( QStringList& theList ) const
2348 theList.append( SVTK_Viewer::Type() );
2356 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2357 return QString(anIOR.in());
2363 activateModule( SUIT_Study* theStudy )
2365 SalomeApp_Module::activateModule( theStudy );
2367 setMenuShown( true );
2368 setToolShown( true );
2375 deactivateModule( SUIT_Study* theStudy )
2377 setMenuShown( false );
2378 setToolShown( false );
2380 SalomeApp_Module::deactivateModule( theStudy );
2384 SalomeApp_Selection*
2386 createSelection() const
2388 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2391 //******************************************************************
2392 void VisuGUI::studyActivated()
2394 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2402 return new VisuGUI();