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 #include "VisuGUI_ActionsDef.h"
121 using namespace VISU;
124 static int MYDEBUG = 1;
126 static int MYDEBUG = 0;
129 //////////////////////////////////////////////////
131 //////////////////////////////////////////////////
134 SalomeApp_Module( "VISU" )
148 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
149 CheckLock(GetCStudy(GetAppStudy(this)));
150 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
153 aFilter.append( tr("FLT_MED_FILES") );
154 aFilter.append( tr("FLT_ALL_FILES") );
156 QFileInfo aFileInfo =
157 SUIT_FileDlg::getFileName(GetDesktop(this),
160 tr("MEN_IMPORT_FROM_FILE"),
162 if(aFileInfo.exists()){
163 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
165 VISU::Result_var aResult;
166 bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
167 if(VisuGUI_FileDlg::IsBuild){
168 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
169 if(!CORBA::is_nil(aResult.in()))
170 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
171 if(!aRes->IsPossible())
172 SUIT_MessageBox::warn1(GetDesktop(this),
174 tr("ERR_CANT_BUILD_PRESENTATION"),
180 aResourceMgr->setValue("Visu:BuildResult",false);
181 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
182 aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
185 if(CORBA::is_nil(aResult.in())) {
186 SUIT_MessageBox::warn1(GetDesktop(this),
188 tr("ERR_ERROR_IN_THE_FILE"),
191 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
202 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
203 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
206 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
209 aFilter.append( tr("FLT_MED_FILES") );
210 aFilter.append( tr("FLT_ALL_FILES") );
212 QFileInfo aFileInfo =
213 SUIT_FileDlg::getFileName(GetDesktop(this),
216 tr("MEN_EXPLORE_MED_FILE"),
218 if(aFileInfo.exists()){
219 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
220 std::string aStudyName = aStudy->Name();
221 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
222 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
230 OnImportTableFromFile()
232 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
233 CheckLock(GetCStudy(GetAppStudy(this)));
236 aFilter.append( tr("FLT_TABLE_FILES") );
237 aFilter.append( tr("FLT_ALL_FILES") );
239 QFileInfo aFileInfo =
240 SUIT_FileDlg::getFileName(GetDesktop(this),
243 tr("MEN_IMPORT_TABLE"),
245 if(aFileInfo.exists()){
246 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
248 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
250 if(CORBA::is_nil(anObject.in())) {
251 SUIT_MessageBox::warn1(GetDesktop(this),
253 tr("ERR_ERROR_IN_THE_FILE"),
256 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
264 OnExportTableToFile()
266 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
270 CreateCurves( SalomeApp_Module* theModule,
271 VISU::CutLines_i* thePrs,
273 const bool theCreate = true )
277 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
281 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
282 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
284 if ( !theCreate && aSObject ){
286 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
287 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
288 _PTR(SObject) aTblObj = aIter->Value();
290 _PTR(GenericAttribute) anAttr;
291 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
292 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
299 if ( aCutDlg->isGenerateTable() ) {
300 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
301 if ( aCutDlg->isGenerateCurves() ) {
303 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
304 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
305 _PTR(SObject) aTblObj = aIter->Value();
307 _PTR(GenericAttribute) anAttr;
308 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
309 CreatePlot( theModule, aTblObj );
318 template<class TPrs3d_i>
320 CreatePrs3d(SalomeApp_Module* theModule,
321 SALOMEDS::SObject_var theTimeStamp,
322 const char* theMeshName,
323 VISU::Entity theEntity,
324 const char* theFieldName,
327 VISU::Result_var aResult;
328 if(CheckResult(theModule,theTimeStamp,aResult)){
329 QApplication::setOverrideCursor(Qt::waitCursor);
330 typedef typename TPrs3d_i::TInterface TPrs3d;
331 typename TPrs3d::_var_type aPrs3d =
332 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
333 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
334 QApplication::restoreOverrideCursor();
335 if(!CORBA::is_nil(aPrs3d.in()))
336 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
338 SUIT_MessageBox::warn1(GetDesktop(theModule),
339 QObject::tr("WRN_VISU"),
340 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
341 QObject::tr("BUT_OK") );
346 template<class TPrs3d_i, class TDlg, int IsDlgModal>
348 CreatePrs3d(SalomeApp_Module* theModule,
349 SALOMEDS::SObject_var theTimeStamp,
350 const Handle(SALOME_InteractiveObject)& theIO)
352 using namespace VISU;
353 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
355 QString aType = Storable::FindValue(aMap,"myType",&isExist);
356 if(!isExist || aType.toInt() != TTIMESTAMP )
358 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
359 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
360 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
361 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
363 CreatePrs3d<TPrs3d_i>(theModule,
366 (Entity)anEntity.toInt(),
368 aTimeStampId.toInt());
370 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
371 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
373 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode
374 aDlg->initFromPrsObject(aPrs3d);
376 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
377 // Optionally, create table and curves for cut lines
378 CreateCurves( theModule, dynamic_cast<VISU::CutLines_i*>( aPrs3d ), aDlg, true ); // in creation mode
381 DeletePrs3d(theModule,aPrs3d,theIO);
391 PublishInView(theModule,aPrs3d);
398 template<class TPrs3d_i, class TDlg, int IsDlgModal>
400 CreatePrs3d(SalomeApp_Module* theModule)
402 if(CheckLock(GetCStudy(GetAppStudy(theModule))))
405 SALOMEDS::SObject_var aTimeStampSObj;
406 Handle(SALOME_InteractiveObject) anIO;
407 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
410 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
413 theModule->application()->putInfo(QObject::tr("INF_DONE"));
414 theModule->updateObjBrowser();
416 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
420 void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
422 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
423 //if (CheckLock(aStudy))
426 SALOMEDS::SObject_var aResultSObj =
427 GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
430 VISU::Result_var aResult;
431 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
435 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
437 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
441 CORBA::Object_var aMesh;
442 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
447 if (aComment == "ENTITY") {
448 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
449 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
450 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
451 } else if (aComment == "FAMILY") {
452 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
453 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
454 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
455 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
456 } else if (aComment == "GROUP") {
457 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
458 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
459 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
463 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
467 QApplication::restoreOverrideCursor();
468 VISU::Mesh_i* pPresent = NULL;
469 if (!CORBA::is_nil(aMesh))
470 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
471 if (pPresent == NULL) {
472 SUIT_MessageBox::warn1 (GetDesktop(this),
474 tr("ERR_CANT_BUILD_PRESENTATION"),
479 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
485 PublishInView(this, pPresent);
489 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
492 application()->putInfo(QObject::tr("INF_DONE"));
493 } catch (std::runtime_error& exc) {
495 SUIT_MessageBox::warn1 (GetDesktop(this),
497 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
507 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
508 if (CheckLock(aStudy))
511 // Get selected SObject
512 SALOMEDS::SObject_var aResultSObj;
513 Handle(SALOME_InteractiveObject) anIO;
514 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
515 if (anIO.IsNull() || !anIO->hasEntry())
525 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
526 if (CheckLock(aStudy))
529 // Get selected SObject
530 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
531 SALOME_ListIO aListIO;
532 aSelectionMgr->selectedObjects(aListIO);
533 SALOME_ListIteratorOfListIO anIter (aListIO);
534 for (; anIter.More(); anIter.Next()) {
535 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
536 if (anIO.IsNull() || !anIO->hasEntry())
547 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
553 OnCreateDeformedShape()
555 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
562 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
567 OnCreateIsoSurfaces()
569 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
576 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
583 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
588 OnCreateStreamLines()
590 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
597 CheckLock(GetCStudy(GetAppStudy(this)));
598 GetVisuGen( this )->CreateContainer();
606 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
608 QApplication::setOverrideCursor(Qt::waitCursor);
610 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
611 mgr->selectedObjects(aList);
613 Handle(SALOME_InteractiveObject) anIO;
614 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
616 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
617 if ( !CORBA::is_nil( anObject ) ) {
618 // is it Prs3d object ?
619 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
621 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
622 UpdateViewer( this, aPrsObject );
623 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
624 vw->highlight(anIO, 1);
629 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
631 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
632 PlotCurve( this, aCurve, VISU::eDisplay );
636 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
638 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
639 PlotContainer( this, aContainer, VISU::eDisplay );
643 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
645 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
646 PlotTable( this, aTable, VISU::eDisplay );
651 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
652 vw->getRenderer()->ResetCameraClippingRange();
655 QApplication::restoreOverrideCursor();
666 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject, bool theUpdate)
668 if (MYDEBUG) MESSAGE("ErasePrs");
670 if ( !CORBA::is_nil( theObject ) ) {
671 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
672 if ( CORBA::is_nil( aBase ) ) return;
673 VISU::VISUType aType = aBase->GetType();
676 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
677 PlotCurve(this, aCurve, VISU::eErase );
680 case VISU::TCONTAINER:{
681 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
682 PlotContainer(this, aContainer, VISU::eErase );
686 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
687 PlotTable(this, aTable, VISU::eErase );
691 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
692 ErasePrs3d( this, aPrsObject );
694 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
707 if(MYDEBUG) MESSAGE("OnErasePrs");
709 QApplication::setOverrideCursor(Qt::waitCursor);
711 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
712 mgr->selectedObjects(aList);
714 Handle(SALOME_InteractiveObject) anIO;
715 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
717 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
718 ErasePrs(anObject, false);
720 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
722 QApplication::restoreOverrideCursor();
725 template<class TPrs3d_i, class TDlg>
727 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
729 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
731 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
732 TDlg* aDlg = new TDlg (GetDesktop(theModule));
733 aDlg->initFromPrsObject(aPrsObject);
735 if (!(aDlg->storeToPrsObject(aPrsObject))) {
739 RecreateActor(theModule, aPrsObject);
740 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
741 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
742 vw->getRenderer()->ResetCameraClippingRange();
755 if (CheckLock(GetCStudy(GetAppStudy(this))))
758 Handle(SALOME_InteractiveObject) anIO;
759 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
760 if (CORBA::is_nil(anObject)) return;
761 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
762 if (!aServant.in()) return;
764 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
767 switch (aPrs3d->GetType()) {
770 case VISU::TSCALARMAP:
771 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
773 case VISU::TDEFORMEDSHAPE:
774 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
776 case VISU::TCUTPLANES:
777 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
779 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
781 VisuGUI_CutPlanesDlg* aDlg =
782 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
783 aDlg->initFromPrsObject(aPrsObject);
788 case VISU::TCUTLINES:
789 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
791 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
793 VisuGUI_CutLinesDlg* aDlg =
794 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
795 aDlg->initFromPrsObject(aPrsObject);
800 case VISU::TISOSURFACE:
801 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
804 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
806 case VISU::TSTREAMLINES:
807 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
813 if (SVTK_ViewWindow* vw = GetViewWindow())
814 vw->highlight(anIO, 1);
821 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
822 if (CheckLock(aCStudy))
824 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
826 Handle(SALOME_InteractiveObject) anIO;
827 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
831 // There is a transaction
832 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
833 aStudyBuilder->NewCommand();
835 // is it Prs3d object ?
836 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
838 DeletePrs3d(this, aPrsObject, anIO);
841 // is it Curve object ?
842 VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
844 //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
847 aStudyBuilder->CommitCommand();
855 SVTK_ViewWindow* vw = GetViewWindow();
858 vw->unHighlightAll();
859 if (vtkRenderer *aRen = vw->getRenderer()) {
861 vtkActorCollection *anActColl = aRen->GetActors();
862 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
863 if (anActor->GetVisibility() > 0)
864 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
865 anVISUActor = anVISUActor->GetParent();
866 anVISUActor->VisibilityOff();
873 void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
875 SVTK_ViewWindow* vw = GetViewWindow();
878 Handle(SALOME_InteractiveObject) anIO;
879 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
880 if (CORBA::is_nil(anObject)) return;
881 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
882 if (!aServant.in()) return;
884 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
886 if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
889 if (anActor->IsShrunk())
892 anActor->SetShrink();
895 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
896 aMesh->SetPresentationType(theType);
897 RecreateActor(this, aMesh);
899 anActor->SetRepresentation(theType);
911 ChangeRepresentation(VISU::SURFACEFRAME);
918 ChangeRepresentation(VISU::INSIDEFRAME);
925 ChangeRepresentation(VISU::WIREFRAME);
932 ChangeRepresentation(VISU::SHADED);
939 ChangeRepresentation(VISU::POINT);
946 ChangeRepresentation(VISU::SHRINK);
953 Handle(SALOME_InteractiveObject) anIO;
954 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
955 if (CORBA::is_nil(anObject)) return;
956 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
957 if (!aServant.in()) return;
959 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
962 SVTK_ViewWindow* vw = GetViewWindow();
965 VISU_Actor* anActor = GetActor(aPrs3d, vw);
966 if (!anActor) return;
968 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
969 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
970 SALOMEDS::Color anOldColor, aNewColor;
971 int aRepresent = anActor->GetRepresentation();
973 switch (aRepresent) {
975 anOldColor = aMesh->GetNodeColor();
977 case VISU::WIREFRAME :
978 case VISU::INSIDEFRAME :
979 anOldColor = aMesh->GetLinkColor();
982 case VISU::SURFACEFRAME :
983 anOldColor = aMesh->GetCellColor();
986 } else if (aDeformedShape) {
987 anOldColor = aDeformedShape->GetColor();
992 QColor aColor (int(255*anOldColor.R),
993 int(255*anOldColor.G),
994 int(255*anOldColor.B));
995 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
996 if (aColorNew.isValid()) {
997 aNewColor.R = aColorNew.red()/255.;
998 aNewColor.G = aColorNew.green()/255.;
999 aNewColor.B = aColorNew.blue()/255.;
1001 switch (aRepresent) {
1003 aMesh->SetNodeColor(aNewColor);
1005 case VISU::WIREFRAME :
1006 case VISU::INSIDEFRAME :
1007 aMesh->SetLinkColor(aNewColor);
1010 case VISU::SURFACEFRAME :
1011 aMesh->SetCellColor(aNewColor);
1015 aDeformedShape->SetColor(aNewColor);
1017 RecreateActor(this, aPrs3d);
1023 OnChangeWireframeColor()
1025 Handle(SALOME_InteractiveObject) anIO;
1026 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1027 if (CORBA::is_nil(anObject)) return;
1028 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1029 if (!aServant.in()) return;
1031 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1032 if (!aPrs3d) return;
1034 SVTK_ViewWindow* vw = GetViewWindow();
1037 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1038 if (!anActor) return;
1040 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
1041 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1042 QColor aColor (int(255*anOldColor.R),
1043 int(255*anOldColor.G),
1044 int(255*anOldColor.B));
1045 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1046 if (aColorNew.isValid()) {
1047 aNewColor.R = aColorNew.red()/255.;
1048 aNewColor.G = aColorNew.green()/255.;
1049 aNewColor.B = aColorNew.blue()/255.;
1050 aMesh->SetLinkColor(aNewColor);
1051 RecreateActor(this, aMesh);
1060 Handle(SALOME_InteractiveObject) anIO;
1061 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1062 if (CORBA::is_nil(anObject)) return;
1063 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1064 if (!aServant.in()) return;
1066 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1067 if (!aPrsObject) return;
1069 SVTK_ViewWindow* vw = GetViewWindow();
1072 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1073 if (!anActor) return;
1075 VisuGUI_CursorDlg* CursorDlg =
1076 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1078 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1079 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1080 CursorDlg->SpinBox1->setMinValue(0);
1081 CursorDlg->SpinBox1->setMaxValue(100);
1083 float oldopac = anActor->GetOpacity();
1084 int intopac = int(oldopac*100. + 0.5);
1085 CursorDlg->SpinBox1->setValue(intopac);
1087 int ret = CursorDlg->exec();
1089 intopac = CursorDlg->SpinBox1->value();
1090 float newopac = intopac/100.;
1091 anActor->SetOpacity(newopac);
1100 Handle(SALOME_InteractiveObject) anIO;
1101 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1102 if (CORBA::is_nil(anObject)) return;
1103 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1104 if (!aServant.in()) return;
1106 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1107 if (!aPrsObject) return;
1109 SVTK_ViewWindow* vw = GetViewWindow();
1112 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1113 if (!anActor) return;
1115 VisuGUI_CursorDlg* CursorDlg =
1116 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1118 CursorDlg->Comment1->setText("DLG_LINEWIDTH_CMT1");
1119 CursorDlg->Comment2->setText("DLG_LINEWIDTH_CMT2");
1120 CursorDlg->SpinBox1->setMinValue(1);
1121 CursorDlg->SpinBox1->setMaxValue(10);
1123 float oldlwid = anActor->GetLineWidth();
1124 int intlwid = int(oldlwid);
1125 CursorDlg->SpinBox1->setValue(intlwid);
1127 int ret = CursorDlg->exec();
1129 intlwid = CursorDlg->SpinBox1->value();
1130 float newlwid = intlwid;
1131 anActor->SetLineWidth(newlwid);
1140 Handle(SALOME_InteractiveObject) anIO;
1141 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1143 if ( !CORBA::is_nil( anObject ) ) {
1144 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1145 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1146 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1147 if( !CORBA::is_nil( aTable ) ) {
1148 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1150 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1155 // possibly this is Table SObject
1156 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1159 if( !IsSObjectTable( SO ) )
1162 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1165 //SAL2670 Orientation of show tables
1166 VisuGUI_TableDlg::ttAuto,
1175 Handle(SALOME_InteractiveObject) anIO;
1176 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1177 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1178 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1179 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1180 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1181 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1190 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1191 if (CheckLock(aCStudy))
1193 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1195 Handle(SALOME_InteractiveObject) anIO;
1196 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1197 if (anIO.IsNull() || !anIO->hasEntry())
1200 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
1201 if (!aSObject->_is_nil()) {
1202 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1203 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1204 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1205 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1206 ErasePrs(aChildObj);
1208 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
1209 // There is a transaction
1210 aStudyBuilder->NewCommand();
1211 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
1212 if (!CORBA::is_nil(anObj)) {
1213 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
1214 if (!CORBA::is_nil(aBase)) {
1215 VISU::VISUType aType = aBase->GetType();
1219 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1220 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1221 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1222 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1223 if (CORBA::is_nil(aChildObj)) continue;
1224 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
1225 if (CORBA::is_nil(aPrs3d)) continue;
1226 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
1227 DeletePrs3d(this, pPrs3d, NULL);
1233 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1234 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1235 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1236 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1237 if (CORBA::is_nil(aChildObj)) continue;
1238 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
1239 if (CORBA::is_nil(aCurve)) continue;
1240 //VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1241 //jfa tmp:DeleteCurve(this, pCurve, NULL);
1248 aStudyBuilder->RemoveObjectWithChildren(aSObject);
1249 aStudyBuilder->CommitCommand();
1250 //jfa tmp:GetActiveStudy()->unHighlightAll();
1251 updateObjBrowser(true);
1259 Handle(SALOME_InteractiveObject) anIO;
1260 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1262 _PTR(GenericAttribute) anAttr;
1263 _PTR(AttributeName) aName;
1265 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1267 if ( !CORBA::is_nil( anObject ) ) {
1268 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1269 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1270 // Table (VISU object) is selected
1271 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1272 if( !CORBA::is_nil( aTbl ) ) {
1273 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1275 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1276 if ( IsSObjectTable(SO) ) {
1277 // get name of SObject
1278 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1280 SOName = QString( aName->Value().c_str() );
1282 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1283 if ( dlg->exec() == QDialog::Accepted ) {
1284 if ( !IsStudyLocked( aStudy ) ) {
1285 // if study is not locked - create new container, create curves
1286 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1288 QValueList<int> verIndices;
1289 dlg->getCurvesSource( horIndex, verIndices );
1290 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1291 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1292 if( !CORBA::is_nil( aContainer ) ) {
1293 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1295 for ( int i = 0; i < verIndices.count(); i++ ) {
1296 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1297 if( !CORBA::is_nil( aNewCurve ) ) {
1298 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1301 int marker, line, lineWidth;
1303 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1304 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1305 pCrv->SetColor( c );
1306 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1307 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1309 pContainer->AddCurve( pCrv->_this() );
1314 PlotContainer( this, pContainer, VISU::eDisplay );
1320 // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
1321 QPtrList<Plot2d_Curve> container;
1322 dlg->getCurves( container );
1323 if ( !container.isEmpty() ) {
1324 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1325 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1335 else if ( !anIO.IsNull() ) {
1336 // check if Table SObject is selected
1337 SO = aStudy->FindObjectID( anIO->getEntry() );
1338 if ( IsSObjectTable(SO) ) {
1339 // get name of SObject
1340 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1342 SOName = QString( aName->Value().c_str() );
1344 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1345 if ( dlg->exec() == QDialog::Accepted ) {
1346 if ( !IsStudyLocked( aStudy ) ) {
1347 // if study is not locked - create new table and container objects, create curves
1348 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1350 QValueList<int> verIndices;
1351 dlg->getCurvesSource( horIndex, verIndices );
1352 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1353 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1354 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1355 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1356 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1357 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1359 if ( pContainer && pTable ) {
1360 for ( int i = 0; i < verIndices.count(); i++ ) {
1361 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
1362 if( !CORBA::is_nil( aNewCurve ) ) {
1363 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1366 int marker, line, lineWidth;
1368 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1369 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1370 pCrv->SetColor( c );
1371 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1372 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1374 pContainer->AddCurve( pCrv->_this() );
1379 PlotContainer( this, pContainer, VISU::eDisplay );
1384 // if study is locked just get curves info and plot them
1385 QPtrList<Plot2d_Curve> container;
1386 dlg->getCurves( container );
1387 if ( !container.isEmpty() ) {
1388 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1389 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1408 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1409 if (CheckLock(aCStudy))
1411 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1412 Handle(SALOME_InteractiveObject) anIO;
1413 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1414 if (anIO.IsNull() || CORBA::is_nil(anObject))
1417 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1418 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1420 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1421 if (!CORBA::is_nil(aCnt)) {
1422 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1423 if (container && container->GetNbCurves() > 0) {
1435 Handle(SALOME_InteractiveObject) anIO;
1436 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1437 if (CORBA::is_nil(anObject)) return;
1439 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1440 if (!aServant.in()) return;
1441 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1442 if (!aContainer) return;
1444 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1445 aDlg->initFromPrsObject(aContainer);
1447 aDlg->storeToPrsObject(aContainer);
1448 updateObjBrowser(true);
1457 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1458 if (CheckLock(aCStudy))
1460 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1462 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1463 if (aViewMgr->getType() != SVTK_Viewer::Type())
1466 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1467 SALOME_ListIO aListIO;
1468 aSelectionMgr->selectedObjects(aListIO);
1469 if (aListIO.Extent() > 1)
1472 if (aListIO.Extent() == 0) {
1473 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1475 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1476 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1483 OnRestoreViewParams()
1485 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1486 if (aViewMgr->getType() != SVTK_Viewer::Type())
1489 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1490 SALOME_ListIO aListIO;
1491 aSelectionMgr->selectedObjects(aListIO);
1492 if (aListIO.Extent() != 1)
1495 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1496 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1497 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1498 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1499 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1504 OnDeleteViewParams()
1506 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1507 if (CheckLock(aCStudy))
1509 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1511 Handle(SALOME_InteractiveObject) anIO;
1512 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1513 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1514 if (!aSObject) return;
1516 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
1517 if (aType == VISU::TVIEW3D) {
1518 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1519 SALOME_ListIO aListIO, aNewListIO;
1520 aSelectionMgr->selectedObjects(aListIO);
1521 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
1522 if (it.Value()->getEntry() != anIO->getEntry()) {
1523 aNewListIO.Append(it.Value());
1526 aSelectionMgr->setSelectedObjects(aNewListIO);
1528 aCStudy->NewBuilder()->RemoveObject(aSObject);
1538 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1539 if (CheckLock(aCStudy))
1542 Handle(SALOME_InteractiveObject) anIO;
1543 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1545 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1548 //TEST DU PARENT == VISU
1549 _PTR(GenericAttribute) anAttr;
1550 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1551 _PTR(AttributeName) aName (anAttr);
1552 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1553 if (!Name.isEmpty()) {
1554 QApplication::setOverrideCursor(Qt::waitCursor);
1556 // rename specific objects
1557 if (!CORBA::is_nil(anObject)) {
1558 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1559 if (!CORBA::is_nil(aVisuObj)) {
1560 switch (aVisuObj->GetType()) {
1561 case VISU::TCURVE: // Curve object
1563 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1564 if (!CORBA::is_nil(aCurve)) {
1565 VISU::Curve_i* curve =
1566 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1568 curve->SetName(Name.latin1());
1572 case VISU::TTABLE: // Table object
1574 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1575 if (!CORBA::is_nil(aTable)) {
1576 VISU::Table_i* table =
1577 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1579 table->SetName(Name.latin1());
1583 case VISU::TCONTAINER: // Container object
1585 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1586 if (!CORBA::is_nil(aContainer)) {
1587 VISU::Container_i* container =
1588 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1590 container->SetName(Name.latin1());
1601 // rename the study object
1602 //getApp()->activeStudy()->renameIObject(anIO, Name);
1603 aName->SetValue(Name.latin1()); // rename the SObject
1604 anIO->setName(Name.latin1()); // rename the InteractiveObject
1605 updateObjBrowser(false);
1607 QApplication::restoreOverrideCursor();
1617 Handle(SALOME_InteractiveObject) anIO;
1618 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1619 if (CORBA::is_nil(anObject)) return;
1620 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1621 if (!aServant.in()) return;
1623 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1624 if (!aPrsObject) return;
1626 SVTK_ViewWindow* vw = GetViewWindow();
1629 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1630 if (!aActor) return;
1632 if (!aActor->GetVisibility()) {
1633 aActor->VisibilityOn();
1636 // Get sweep parameters
1637 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1639 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
1640 int aTemp = int(1.E6 * aTempoDbl);
1642 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
1643 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
1646 QApplication::setOverrideCursor(Qt::waitCursor);
1648 for (int j = 0; j < aCycles; j++) {
1649 for (int i = 0; i <= aSteps; i++) {
1650 float aPercents = float(i)/aSteps;
1651 aPrsObject->SetMapScale(aPercents);
1652 aPrsObject->UpdateActor(aActor);
1653 vw->getRenderWindow()->getRenderWindow()->Render();
1657 } catch (std::exception& exc) {
1658 INFOS("Follow exception was occured :\n" << exc.what());
1660 INFOS("Unknown exception was occured!");
1662 QApplication::restoreOverrideCursor();
1669 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1670 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1671 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1673 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1674 SALOME_ListIO aListIO;
1675 aSelectionMgr->selectedObjects(aListIO);
1677 bool isDefined = false;
1679 SALOME_ListIteratorOfListIO It (aListIO);
1680 for (; It.More(); It.Next()) {
1681 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1682 if (!aSObject) continue;
1683 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1684 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1688 aAnimationDlg->addField(aSObject);
1690 } else if (aNbTimes == aNumber) {
1691 aAnimationDlg->addField(aSObject);
1696 if (isDefined) aAnimationDlg->show();
1697 else delete aAnimationDlg;
1702 OnCopyPresentation()
1704 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1705 if (CheckLock(aCStudy))
1708 //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
1709 Handle(SALOME_InteractiveObject) anIO;
1710 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1711 if (CORBA::is_nil(anObject)) return;
1712 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1713 if (!aServant.in()) return;
1715 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1716 if (!aPrsObject) return;
1718 switch (aPrsObject->GetType()) {
1721 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1722 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1723 aSameMesh->SameAs(aMeshPrs);
1724 UpdateViewer(this, aSameMesh);
1727 case VISU::TSCALARMAP:
1729 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1730 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1731 aSameScalar->SameAs(aScalarPrs);
1732 UpdateViewer(this, aSameScalar);
1735 case VISU::TDEFORMEDSHAPE:
1737 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1738 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1739 aSameDeformed->SameAs(aDefPrs);
1740 UpdateViewer(this, aSameDeformed);
1743 case VISU::TCUTPLANES:
1745 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1746 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1747 aSameCut->SameAs(aCutPrs);
1748 UpdateViewer(this, aSameCut);
1751 case VISU::TCUTLINES:
1753 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1754 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1755 aSameCut->SameAs(aCutPrs);
1756 UpdateViewer(this, aSameCut);
1759 case VISU::TISOSURFACE:
1761 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1762 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1763 aSameIso->SameAs(aIsoPrs);
1764 UpdateViewer(this, aSameIso);
1767 case VISU::TSTREAMLINES:
1769 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1770 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1771 aSameLines->SameAs(aLinesPrs);
1772 UpdateViewer(this, aSameLines);
1775 case VISU::TVECTORS:
1777 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1778 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1779 aSameVectors->SameAs(aVectorsPrs);
1780 UpdateViewer(this, aSameVectors);
1791 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1798 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1799 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1800 false, Qt::WDestructiveClose);
1801 m_NonIsoDlg->show();
1806 initialize( CAM_Application* theApp )
1808 SalomeApp_Module::initialize( theApp );
1821 QWidget* aParent = application()->desktop();
1822 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1825 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1826 this, SLOT(OnImportFromFile()));
1827 createAction( VISU_EXPLORE_MED, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1828 this, SLOT(OnExploreMEDFile()));
1829 createAction( VISU_IMPORT_TABLE, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1830 this, SLOT(OnImportTableFromFile()));
1832 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1833 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1834 this, SLOT(OnCreateScalarMap()));
1836 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1837 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1838 this, SLOT(OnCreateDeformedShape()));
1840 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1841 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1842 this, SLOT(OnCreateVectors()));
1844 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1845 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1846 this, SLOT(OnCreateIsoSurfaces()));
1848 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1849 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1850 this, SLOT(OnCreateCutPlanes()));
1852 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1853 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1854 this, SLOT(OnCreateStreamLines()));
1856 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1857 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1858 this, SLOT(OnCreateCutLines()));
1860 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1861 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1862 this, SLOT(OnCreatePlot2dView()));
1864 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1865 createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1866 this, SLOT(OnDeleteObject()));
1868 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1869 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1870 //this, SLOT(OnRenameTable()));
1872 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1873 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1874 this, SLOT(OnShowTable()));
1876 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1877 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(aPixmap), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1878 this, SLOT(OnPlotData()));
1880 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1881 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(aPixmap), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1882 this, SLOT(OnExportTableToFile()));
1884 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1885 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
1886 this, SLOT(OnCreateMesh()));
1888 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1889 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
1890 this, SLOT(OnCreateManyMesh()));
1892 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1893 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1894 this, SLOT(OnErasePrs()));
1896 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1897 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1898 this, SLOT(OnDisplayPrs()));
1900 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1901 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1902 this, SLOT(OnDisplayOnlyPrs()));
1904 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1905 createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1906 this, SLOT(OnDeletePrs()));
1908 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1909 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(aPixmap), tr("MEN_COPY_PRS"), "", 0, aParent, false,
1910 this, SLOT(OnCopyPresentation()));
1912 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1913 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(aPixmap), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
1914 this, SLOT(OnCurveProperties()));
1916 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1917 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(aPixmap), tr("MEN_RENAME"), "", 0, aParent, false,
1918 this, SLOT(OnRename()));
1920 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1921 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
1922 this, SLOT(OnEditContainer()));
1924 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1925 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
1926 //this, SLOT(OnRenameContainer()));
1928 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1929 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
1930 this, SLOT(OnClearContainer()));
1932 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1933 createAction( VISU_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(aPixmap),
1934 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
1935 this, SLOT(OnSaveViewParams()));
1937 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1938 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(aPixmap),
1939 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
1940 this, SLOT(OnRestoreViewParams()));
1942 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1943 createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(aPixmap),
1944 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
1945 this, SLOT(OnDeleteViewParams()));
1947 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1948 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
1949 this, SLOT(OnMakePoints()));
1951 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1952 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
1953 this, SLOT(OnMakeWireframe()));
1955 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1956 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
1957 this, SLOT(OnMakeSurface()));
1959 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1960 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(aPixmap), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
1961 this, SLOT(OnMakeInsideframe()));
1963 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1964 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(aPixmap), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
1965 this, SLOT(OnMakeSurfaceframe()));
1967 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1968 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(aPixmap), tr("MEN_SHRINK"), "", 0, aParent, false,
1969 this, SLOT(OnMakeShrink()));
1971 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1972 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(aPixmap), tr("MEN_UNSHRINK"), "", 0, aParent, false,
1973 this, SLOT(OnMakeShrink()));
1975 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1976 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(aPixmap), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
1977 this, SLOT(OnChangeColor()));
1979 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1980 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(aPixmap), tr("MEN_COLOR"), "", 0, aParent, false,
1981 this, SLOT(OnChangeColor()));
1983 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1984 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(aPixmap), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
1985 this, SLOT(OnChangeWireframeColor()));
1987 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1988 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(aPixmap), tr("MEN_OPACITY"), "", 0, aParent, false,
1989 this, SLOT(OnChangeOpacity()));
1991 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1992 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(aPixmap), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
1993 this, SLOT(OnChangeLines()));
1995 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1996 createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(aPixmap), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
1997 this, SLOT(OnEditPrs()));
1999 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2000 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(aPixmap), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2001 this, SLOT(OnCreateTable()));
2003 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2004 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
2005 this, SLOT(OnSweep()));
2007 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2008 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(aPixmap),
2009 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2010 this, SLOT(OnSelectionInfo()));
2012 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2013 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
2014 this, SLOT(OnTimeAnimation()));
2016 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2017 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2018 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2019 this, SLOT(OnEraseAll()));
2021 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2022 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2023 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2024 //this, SLOT(OnEraseAll()));
2027 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2028 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2029 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2030 //this, SLOT(OnEraseAll()));
2033 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2034 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2035 tr("MEN_SCALING"), "", 0, aParent, false,
2036 this, SLOT(OnScaling()));
2043 // Add actions to menus
2045 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
2046 createMenu( separator(), aMenuId, -1, 10 );
2047 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2048 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2049 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2051 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2052 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2053 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2054 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2055 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2056 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2057 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2058 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2060 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2061 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2063 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2065 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2066 createMenu( VISU_POINTS, parentId, 10 ); // points
2067 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2068 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2069 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2070 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2071 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2072 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2079 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2080 createTool( VISU_SCALAR_MAP, aToolId );
2081 createTool( VISU_DEFORMED_SHAPE, aToolId );
2082 createTool( VISU_VECTORS, aToolId );
2083 createTool( VISU_ISO_SURFACES, aToolId );
2084 createTool( VISU_CUT_PLANES, aToolId );
2085 createTool( VISU_STREAM_LINES, aToolId );
2086 createTool( VISU_CUT_LINES, aToolId );
2093 // Prepare popup menus
2094 QtxPopupMgr* mgr = popupMgr();
2096 // VISU root commands
2097 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
2098 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED
2099 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2100 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables
2101 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2102 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d
2103 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2104 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
2105 mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // delete object
2106 mgr->setRule( action( VISU_DELETE ), aRule, true );
2108 // timestamp commands
2109 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2110 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2111 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2112 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2113 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2114 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2115 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2116 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2117 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2118 aRule += " and nbComponents>1";
2119 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2120 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2121 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2122 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2123 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2124 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2126 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
2127 //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
2128 //mgr->setRule( action( 4022 ), aRule, true );
2129 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2130 mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
2131 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2132 mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
2133 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2134 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
2135 mgr->insert( separator(), -1, -1, -1 );
2136 aRule = "(client='ObjectBrowser' and selcount>0 and ((type='VISU::TTABLE' and nbChildren>0) "
2137 "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) "
2138 " or (selcount>0 and $type in {"
2139 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2140 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
2141 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2142 mgr->setRule( action( VISU_ERASE ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=1"), true );
2143 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2144 mgr->setRule( action( VISU_DISPLAY ), aRule.arg(""), true );// TODO: aRule.arg(" and isVisible=0"), true );
2145 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2146 mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule.arg(""), true );
2148 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
2149 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2150 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2151 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2152 mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // delete presentation
2153 mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
2156 mgr->insert ( action( VISU_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2157 //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
2158 mgr->setRule( action( VISU_VIEW_PARAMS ), "selcount=0", true ); //jfa tmp
2159 mgr->insert ( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2160 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2161 mgr->insert ( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2162 mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2164 // 3D presentations commands
2165 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2166 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2167 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2168 QString aSurfType = " and $type in {'VISU::TMESH'}";
2169 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2170 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
2171 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2172 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
2173 aRule = "selcount=1";
2175 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
2176 mgr->insert( action( VISU_POINTS ), parentId, -1, -1 ); // points
2177 mgr->setRule( action( VISU_POINTS ), aRule + aPrsType +
2178 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2179 mgr->insert( action( VISU_WIREFRAME ), parentId, -1, -1 ); // wireframe
2180 mgr->setRule( action( VISU_WIREFRAME ), aRule + aPrsType +
2181 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2182 mgr->insert( action( VISU_SURFACE ), parentId, -1, -1 ); // surface
2183 mgr->setRule( action( VISU_SURFACE ), aRule + aPrsType +
2184 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2185 mgr->insert( action( VISU_INSIDEFRAME ), parentId, -1, -1 ); // insideframe
2186 mgr->setRule( action( VISU_INSIDEFRAME ), aRule + aInsideType +
2187 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
2188 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2189 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType +
2190 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
2191 mgr->insert( action( VISU_SHRINK ), parentId, -1, -1 ); // shrink
2192 mgr->setRule( action( VISU_SHRINK ), aRule + aShrinkType + " and isShrunk=0", true );
2193 mgr->insert( action( VISU_UNSHRINK ), parentId, -1, -1 ); // unshrink
2194 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2196 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
2197 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2198 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2199 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2200 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2201 mgr->insert( action( VISU_COLOR ), parentId, -1, -1 ); // color
2202 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2203 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2204 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2205 mgr->insert( action( VISU_OPACITY ), parentId, -1, -1 ); // opacity
2206 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2207 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2208 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2211 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
2212 aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2213 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2215 aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
2216 mgr->insert ( action( VISU_RENAME ), -1, -1, -1 ); // rename
2217 mgr->setRule( action( VISU_RENAME ), aRule, true );
2219 // copy presentation command
2220 aRule = "selcount=1 and " + aPrsType;
2221 mgr->insert ( action( VISU_COPY_PRS ), -1, -1, -1 ); // copy
2222 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2225 aRule = "selcount=1 and type='VISU::TCURVE'";
2226 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2227 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2229 // curve container commands
2230 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2231 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); // edit container
2232 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2233 //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
2234 //mgr->setRule( action( 4043 ), aRule, true );
2235 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // clear container
2236 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2238 aRule = "selcount=1 and ";
2239 mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); // edit prs
2240 mgr->setRule( action( VISU_EDIT_PRS ), aRule + aPrsType, true );
2242 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2243 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2244 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2246 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
2247 mgr->insert ( action( VISU_SWEEP ), -1, -1, -1 ); // sweep
2248 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2250 // Selection info popup item
2251 aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
2252 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2253 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2255 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2256 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); // animation
2257 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2259 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2260 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2261 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2262 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2263 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2268 windows( QMap<int, int>& theMap ) const
2271 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2277 viewManagers( QStringList& theList ) const
2280 theList.append( SVTK_Viewer::Type() );
2288 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2289 return QString(anIOR.in());
2295 activateModule( SUIT_Study* theStudy )
2297 SalomeApp_Module::activateModule( theStudy );
2299 setMenuShown( true );
2300 setToolShown( true );
2307 deactivateModule( SUIT_Study* theStudy )
2309 setMenuShown( false );
2310 setToolShown( false );
2312 SalomeApp_Module::deactivateModule( theStudy );
2316 SalomeApp_Selection*
2318 createSelection() const
2320 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2327 return new VisuGUI();