1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Laurent CORNABE
34 #include <qptrvector.h>
35 #include <qcolordialog.h>
37 #include <vtkRenderer.h>
38 #include <vtkRenderWindow.h>
39 #include <vtkActorCollection.h>
41 #include "SALOME_LifeCycleCORBA.hxx"
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_MessageBox.h"
46 #include "SUIT_ViewWindow.h"
47 #include "SUIT_ViewManager.h"
49 #include "CAM_Module.h"
51 #include "SVTK_RenderWindow.h"
52 #include "SVTK_ViewWindow.h"
53 #include "SVTK_ViewModel.h"
54 #include "SVTK_Functor.h"
56 #include "SPlot2d_ViewModel.h"
57 #include "SPlot2d_SetupPlot2dDlg.h"
58 #include "Plot2d_SetupCurveDlg.h"
60 #include "OB_Browser.h"
62 #include "SALOME_ListIO.hxx"
63 #include "SALOME_ListIteratorOfListIO.hxx"
65 #include "SalomeApp_Application.h"
66 #include "SalomeApp_DataModel.h"
67 #include "SalomeApp_Study.h"
68 #include "SalomeApp_SelectionMgr.h"
69 #include "SalomeApp_Selection.h"
71 #include "VISUConfig.hh"
72 #include "VISU_Gen_i.hh"
73 #include "VISU_Mesh_i.hh"
74 #include "VISU_Table_i.hh"
75 #include "VISU_Result_i.hh"
76 #include "VISU_View_i.hh"
77 #include "VISU_ViewManager_i.hh"
79 #include "VISU_Actor.h"
82 #include "VisuGUI_Tools.h"
83 #include "VisuGUI_PopupTools.h"
84 #include "VisuGUI_NameDlg.h"
85 #include "VisuGUI_FileDlg.h"
86 #include "VisuGUI_CursorDlg.h"
87 #include "VisuGUI_Selection.h"
88 #include "VisuGUI_TimeAnimation.h"
89 #include "VisuGUI_EditContainerDlg.h"
90 #include "VisuGUI_NonIsometricDlg.h"
92 #include "VISU_ScalarMap_i.hh"
93 #include "VisuGUI_ScalarBarDlg.h"
95 #include "VISU_DeformedShape_i.hh"
96 #include "VisuGUI_DeformedShapeDlg.h"
98 #include "VISU_IsoSurfaces_i.hh"
99 #include "VisuGUI_IsoSurfacesDlg.h"
101 #include "VISU_CutPlanes_i.hh"
102 #include "VisuGUI_CutPlanesDlg.h"
104 #include "VISU_CutLines_i.hh"
105 #include "VisuGUI_CutLinesDlg.h"
107 #include "VISU_StreamLines_i.hh"
108 #include "VisuGUI_StreamLinesDlg.h"
110 #include "VISU_Vectors_i.hh"
111 #include "VisuGUI_VectorsDlg.h"
113 #include "VisuGUI_TableDlg.h"
115 #include "SALOMEconfig.h"
116 #include CORBA_SERVER_HEADER(MED_Gen)
118 #include "utilities.h"
120 #include "VisuGUI_ActionsDef.h"
122 using namespace VISU;
125 static int MYDEBUG = 1;
127 static int MYDEBUG = 0;
130 //////////////////////////////////////////////////
132 //////////////////////////////////////////////////
135 SalomeApp_Module( "VISU" )
149 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
150 CheckLock(GetCStudy(GetAppStudy(this)));
151 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
154 aFilter.append( tr("FLT_MED_FILES") );
155 aFilter.append( tr("FLT_ALL_FILES") );
157 QFileInfo aFileInfo =
158 SUIT_FileDlg::getFileName(GetDesktop(this),
161 tr("MEN_IMPORT_FROM_FILE"),
163 if(aFileInfo.exists()){
164 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
166 VISU::Result_var aResult;
167 bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
168 if(VisuGUI_FileDlg::IsBuild){
169 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
170 if(!CORBA::is_nil(aResult.in()))
171 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
172 if(!aRes->IsPossible())
173 SUIT_MessageBox::warn1(GetDesktop(this),
175 tr("ERR_CANT_BUILD_PRESENTATION"),
181 aResourceMgr->setValue("Visu:BuildResult",false);
182 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
183 aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
186 if(CORBA::is_nil(aResult.in())) {
187 SUIT_MessageBox::warn1(GetDesktop(this),
189 tr("ERR_ERROR_IN_THE_FILE"),
192 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
203 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
204 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
207 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
210 aFilter.append( tr("FLT_MED_FILES") );
211 aFilter.append( tr("FLT_ALL_FILES") );
213 QFileInfo aFileInfo =
214 SUIT_FileDlg::getFileName(GetDesktop(this),
217 tr("MEN_EXPLORE_MED_FILE"),
219 if(aFileInfo.exists()){
220 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
221 std::string aStudyName = aStudy->Name();
222 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
223 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
231 OnImportTableFromFile()
233 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
234 CheckLock(GetCStudy(GetAppStudy(this)));
237 aFilter.append( tr("FLT_TABLE_FILES") );
238 aFilter.append( tr("FLT_ALL_FILES") );
240 QFileInfo aFileInfo =
241 SUIT_FileDlg::getFileName(GetDesktop(this),
244 tr("MEN_IMPORT_TABLE"),
246 if(aFileInfo.exists()){
247 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
249 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
251 if(CORBA::is_nil(anObject.in())) {
252 SUIT_MessageBox::warn1(GetDesktop(this),
254 tr("ERR_ERROR_IN_THE_FILE"),
257 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
265 OnExportTableToFile()
267 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
274 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
275 if (CheckLock(aCStudy))
277 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
279 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
280 SALOME_ListIO aListIO;
281 aSelectionMgr->selectedObjects(aListIO);
283 SALOME_ListIteratorOfListIO It (aListIO);
284 QApplication::setOverrideCursor(Qt::waitCursor);
285 for (; It.More(); It.Next()) {
286 Handle(SALOME_InteractiveObject) anIO = It.Value();
287 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
288 if (!aSObject->_is_nil()) {
289 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
290 if (!CORBA::is_nil(anObject)) {
291 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
292 if (!CORBA::is_nil(aMED.in()))
293 GetVisuGen(this)->ImportMed(aSObject);
294 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
295 if (!CORBA::is_nil(aField.in()))
296 GetVisuGen(this)->ImportMedField(aField);
298 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
299 SALOMEDS::GenericAttribute_var anAttr;
300 aSFather->FindAttribute(anAttr, "AttributeName");
301 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
302 CORBA::String_var aValue = aName->Value();
303 if (strcmp(aValue.in(), "MEDFIELD") == 0)
304 GetVisuGen(this)->ImportMed(aSObject);
308 updateObjBrowser(true);
309 QApplication::restoreOverrideCursor();
313 CreateCurves( SalomeApp_Module* theModule,
314 VISU::CutLines_i* thePrs,
316 const bool theCreate = true )
320 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
324 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
325 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
327 if ( !theCreate && aSObject ){
329 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
330 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
331 _PTR(SObject) aTblObj = aIter->Value();
333 _PTR(GenericAttribute) anAttr;
334 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
335 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
342 if ( aCutDlg->isGenerateTable() ) {
343 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
344 if ( aCutDlg->isGenerateCurves() ) {
346 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
347 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
348 _PTR(SObject) aTblObj = aIter->Value();
350 _PTR(GenericAttribute) anAttr;
351 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
352 CreatePlot( theModule, aTblObj );
361 template<class TPrs3d_i>
363 CreatePrs3d(SalomeApp_Module* theModule,
364 SALOMEDS::SObject_var theTimeStamp,
365 const char* theMeshName,
366 VISU::Entity theEntity,
367 const char* theFieldName,
370 VISU::Result_var aResult;
371 if(CheckResult(theModule,theTimeStamp,aResult)){
372 QApplication::setOverrideCursor(Qt::waitCursor);
373 typedef typename TPrs3d_i::TInterface TPrs3d;
374 typename TPrs3d::_var_type aPrs3d =
375 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
376 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
377 QApplication::restoreOverrideCursor();
378 if(!CORBA::is_nil(aPrs3d.in()))
379 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
381 SUIT_MessageBox::warn1(GetDesktop(theModule),
382 QObject::tr("WRN_VISU"),
383 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
384 QObject::tr("BUT_OK") );
389 template<class TPrs3d_i, class TDlg, int IsDlgModal>
391 CreatePrs3d(SalomeApp_Module* theModule,
392 SALOMEDS::SObject_var theTimeStamp,
393 const Handle(SALOME_InteractiveObject)& theIO)
395 using namespace VISU;
396 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
398 QString aType = Storable::FindValue(aMap,"myType",&isExist);
399 if(!isExist || aType.toInt() != TTIMESTAMP )
401 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
402 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
403 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
404 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
405 QApplication::setOverrideCursor(Qt::waitCursor);
407 CreatePrs3d<TPrs3d_i>(theModule,
410 (Entity)anEntity.toInt(),
412 aTimeStampId.toInt());
413 QApplication::restoreOverrideCursor();
415 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
416 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
418 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode
419 aDlg->initFromPrsObject(aPrs3d);
421 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
422 // Optionally, create table and curves for cut lines
423 QApplication::setOverrideCursor(Qt::waitCursor);
424 CreateCurves( theModule, dynamic_cast<VISU::CutLines_i*>( aPrs3d ), aDlg, true ); // in creation mode
425 QApplication::restoreOverrideCursor();
428 DeletePrs3d(theModule,aPrs3d,theIO);
438 PublishInView(theModule,aPrs3d);
445 template<class TPrs3d_i, class TDlg, int IsDlgModal>
447 CreatePrs3d(SalomeApp_Module* theModule)
449 if(CheckLock(GetCStudy(GetAppStudy(theModule))))
452 SALOMEDS::SObject_var aTimeStampSObj;
453 Handle(SALOME_InteractiveObject) anIO;
454 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
457 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
460 theModule->application()->putInfo(QObject::tr("INF_DONE"));
461 theModule->updateObjBrowser();
463 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
467 void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
469 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
470 //if (CheckLock(aStudy))
473 SALOMEDS::SObject_var aResultSObj =
474 GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
477 VISU::Result_var aResult;
478 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
482 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
484 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
488 CORBA::Object_var aMesh;
489 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
494 if (aComment == "ENTITY") {
495 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
496 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
497 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
498 } else if (aComment == "FAMILY") {
499 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
500 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
501 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
502 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
503 } else if (aComment == "GROUP") {
504 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
505 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
506 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
510 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
514 QApplication::restoreOverrideCursor();
515 VISU::Mesh_i* pPresent = NULL;
516 if (!CORBA::is_nil(aMesh))
517 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
518 if (pPresent == NULL) {
519 SUIT_MessageBox::warn1 (GetDesktop(this),
521 tr("ERR_CANT_BUILD_PRESENTATION"),
526 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
532 PublishInView(this, pPresent);
536 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
539 application()->putInfo(QObject::tr("INF_DONE"));
540 } catch (std::runtime_error& exc) {
542 SUIT_MessageBox::warn1 (GetDesktop(this),
544 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
554 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
555 if (CheckLock(aStudy))
558 // Get selected SObject
559 SALOMEDS::SObject_var aResultSObj;
560 Handle(SALOME_InteractiveObject) anIO;
561 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
562 if (anIO.IsNull() || !anIO->hasEntry())
572 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
573 if (CheckLock(aStudy))
576 // Get selected SObject
577 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
578 SALOME_ListIO aListIO;
579 aSelectionMgr->selectedObjects(aListIO);
580 SALOME_ListIteratorOfListIO anIter (aListIO);
581 for (; anIter.More(); anIter.Next()) {
582 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
583 if (anIO.IsNull() || !anIO->hasEntry())
594 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
600 OnCreateDeformedShape()
602 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
609 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
614 OnCreateIsoSurfaces()
616 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
623 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
630 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
635 OnCreateStreamLines()
637 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
644 CheckLock(GetCStudy(GetAppStudy(this)));
645 GetVisuGen( this )->CreateContainer();
653 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
655 QApplication::setOverrideCursor(Qt::waitCursor);
657 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
658 mgr->selectedObjects(aList);
660 Handle(SALOME_InteractiveObject) anIO;
661 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
663 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
664 if ( !CORBA::is_nil( anObject ) ) {
665 // is it Prs3d object ?
666 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
668 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
669 UpdateViewer( this, aPrsObject );
670 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
671 vw->highlight(anIO, 1);
676 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
678 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
679 PlotCurve( this, aCurve, VISU::eDisplay );
683 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
685 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
686 PlotContainer( this, aContainer, VISU::eDisplay );
690 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
692 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
693 PlotTable( this, aTable, VISU::eDisplay );
698 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
699 vw->getRenderer()->ResetCameraClippingRange();
702 QApplication::restoreOverrideCursor();
713 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject, bool theUpdate)
715 if (MYDEBUG) MESSAGE("ErasePrs");
717 if ( !CORBA::is_nil( theObject ) ) {
718 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
719 if ( CORBA::is_nil( aBase ) ) return;
720 VISU::VISUType aType = aBase->GetType();
723 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
724 PlotCurve(this, aCurve, VISU::eErase );
727 case VISU::TCONTAINER:{
728 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
729 PlotContainer(this, aContainer, VISU::eErase );
733 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
734 PlotTable(this, aTable, VISU::eErase );
738 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
739 ErasePrs3d( this, aPrsObject );
741 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
754 if(MYDEBUG) MESSAGE("OnErasePrs");
756 QApplication::setOverrideCursor(Qt::waitCursor);
758 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
759 mgr->selectedObjects(aList);
761 Handle(SALOME_InteractiveObject) anIO;
762 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
764 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
765 ErasePrs(anObject, false);
767 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
769 QApplication::restoreOverrideCursor();
772 template<class TPrs3d_i, class TDlg>
774 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
776 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
778 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
779 TDlg* aDlg = new TDlg (GetDesktop(theModule));
780 aDlg->initFromPrsObject(aPrsObject);
782 if (!(aDlg->storeToPrsObject(aPrsObject))) {
786 RecreateActor(theModule, aPrsObject);
787 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
788 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
789 vw->getRenderer()->ResetCameraClippingRange();
802 if (CheckLock(GetCStudy(GetAppStudy(this))))
805 Handle(SALOME_InteractiveObject) anIO;
806 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
807 if (CORBA::is_nil(anObject)) return;
808 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
809 if (!aServant.in()) return;
811 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
814 switch (aPrs3d->GetType()) {
817 case VISU::TSCALARMAP:
818 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
820 case VISU::TDEFORMEDSHAPE:
821 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
823 case VISU::TCUTPLANES:
824 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
826 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
828 VisuGUI_CutPlanesDlg* aDlg =
829 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
830 aDlg->initFromPrsObject(aPrsObject);
835 case VISU::TCUTLINES:
836 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
838 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
840 VisuGUI_CutLinesDlg* aDlg =
841 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
842 aDlg->initFromPrsObject(aPrsObject);
847 case VISU::TISOSURFACE:
848 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
851 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
853 case VISU::TSTREAMLINES:
854 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
860 if (SVTK_ViewWindow* vw = GetViewWindow())
861 vw->highlight(anIO, 1);
868 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
869 if (CheckLock(aCStudy))
871 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
873 Handle(SALOME_InteractiveObject) anIO;
874 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
878 // There is a transaction
879 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
880 aStudyBuilder->NewCommand();
882 // is it Prs3d object ?
883 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
885 DeletePrs3d(this, aPrsObject, anIO);
888 // is it Curve object ?
889 VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
891 //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
894 aStudyBuilder->CommitCommand();
902 if (SVTK_ViewWindow* vw = GetViewWindow()) {
903 vw->unHighlightAll();
904 if (vtkRenderer *aRen = vw->getRenderer()) {
906 vtkActorCollection *anActColl = aRen->GetActors();
907 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
908 if (anActor->GetVisibility() > 0)
909 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
910 anVISUActor = anVISUActor->GetParent();
911 anVISUActor->VisibilityOff();
916 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
921 void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
923 SUIT_ViewWindow* aView = GetActiveView(this, VTKViewer_Viewer::Type());
925 SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView;
927 Handle(SALOME_InteractiveObject) anIO;
928 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
929 if (CORBA::is_nil(anObject)) return;
930 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
931 if (!aServant.in()) return;
933 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
935 if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
938 if (anActor->IsShrunk())
941 anActor->SetShrink();
944 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
945 aMesh->SetPresentationType(theType);
946 RecreateActor(this, aMesh);
948 anActor->SetRepresentation(theType);
960 ChangeRepresentation(VISU::SURFACEFRAME);
967 ChangeRepresentation(VISU::INSIDEFRAME);
974 ChangeRepresentation(VISU::WIREFRAME);
981 ChangeRepresentation(VISU::SHADED);
988 ChangeRepresentation(VISU::POINT);
995 ChangeRepresentation(VISU::SHRINK);
1002 Handle(SALOME_InteractiveObject) anIO;
1003 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1004 if (CORBA::is_nil(anObject)) return;
1005 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1006 if (!aServant.in()) return;
1008 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1009 if (!aPrs3d) return;
1011 SVTK_ViewWindow* vw = GetViewWindow();
1014 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1015 if (!anActor) return;
1017 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1018 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1019 SALOMEDS::Color anOldColor, aNewColor;
1020 int aRepresent = anActor->GetRepresentation();
1022 switch (aRepresent) {
1024 anOldColor = aMesh->GetNodeColor();
1026 case VISU::WIREFRAME :
1027 case VISU::INSIDEFRAME :
1028 anOldColor = aMesh->GetLinkColor();
1031 case VISU::SURFACEFRAME :
1032 anOldColor = aMesh->GetCellColor();
1035 } else if (aDeformedShape) {
1036 anOldColor = aDeformedShape->GetColor();
1041 QColor aColor (int(255*anOldColor.R),
1042 int(255*anOldColor.G),
1043 int(255*anOldColor.B));
1044 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1045 if (aColorNew.isValid()) {
1046 aNewColor.R = aColorNew.red()/255.;
1047 aNewColor.G = aColorNew.green()/255.;
1048 aNewColor.B = aColorNew.blue()/255.;
1050 switch (aRepresent) {
1052 aMesh->SetNodeColor(aNewColor);
1054 case VISU::WIREFRAME :
1055 case VISU::INSIDEFRAME :
1056 aMesh->SetLinkColor(aNewColor);
1059 case VISU::SURFACEFRAME :
1060 aMesh->SetCellColor(aNewColor);
1064 aDeformedShape->SetColor(aNewColor);
1066 RecreateActor(this, aPrs3d);
1072 OnChangeWireframeColor()
1074 Handle(SALOME_InteractiveObject) anIO;
1075 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1076 if (CORBA::is_nil(anObject)) return;
1077 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1078 if (!aServant.in()) return;
1080 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1081 if (!aPrs3d) return;
1083 SVTK_ViewWindow* vw = GetViewWindow();
1086 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1087 if (!anActor) return;
1089 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
1090 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1091 QColor aColor (int(255*anOldColor.R),
1092 int(255*anOldColor.G),
1093 int(255*anOldColor.B));
1094 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1095 if (aColorNew.isValid()) {
1096 aNewColor.R = aColorNew.red()/255.;
1097 aNewColor.G = aColorNew.green()/255.;
1098 aNewColor.B = aColorNew.blue()/255.;
1099 aMesh->SetLinkColor(aNewColor);
1100 RecreateActor(this, aMesh);
1109 Handle(SALOME_InteractiveObject) anIO;
1110 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1111 if (CORBA::is_nil(anObject)) return;
1112 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1113 if (!aServant.in()) return;
1115 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1116 if (!aPrsObject) return;
1118 SVTK_ViewWindow* vw = GetViewWindow();
1121 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1122 if (!anActor) return;
1124 VisuGUI_CursorDlg* CursorDlg =
1125 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1127 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1128 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1129 CursorDlg->SpinBox1->setMinValue(0);
1130 CursorDlg->SpinBox1->setMaxValue(100);
1132 float oldopac = anActor->GetOpacity();
1133 int intopac = int(oldopac*100. + 0.5);
1134 CursorDlg->SpinBox1->setValue(intopac);
1136 int ret = CursorDlg->exec();
1138 intopac = CursorDlg->SpinBox1->value();
1139 float newopac = intopac/100.;
1140 anActor->SetOpacity(newopac);
1149 Handle(SALOME_InteractiveObject) anIO;
1150 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1151 if (CORBA::is_nil(anObject)) return;
1152 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1153 if (!aServant.in()) return;
1155 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1156 if (!aPrsObject) return;
1158 SVTK_ViewWindow* vw = GetViewWindow();
1161 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1162 if (!anActor) return;
1164 VisuGUI_CursorDlg* CursorDlg =
1165 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1167 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1168 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1169 CursorDlg->SpinBox1->setMinValue(1);
1170 CursorDlg->SpinBox1->setMaxValue(10);
1172 float oldlwid = anActor->GetLineWidth();
1173 int intlwid = int(oldlwid);
1174 CursorDlg->SpinBox1->setValue(intlwid);
1176 int ret = CursorDlg->exec();
1178 intlwid = CursorDlg->SpinBox1->value();
1179 float newlwid = intlwid;
1180 anActor->SetLineWidth(newlwid);
1189 Handle(SALOME_InteractiveObject) anIO;
1190 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1192 if ( !CORBA::is_nil( anObject ) ) {
1193 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1194 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1195 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1196 if( !CORBA::is_nil( aTable ) ) {
1197 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1199 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1204 // possibly this is Table SObject
1205 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1208 if( !IsSObjectTable( SO ) )
1211 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1214 //SAL2670 Orientation of show tables
1215 VisuGUI_TableDlg::ttAuto,
1224 Handle(SALOME_InteractiveObject) anIO;
1225 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1226 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1227 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1228 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1229 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1230 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1239 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1240 if (CheckLock(aCStudy))
1242 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1244 Handle(SALOME_InteractiveObject) anIO;
1245 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1246 if (anIO.IsNull() || !anIO->hasEntry())
1249 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
1250 if (!aSObject->_is_nil()) {
1251 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1252 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1253 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1254 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1255 ErasePrs(aChildObj);
1257 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
1258 // There is a transaction
1259 aStudyBuilder->NewCommand();
1260 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
1261 if (!CORBA::is_nil(anObj)) {
1262 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
1263 if (!CORBA::is_nil(aBase)) {
1264 VISU::VISUType aType = aBase->GetType();
1268 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1269 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1270 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1271 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1272 if (CORBA::is_nil(aChildObj)) continue;
1273 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
1274 if (CORBA::is_nil(aPrs3d)) continue;
1275 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
1276 DeletePrs3d(this, pPrs3d, NULL);
1282 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1283 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1284 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1285 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1286 if (CORBA::is_nil(aChildObj)) continue;
1287 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
1288 if (CORBA::is_nil(aCurve)) continue;
1289 //VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1290 //jfa tmp:DeleteCurve(this, pCurve, NULL);
1297 aStudyBuilder->RemoveObjectWithChildren(aSObject);
1298 aStudyBuilder->CommitCommand();
1299 //jfa tmp:GetActiveStudy()->unHighlightAll();
1300 updateObjBrowser(true);
1308 Handle(SALOME_InteractiveObject) anIO;
1309 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1311 _PTR(GenericAttribute) anAttr;
1312 _PTR(AttributeName) aName;
1314 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1316 if ( !CORBA::is_nil( anObject ) ) {
1317 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1318 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1319 // Table (VISU object) is selected
1320 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1321 if( !CORBA::is_nil( aTbl ) ) {
1322 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1324 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1325 if ( IsSObjectTable(SO) ) {
1326 // get name of SObject
1327 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1329 SOName = QString( aName->Value().c_str() );
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 container, 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 aContainer = GetVisuGen(this)->CreateContainer();
1341 if( !CORBA::is_nil( aContainer ) ) {
1342 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1344 for ( int i = 0; i < verIndices.count(); i++ ) {
1345 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1346 if( !CORBA::is_nil( aNewCurve ) ) {
1347 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1350 int marker, line, lineWidth;
1352 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1353 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1354 pCrv->SetColor( c );
1355 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1356 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1358 pContainer->AddCurve( pCrv->_this() );
1363 PlotContainer( this, pContainer, VISU::eDisplay );
1369 // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
1370 QPtrList<Plot2d_Curve> container;
1371 dlg->getCurves( container );
1372 if ( !container.isEmpty() ) {
1373 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1374 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1384 else if ( !anIO.IsNull() ) {
1385 // check if Table SObject is selected
1386 SO = aStudy->FindObjectID( anIO->getEntry() );
1387 if ( IsSObjectTable(SO) ) {
1388 // get name of SObject
1389 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1391 SOName = QString( aName->Value().c_str() );
1393 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1394 if ( dlg->exec() == QDialog::Accepted ) {
1395 if ( !IsStudyLocked( aStudy ) ) {
1396 // if study is not locked - create new table and container objects, create curves
1397 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1399 QValueList<int> verIndices;
1400 dlg->getCurvesSource( horIndex, verIndices );
1401 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1402 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1403 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1404 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1405 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1406 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1408 if ( pContainer && pTable ) {
1409 for ( int i = 0; i < verIndices.count(); i++ ) {
1410 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
1411 if( !CORBA::is_nil( aNewCurve ) ) {
1412 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1415 int marker, line, lineWidth;
1417 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1418 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1419 pCrv->SetColor( c );
1420 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1421 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1423 pContainer->AddCurve( pCrv->_this() );
1428 PlotContainer( this, pContainer, VISU::eDisplay );
1433 // if study is locked just get curves info and plot them
1434 QPtrList<Plot2d_Curve> container;
1435 dlg->getCurves( container );
1436 if ( !container.isEmpty() ) {
1437 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1438 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1451 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1452 SALOME_ListIO aListIO;
1453 aSelectionMgr->selectedObjects(aListIO);
1454 if (aListIO.Extent() != 1) return;
1456 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1457 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1458 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1459 if (CORBA::is_nil( anObject )) return;
1461 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1462 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1464 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1465 if( !CORBA::is_nil( aCurve ) ) {
1466 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1467 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1468 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1470 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1471 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1472 SALOMEDS::Color aColor = aDSCurve->GetColor();
1473 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1474 if( aDlg.exec() == QDialog::Accepted ) {
1475 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1476 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1477 SALOMEDS::Color newColor;
1478 newColor.R = aDlg.getColor().red()/255.;
1479 newColor.G = aDlg.getColor().green()/255.;
1480 newColor.B = aDlg.getColor().blue()/255.;
1481 aDSCurve->SetColor( newColor );
1482 PlotCurve(this, aDSCurve, VISU::eDisplay);
1493 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1494 if (CheckLock(aCStudy))
1496 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1497 Handle(SALOME_InteractiveObject) anIO;
1498 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1499 if (anIO.IsNull() || CORBA::is_nil(anObject))
1502 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1503 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1505 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1506 if (!CORBA::is_nil(aCnt)) {
1507 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1508 if (container && container->GetNbCurves() > 0) {
1520 Handle(SALOME_InteractiveObject) anIO;
1521 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1522 if (CORBA::is_nil(anObject)) return;
1524 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1525 if (!aServant.in()) return;
1526 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1527 if (!aContainer) return;
1529 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1530 aDlg->initFromPrsObject(aContainer);
1532 aDlg->storeToPrsObject(aContainer);
1533 updateObjBrowser(true);
1542 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1543 if (CheckLock(aCStudy))
1545 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1547 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1548 if (aViewMgr->getType() != SVTK_Viewer::Type())
1551 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1552 SALOME_ListIO aListIO;
1553 aSelectionMgr->selectedObjects(aListIO);
1554 if (aListIO.Extent() > 1)
1557 if (aListIO.Extent() == 0) {
1558 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1560 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1561 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1568 OnRestoreViewParams()
1570 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1571 if (aViewMgr->getType() != SVTK_Viewer::Type())
1574 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1575 SALOME_ListIO aListIO;
1576 aSelectionMgr->selectedObjects(aListIO);
1577 if (aListIO.Extent() != 1)
1580 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1581 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1582 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1583 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1584 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1589 OnDeleteViewParams()
1591 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1592 if (CheckLock(aCStudy))
1594 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1596 Handle(SALOME_InteractiveObject) anIO;
1597 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1598 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1599 if (!aSObject) return;
1601 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
1602 if (aType == VISU::TVIEW3D) {
1603 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1604 SALOME_ListIO aListIO, aNewListIO;
1605 aSelectionMgr->selectedObjects(aListIO);
1606 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
1607 if (it.Value()->getEntry() != anIO->getEntry()) {
1608 aNewListIO.Append(it.Value());
1611 aSelectionMgr->setSelectedObjects(aNewListIO);
1613 aCStudy->NewBuilder()->RemoveObject(aSObject);
1623 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1624 if (CheckLock(aCStudy))
1627 Handle(SALOME_InteractiveObject) anIO;
1628 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1630 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1633 //TEST DU PARENT == VISU
1634 _PTR(GenericAttribute) anAttr;
1635 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1636 _PTR(AttributeName) aName (anAttr);
1637 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1638 if (!Name.isEmpty()) {
1639 QApplication::setOverrideCursor(Qt::waitCursor);
1641 // rename specific objects
1642 if (!CORBA::is_nil(anObject)) {
1643 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1644 if (!CORBA::is_nil(aVisuObj)) {
1645 switch (aVisuObj->GetType()) {
1646 case VISU::TCURVE: // Curve object
1648 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1649 if (!CORBA::is_nil(aCurve)) {
1650 VISU::Curve_i* curve =
1651 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1653 curve->SetName(Name.latin1());
1657 case VISU::TTABLE: // Table object
1659 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1660 if (!CORBA::is_nil(aTable)) {
1661 VISU::Table_i* table =
1662 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1664 table->SetName(Name.latin1());
1668 case VISU::TCONTAINER: // Container object
1670 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1671 if (!CORBA::is_nil(aContainer)) {
1672 VISU::Container_i* container =
1673 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1675 container->SetName(Name.latin1());
1686 // rename the study object
1687 //getApp()->activeStudy()->renameIObject(anIO, Name);
1688 aName->SetValue(Name.latin1()); // rename the SObject
1689 anIO->setName(Name.latin1()); // rename the InteractiveObject
1690 updateObjBrowser(false);
1692 QApplication::restoreOverrideCursor();
1702 Handle(SALOME_InteractiveObject) anIO;
1703 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1704 if (CORBA::is_nil(anObject)) return;
1705 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1706 if (!aServant.in()) return;
1708 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1709 if (!aPrsObject) return;
1711 SVTK_ViewWindow* vw = GetViewWindow();
1714 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1715 if (!aActor) return;
1717 if (!aActor->GetVisibility()) {
1718 aActor->VisibilityOn();
1721 // Get sweep parameters
1722 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1724 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
1725 int aTemp = int(1.E6 * aTempoDbl);
1727 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
1728 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
1731 QApplication::setOverrideCursor(Qt::waitCursor);
1733 for (int j = 0; j < aCycles; j++) {
1734 for (int i = 0; i <= aSteps; i++) {
1735 float aPercents = float(i)/aSteps;
1736 aPrsObject->SetMapScale(aPercents);
1737 aPrsObject->UpdateActor(aActor);
1738 vw->getRenderWindow()->getRenderWindow()->Render();
1742 } catch (std::exception& exc) {
1743 INFOS("Follow exception was occured :\n" << exc.what());
1745 INFOS("Unknown exception was occured!");
1747 QApplication::restoreOverrideCursor();
1754 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1755 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1756 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1758 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1759 SALOME_ListIO aListIO;
1760 aSelectionMgr->selectedObjects(aListIO);
1762 bool isDefined = false;
1764 SALOME_ListIteratorOfListIO It (aListIO);
1765 for (; It.More(); It.Next()) {
1766 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1767 if (!aSObject) continue;
1768 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1769 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1773 aAnimationDlg->addField(aSObject);
1775 } else if (aNbTimes == aNumber) {
1776 aAnimationDlg->addField(aSObject);
1781 if (isDefined) aAnimationDlg->show();
1782 else delete aAnimationDlg;
1787 OnCopyPresentation()
1789 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1790 if (CheckLock(aCStudy))
1793 //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
1794 Handle(SALOME_InteractiveObject) anIO;
1795 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1796 if (CORBA::is_nil(anObject)) return;
1797 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1798 if (!aServant.in()) return;
1800 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1801 if (!aPrsObject) return;
1803 switch (aPrsObject->GetType()) {
1806 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1807 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1808 aSameMesh->SameAs(aMeshPrs);
1809 UpdateViewer(this, aSameMesh);
1812 case VISU::TSCALARMAP:
1814 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1815 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1816 aSameScalar->SameAs(aScalarPrs);
1817 UpdateViewer(this, aSameScalar);
1820 case VISU::TDEFORMEDSHAPE:
1822 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1823 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1824 aSameDeformed->SameAs(aDefPrs);
1825 UpdateViewer(this, aSameDeformed);
1828 case VISU::TCUTPLANES:
1830 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1831 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1832 aSameCut->SameAs(aCutPrs);
1833 UpdateViewer(this, aSameCut);
1836 case VISU::TCUTLINES:
1838 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1839 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1840 aSameCut->SameAs(aCutPrs);
1841 UpdateViewer(this, aSameCut);
1844 case VISU::TISOSURFACE:
1846 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1847 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1848 aSameIso->SameAs(aIsoPrs);
1849 UpdateViewer(this, aSameIso);
1852 case VISU::TSTREAMLINES:
1854 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1855 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1856 aSameLines->SameAs(aLinesPrs);
1857 UpdateViewer(this, aSameLines);
1860 case VISU::TVECTORS:
1862 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1863 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1864 aSameVectors->SameAs(aVectorsPrs);
1865 UpdateViewer(this, aSameVectors);
1876 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1883 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1884 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1885 false, Qt::WDestructiveClose);
1886 m_NonIsoDlg->show();
1891 initialize( CAM_Application* theApp )
1893 SalomeApp_Module::initialize( theApp );
1906 QWidget* aParent = application()->desktop();
1907 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1910 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1911 this, SLOT(OnImportFromFile()));
1912 createAction( VISU_EXPLORE_MED, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1913 this, SLOT(OnExploreMEDFile()));
1914 createAction( VISU_IMPORT_TABLE, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1915 this, SLOT(OnImportTableFromFile()));
1917 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1918 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1919 this, SLOT(OnCreateScalarMap()));
1921 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1922 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1923 this, SLOT(OnCreateDeformedShape()));
1925 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1926 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1927 this, SLOT(OnCreateVectors()));
1929 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1930 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1931 this, SLOT(OnCreateIsoSurfaces()));
1933 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1934 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1935 this, SLOT(OnCreateCutPlanes()));
1937 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1938 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1939 this, SLOT(OnCreateStreamLines()));
1941 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1942 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1943 this, SLOT(OnCreateCutLines()));
1945 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
1946 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1947 this, SLOT(OnCreatePlot2dView()));
1949 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1950 createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1951 this, SLOT(OnDeleteObject()));
1953 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1954 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1955 //this, SLOT(OnRenameTable()));
1957 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1958 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1959 this, SLOT(OnShowTable()));
1961 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1962 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1963 this, SLOT(OnPlotData()));
1965 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1966 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1967 this, SLOT(OnExportTableToFile()));
1969 createAction( VISU_IMPORT_MED, tr("MEN_IMPORT_MED"), QIconSet(),
1970 tr("MEN_IMPORT_MED"), "", 0, aParent, false,
1971 this, SLOT(OnImportMedField()));
1973 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1974 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
1975 this, SLOT(OnCreateMesh()));
1977 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1978 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
1979 this, SLOT(OnCreateManyMesh()));
1981 //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE"));
1982 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(), tr("MEN_ERASE"), "", 0, aParent, false,
1983 this, SLOT(OnErasePrs()));
1985 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1986 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(), tr("MEN_DISPLAY"), "", 0, aParent, false,
1987 this, SLOT(OnDisplayPrs()));
1989 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1990 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1991 this, SLOT(OnDisplayOnlyPrs()));
1993 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1994 createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1995 this, SLOT(OnDeletePrs()));
1997 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1998 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false,
1999 this, SLOT(OnCopyPresentation()));
2001 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2002 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2003 this, SLOT(OnCurveProperties()));
2005 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2006 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2007 this, SLOT(OnRename()));
2009 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2010 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2011 this, SLOT(OnEditContainer()));
2013 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2014 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
2015 //this, SLOT(OnRenameContainer()));
2017 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2018 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2019 this, SLOT(OnClearContainer()));
2021 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2022 createAction( VISU_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2023 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2024 this, SLOT(OnSaveViewParams()));
2026 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2027 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2028 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2029 this, SLOT(OnRestoreViewParams()));
2031 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2032 createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2033 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2034 this, SLOT(OnDeleteViewParams()));
2036 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2037 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
2038 this, SLOT(OnMakePoints()));
2040 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2041 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
2042 this, SLOT(OnMakeWireframe()));
2044 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2045 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
2046 this, SLOT(OnMakeSurface()));
2048 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2049 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2050 this, SLOT(OnMakeInsideframe()));
2052 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2053 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2054 this, SLOT(OnMakeSurfaceframe()));
2056 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2057 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(), tr("MEN_SHRINK"), "", 0, aParent, false,
2058 this, SLOT(OnMakeShrink()));
2060 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2061 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(), tr("MEN_UNSHRINK"), "", 0, aParent, false,
2062 this, SLOT(OnMakeShrink()));
2064 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2065 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2066 this, SLOT(OnChangeColor()));
2068 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2069 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(), tr("MEN_COLOR"), "", 0, aParent, false,
2070 this, SLOT(OnChangeColor()));
2072 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2073 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2074 this, SLOT(OnChangeWireframeColor()));
2076 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2077 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(), tr("MEN_OPACITY"), "", 0, aParent, false,
2078 this, SLOT(OnChangeOpacity()));
2080 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2081 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2082 this, SLOT(OnChangeLines()));
2084 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2085 createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2086 this, SLOT(OnEditPrs()));
2088 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2089 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2090 this, SLOT(OnCreateTable()));
2092 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2093 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
2094 this, SLOT(OnSweep()));
2096 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2097 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2098 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2099 this, SLOT(OnSelectionInfo()));
2101 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2102 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
2103 this, SLOT(OnTimeAnimation()));
2105 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2106 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2107 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2108 this, SLOT(OnEraseAll()));
2110 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2111 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2112 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2113 //this, SLOT(OnEraseAll()));
2116 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2117 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2118 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2119 //this, SLOT(OnEraseAll()));
2122 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
2123 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2124 tr("MEN_SCALING"), "", 0, aParent, false,
2125 this, SLOT(OnScaling()));
2132 // Add actions to menus
2134 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
2135 createMenu( separator(), aMenuId, -1, 10 );
2136 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2137 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2138 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2140 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2141 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2142 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2143 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2144 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2145 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2146 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2147 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2149 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2150 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2152 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2154 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2155 createMenu( VISU_POINTS, parentId, 10 ); // points
2156 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2157 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2158 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2159 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2160 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2161 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2168 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2169 createTool( VISU_SCALAR_MAP, aToolId );
2170 createTool( VISU_DEFORMED_SHAPE, aToolId );
2171 createTool( VISU_VECTORS, aToolId );
2172 createTool( VISU_ISO_SURFACES, aToolId );
2173 createTool( VISU_CUT_PLANES, aToolId );
2174 createTool( VISU_CUT_LINES, aToolId );
2175 createTool( VISU_STREAM_LINES, aToolId );
2182 // Prepare popup menus
2183 QtxPopupMgr* mgr = popupMgr();
2185 // VISU root commands
2186 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
2187 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED
2188 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2189 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables
2190 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2191 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d
2192 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2193 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
2194 mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // delete object
2195 mgr->setRule( action( VISU_DELETE ), aRule, true );
2197 // timestamp commands
2198 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2199 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2200 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2201 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2202 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2203 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2204 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2205 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2206 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2207 aRule += " and nbComponents>1";
2208 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2209 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2210 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2211 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2212 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2213 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2215 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
2216 //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
2217 //mgr->setRule( action( 4022 ), aRule, true );
2218 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2219 mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
2220 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2221 mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
2222 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2223 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
2224 mgr->insert( separator(), -1, -1, -1 );
2225 aRule = "(client='ObjectBrowser' and selcount>0 and ((type='VISU::TTABLE' and nbChildren>0) "
2226 "or (type='VISU::TCURVE') or (type='VISU::TCONTAINER'))) "
2227 " or (selcount>0 and $type in {"
2228 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2229 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
2230 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2231 mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true );
2232 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2233 mgr->setRule( action( VISU_DISPLAY ), aRule + "and (isVisible=false)", true );// TODO: aRule.arg(" and isVisible=0"), true );
2234 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2235 mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true );
2237 /* aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
2238 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2239 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2240 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";*/
2241 aRule = "selcount=1 and $type in {'VISU::TTABLE' "
2242 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2243 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2244 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2245 mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // delete presentation
2246 mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
2249 mgr->insert ( action( VISU_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2250 //jfa tmp:mgr->setRule( action( 4046 ),"(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
2252 mgr->setRule( action( VISU_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); //jfa tmp
2253 mgr->insert ( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2254 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2255 mgr->insert ( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2256 mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2258 // 3D presentations commands
2259 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2260 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2261 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2262 QString aSurfType = " and $type in {'VISU::TMESH'}";
2263 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2264 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
2265 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2266 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
2267 aRule = "selcount=1";
2269 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
2270 mgr->insert( action( VISU_POINTS ), parentId, -1, -1 ); // points
2271 mgr->setRule( action( VISU_POINTS ), aRule + aPrsType +
2272 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2273 mgr->insert( action( VISU_WIREFRAME ), parentId, -1, -1 ); // wireframe
2274 mgr->setRule( action( VISU_WIREFRAME ), aRule + aPrsType +
2275 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2276 mgr->insert( action( VISU_SURFACE ), parentId, -1, -1 ); // surface
2277 mgr->setRule( action( VISU_SURFACE ), aRule + aPrsType +
2278 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2279 mgr->insert( action( VISU_INSIDEFRAME ), parentId, -1, -1 ); // insideframe
2280 mgr->setRule( action( VISU_INSIDEFRAME ), aRule + aInsideType +
2281 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
2282 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2283 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType +
2284 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
2285 mgr->insert( action( VISU_SHRINK ), parentId, -1, -1 ); // shrink
2286 mgr->setRule( action( VISU_SHRINK ), aRule + aShrinkType + " and isShrunk=0", true );
2287 mgr->insert( action( VISU_UNSHRINK ), parentId, -1, -1 ); // unshrink
2288 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2290 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
2291 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2292 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2293 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2294 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2295 mgr->insert( action( VISU_COLOR ), parentId, -1, -1 ); // color
2296 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2297 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2298 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2299 mgr->insert( action( VISU_OPACITY ), parentId, -1, -1 ); // opacity
2300 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2301 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2302 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2305 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
2306 aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2307 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2309 aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
2310 mgr->insert ( action( VISU_RENAME ), -1, -1, -1 ); // rename
2311 mgr->setRule( action( VISU_RENAME ), aRule, true );
2313 // copy presentation command
2314 aRule = "selcount=1 and " + aPrsType;
2315 mgr->insert ( action( VISU_COPY_PRS ), -1, -1, -1 ); // copy
2316 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2319 aRule = "selcount=1 and type='VISU::TCURVE'";
2320 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2321 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2323 // curve container commands
2324 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2325 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); // edit container
2326 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2327 //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
2328 //mgr->setRule( action( 4043 ), aRule, true );
2329 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // clear container
2330 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2332 aRule = "selcount=1 and ";
2333 mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); // edit prs
2334 mgr->setRule( action( VISU_EDIT_PRS ), aRule + aPrsType, true );
2336 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2337 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2338 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2340 //aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
2341 aRule = "selcount=1 and type='VISU::TSCALARMAP'";
2342 mgr->insert ( action( VISU_SWEEP ), -1, -1, -1 ); // sweep
2343 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2345 // Selection info popup item
2346 aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
2347 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2348 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2350 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2351 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); // animation
2352 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2354 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2355 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2356 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2357 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2358 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2360 aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2361 mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure
2362 mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2365 //***************************************************************************
2366 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2368 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2370 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2371 SALOME_ListIO aListIO;
2372 aSelectionMgr->selectedObjects(aListIO);
2373 if (aListIO.Extent() != 1) return;
2375 Handle(SALOME_InteractiveObject) anIO;
2376 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
2377 _PTR(SObject) SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
2378 if (IsSObjectTable(SO)) {
2379 action( VISU_SHOW_TABLE )->addTo(theMenu);
2380 action( VISU_CREATE_CURVES )->addTo(theMenu);
2381 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2382 theMenu->insertSeparator();
2383 action( VISU_DELETE )->addTo(theMenu);
2385 if (!CORBA::is_nil(anObject)) {
2386 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2387 if (!CORBA::is_nil(aMED.in())) {
2388 action( VISU_IMPORT_MED )->addTo(theMenu);
2390 _PTR(SObject) aSFather = SO->GetFather();
2391 _PTR(GenericAttribute) anAttr;
2392 aSFather->FindAttribute(anAttr, "AttributeName");
2393 _PTR(AttributeName) aName (anAttr);
2394 std::string aValue = aName->Value();
2395 if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
2396 action( VISU_IMPORT_MED )->addTo(theMenu);
2403 //***************************************************************************
2406 windows( QMap<int, int>& theMap ) const
2409 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2410 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2416 viewManagers( QStringList& theList ) const
2419 theList.append( SVTK_Viewer::Type() );
2427 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2428 return QString(anIOR.in());
2434 activateModule( SUIT_Study* theStudy )
2436 SalomeApp_Module::activateModule( theStudy );
2438 setMenuShown( true );
2439 setToolShown( true );
2446 deactivateModule( SUIT_Study* theStudy )
2448 setMenuShown( false );
2449 setToolShown( false );
2451 SalomeApp_Module::deactivateModule( theStudy );
2455 SalomeApp_Selection*
2457 createSelection() const
2459 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2462 //******************************************************************
2463 void VisuGUI::studyActivated()
2465 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2473 return new VisuGUI();