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))
278 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
279 SALOME_ListIO aListIO;
280 aSelectionMgr->selectedObjects(aListIO);
282 SALOME_ListIteratorOfListIO It (aListIO);
283 QApplication::setOverrideCursor(Qt::waitCursor);
284 for (; It.More(); It.Next()) {
285 Handle(SALOME_InteractiveObject) anIO = It.Value();
286 //SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
287 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
288 //if (!aSObject->_is_nil()) {
290 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
291 if (!CORBA::is_nil(anObject)) {
292 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
293 if (!CORBA::is_nil(aMED.in()))
294 GetVisuGen(this)->ClientImportMed(aSObject);
295 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
296 if (!CORBA::is_nil(aField.in()))
297 GetVisuGen(this)->ImportMedField(aField);
299 //SALOMEDS::SObject_var aSFather = aSObject->GetFather();
300 _PTR(SObject) aSFather = aSObject->GetFather();
301 //SALOMEDS::GenericAttribute_var anAttr;
302 _PTR(GenericAttribute) anAttr;
303 aSFather->FindAttribute(anAttr, "AttributeName");
304 //SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
305 _PTR(AttributeName) aName (anAttr);
306 std::string aValue = aName->Value();
307 if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
308 GetVisuGen(this)->ClientImportMed(aSObject);
312 updateObjBrowser(true);
313 QApplication::restoreOverrideCursor();
320 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
321 if (CheckLock(aCStudy))
323 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
325 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
326 SALOME_ListIO aListIO;
327 aSelectionMgr->selectedObjects(aListIO);
329 SALOME_ListIteratorOfListIO It (aListIO);
330 QApplication::setOverrideCursor(Qt::waitCursor);
331 for (; It.More(); It.Next()) {
332 Handle(SALOME_InteractiveObject) anIO = It.Value();
333 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
334 if (!aSObject->_is_nil()) {
335 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
336 if (!CORBA::is_nil(anObject)) {
337 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
338 if (!CORBA::is_nil(aMED.in()))
339 GetVisuGen(this)->ImportMed(aSObject);
340 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
341 if (!CORBA::is_nil(aField.in()))
342 GetVisuGen(this)->ImportMedField(aField);
344 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
345 SALOMEDS::GenericAttribute_var anAttr;
346 aSFather->FindAttribute(anAttr, "AttributeName");
347 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
348 CORBA::String_var aValue = aName->Value();
349 if (strcmp(aValue.in(), "MEDFIELD") == 0)
350 GetVisuGen(this)->ImportMed(aSObject);
354 updateObjBrowser(true);
355 QApplication::restoreOverrideCursor();
359 CreateCurves( SalomeApp_Module* theModule,
360 VISU::CutLines_i* thePrs,
362 const bool theCreate = true )
366 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
370 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
371 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
373 if ( !theCreate && aSObject ){
375 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
376 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
377 _PTR(SObject) aTblObj = aIter->Value();
379 _PTR(GenericAttribute) anAttr;
380 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
381 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
388 if ( aCutDlg->isGenerateTable() ) {
389 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
390 if ( aCutDlg->isGenerateCurves() ) {
392 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
393 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
394 _PTR(SObject) aTblObj = aIter->Value();
396 _PTR(GenericAttribute) anAttr;
397 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
398 CreatePlot( theModule, aTblObj );
407 template<class TPrs3d_i>
409 CreatePrs3d(SalomeApp_Module* theModule,
410 SALOMEDS::SObject_var theTimeStamp,
411 const char* theMeshName,
412 VISU::Entity theEntity,
413 const char* theFieldName,
416 VISU::Result_var aResult;
417 if(CheckResult(theModule,theTimeStamp,aResult)){
418 QApplication::setOverrideCursor(Qt::waitCursor);
419 typedef typename TPrs3d_i::TInterface TPrs3d;
420 typename TPrs3d::_var_type aPrs3d =
421 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
422 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
423 QApplication::restoreOverrideCursor();
424 if(!CORBA::is_nil(aPrs3d.in()))
425 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
427 SUIT_MessageBox::warn1(GetDesktop(theModule),
428 QObject::tr("WRN_VISU"),
429 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
430 QObject::tr("BUT_OK") );
435 template<class TPrs3d_i, class TDlg, int IsDlgModal>
437 CreatePrs3d(SalomeApp_Module* theModule,
438 SALOMEDS::SObject_var theTimeStamp,
439 const Handle(SALOME_InteractiveObject)& theIO)
441 using namespace VISU;
442 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
444 QString aType = Storable::FindValue(aMap,"myType",&isExist);
445 if(!isExist || aType.toInt() != TTIMESTAMP )
447 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
448 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
449 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
450 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
451 QApplication::setOverrideCursor(Qt::waitCursor);
453 CreatePrs3d<TPrs3d_i>(theModule,
456 (Entity)anEntity.toInt(),
458 aTimeStampId.toInt());
459 QApplication::restoreOverrideCursor();
461 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
462 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
464 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode
465 aDlg->initFromPrsObject(aPrs3d);
467 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
468 // Optionally, create table and curves for cut lines
469 QApplication::setOverrideCursor(Qt::waitCursor);
470 CreateCurves( theModule, dynamic_cast<VISU::CutLines_i*>( aPrs3d ), aDlg, true ); // in creation mode
471 QApplication::restoreOverrideCursor();
474 DeletePrs3d(theModule,aPrs3d,theIO);
484 PublishInView(theModule,aPrs3d);
491 template<class TPrs3d_i, class TDlg, int IsDlgModal>
493 CreatePrs3d(SalomeApp_Module* theModule)
495 if(CheckLock(GetCStudy(GetAppStudy(theModule))))
498 SALOMEDS::SObject_var aTimeStampSObj;
499 Handle(SALOME_InteractiveObject) anIO;
500 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
503 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
506 theModule->application()->putInfo(QObject::tr("INF_DONE"));
507 theModule->updateObjBrowser();
509 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
513 void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
515 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
516 //if (CheckLock(aStudy))
519 SALOMEDS::SObject_var aResultSObj =
520 GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
523 VISU::Result_var aResult;
524 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
528 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
530 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
534 CORBA::Object_var aMesh;
535 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
540 if (aComment == "ENTITY") {
541 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
542 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
543 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
544 } else if (aComment == "FAMILY") {
545 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
546 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
547 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
548 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
549 } else if (aComment == "GROUP") {
550 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
551 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
552 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
556 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
560 QApplication::restoreOverrideCursor();
561 VISU::Mesh_i* pPresent = NULL;
562 if (!CORBA::is_nil(aMesh))
563 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
564 if (pPresent == NULL) {
565 SUIT_MessageBox::warn1 (GetDesktop(this),
567 tr("ERR_CANT_BUILD_PRESENTATION"),
572 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
578 PublishInView(this, pPresent);
582 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
585 application()->putInfo(QObject::tr("INF_DONE"));
586 } catch (std::runtime_error& exc) {
588 SUIT_MessageBox::warn1 (GetDesktop(this),
590 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
600 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
601 if (CheckLock(aStudy))
604 // Get selected SObject
605 SALOMEDS::SObject_var aResultSObj;
606 Handle(SALOME_InteractiveObject) anIO;
607 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
608 if (anIO.IsNull() || !anIO->hasEntry())
618 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
619 if (CheckLock(aStudy))
622 // Get selected SObject
623 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
624 SALOME_ListIO aListIO;
625 aSelectionMgr->selectedObjects(aListIO);
626 SALOME_ListIteratorOfListIO anIter (aListIO);
627 for (; anIter.More(); anIter.Next()) {
628 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
629 if (anIO.IsNull() || !anIO->hasEntry())
640 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
646 OnCreateDeformedShape()
648 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
655 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
660 OnCreateIsoSurfaces()
662 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
669 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
676 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
681 OnCreateStreamLines()
683 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
690 CheckLock(GetCStudy(GetAppStudy(this)));
691 GetVisuGen( this )->CreateContainer();
699 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
701 QApplication::setOverrideCursor(Qt::waitCursor);
703 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
704 mgr->selectedObjects(aList);
706 Handle(SALOME_InteractiveObject) anIO;
707 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
709 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
710 if ( !CORBA::is_nil( anObject ) ) {
711 // is it Prs3d object ?
712 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
714 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
715 UpdateViewer( this, aPrsObject );
716 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
717 vw->highlight(anIO, 1);
722 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
724 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
725 PlotCurve( this, aCurve, VISU::eDisplay );
729 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
731 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
732 PlotContainer( this, aContainer, VISU::eDisplay );
736 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
738 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
739 PlotTable( this, aTable, VISU::eDisplay );
744 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
745 vw->getRenderer()->ResetCameraClippingRange();
748 QApplication::restoreOverrideCursor();
759 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject, bool theUpdate)
761 if (MYDEBUG) MESSAGE("ErasePrs");
763 if ( !CORBA::is_nil( theObject ) ) {
764 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
765 if ( CORBA::is_nil( aBase ) ) return;
766 VISU::VISUType aType = aBase->GetType();
769 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
770 PlotCurve(this, aCurve, VISU::eErase );
773 case VISU::TCONTAINER:{
774 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
775 PlotContainer(this, aContainer, VISU::eErase );
779 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
780 PlotTable(this, aTable, VISU::eErase );
784 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
785 ErasePrs3d( this, aPrsObject );
787 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
800 if(MYDEBUG) MESSAGE("OnErasePrs");
802 QApplication::setOverrideCursor(Qt::waitCursor);
804 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
805 mgr->selectedObjects(aList);
807 Handle(SALOME_InteractiveObject) anIO;
808 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
810 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
811 ErasePrs(anObject, false);
813 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
815 QApplication::restoreOverrideCursor();
818 template<class TPrs3d_i, class TDlg>
820 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
822 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
824 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
825 TDlg* aDlg = new TDlg (GetDesktop(theModule));
826 aDlg->initFromPrsObject(aPrsObject);
828 if (!(aDlg->storeToPrsObject(aPrsObject))) {
832 RecreateActor(theModule, aPrsObject);
833 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
834 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
835 vw->getRenderer()->ResetCameraClippingRange();
848 if (CheckLock(GetCStudy(GetAppStudy(this))))
851 Handle(SALOME_InteractiveObject) anIO;
852 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
853 if (CORBA::is_nil(anObject)) return;
854 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
855 if (!aServant.in()) return;
857 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
860 switch (aPrs3d->GetType()) {
863 case VISU::TSCALARMAP:
864 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
866 case VISU::TDEFORMEDSHAPE:
867 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
869 case VISU::TCUTPLANES:
870 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
872 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
874 VisuGUI_CutPlanesDlg* aDlg =
875 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
876 aDlg->initFromPrsObject(aPrsObject);
881 case VISU::TCUTLINES:
882 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
884 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
886 VisuGUI_CutLinesDlg* aDlg =
887 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
888 aDlg->initFromPrsObject(aPrsObject);
893 case VISU::TISOSURFACE:
894 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
897 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
899 case VISU::TSTREAMLINES:
900 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
906 if (SVTK_ViewWindow* vw = GetViewWindow())
907 vw->highlight(anIO, 1);
914 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
915 if (CheckLock(aCStudy))
917 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
919 Handle(SALOME_InteractiveObject) anIO;
920 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
924 // There is a transaction
925 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
926 aStudyBuilder->NewCommand();
928 // is it Prs3d object ?
929 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
931 DeletePrs3d(this, aPrsObject, anIO);
934 // is it Curve object ?
935 VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
937 //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
940 aStudyBuilder->CommitCommand();
948 if (SVTK_ViewWindow* vw = GetViewWindow()) {
949 vw->unHighlightAll();
950 if (vtkRenderer *aRen = vw->getRenderer()) {
952 vtkActorCollection *anActColl = aRen->GetActors();
953 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
954 if (anActor->GetVisibility() > 0)
955 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
956 anVISUActor = anVISUActor->GetParent();
957 anVISUActor->VisibilityOff();
962 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
967 void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
969 SUIT_ViewWindow* aView = GetActiveView(this, VTKViewer_Viewer::Type());
971 SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView;
973 Handle(SALOME_InteractiveObject) anIO;
974 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
975 if (CORBA::is_nil(anObject)) return;
976 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
977 if (!aServant.in()) return;
979 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
981 if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
984 if (anActor->IsShrunk())
987 anActor->SetShrink();
990 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
991 aMesh->SetPresentationType(theType);
992 RecreateActor(this, aMesh);
994 anActor->SetRepresentation(theType);
1004 OnMakeSurfaceframe()
1006 ChangeRepresentation(VISU::SURFACEFRAME);
1013 ChangeRepresentation(VISU::INSIDEFRAME);
1020 ChangeRepresentation(VISU::WIREFRAME);
1027 ChangeRepresentation(VISU::SHADED);
1034 ChangeRepresentation(VISU::POINT);
1041 ChangeRepresentation(VISU::SHRINK);
1048 Handle(SALOME_InteractiveObject) anIO;
1049 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1050 if (CORBA::is_nil(anObject)) return;
1051 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1052 if (!aServant.in()) return;
1054 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1055 if (!aPrs3d) return;
1057 SVTK_ViewWindow* vw = GetViewWindow();
1060 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1061 if (!anActor) return;
1063 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1064 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1065 SALOMEDS::Color anOldColor, aNewColor;
1066 int aRepresent = anActor->GetRepresentation();
1068 switch (aRepresent) {
1070 anOldColor = aMesh->GetNodeColor();
1072 case VISU::WIREFRAME :
1073 case VISU::INSIDEFRAME :
1074 anOldColor = aMesh->GetLinkColor();
1077 case VISU::SURFACEFRAME :
1078 anOldColor = aMesh->GetCellColor();
1081 } else if (aDeformedShape) {
1082 anOldColor = aDeformedShape->GetColor();
1087 QColor aColor (int(255*anOldColor.R),
1088 int(255*anOldColor.G),
1089 int(255*anOldColor.B));
1090 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1091 if (aColorNew.isValid()) {
1092 aNewColor.R = aColorNew.red()/255.;
1093 aNewColor.G = aColorNew.green()/255.;
1094 aNewColor.B = aColorNew.blue()/255.;
1096 switch (aRepresent) {
1098 aMesh->SetNodeColor(aNewColor);
1100 case VISU::WIREFRAME :
1101 case VISU::INSIDEFRAME :
1102 aMesh->SetLinkColor(aNewColor);
1105 case VISU::SURFACEFRAME :
1106 aMesh->SetCellColor(aNewColor);
1110 aDeformedShape->SetColor(aNewColor);
1112 RecreateActor(this, aPrs3d);
1118 OnChangeWireframeColor()
1120 Handle(SALOME_InteractiveObject) anIO;
1121 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1122 if (CORBA::is_nil(anObject)) return;
1123 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1124 if (!aServant.in()) return;
1126 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1127 if (!aPrs3d) return;
1129 SVTK_ViewWindow* vw = GetViewWindow();
1132 VISU_Actor* anActor = GetActor(aPrs3d, vw);
1133 if (!anActor) return;
1135 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
1136 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1137 QColor aColor (int(255*anOldColor.R),
1138 int(255*anOldColor.G),
1139 int(255*anOldColor.B));
1140 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1141 if (aColorNew.isValid()) {
1142 aNewColor.R = aColorNew.red()/255.;
1143 aNewColor.G = aColorNew.green()/255.;
1144 aNewColor.B = aColorNew.blue()/255.;
1145 aMesh->SetLinkColor(aNewColor);
1146 RecreateActor(this, aMesh);
1155 Handle(SALOME_InteractiveObject) anIO;
1156 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1157 if (CORBA::is_nil(anObject)) return;
1158 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1159 if (!aServant.in()) return;
1161 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1162 if (!aPrsObject) return;
1164 SVTK_ViewWindow* vw = GetViewWindow();
1167 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1168 if (!anActor) return;
1170 VisuGUI_CursorDlg* CursorDlg =
1171 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
1173 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1174 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1175 CursorDlg->SpinBox1->setMinValue(0);
1176 CursorDlg->SpinBox1->setMaxValue(100);
1178 float oldopac = anActor->GetOpacity();
1179 int intopac = int(oldopac*100. + 0.5);
1180 CursorDlg->SpinBox1->setValue(intopac);
1182 int ret = CursorDlg->exec();
1184 intopac = CursorDlg->SpinBox1->value();
1185 float newopac = intopac/100.;
1186 anActor->SetOpacity(newopac);
1195 Handle(SALOME_InteractiveObject) anIO;
1196 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1197 if (CORBA::is_nil(anObject)) return;
1198 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1199 if (!aServant.in()) return;
1201 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1202 if (!aPrsObject) return;
1204 SVTK_ViewWindow* vw = GetViewWindow();
1207 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1208 if (!anActor) return;
1210 VisuGUI_CursorDlg* CursorDlg =
1211 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1213 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1214 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1215 CursorDlg->SpinBox1->setMinValue(1);
1216 CursorDlg->SpinBox1->setMaxValue(10);
1218 float oldlwid = anActor->GetLineWidth();
1219 int intlwid = int(oldlwid);
1220 CursorDlg->SpinBox1->setValue(intlwid);
1222 int ret = CursorDlg->exec();
1224 intlwid = CursorDlg->SpinBox1->value();
1225 float newlwid = intlwid;
1226 anActor->SetLineWidth(newlwid);
1235 Handle(SALOME_InteractiveObject) anIO;
1236 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1238 if ( !CORBA::is_nil( anObject ) ) {
1239 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1240 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1241 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1242 if( !CORBA::is_nil( aTable ) ) {
1243 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1245 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1250 // possibly this is Table SObject
1251 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1254 if( !IsSObjectTable( SO ) )
1257 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1260 //SAL2670 Orientation of show tables
1261 VisuGUI_TableDlg::ttAuto,
1270 Handle(SALOME_InteractiveObject) anIO;
1271 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1272 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1273 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1274 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1275 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1276 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1285 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1286 if (CheckLock(aCStudy))
1288 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1290 Handle(SALOME_InteractiveObject) anIO;
1291 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1292 if (anIO.IsNull() || !anIO->hasEntry())
1295 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
1296 if (!aSObject->_is_nil()) {
1297 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1298 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1299 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1300 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1301 ErasePrs(aChildObj);
1303 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
1304 // There is a transaction
1305 aStudyBuilder->NewCommand();
1306 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
1307 if (!CORBA::is_nil(anObj)) {
1308 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
1309 if (!CORBA::is_nil(aBase)) {
1310 VISU::VISUType aType = aBase->GetType();
1314 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1315 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1316 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1317 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1318 if (CORBA::is_nil(aChildObj)) continue;
1319 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
1320 if (CORBA::is_nil(aPrs3d)) continue;
1321 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
1322 DeletePrs3d(this, pPrs3d, NULL);
1328 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1329 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1330 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1331 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1332 if (CORBA::is_nil(aChildObj)) continue;
1333 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
1334 if (CORBA::is_nil(aCurve)) continue;
1335 //VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1336 //jfa tmp:DeleteCurve(this, pCurve, NULL);
1343 aStudyBuilder->RemoveObjectWithChildren(aSObject);
1344 aStudyBuilder->CommitCommand();
1345 //jfa tmp:GetActiveStudy()->unHighlightAll();
1346 updateObjBrowser(true);
1354 Handle(SALOME_InteractiveObject) anIO;
1355 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1357 _PTR(GenericAttribute) anAttr;
1358 _PTR(AttributeName) aName;
1360 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1362 if ( !CORBA::is_nil( anObject ) ) {
1363 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1364 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1365 // Table (VISU object) is selected
1366 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1367 if( !CORBA::is_nil( aTbl ) ) {
1368 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1370 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1371 if ( IsSObjectTable(SO) ) {
1372 // get name of SObject
1373 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1375 SOName = QString( aName->Value().c_str() );
1377 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1378 if ( dlg->exec() == QDialog::Accepted ) {
1379 if ( !IsStudyLocked( aStudy ) ) {
1380 // if study is not locked - create new container, create curves
1381 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1383 QValueList<int> verIndices;
1384 dlg->getCurvesSource( horIndex, verIndices );
1385 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1386 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1387 if( !CORBA::is_nil( aContainer ) ) {
1388 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1390 for ( int i = 0; i < verIndices.count(); i++ ) {
1391 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1392 if( !CORBA::is_nil( aNewCurve ) ) {
1393 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1396 int marker, line, lineWidth;
1398 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1399 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1400 pCrv->SetColor( c );
1401 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1402 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1404 pContainer->AddCurve( pCrv->_this() );
1409 PlotContainer( this, pContainer, VISU::eDisplay );
1415 // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
1416 QPtrList<Plot2d_Curve> container;
1417 dlg->getCurves( container );
1418 if ( !container.isEmpty() ) {
1419 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1420 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1430 else if ( !anIO.IsNull() ) {
1431 // check if Table SObject is selected
1432 SO = aStudy->FindObjectID( anIO->getEntry() );
1433 if ( IsSObjectTable(SO) ) {
1434 // get name of SObject
1435 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1437 SOName = QString( aName->Value().c_str() );
1439 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1440 if ( dlg->exec() == QDialog::Accepted ) {
1441 if ( !IsStudyLocked( aStudy ) ) {
1442 // if study is not locked - create new table and container objects, create curves
1443 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1445 QValueList<int> verIndices;
1446 dlg->getCurvesSource( horIndex, verIndices );
1447 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1448 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1449 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1450 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1451 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1452 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1454 if ( pContainer && pTable ) {
1455 for ( int i = 0; i < verIndices.count(); i++ ) {
1456 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
1457 if( !CORBA::is_nil( aNewCurve ) ) {
1458 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1461 int marker, line, lineWidth;
1463 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1464 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1465 pCrv->SetColor( c );
1466 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1467 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1469 pContainer->AddCurve( pCrv->_this() );
1474 PlotContainer( this, pContainer, VISU::eDisplay );
1479 // if study is locked just get curves info and plot them
1480 QPtrList<Plot2d_Curve> container;
1481 dlg->getCurves( container );
1482 if ( !container.isEmpty() ) {
1483 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1484 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1497 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1498 SALOME_ListIO aListIO;
1499 aSelectionMgr->selectedObjects(aListIO);
1500 if (aListIO.Extent() != 1) return;
1502 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1503 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1504 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1505 if (CORBA::is_nil( anObject )) return;
1507 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1508 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1510 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1511 if( !CORBA::is_nil( aCurve ) ) {
1512 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1513 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1514 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1516 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1517 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1518 SALOMEDS::Color aColor = aDSCurve->GetColor();
1519 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1520 if( aDlg.exec() == QDialog::Accepted ) {
1521 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1522 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1523 SALOMEDS::Color newColor;
1524 newColor.R = aDlg.getColor().red()/255.;
1525 newColor.G = aDlg.getColor().green()/255.;
1526 newColor.B = aDlg.getColor().blue()/255.;
1527 aDSCurve->SetColor( newColor );
1528 PlotCurve(this, aDSCurve, VISU::eDisplay);
1539 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1540 if (CheckLock(aCStudy))
1542 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1543 Handle(SALOME_InteractiveObject) anIO;
1544 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1545 if (anIO.IsNull() || CORBA::is_nil(anObject))
1548 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1549 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1551 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1552 if (!CORBA::is_nil(aCnt)) {
1553 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1554 if (container && container->GetNbCurves() > 0) {
1566 Handle(SALOME_InteractiveObject) anIO;
1567 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1568 if (CORBA::is_nil(anObject)) return;
1570 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1571 if (!aServant.in()) return;
1572 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1573 if (!aContainer) return;
1575 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1576 aDlg->initFromPrsObject(aContainer);
1578 aDlg->storeToPrsObject(aContainer);
1579 updateObjBrowser(true);
1588 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1589 if (CheckLock(aCStudy))
1591 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1593 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1594 if (aViewMgr->getType() != SVTK_Viewer::Type())
1597 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1598 SALOME_ListIO aListIO;
1599 aSelectionMgr->selectedObjects(aListIO);
1600 if (aListIO.Extent() > 1)
1603 if (aListIO.Extent() == 0) {
1604 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1606 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1607 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1614 OnRestoreViewParams()
1616 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1617 if (aViewMgr->getType() != SVTK_Viewer::Type())
1620 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1621 SALOME_ListIO aListIO;
1622 aSelectionMgr->selectedObjects(aListIO);
1623 if (aListIO.Extent() != 1)
1626 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1627 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1628 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1629 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1630 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1635 OnDeleteViewParams()
1637 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1638 if (CheckLock(aCStudy))
1640 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1642 Handle(SALOME_InteractiveObject) anIO;
1643 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1644 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1645 if (!aSObject) return;
1647 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
1648 if (aType == VISU::TVIEW3D) {
1649 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1650 SALOME_ListIO aListIO, aNewListIO;
1651 aSelectionMgr->selectedObjects(aListIO);
1652 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
1653 if (it.Value()->getEntry() != anIO->getEntry()) {
1654 aNewListIO.Append(it.Value());
1657 aSelectionMgr->setSelectedObjects(aNewListIO);
1659 aCStudy->NewBuilder()->RemoveObject(aSObject);
1669 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1670 if (CheckLock(aCStudy))
1673 Handle(SALOME_InteractiveObject) anIO;
1674 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1676 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1679 //TEST DU PARENT == VISU
1680 _PTR(GenericAttribute) anAttr;
1681 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1682 _PTR(AttributeName) aName (anAttr);
1683 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1684 if (!Name.isEmpty()) {
1685 QApplication::setOverrideCursor(Qt::waitCursor);
1687 // rename specific objects
1688 if (!CORBA::is_nil(anObject)) {
1689 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1690 if (!CORBA::is_nil(aVisuObj)) {
1691 switch (aVisuObj->GetType()) {
1692 case VISU::TCURVE: // Curve object
1694 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1695 if (!CORBA::is_nil(aCurve)) {
1696 VISU::Curve_i* curve =
1697 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1699 curve->SetName(Name.latin1());
1703 case VISU::TTABLE: // Table object
1705 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1706 if (!CORBA::is_nil(aTable)) {
1707 VISU::Table_i* table =
1708 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1710 table->SetName(Name.latin1());
1714 case VISU::TCONTAINER: // Container object
1716 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1717 if (!CORBA::is_nil(aContainer)) {
1718 VISU::Container_i* container =
1719 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1721 container->SetName(Name.latin1());
1732 // rename the study object
1733 //getApp()->activeStudy()->renameIObject(anIO, Name);
1734 aName->SetValue(Name.latin1()); // rename the SObject
1735 anIO->setName(Name.latin1()); // rename the InteractiveObject
1736 updateObjBrowser(false);
1738 QApplication::restoreOverrideCursor();
1748 Handle(SALOME_InteractiveObject) anIO;
1749 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1750 if (CORBA::is_nil(anObject)) return;
1751 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1752 if (!aServant.in()) return;
1754 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1755 if (!aPrsObject) return;
1757 SVTK_ViewWindow* vw = GetViewWindow();
1760 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1761 if (!aActor) return;
1763 if (!aActor->GetVisibility()) {
1764 aActor->VisibilityOn();
1767 // Get sweep parameters
1768 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1770 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
1771 int aTemp = int(1.E6 * aTempoDbl);
1773 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
1774 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
1777 QApplication::setOverrideCursor(Qt::waitCursor);
1779 for (int j = 0; j < aCycles; j++) {
1780 for (int i = 0; i <= aSteps; i++) {
1781 float aPercents = float(i)/aSteps;
1782 aPrsObject->SetMapScale(aPercents);
1783 aPrsObject->UpdateActor(aActor);
1784 vw->getRenderWindow()->getRenderWindow()->Render();
1788 } catch (std::exception& exc) {
1789 INFOS("Follow exception was occured :\n" << exc.what());
1791 INFOS("Unknown exception was occured!");
1793 QApplication::restoreOverrideCursor();
1800 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1801 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1802 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1804 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1805 SALOME_ListIO aListIO;
1806 aSelectionMgr->selectedObjects(aListIO);
1808 bool isDefined = false;
1810 SALOME_ListIteratorOfListIO It (aListIO);
1811 for (; It.More(); It.Next()) {
1812 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1813 if (!aSObject) continue;
1814 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1815 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1819 aAnimationDlg->addField(aSObject);
1821 } else if (aNbTimes == aNumber) {
1822 aAnimationDlg->addField(aSObject);
1827 if (isDefined) aAnimationDlg->show();
1828 else delete aAnimationDlg;
1833 OnCopyPresentation()
1835 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1836 if (CheckLock(aCStudy))
1839 //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
1840 Handle(SALOME_InteractiveObject) anIO;
1841 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1842 if (CORBA::is_nil(anObject)) return;
1843 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1844 if (!aServant.in()) return;
1846 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1847 if (!aPrsObject) return;
1849 switch (aPrsObject->GetType()) {
1852 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1853 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1854 aSameMesh->SameAs(aMeshPrs);
1855 UpdateViewer(this, aSameMesh);
1858 case VISU::TSCALARMAP:
1860 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1861 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1862 aSameScalar->SameAs(aScalarPrs);
1863 UpdateViewer(this, aSameScalar);
1866 case VISU::TDEFORMEDSHAPE:
1868 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1869 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1870 aSameDeformed->SameAs(aDefPrs);
1871 UpdateViewer(this, aSameDeformed);
1874 case VISU::TCUTPLANES:
1876 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1877 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1878 aSameCut->SameAs(aCutPrs);
1879 UpdateViewer(this, aSameCut);
1882 case VISU::TCUTLINES:
1884 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1885 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1886 aSameCut->SameAs(aCutPrs);
1887 UpdateViewer(this, aSameCut);
1890 case VISU::TISOSURFACE:
1892 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1893 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1894 aSameIso->SameAs(aIsoPrs);
1895 UpdateViewer(this, aSameIso);
1898 case VISU::TSTREAMLINES:
1900 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1901 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1902 aSameLines->SameAs(aLinesPrs);
1903 UpdateViewer(this, aSameLines);
1906 case VISU::TVECTORS:
1908 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1909 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1910 aSameVectors->SameAs(aVectorsPrs);
1911 UpdateViewer(this, aSameVectors);
1922 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1929 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1930 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1931 false, Qt::WDestructiveClose);
1932 m_NonIsoDlg->show();
1937 initialize( CAM_Application* theApp )
1939 SalomeApp_Module::initialize( theApp );
1952 QWidget* aParent = application()->desktop();
1953 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1956 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1957 this, SLOT(OnImportFromFile()));
1958 createAction( VISU_EXPLORE_MED, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1959 this, SLOT(OnExploreMEDFile()));
1960 createAction( VISU_IMPORT_TABLE, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1961 this, SLOT(OnImportTableFromFile()));
1963 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1964 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1965 this, SLOT(OnCreateScalarMap()));
1967 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1968 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1969 this, SLOT(OnCreateDeformedShape()));
1971 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1972 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1973 this, SLOT(OnCreateVectors()));
1975 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1976 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1977 this, SLOT(OnCreateIsoSurfaces()));
1979 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1980 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1981 this, SLOT(OnCreateCutPlanes()));
1983 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1984 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1985 this, SLOT(OnCreateStreamLines()));
1987 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1988 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1989 this, SLOT(OnCreateCutLines()));
1991 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
1992 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1993 this, SLOT(OnCreatePlot2dView()));
1995 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1996 createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1997 this, SLOT(OnDeleteObject()));
1999 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2000 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
2001 //this, SLOT(OnRenameTable()));
2003 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2004 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2005 this, SLOT(OnShowTable()));
2007 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2008 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2009 this, SLOT(OnPlotData()));
2011 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2012 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2013 this, SLOT(OnExportTableToFile()));
2015 createAction( VISU_IMPORT_MED, tr("MEN_IMPORT_MED"), QIconSet(),
2016 tr("MEN_IMPORT_MED"), "", 0, aParent, false,
2017 this, SLOT(OnImportMedField()));
2019 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2020 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2021 this, SLOT(OnCreateMesh()));
2023 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2024 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2025 this, SLOT(OnCreateManyMesh()));
2027 //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE"));
2028 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(), tr("MEN_ERASE"), "", 0, aParent, false,
2029 this, SLOT(OnErasePrs()));
2031 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2032 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(), tr("MEN_DISPLAY"), "", 0, aParent, false,
2033 this, SLOT(OnDisplayPrs()));
2035 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2036 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2037 this, SLOT(OnDisplayOnlyPrs()));
2039 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2040 createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
2041 this, SLOT(OnDeletePrs()));
2043 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2044 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false,
2045 this, SLOT(OnCopyPresentation()));
2047 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2048 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2049 this, SLOT(OnCurveProperties()));
2051 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2052 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2053 this, SLOT(OnRename()));
2055 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2056 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2057 this, SLOT(OnEditContainer()));
2059 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2060 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
2061 //this, SLOT(OnRenameContainer()));
2063 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2064 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2065 this, SLOT(OnClearContainer()));
2067 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2068 createAction( VISU_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2069 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2070 this, SLOT(OnSaveViewParams()));
2072 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2073 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2074 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2075 this, SLOT(OnRestoreViewParams()));
2077 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2078 createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2079 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2080 this, SLOT(OnDeleteViewParams()));
2082 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2083 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
2084 this, SLOT(OnMakePoints()));
2086 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2087 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
2088 this, SLOT(OnMakeWireframe()));
2090 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2091 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
2092 this, SLOT(OnMakeSurface()));
2094 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2095 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2096 this, SLOT(OnMakeInsideframe()));
2098 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2099 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2100 this, SLOT(OnMakeSurfaceframe()));
2102 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2103 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(), tr("MEN_SHRINK"), "", 0, aParent, false,
2104 this, SLOT(OnMakeShrink()));
2106 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2107 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(), tr("MEN_UNSHRINK"), "", 0, aParent, false,
2108 this, SLOT(OnMakeShrink()));
2110 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2111 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2112 this, SLOT(OnChangeColor()));
2114 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2115 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(), tr("MEN_COLOR"), "", 0, aParent, false,
2116 this, SLOT(OnChangeColor()));
2118 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2119 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2120 this, SLOT(OnChangeWireframeColor()));
2122 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2123 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(), tr("MEN_OPACITY"), "", 0, aParent, false,
2124 this, SLOT(OnChangeOpacity()));
2126 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2127 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2128 this, SLOT(OnChangeLines()));
2130 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2131 createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2132 this, SLOT(OnEditPrs()));
2134 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2135 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2136 this, SLOT(OnCreateTable()));
2138 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2139 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
2140 this, SLOT(OnSweep()));
2142 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2143 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2144 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2145 this, SLOT(OnSelectionInfo()));
2147 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2148 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
2149 this, SLOT(OnTimeAnimation()));
2151 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2152 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2153 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2154 this, SLOT(OnEraseAll()));
2156 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2157 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2158 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2159 //this, SLOT(OnEraseAll()));
2162 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2163 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2164 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2165 //this, SLOT(OnEraseAll()));
2168 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
2169 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2170 tr("MEN_SCALING"), "", 0, aParent, false,
2171 this, SLOT(OnScaling()));
2178 // Add actions to menus
2180 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
2181 createMenu( separator(), aMenuId, -1, 10 );
2182 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2183 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2184 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2186 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2187 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2188 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2189 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2190 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2191 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2192 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2193 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2195 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2196 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2198 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2200 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2201 createMenu( VISU_POINTS, parentId, 10 ); // points
2202 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2203 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2204 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2205 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2206 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2207 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2214 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2215 createTool( VISU_SCALAR_MAP, aToolId );
2216 createTool( VISU_DEFORMED_SHAPE, aToolId );
2217 createTool( VISU_VECTORS, aToolId );
2218 createTool( VISU_ISO_SURFACES, aToolId );
2219 createTool( VISU_CUT_PLANES, aToolId );
2220 createTool( VISU_CUT_LINES, aToolId );
2221 createTool( VISU_STREAM_LINES, aToolId );
2228 // Prepare popup menus
2229 QtxPopupMgr* mgr = popupMgr();
2231 // VISU root commands
2232 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
2233 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED
2234 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2235 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables
2236 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2237 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d
2238 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2239 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
2240 mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // delete object
2241 mgr->setRule( action( VISU_DELETE ), aRule, true );
2243 // timestamp commands
2244 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2245 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2246 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2247 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2248 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2249 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2250 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2251 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2252 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2253 aRule += " and nbComponents>1";
2254 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2255 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2256 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2257 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2258 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2259 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2261 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
2262 //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
2263 //mgr->setRule( action( 4022 ), aRule, true );
2264 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2265 mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
2266 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2267 mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
2268 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2269 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
2270 mgr->insert( separator(), -1, -1, -1 );
2271 aRule = "(client='ObjectBrowser' and selcount>0 and ((type='VISU::TTABLE' and nbChildren>0) "
2272 "or (type='VISU::TCURVE') or (type='VISU::TCONTAINER'))) "
2273 " or (selcount>0 and $type in {"
2274 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2275 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
2276 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2277 mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true );
2278 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2279 mgr->setRule( action( VISU_DISPLAY ), aRule + "and (isVisible=false)", true );// TODO: aRule.arg(" and isVisible=0"), true );
2280 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2281 mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true );
2283 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
2284 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2285 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2286 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2287 mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // delete presentation
2288 mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
2291 mgr->insert ( action( VISU_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2292 //jfa tmp:mgr->setRule( action( 4046 ),"(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
2294 mgr->setRule( action( VISU_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); //jfa tmp
2295 mgr->insert ( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2296 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2297 mgr->insert ( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2298 mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2300 // 3D presentations commands
2301 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2302 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2303 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2304 QString aSurfType = " and $type in {'VISU::TMESH'}";
2305 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2306 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
2307 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2308 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
2309 aRule = "selcount=1";
2311 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
2312 mgr->insert( action( VISU_POINTS ), parentId, -1, -1 ); // points
2313 mgr->setRule( action( VISU_POINTS ), aRule + aPrsType +
2314 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2315 mgr->insert( action( VISU_WIREFRAME ), parentId, -1, -1 ); // wireframe
2316 mgr->setRule( action( VISU_WIREFRAME ), aRule + aPrsType +
2317 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2318 mgr->insert( action( VISU_SURFACE ), parentId, -1, -1 ); // surface
2319 mgr->setRule( action( VISU_SURFACE ), aRule + aPrsType +
2320 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2321 mgr->insert( action( VISU_INSIDEFRAME ), parentId, -1, -1 ); // insideframe
2322 mgr->setRule( action( VISU_INSIDEFRAME ), aRule + aInsideType +
2323 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
2324 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2325 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType +
2326 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
2327 mgr->insert( action( VISU_SHRINK ), parentId, -1, -1 ); // shrink
2328 mgr->setRule( action( VISU_SHRINK ), aRule + aShrinkType + " and isShrunk=0", true );
2329 mgr->insert( action( VISU_UNSHRINK ), parentId, -1, -1 ); // unshrink
2330 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2332 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
2333 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2334 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2335 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2336 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2337 mgr->insert( action( VISU_COLOR ), parentId, -1, -1 ); // color
2338 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2339 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2340 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2341 mgr->insert( action( VISU_OPACITY ), parentId, -1, -1 ); // opacity
2342 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2343 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2344 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2347 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
2348 aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2349 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2351 aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
2352 mgr->insert ( action( VISU_RENAME ), -1, -1, -1 ); // rename
2353 mgr->setRule( action( VISU_RENAME ), aRule, true );
2355 // copy presentation command
2356 aRule = "selcount=1 and " + aPrsType;
2357 mgr->insert ( action( VISU_COPY_PRS ), -1, -1, -1 ); // copy
2358 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2361 aRule = "selcount=1 and type='VISU::TCURVE'";
2362 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2363 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2365 // curve container commands
2366 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2367 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); // edit container
2368 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2369 //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
2370 //mgr->setRule( action( 4043 ), aRule, true );
2371 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // clear container
2372 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2374 aRule = "selcount=1 and ";
2375 mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 ); // edit prs
2376 mgr->setRule( action( VISU_EDIT_PRS ), aRule + aPrsType, true );
2378 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2379 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2380 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2382 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
2383 mgr->insert ( action( VISU_SWEEP ), -1, -1, -1 ); // sweep
2384 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2386 // Selection info popup item
2387 aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
2388 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2389 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2391 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2392 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); // animation
2393 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2395 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2396 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2397 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2398 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2399 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2401 aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2402 mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure
2403 mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2406 //***************************************************************************
2407 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2409 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2411 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2412 SALOME_ListIO aListIO;
2413 aSelectionMgr->selectedObjects(aListIO);
2414 if (aListIO.Extent() != 1) return;
2416 Handle(SALOME_InteractiveObject) anIO;
2417 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
2418 _PTR(SObject) SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
2419 if (IsSObjectTable(SO)) {
2420 action( VISU_SHOW_TABLE )->addTo(theMenu);
2421 action( VISU_CREATE_CURVES )->addTo(theMenu);
2422 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2423 theMenu->insertSeparator();
2424 action( VISU_DELETE )->addTo(theMenu);
2426 if (!CORBA::is_nil(anObject)) {
2427 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2428 if (!CORBA::is_nil(aMED.in())) {
2429 action( VISU_IMPORT_MED )->addTo(theMenu);
2431 _PTR(SObject) aSFather = SO->GetFather();
2432 _PTR(GenericAttribute) anAttr;
2433 aSFather->FindAttribute(anAttr, "AttributeName");
2434 _PTR(AttributeName) aName (anAttr);
2435 std::string aValue = aName->Value();
2436 if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
2437 action( VISU_IMPORT_MED )->addTo(theMenu);
2444 //***************************************************************************
2447 windows( QMap<int, int>& theMap ) const
2450 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2451 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2457 viewManagers( QStringList& theList ) const
2460 theList.append( SVTK_Viewer::Type() );
2468 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2469 return QString(anIOR.in());
2475 activateModule( SUIT_Study* theStudy )
2477 SalomeApp_Module::activateModule( theStudy );
2479 setMenuShown( true );
2480 setToolShown( true );
2487 deactivateModule( SUIT_Study* theStudy )
2489 setMenuShown( false );
2490 setToolShown( false );
2492 SalomeApp_Module::deactivateModule( theStudy );
2496 SalomeApp_Selection*
2498 createSelection() const
2500 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2503 //******************************************************************
2504 void VisuGUI::studyActivated()
2506 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2514 return new VisuGUI();