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"
59 #include "OB_Browser.h"
61 #include "SALOME_ListIO.hxx"
62 #include "SALOME_ListIteratorOfListIO.hxx"
64 #include "SalomeApp_Application.h"
65 #include "SalomeApp_DataModel.h"
66 #include "SalomeApp_Study.h"
67 #include "SalomeApp_SelectionMgr.h"
68 #include "SalomeApp_Selection.h"
70 #include "VISUConfig.hh"
71 #include "VISU_Gen_i.hh"
72 #include "VISU_Mesh_i.hh"
73 #include "VISU_Table_i.hh"
74 #include "VISU_Result_i.hh"
75 #include "VISU_View_i.hh"
76 #include "VISU_ViewManager_i.hh"
78 #include "VISU_Actor.h"
81 #include "VisuGUI_Tools.h"
82 #include "VisuGUI_PopupTools.h"
83 #include "VisuGUI_NameDlg.h"
84 #include "VisuGUI_FileDlg.h"
85 #include "VisuGUI_CursorDlg.h"
86 #include "VisuGUI_Selection.h"
87 #include "VisuGUI_TimeAnimation.h"
88 #include "VisuGUI_EditContainerDlg.h"
89 #include "VisuGUI_NonIsometricDlg.h"
91 #include "VISU_ScalarMap_i.hh"
92 #include "VisuGUI_ScalarBarDlg.h"
94 #include "VISU_DeformedShape_i.hh"
95 #include "VisuGUI_DeformedShapeDlg.h"
97 #include "VISU_IsoSurfaces_i.hh"
98 #include "VisuGUI_IsoSurfacesDlg.h"
100 #include "VISU_CutPlanes_i.hh"
101 #include "VisuGUI_CutPlanesDlg.h"
103 #include "VISU_CutLines_i.hh"
104 #include "VisuGUI_CutLinesDlg.h"
106 #include "VISU_StreamLines_i.hh"
107 #include "VisuGUI_StreamLinesDlg.h"
109 #include "VISU_Vectors_i.hh"
110 #include "VisuGUI_VectorsDlg.h"
112 #include "VisuGUI_TableDlg.h"
114 #include "SALOMEconfig.h"
115 #include CORBA_SERVER_HEADER(MED_Gen)
117 #include "utilities.h"
119 using namespace VISU;
122 static int MYDEBUG = 1;
124 static int MYDEBUG = 0;
127 //////////////////////////////////////////////////
129 //////////////////////////////////////////////////
132 SalomeApp_Module( "VISU" )
146 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
147 CheckLock(GetCStudy(GetAppStudy(this)));
148 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
151 aFilter.append( tr("FLT_MED_FILES") );
152 aFilter.append( tr("FLT_ALL_FILES") );
154 QFileInfo aFileInfo =
155 SUIT_FileDlg::getFileName(GetDesktop(this),
158 tr("MEN_IMPORT_FROM_FILE"),
160 if(aFileInfo.exists()){
161 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
163 VISU::Result_var aResult;
164 bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
165 if(VisuGUI_FileDlg::IsBuild){
166 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
167 if(!CORBA::is_nil(aResult.in()))
168 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
169 if(!aRes->IsPossible())
170 SUIT_MessageBox::warn1(GetDesktop(this),
172 tr("ERR_CANT_BUILD_PRESENTATION"),
178 aResourceMgr->setValue("Visu:BuildResult",false);
179 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
180 aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
183 if(CORBA::is_nil(aResult.in())) {
184 SUIT_MessageBox::warn1(GetDesktop(this),
186 tr("ERR_ERROR_IN_THE_FILE"),
189 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
200 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
201 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
204 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
207 aFilter.append( tr("FLT_MED_FILES") );
208 aFilter.append( tr("FLT_ALL_FILES") );
210 QFileInfo aFileInfo =
211 SUIT_FileDlg::getFileName(GetDesktop(this),
214 tr("MEN_EXPLORE_MED_FILE"),
216 if(aFileInfo.exists()){
217 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
218 std::string aStudyName = aStudy->Name();
219 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
220 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
228 OnImportTableFromFile()
230 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
231 CheckLock(GetCStudy(GetAppStudy(this)));
234 aFilter.append( tr("FLT_TABLE_FILES") );
235 aFilter.append( tr("FLT_ALL_FILES") );
237 QFileInfo aFileInfo =
238 SUIT_FileDlg::getFileName(GetDesktop(this),
241 tr("MEN_IMPORT_TABLE"),
243 if(aFileInfo.exists()){
244 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
246 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
248 if(CORBA::is_nil(anObject.in())) {
249 SUIT_MessageBox::warn1(GetDesktop(this),
251 tr("ERR_ERROR_IN_THE_FILE"),
254 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
262 OnExportTableToFile()
264 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
268 CreateCurves( SalomeApp_Module* theModule,
269 VISU::CutLines_i* thePrs,
271 const bool theCreate = true )
275 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
279 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
280 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
282 if ( !theCreate && aSObject ){
284 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
285 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
286 _PTR(SObject) aTblObj = aIter->Value();
288 _PTR(GenericAttribute) anAttr;
289 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
290 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
297 if ( aCutDlg->isGenerateTable() ) {
298 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
299 if ( aCutDlg->isGenerateCurves() ) {
301 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
302 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
303 _PTR(SObject) aTblObj = aIter->Value();
305 _PTR(GenericAttribute) anAttr;
306 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
307 CreatePlot( theModule, aTblObj );
316 template<class TPrs3d_i>
318 CreatePrs3d(SalomeApp_Module* theModule,
319 SALOMEDS::SObject_var theTimeStamp,
320 const char* theMeshName,
321 VISU::Entity theEntity,
322 const char* theFieldName,
325 VISU::Result_var aResult;
326 if(CheckResult(theModule,theTimeStamp,aResult)){
327 QApplication::setOverrideCursor(Qt::waitCursor);
328 typedef typename TPrs3d_i::TInterface TPrs3d;
329 typename TPrs3d::_var_type aPrs3d =
330 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
331 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
332 QApplication::restoreOverrideCursor();
333 if(!CORBA::is_nil(aPrs3d.in()))
334 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
336 SUIT_MessageBox::warn1(GetDesktop(theModule),
337 QObject::tr("WRN_VISU"),
338 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
339 QObject::tr("BUT_OK") );
344 template<class TPrs3d_i, class TDlg, int IsDlgModal>
346 CreatePrs3d(SalomeApp_Module* theModule,
347 SALOMEDS::SObject_var theTimeStamp,
348 const Handle(SALOME_InteractiveObject)& theIO)
350 using namespace VISU;
351 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
353 QString aType = Storable::FindValue(aMap,"myType",&isExist);
354 if(!isExist || aType.toInt() != TTIMESTAMP )
356 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
357 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
358 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
359 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
361 CreatePrs3d<TPrs3d_i>(theModule,
364 (Entity)anEntity.toInt(),
366 aTimeStampId.toInt());
368 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
369 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
371 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode
372 aDlg->initFromPrsObject(aPrs3d);
374 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
375 // Optionally, create table and curves for cut lines
376 CreateCurves( theModule, dynamic_cast<VISU::CutLines_i*>( aPrs3d ), aDlg, true ); // in creation mode
379 DeletePrs3d(theModule,aPrs3d,theIO);
389 PublishInView(theModule,aPrs3d);
396 template<class TPrs3d_i, class TDlg, int IsDlgModal>
398 CreatePrs3d(SalomeApp_Module* theModule)
400 if(CheckLock(GetCStudy(GetAppStudy(theModule))))
403 SALOMEDS::SObject_var aTimeStampSObj;
404 Handle(SALOME_InteractiveObject) anIO;
405 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
408 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
411 theModule->application()->putInfo(QObject::tr("INF_DONE"));
412 theModule->updateObjBrowser();
414 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
418 void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
420 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
421 //if (CheckLock(aStudy))
424 SALOMEDS::SObject_var aResultSObj =
425 GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
428 VISU::Result_var aResult;
429 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
433 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
435 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
439 CORBA::Object_var aMesh;
440 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
445 if (aComment == "ENTITY") {
446 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
447 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
448 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
449 } else if (aComment == "FAMILY") {
450 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
451 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
452 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
453 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
454 } else if (aComment == "GROUP") {
455 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
456 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
457 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
461 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
465 QApplication::restoreOverrideCursor();
466 VISU::Mesh_i* pPresent = NULL;
467 if (!CORBA::is_nil(aMesh))
468 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
469 if (pPresent == NULL) {
470 SUIT_MessageBox::warn1 (GetDesktop(this),
472 tr("ERR_CANT_BUILD_PRESENTATION"),
477 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
483 PublishInView(this, pPresent);
487 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
490 application()->putInfo(QObject::tr("INF_DONE"));
491 } catch (std::runtime_error& exc) {
493 SUIT_MessageBox::warn1 (GetDesktop(this),
495 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
505 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
506 if (CheckLock(aStudy))
509 // Get selected SObject
510 SALOMEDS::SObject_var aResultSObj;
511 Handle(SALOME_InteractiveObject) anIO;
512 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
513 if (anIO.IsNull() || !anIO->hasEntry())
523 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
524 if (CheckLock(aStudy))
527 // Get selected SObject
528 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
529 SALOME_ListIO aListIO;
530 aSelectionMgr->selectedObjects(aListIO);
531 SALOME_ListIteratorOfListIO anIter (aListIO);
532 for (; anIter.More(); anIter.Next()) {
533 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
534 if (anIO.IsNull() || !anIO->hasEntry())
545 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
551 OnCreateDeformedShape()
553 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
560 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
565 OnCreateIsoSurfaces()
567 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
574 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
581 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
586 OnCreateStreamLines()
588 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
595 CheckLock(GetCStudy(GetAppStudy(this)));
596 GetVisuGen( this )->CreateContainer();
604 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
605 Handle(SALOME_InteractiveObject) anIO;
606 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
607 if ( !CORBA::is_nil( anObject ) ) {
608 // is it Prs3d object ?
609 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
611 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
612 UpdateViewer( this, aPrsObject );
613 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
614 vw->getRenderer()->ResetCameraClippingRange();
616 vw->highlight(anIO, 1);
621 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
623 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
624 PlotCurve( this, aCurve, VISU::eDisplay );
628 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
630 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
631 PlotContainer( this, aContainer, VISU::eDisplay );
635 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
637 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
638 PlotTable( this, aTable, VISU::eDisplay );
650 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject)
652 if (MYDEBUG) MESSAGE("ErasePrs");
654 if ( !CORBA::is_nil( theObject ) ) {
655 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
656 if ( CORBA::is_nil( aBase ) ) return;
657 VISU::VISUType aType = aBase->GetType();
660 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
661 PlotCurve(this, aCurve, VISU::eErase );
664 case VISU::TCONTAINER:{
665 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
666 PlotContainer(this, aContainer, VISU::eErase );
670 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
671 PlotTable(this, aTable, VISU::eErase );
675 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
676 ErasePrs3d( this, aPrsObject );
677 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
689 if(MYDEBUG) MESSAGE("OnErasePrs");
690 Handle(SALOME_InteractiveObject) anIO;
691 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
695 template<class TPrs3d_i, class TDlg>
697 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
699 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
701 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
702 TDlg* aDlg = new TDlg (GetDesktop(theModule));
703 aDlg->initFromPrsObject(aPrsObject);
705 if (!(aDlg->storeToPrsObject(aPrsObject))) {
709 RecreateActor(theModule, aPrsObject);
710 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
711 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
712 vw->getRenderer()->ResetCameraClippingRange();
725 if (CheckLock(GetCStudy(GetAppStudy(this))))
728 Handle(SALOME_InteractiveObject) anIO;
729 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
730 if (CORBA::is_nil(anObject)) return;
731 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
732 if (!aServant.in()) return;
734 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
737 switch (aPrs3d->GetType()) {
740 case VISU::TSCALARMAP:
741 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
743 case VISU::TDEFORMEDSHAPE:
744 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
746 case VISU::TCUTPLANES:
747 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
749 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
751 VisuGUI_CutPlanesDlg* aDlg =
752 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
753 aDlg->initFromPrsObject(aPrsObject);
758 case VISU::TCUTLINES:
759 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
761 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
763 VisuGUI_CutLinesDlg* aDlg =
764 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
765 aDlg->initFromPrsObject(aPrsObject);
770 case VISU::TISOSURFACE:
771 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
774 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
776 case VISU::TSTREAMLINES:
777 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
783 if (SVTK_ViewWindow* vw = GetViewWindow())
784 vw->highlight(anIO, 1);
791 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
792 if (CheckLock(aCStudy))
794 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
796 Handle(SALOME_InteractiveObject) anIO;
797 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
801 // There is a transaction
802 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
803 aStudyBuilder->NewCommand();
805 // is it Prs3d object ?
806 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
808 DeletePrs3d(this, aPrsObject, anIO);
811 // is it Curve object ?
812 VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
814 //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
817 aStudyBuilder->CommitCommand();
834 OnDisplayOnlyManyPrs()
842 SVTK_ViewWindow* vw = GetViewWindow();
845 /*jfa tmp:GetActiveStudy()->unHighlightAll();
846 if (vtkRenderer *aRen = GetRenderer()) {
848 vtkActorCollection *anActColl = aRen->GetActors();
849 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
850 if (anActor->GetVisibility() > 0)
851 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
852 anVISUActor = anVISUActor->GetParent();
853 anVISUActor->VisibilityOff();
860 void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
862 SVTK_ViewWindow* vw = GetViewWindow();
865 Handle(SALOME_InteractiveObject) anIO;
866 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
867 if (CORBA::is_nil(anObject)) return;
868 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
869 if (!aServant.in()) return;
871 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
873 if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
876 if (anActor->IsShrunk())
879 anActor->SetShrink();
882 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
883 aMesh->SetPresentationType(theType);
884 RecreateActor(this, aMesh);
886 anActor->SetRepresentation(theType);
898 ChangeRepresentation(VISU::SURFACEFRAME);
905 ChangeRepresentation(VISU::INSIDEFRAME);
912 ChangeRepresentation(VISU::WIREFRAME);
919 ChangeRepresentation(VISU::SHADED);
926 ChangeRepresentation(VISU::POINT);
933 ChangeRepresentation(VISU::SHRINK);
940 Handle(SALOME_InteractiveObject) anIO;
941 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
942 if (CORBA::is_nil(anObject)) return;
943 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
944 if (!aServant.in()) return;
946 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
949 SVTK_ViewWindow* vw = GetViewWindow();
952 VISU_Actor* anActor = GetActor(aPrs3d, vw);
953 if (!anActor) return;
955 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
956 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
957 SALOMEDS::Color anOldColor, aNewColor;
958 int aRepresent = anActor->GetRepresentation();
960 switch (aRepresent) {
962 anOldColor = aMesh->GetNodeColor();
964 case VISU::WIREFRAME :
965 case VISU::INSIDEFRAME :
966 anOldColor = aMesh->GetLinkColor();
969 case VISU::SURFACEFRAME :
970 anOldColor = aMesh->GetCellColor();
973 } else if (aDeformedShape) {
974 anOldColor = aDeformedShape->GetColor();
979 QColor aColor (int(255*anOldColor.R),
980 int(255*anOldColor.G),
981 int(255*anOldColor.B));
982 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
983 if (aColorNew.isValid()) {
984 aNewColor.R = aColorNew.red()/255.;
985 aNewColor.G = aColorNew.green()/255.;
986 aNewColor.B = aColorNew.blue()/255.;
988 switch (aRepresent) {
990 aMesh->SetNodeColor(aNewColor);
992 case VISU::WIREFRAME :
993 case VISU::INSIDEFRAME :
994 aMesh->SetLinkColor(aNewColor);
997 case VISU::SURFACEFRAME :
998 aMesh->SetCellColor(aNewColor);
1002 aDeformedShape->SetColor(aNewColor);
1004 RecreateActor(this, aPrs3d);
1010 OnChangeWireframeColor()
1012 Handle(SALOME_InteractiveObject) anIO;
1013 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1014 if (CORBA::is_nil(anObject)) return;
1015 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1016 if (!aServant.in()) return;
1018 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1019 if (!aPrs3d) return;
1021 SVTK_ViewWindow* vw = GetViewWindow();
1024 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1025 if (!anActor) return;
1027 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
1028 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1029 QColor aColor (int(255*anOldColor.R),
1030 int(255*anOldColor.G),
1031 int(255*anOldColor.B));
1032 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1033 if (aColorNew.isValid()) {
1034 aNewColor.R = aColorNew.red()/255.;
1035 aNewColor.G = aColorNew.green()/255.;
1036 aNewColor.B = aColorNew.blue()/255.;
1037 aMesh->SetLinkColor(aNewColor);
1038 RecreateActor(this, aMesh);
1047 Handle(SALOME_InteractiveObject) anIO;
1048 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1049 if (CORBA::is_nil(anObject)) return;
1050 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1051 if (!aServant.in()) return;
1053 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1054 if (!aPrsObject) return;
1056 SVTK_ViewWindow* vw = GetViewWindow();
1059 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1060 if (!anActor) return;
1062 VisuGUI_CursorDlg* CursorDlg =
1063 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1065 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1066 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1067 CursorDlg->SpinBox1->setMinValue(0);
1068 CursorDlg->SpinBox1->setMaxValue(100);
1070 float oldopac = anActor->GetOpacity();
1071 int intopac = int(oldopac*100. + 0.5);
1072 CursorDlg->SpinBox1->setValue(intopac);
1074 int ret = CursorDlg->exec();
1076 intopac = CursorDlg->SpinBox1->value();
1077 float newopac = intopac/100.;
1078 anActor->SetOpacity(newopac);
1087 Handle(SALOME_InteractiveObject) anIO;
1088 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1089 if (CORBA::is_nil(anObject)) return;
1090 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1091 if (!aServant.in()) return;
1093 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1094 if (!aPrsObject) return;
1096 SVTK_ViewWindow* vw = GetViewWindow();
1099 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1100 if (!anActor) return;
1102 VisuGUI_CursorDlg* CursorDlg =
1103 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1105 CursorDlg->Comment1->setText("DLG_LINEWIDTH_CMT1");
1106 CursorDlg->Comment2->setText("DLG_LINEWIDTH_CMT2");
1107 CursorDlg->SpinBox1->setMinValue(1);
1108 CursorDlg->SpinBox1->setMaxValue(10);
1110 float oldlwid = anActor->GetLineWidth();
1111 int intlwid = int(oldlwid);
1112 CursorDlg->SpinBox1->setValue(intlwid);
1114 int ret = CursorDlg->exec();
1116 intlwid = CursorDlg->SpinBox1->value();
1117 float newlwid = intlwid;
1118 anActor->SetLineWidth(newlwid);
1127 Handle(SALOME_InteractiveObject) anIO;
1128 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1130 if ( !CORBA::is_nil( anObject ) ) {
1131 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1132 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1133 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1134 if( !CORBA::is_nil( aTable ) ) {
1135 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1137 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1142 // possibly this is Table SObject
1143 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1146 if( !IsSObjectTable( SO ) )
1149 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1152 //SAL2670 Orientation of show tables
1153 VisuGUI_TableDlg::ttAuto,
1162 Handle(SALOME_InteractiveObject) anIO;
1163 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1164 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1165 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1166 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1167 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1168 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1177 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1178 if (CheckLock(aCStudy))
1180 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1182 Handle(SALOME_InteractiveObject) anIO;
1183 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1184 if (anIO.IsNull() || !anIO->hasEntry())
1187 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
1188 if (!aSObject->_is_nil()) {
1189 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1190 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1191 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1192 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1193 ErasePrs(aChildObj);
1195 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
1196 // There is a transaction
1197 aStudyBuilder->NewCommand();
1198 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
1199 if (!CORBA::is_nil(anObj)) {
1200 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
1201 if (!CORBA::is_nil(aBase)) {
1202 VISU::VISUType aType = aBase->GetType();
1206 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1207 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1208 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1209 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1210 if (CORBA::is_nil(aChildObj)) continue;
1211 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
1212 if (CORBA::is_nil(aPrs3d)) continue;
1213 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
1214 DeletePrs3d(this, pPrs3d, NULL);
1220 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1221 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1222 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1223 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1224 if (CORBA::is_nil(aChildObj)) continue;
1225 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
1226 if (CORBA::is_nil(aCurve)) continue;
1227 VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1228 //jfa tmp:DeleteCurve(this, pCurve, NULL);
1235 aStudyBuilder->RemoveObjectWithChildren(aSObject);
1236 aStudyBuilder->CommitCommand();
1237 //jfa tmp:GetActiveStudy()->unHighlightAll();
1238 updateObjBrowser(true);
1246 Handle(SALOME_InteractiveObject) anIO;
1247 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1249 _PTR(GenericAttribute) anAttr;
1250 _PTR(AttributeName) aName;
1252 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1254 if ( !CORBA::is_nil( anObject ) ) {
1255 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1256 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1257 // Table (VISU object) is selected
1258 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1259 if( !CORBA::is_nil( aTbl ) ) {
1260 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1262 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1263 if ( IsSObjectTable(SO) ) {
1264 // get name of SObject
1265 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1267 SOName = aName->Value();
1269 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1270 if ( dlg->exec() == QDialog::Accepted ) {
1271 if ( !IsStudyLocked( aStudy ) ) {
1272 // if study is not locked - create new container, create curves
1273 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1275 QValueList<int> verIndices;
1276 dlg->getCurvesSource( horIndex, verIndices );
1277 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1278 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1279 if( !CORBA::is_nil( aContainer ) ) {
1280 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1282 for ( int i = 0; i < verIndices.count(); i++ ) {
1283 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1284 if( !CORBA::is_nil( aNewCurve ) ) {
1285 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1288 int marker, line, lineWidth;
1290 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1291 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1292 pCrv->SetColor( c );
1293 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1294 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1296 pContainer->AddCurve( pCrv->_this() );
1301 PlotContainer( this, pContainer, VISU::eDisplay );
1307 // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
1308 QPtrList<Plot2d_Curve> container;
1309 dlg->getCurves( container );
1310 if ( !container.isEmpty() ) {
1311 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1312 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1322 else if ( !anIO.IsNull() ) {
1323 // check if Table SObject is selected
1324 SO = aStudy->FindObjectID( anIO->getEntry() );
1325 if ( IsSObjectTable(SO) ) {
1326 // get name of SObject
1327 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1329 SOName = aName->Value();
1331 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1332 if ( dlg->exec() == QDialog::Accepted ) {
1333 if ( !IsStudyLocked( aStudy ) ) {
1334 // if study is not locked - create new table and container objects, create curves
1335 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1337 QValueList<int> verIndices;
1338 dlg->getCurvesSource( horIndex, verIndices );
1339 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1340 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1341 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1342 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1343 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1344 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1346 if ( pContainer && pTable ) {
1347 for ( int i = 0; i < verIndices.count(); i++ ) {
1348 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
1349 if( !CORBA::is_nil( aNewCurve ) ) {
1350 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1353 int marker, line, lineWidth;
1355 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1356 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1357 pCrv->SetColor( c );
1358 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1359 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1361 pContainer->AddCurve( pCrv->_this() );
1366 PlotContainer( this, pContainer, VISU::eDisplay );
1371 // if study is locked just get curves info and plot them
1372 QPtrList<Plot2d_Curve> container;
1373 dlg->getCurves( container );
1374 if ( !container.isEmpty() ) {
1375 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1376 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1395 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1396 if (CheckLock(aCStudy))
1398 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1399 Handle(SALOME_InteractiveObject) anIO;
1400 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1401 if (anIO.IsNull() || CORBA::is_nil(anObject))
1404 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1405 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1407 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1408 if (!CORBA::is_nil(aCnt)) {
1409 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1410 if (container && container->GetNbCurves() > 0) {
1422 Handle(SALOME_InteractiveObject) anIO;
1423 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1424 if (CORBA::is_nil(anObject)) return;
1426 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1427 if (!aServant.in()) return;
1428 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1429 if (!aContainer) return;
1431 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1432 aDlg->initFromPrsObject(aContainer);
1434 aDlg->storeToPrsObject(aContainer);
1435 updateObjBrowser(true);
1444 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1445 if (CheckLock(aCStudy))
1447 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1449 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1450 if (aViewMgr->getType() != SVTK_Viewer::Type())
1453 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1454 SALOME_ListIO aListIO;
1455 aSelectionMgr->selectedObjects(aListIO);
1456 if (aListIO.Extent() > 1)
1459 if (aListIO.Extent() == 0) {
1460 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1462 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1463 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1470 OnRestoreViewParams()
1472 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1473 if (aViewMgr->getType() != SVTK_Viewer::Type())
1476 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1477 SALOME_ListIO aListIO;
1478 aSelectionMgr->selectedObjects(aListIO);
1479 if (aListIO.Extent() != 1)
1482 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1483 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1484 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1485 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1486 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1491 OnDeleteViewParams()
1493 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1494 if (CheckLock(aCStudy))
1496 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1498 Handle(SALOME_InteractiveObject) anIO;
1499 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1500 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1501 if (!aSObject) return;
1503 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
1504 if (aType == VISU::TVIEW3D) {
1505 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1506 SALOME_ListIO aListIO, aNewListIO;
1507 aSelectionMgr->selectedObjects(aListIO);
1508 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
1509 if (it.Value()->getEntry() != anIO->getEntry()) {
1510 aNewListIO.Append(it.Value());
1513 aSelectionMgr->setSelectedObjects(aNewListIO);
1515 aCStudy->NewBuilder()->RemoveObject(aSObject);
1525 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1526 if (CheckLock(aCStudy))
1529 Handle(SALOME_InteractiveObject) anIO;
1530 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1532 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1535 //TEST DU PARENT == VISU
1536 _PTR(GenericAttribute) anAttr;
1537 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1538 _PTR(AttributeName) aName (anAttr);
1539 QString Name = VisuGUI_NameDlg::getName(GetDesktop(this), aName->Value());
1540 if (!Name.isEmpty()) {
1541 QApplication::setOverrideCursor(Qt::waitCursor);
1543 // rename specific objects
1544 if (!CORBA::is_nil(anObject)) {
1545 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1546 if (!CORBA::is_nil(aVisuObj)) {
1547 switch (aVisuObj->GetType()) {
1548 case VISU::TCURVE: // Curve object
1550 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1551 if (!CORBA::is_nil(aCurve)) {
1552 VISU::Curve_i* curve =
1553 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1555 curve->SetName(Name.latin1());
1559 case VISU::TTABLE: // Table object
1561 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1562 if (!CORBA::is_nil(aTable)) {
1563 VISU::Table_i* table =
1564 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1566 table->SetName(Name.latin1());
1570 case VISU::TCONTAINER: // Container object
1572 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1573 if (!CORBA::is_nil(aContainer)) {
1574 VISU::Container_i* container =
1575 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1577 container->SetName(Name.latin1());
1588 // rename the study object
1589 //getApp()->activeStudy()->renameIObject(anIO, Name);
1590 aName->SetValue(Name.latin1()); // rename the SObject
1591 anIO->setName(Name.latin1()); // rename the InteractiveObject
1592 updateObjBrowser(false);
1594 QApplication::restoreOverrideCursor();
1604 Handle(SALOME_InteractiveObject) anIO;
1605 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1606 if (CORBA::is_nil(anObject)) return;
1607 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1608 if (!aServant.in()) return;
1610 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1611 if (!aPrsObject) return;
1613 SVTK_ViewWindow* vw = GetViewWindow();
1616 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1617 if (!aActor) return;
1619 if (!aActor->GetVisibility()) {
1620 aActor->VisibilityOn();
1623 // Get sweep parameters
1624 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1626 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
1627 int aTemp = int(1.E6 * aTempoDbl);
1629 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
1630 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
1633 QApplication::setOverrideCursor(Qt::waitCursor);
1635 for (int j = 0; j < aCycles; j++) {
1636 for (int i = 0; i <= aSteps; i++) {
1637 float aPercents = float(i)/aSteps;
1638 aPrsObject->SetMapScale(aPercents);
1639 aPrsObject->UpdateActor(aActor);
1640 vw->getRenderWindow()->getRenderWindow()->Render();
1644 } catch (std::exception& exc) {
1645 INFOS("Follow exception was occured :\n" << exc.what());
1647 INFOS("Unknown exception was occured!");
1649 QApplication::restoreOverrideCursor();
1656 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1657 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1658 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1660 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1661 SALOME_ListIO aListIO;
1662 aSelectionMgr->selectedObjects(aListIO);
1664 bool isDefined = false;
1666 SALOME_ListIteratorOfListIO It (aListIO);
1667 for (; It.More(); It.Next()) {
1668 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1669 if (!aSObject) continue;
1670 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1671 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1675 aAnimationDlg->addField(aSObject);
1677 } else if (aNbTimes == aNumber) {
1678 aAnimationDlg->addField(aSObject);
1683 if (isDefined) aAnimationDlg->show();
1684 else delete aAnimationDlg;
1689 OnCopyPresentation()
1691 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1692 if (CheckLock(aCStudy))
1695 //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
1696 Handle(SALOME_InteractiveObject) anIO;
1697 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1698 if (CORBA::is_nil(anObject)) return;
1699 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1700 if (!aServant.in()) return;
1702 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1703 if (!aPrsObject) return;
1705 switch (aPrsObject->GetType()) {
1708 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1709 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1710 aSameMesh->SameAs(aMeshPrs);
1711 UpdateViewer(this, aSameMesh);
1714 case VISU::TSCALARMAP:
1716 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1717 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1718 aSameScalar->SameAs(aScalarPrs);
1719 UpdateViewer(this, aSameScalar);
1722 case VISU::TDEFORMEDSHAPE:
1724 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1725 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1726 aSameDeformed->SameAs(aDefPrs);
1727 UpdateViewer(this, aSameDeformed);
1730 case VISU::TCUTPLANES:
1732 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1733 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1734 aSameCut->SameAs(aCutPrs);
1735 UpdateViewer(this, aSameCut);
1738 case VISU::TCUTLINES:
1740 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1741 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1742 aSameCut->SameAs(aCutPrs);
1743 UpdateViewer(this, aSameCut);
1746 case VISU::TISOSURFACE:
1748 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1749 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1750 aSameIso->SameAs(aIsoPrs);
1751 UpdateViewer(this, aSameIso);
1754 case VISU::TSTREAMLINES:
1756 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1757 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1758 aSameLines->SameAs(aLinesPrs);
1759 UpdateViewer(this, aSameLines);
1762 case VISU::TVECTORS:
1764 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1765 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1766 aSameVectors->SameAs(aVectorsPrs);
1767 UpdateViewer(this, aSameVectors);
1778 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1785 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1786 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1787 false, Qt::WDestructiveClose);
1788 m_NonIsoDlg->show();
1793 initialize( CAM_Application* theApp )
1795 SalomeApp_Module::initialize( theApp );
1808 QWidget* aParent = application()->desktop();
1809 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1812 createAction( 112, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1813 this, SLOT(OnImportFromFile()));
1814 createAction( 113, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1815 this, SLOT(OnExploreMEDFile()));
1816 createAction( 199, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1817 this, SLOT(OnImportTableFromFile()));
1819 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1820 createAction( 4011, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1821 this, SLOT(OnCreateScalarMap()));
1823 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1824 createAction( 4012, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1825 this, SLOT(OnCreateDeformedShape()));
1827 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1828 createAction( 4013, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1829 this, SLOT(OnCreateVectors()));
1831 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1832 createAction( 4014, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1833 this, SLOT(OnCreateIsoSurfaces()));
1835 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1836 createAction( 4015, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1837 this, SLOT(OnCreateCutPlanes()));
1839 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1840 createAction( 4016, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1841 this, SLOT(OnCreateStreamLines()));
1843 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1844 createAction( 4018, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1845 this, SLOT(OnCreateCutLines()));
1847 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1848 createAction( 4020, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1849 this, SLOT(OnCreatePlot2dView()));
1851 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1852 createAction( 4021, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1853 this, SLOT(OnDeleteObject()));
1855 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1856 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1857 //this, SLOT(OnRenameTable()));
1859 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1860 createAction( 4023, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1861 this, SLOT(OnShowTable()));
1863 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1864 createAction( 4024, tr("MEN_CREATE_CURVES"), QIconSet(aPixmap), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1865 this, SLOT(OnPlotData()));
1867 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1868 createAction( 4025, tr("MEN_EXPORT_TABLE"), QIconSet(aPixmap), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1869 this, SLOT(OnExportTableToFile()));
1871 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1872 createAction( 4026, tr("MEN_CREATE_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
1873 this, SLOT(OnCreateMesh()));
1875 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1876 createAction( 4027, tr("MEN_CREATE_MANY_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
1877 this, SLOT(OnCreateManyMesh()));
1879 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1880 createAction( 4030, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1881 this, SLOT(OnErasePrs()));
1883 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1884 createAction( 4031, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1885 this, SLOT(OnDisplayPrs()));
1887 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1888 createAction( 4032, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1889 this, SLOT(OnDisplayOnlyPrs()));
1891 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1892 createAction( 4033, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1893 this, SLOT(OnDeletePrs()));
1895 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1896 createAction( 4034, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1897 this, SLOT(OnDisplayManyPrs()));
1899 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1900 createAction( 4035, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1901 this, SLOT(OnEraseManyPrs()));
1903 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1904 createAction( 4036, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1905 this, SLOT(OnDisplayOnlyManyPrs()));
1907 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1908 createAction( 4037, tr("MEN_COPY_PRS"), QIconSet(aPixmap), tr("MEN_COPY_PRS"), "", 0, aParent, false,
1909 this, SLOT(OnCopyPresentation()));
1911 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1912 createAction( 4040, tr("MEN_CURVE_PROPS"), QIconSet(aPixmap), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
1913 this, SLOT(OnCurveProperties()));
1915 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1916 createAction( 4041, tr("MEN_RENAME"), QIconSet(aPixmap), tr("MEN_RENAME"), "", 0, aParent, false,
1917 this, SLOT(OnRename()));
1919 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1920 createAction( 4042, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
1921 this, SLOT(OnEditContainer()));
1923 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1924 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
1925 //this, SLOT(OnRenameContainer()));
1927 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1928 createAction( 4044, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
1929 this, SLOT(OnClearContainer()));
1931 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1932 createAction( 4046, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(aPixmap),
1933 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
1934 this, SLOT(OnSaveViewParams()));
1936 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1937 createAction( 4047, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(aPixmap),
1938 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
1939 this, SLOT(OnRestoreViewParams()));
1941 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1942 createAction( 4048, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(aPixmap),
1943 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
1944 this, SLOT(OnDeleteViewParams()));
1946 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1947 createAction( 4050, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
1948 this, SLOT(OnMakePoints()));
1950 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1951 createAction( 4051, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
1952 this, SLOT(OnMakeWireframe()));
1954 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1955 createAction( 4052, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
1956 this, SLOT(OnMakeSurface()));
1958 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1959 createAction( 4053, tr("MEN_INSIDEFRAME"), QIconSet(aPixmap), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
1960 this, SLOT(OnMakeInsideframe()));
1962 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1963 createAction( 4054, tr("MEN_SURFACEFRAME"), QIconSet(aPixmap), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
1964 this, SLOT(OnMakeSurfaceframe()));
1966 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1967 createAction( 4055, tr("MEN_SHRINK"), QIconSet(aPixmap), tr("MEN_SHRINK"), "", 0, aParent, false,
1968 this, SLOT(OnMakeShrink()));
1970 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1971 createAction( 4056, tr("MEN_UNSHRINK"), QIconSet(aPixmap), tr("MEN_UNSHRINK"), "", 0, aParent, false,
1972 this, SLOT(OnMakeShrink()));
1974 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1975 createAction( 4057, tr("MEN_CELL_COLOR"), QIconSet(aPixmap), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
1976 this, SLOT(OnChangeColor()));
1978 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1979 createAction( 4058, tr("MEN_COLOR"), QIconSet(aPixmap), tr("MEN_COLOR"), "", 0, aParent, false,
1980 this, SLOT(OnChangeColor()));
1982 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1983 createAction( 4059, tr("MEN_EDGE_COLOR"), QIconSet(aPixmap), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
1984 this, SLOT(OnChangeWireframeColor()));
1986 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1987 createAction( 4060, tr("MEN_OPACITY"), QIconSet(aPixmap), tr("MEN_OPACITY"), "", 0, aParent, false,
1988 this, SLOT(OnChangeOpacity()));
1990 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1991 createAction( 4061, tr("MEN_LINE_WIDTH"), QIconSet(aPixmap), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
1992 this, SLOT(OnChangeLines()));
1994 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1995 createAction( 4062, tr("MEN_EDIT_PRS"), QIconSet(aPixmap), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
1996 this, SLOT(OnEditPrs()));
1998 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1999 createAction( 4063, tr("MEN_CREATE_TABLE"), QIconSet(aPixmap), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2000 this, SLOT(OnCreateTable()));
2002 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2003 createAction( 4064, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
2004 this, SLOT(OnSweep()));
2006 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2007 createAction( 4065, tr("MEN_SELECTION_INFO"), QIconSet(aPixmap),
2008 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2009 this, SLOT(OnSelectionInfo()));
2011 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2012 createAction( 4066, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
2013 this, SLOT(OnTimeAnimation()));
2015 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2016 createAction( 4070, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2017 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2018 this, SLOT(OnEraseAll()));
2020 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2021 createAction( 4071, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2022 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2023 //this, SLOT(OnEraseAll()));
2026 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2027 createAction( 4072, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2028 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2029 //this, SLOT(OnEraseAll()));
2032 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2033 createAction( 4073, tr("MEN_SCALING"), QIconSet(aPixmap),
2034 tr("MEN_SCALING"), "", 0, aParent, false,
2035 this, SLOT(OnScaling()));
2042 // Add actions to menus
2044 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
2045 createMenu( separator(), aMenuId, 10 );
2046 createMenu( 112, aMenuId, 10 ); // import from file
2047 createMenu( 113, aMenuId, 10 ); // explore MED file
2048 createMenu( 199, aMenuId, 10 ); // import table
2050 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2051 createMenu( 4011, aMenuId, 10 ); // scalar map
2052 createMenu( 4012, aMenuId, 10 ); // deformed shape
2053 createMenu( 4013, aMenuId, 10 ); // vectors
2054 createMenu( 4014, aMenuId, 10 ); // iso surfaces
2055 createMenu( 4015, aMenuId, 10 ); // cut planes
2056 createMenu( 4016, aMenuId, 10 ); // stream lines
2057 createMenu( 4018, aMenuId, 10 ); // cut lines
2059 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2060 createMenu( 4065, aMenuId, 10 ); // selection info
2062 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2064 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2065 createMenu( 4050, parentId, 10 ); // points
2066 createMenu( 4051, parentId, 10 ); // wireframe
2067 createMenu( 4052, parentId, 10 ); // surface
2068 createMenu( 4070, aMenuId, 10 ); // erase all
2069 createMenu( 4071, aMenuId, 10 ); // global selection
2070 createMenu( 4072, aMenuId, 10 ); // partial selection
2071 createMenu( 4073, aMenuId, 10 ); // scaling
2078 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2079 createTool( 4011, aToolId );
2080 createTool( 4012, aToolId );
2081 createTool( 4013, aToolId );
2082 createTool( 4014, aToolId );
2083 createTool( 4015, aToolId );
2084 createTool( 4016, aToolId );
2085 createTool( 4018, aToolId );
2092 // Prepare popup menus
2093 QtxPopupMgr* mgr = popupMgr();
2095 // VISU root commands
2096 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
2097 mgr->insert( action( 112 ), -1, -1, -1 ); // import MED
2098 mgr->setRule( action( 112 ), aRule, true );
2099 mgr->insert( action( 199 ), -1, -1, -1 ); // import tables
2100 mgr->setRule( action( 199 ), aRule, true );
2101 mgr->insert( action( 4020 ), -1, -1, -1 ); // create Plot2d
2102 mgr->setRule( action( 4020 ), aRule, true );
2103 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
2104 mgr->insert( action( 4021 ), -1, -1, -1 ); // delete object
2105 mgr->setRule( action( 4021 ), aRule, true );
2107 // timestamp commands
2108 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2109 mgr->insert( action( 4011 ), -1, -1, -1 ); // scalar bar
2110 mgr->setRule( action( 4011 ), aRule, true );
2111 mgr->insert( action( 4014 ), -1, -1, -1 ); // iso surface
2112 mgr->setRule( action( 4014 ), aRule, true );
2113 mgr->insert( action( 4015 ), -1, -1, -1 ); // cut planes
2114 mgr->setRule( action( 4015 ), aRule, true );
2115 mgr->insert( action( 4018 ), -1, -1, -1 ); // cut lines
2116 mgr->setRule( action( 4018 ), aRule, true );
2117 aRule += " and nbComponents>1";
2118 mgr->insert( action( 4012 ), -1, -1, -1 ); // deformed shape
2119 mgr->setRule( action( 4012 ), aRule, true );
2120 mgr->insert( action( 4013 ), -1, -1, -1 ); // vectors
2121 mgr->setRule( action( 4013 ), aRule, true );
2122 mgr->insert( action( 4016 ), -1, -1, -1 ); // stream lines
2123 mgr->setRule( action( 4016 ), aRule, true );
2125 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
2126 //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
2127 //mgr->setRule( action( 4022 ), aRule, true );
2128 mgr->insert( action( 4023 ), -1, -1, -1 ); // show table
2129 mgr->setRule( action( 4023 ), aRule, true );
2130 mgr->insert( action( 4024 ), -1, -1, -1 ); // create curves
2131 mgr->setRule( action( 4024 ), aRule, true );
2132 mgr->insert( action( 4025 ), -1, -1, -1 ); // export table
2133 mgr->setRule( action( 4025 ), aRule, true );
2134 mgr->insert( separator(), -1, -1, -1 );
2135 aRule = "(client='ObjectBrowser' and selcount=1 and ((type='VISU::TTABLE' and nbChildren>0) "
2136 "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) "
2137 " or (selcount>0 and $type in {"
2138 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2139 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
2140 mgr->insert( action( 4030 ), -1, -1, -1 ); // erase
2141 mgr->setRule( action( 4030 ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=1"), true );
2142 mgr->insert( action( 4031 ), -1, -1, -1 ); // display
2143 mgr->setRule( action( 4031 ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=0"), true );
2144 mgr->insert( action( 4032 ), -1, -1, -1 ); // display only
2145 mgr->setRule( action( 4032 ), aRule.arg(""), true );
2147 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
2148 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2149 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2150 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2151 mgr->insert( action( 4033 ), -1, -1, -1 ); // delete presentation
2152 mgr->setRule( action( 4033 ), aRule, true );
2155 mgr->insert ( action( 4046 ), -1, -1, -1 ); // save view params
2156 //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
2157 mgr->setRule( action( 4046 ), "selcount=0", true ); //jfa tmp
2158 mgr->insert ( action( 4047 ), -1, -1, -1 ); // restore view params
2159 mgr->setRule( action( 4047 ), "selcount=1 and type='VISU::TVIEW3D'", true );
2160 mgr->insert ( action( 4048 ), -1, -1, -1 ); // delete view params
2161 mgr->setRule( action( 4048 ), "selcount=1 and type='VISU::TVIEW3D'", true );
2163 // 3D presentations commands
2164 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2165 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2166 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2167 QString aSurfType = " and $type in {'VISU::TMESH'}";
2168 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2169 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
2170 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2171 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
2172 aRule = "selcount=1";
2174 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
2175 mgr->insert( action( 4050 ), parentId, -1, -1 ); // points
2176 mgr->setRule( action( 4050 ), aRule + aPrsType +
2177 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2178 mgr->insert( action( 4051 ), parentId, -1, -1 ); // wireframe
2179 mgr->setRule( action( 4051 ), aRule + aPrsType +
2180 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2181 mgr->insert( action( 4052 ), parentId, -1, -1 ); // surface
2182 mgr->setRule( action( 4052 ), aRule + aPrsType +
2183 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2184 mgr->insert( action( 4053 ), parentId, -1, -1 ); // insideframe
2185 mgr->setRule( action( 4053 ), aRule + aInsideType +
2186 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
2187 mgr->insert( action( 4054 ), parentId, -1, -1 ); // surfaceframe
2188 mgr->setRule( action( 4054 ), aRule + aSurfType +
2189 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
2190 mgr->insert( action( 4055 ), parentId, -1, -1 ); // shrink
2191 mgr->setRule( action( 4055 ), aRule + aShrinkType + " and isShrunk=0", true );
2192 mgr->insert( action( 4056 ), parentId, -1, -1 ); // unshrink
2193 mgr->setRule( action( 4056 ), aRule + aShrinkType + " and isShrunk=1", true );
2195 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
2196 mgr->insert( action( 4057 ), parentId, -1, -1 ); // cell color
2197 mgr->setRule( action( 4057 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2198 mgr->insert( action( 4059 ), parentId, -1, -1 ); // edge color
2199 mgr->setRule( action( 4059 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2200 mgr->insert( action( 4058 ), parentId, -1, -1 ); // color
2201 mgr->setRule( action( 4058 ), aRule + " and ((type='VISU::TMESH'"
2202 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2203 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2204 mgr->insert( action( 4060 ), parentId, -1, -1 ); // opacity
2205 mgr->setRule( action( 4060 ), aRule + aShrinkType + " and hasActor=1", true );
2206 mgr->insert( action( 4061 ), parentId, -1, -1 ); // line width
2207 mgr->setRule( action( 4061 ), aRule + aLineType + " and hasActor=1", true );
2210 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
2211 aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2212 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2214 aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
2215 mgr->insert ( action( 4041 ), -1, -1, -1 ); // rename
2216 mgr->setRule( action( 4041 ), aRule, true );
2218 // copy presentation command
2219 aRule = "selcount=1 and " + aPrsType;
2220 mgr->insert ( action( 4037 ), -1, -1, -1 ); // copy
2221 mgr->setRule( action( 4037 ), aRule, true );
2224 aRule = "selcount=1 and type='VISU::TCURVE'";
2225 mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties
2226 mgr->setRule( action( 4040 ), aRule, true );
2228 aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2229 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2230 aRule = "client='ObjectBrowser' and selcount>1";
2231 mgr->insert( action( 4034 ), -1, -1, -1 ); // display many
2232 mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
2233 mgr->insert( action( 4035 ), -1, -1, -1 ); // erase many
2234 mgr->setRule( action( 4035 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
2235 mgr->insert( action( 4036 ), -1, -1, -1 ); // display only many
2236 mgr->setRule( action( 4036 ), aRule + " and " + aCurveType, true );
2238 // curve container commands
2239 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2240 mgr->insert( action( 4042 ), -1, -1, -1 ); // edit container
2241 mgr->setRule( action( 4042 ), aRule, true );
2242 //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
2243 //mgr->setRule( action( 4043 ), aRule, true );
2244 mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container
2245 mgr->setRule( action( 4044 ), aRule, true );
2247 aRule = "selcount=1 and ";
2248 mgr->insert( action( 4062 ), -1, -1, -1 ); // edit prs
2249 mgr->setRule( action( 4062 ), aRule + aPrsType, true );
2251 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2252 mgr->insert( action( 4063 ), -1, -1, -1 ); // create table
2253 mgr->setRule( action( 4063 ), aRule, true );
2255 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
2256 mgr->insert ( action( 4064 ), -1, -1, -1 ); // sweep
2257 mgr->setRule( action( 4064 ), aRule, true );
2259 // Selection info popup item
2260 aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
2261 mgr->insert( action( 4065 ), -1, -1, -1 ); // Selection info
2262 mgr->setRule( action( 4065 ), aRule, true );
2264 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2265 mgr->insert( action( 4066 ), -1, -1, -1 ); // animation
2266 mgr->setRule( action( 4066 ), aRule, true );
2268 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2269 mgr->insert( action( 4026 ), -1, -1, -1 ); // create presentation
2270 mgr->setRule( action( 4026 ), aRule + " and selcount=1", true );
2271 mgr->insert( action( 4027 ), -1, -1, -1 ); // create presentations
2272 mgr->setRule( action( 4027 ), aRule + " and selcount>1", true );
2277 windows( QMap<int, int>& theMap ) const
2280 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2286 viewManagers( QStringList& theList ) const
2289 theList.append( SVTK_Viewer::Type() );
2297 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2298 return QString(anIOR.in());
2304 activateModule( SUIT_Study* theStudy )
2306 SalomeApp_Module::activateModule( theStudy );
2308 setMenuShown( true );
2309 setToolShown( true );
2316 deactivateModule( SUIT_Study* theStudy )
2318 setMenuShown( false );
2319 setToolShown( false );
2321 SalomeApp_Module::deactivateModule( theStudy );
2325 SalomeApp_Selection*
2327 createSelection() const
2329 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2336 return new VisuGUI();