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
38 #include <qptrvector.h>
39 #include <qcolordialog.h>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
47 #include "SALOME_LifeCycleCORBA.hxx"
49 #include "SUIT_ResourceMgr.h"
50 #include "SUIT_MessageBox.h"
52 #include "SUIT_ViewWindow.h"
53 #include "SUIT_ViewManager.h"
55 #include "CAM_Module.h"
57 #include "SVTK_RenderWindow.h"
58 #include "SVTK_ViewWindow.h"
59 #include "SVTK_ViewModel.h"
60 #include "SVTK_Functor.h"
62 #include "SPlot2d_ViewModel.h"
63 #include "SPlot2d_SetupPlot2dDlg.h"
64 #include "Plot2d_SetupCurveDlg.h"
66 #include "OB_Browser.h"
68 #include "SALOME_ListIO.hxx"
69 #include "SALOME_ListIteratorOfListIO.hxx"
71 #include "SalomeApp_Application.h"
72 #include "SalomeApp_DataModel.h"
73 #include "SalomeApp_Study.h"
74 #include "SalomeApp_SelectionMgr.h"
75 #include "SalomeApp_Selection.h"
76 #include "SalomeApp_Preferences.h"
78 #include "VISUConfig.hh"
79 #include "VISU_Gen_i.hh"
80 #include "VISU_Mesh_i.hh"
81 #include "VISU_Table_i.hh"
82 #include "VISU_Result_i.hh"
83 #include "VISU_View_i.hh"
84 #include "VISU_ViewManager_i.hh"
85 #include "VISU_Plot3D_i.hh"
87 #include "VISU_Actor.h"
89 #include "VisuGUI_Tools.h"
90 #include "VisuGUI_PopupTools.h"
91 #include "VisuGUI_NameDlg.h"
92 #include "VisuGUI_FileDlg.h"
93 #include "VisuGUI_CursorDlg.h"
94 #include "VisuGUI_Selection.h"
95 #include "VisuGUI_TimeAnimation.h"
96 #include "VisuGUI_EditContainerDlg.h"
97 #include "VisuGUI_NonIsometricDlg.h"
98 #include "VisuGUI_ClippingDlg.h"
99 #include "VisuGUI_Plot3DDlg.h"
100 #include "VisuGUI_CubeAxesDlg.h"
101 #include "VisuGUI_OffsetDlg.h"
103 #include "VISU_ScalarMap_i.hh"
104 #include "VisuGUI_ScalarBarDlg.h"
106 #include "VISU_DeformedShape_i.hh"
107 #include "VisuGUI_DeformedShapeDlg.h"
109 #include "VISU_IsoSurfaces_i.hh"
110 #include "VisuGUI_IsoSurfacesDlg.h"
112 #include "VISU_CutPlanes_i.hh"
113 #include "VisuGUI_CutPlanesDlg.h"
115 #include "VISU_CutLines_i.hh"
116 #include "VisuGUI_CutLinesDlg.h"
118 #include "VISU_StreamLines_i.hh"
119 #include "VisuGUI_StreamLinesDlg.h"
121 #include "VISU_Vectors_i.hh"
122 #include "VisuGUI_VectorsDlg.h"
124 #include "VisuGUI_TableDlg.h"
126 #include "SALOMEconfig.h"
127 #include CORBA_SERVER_HEADER(MED_Gen)
129 #include "utilities.h"
131 #include "VisuGUI_ActionsDef.h"
133 using namespace VISU;
136 static int MYDEBUG = 1;
138 static int MYDEBUG = 0;
141 //////////////////////////////////////////////////
143 //////////////////////////////////////////////////
146 SalomeApp_Module( "VISU" )
160 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
161 CheckLock(GetCStudy(GetAppStudy(this)));
162 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
165 aFilter.append( tr("FLT_MED_FILES") );
166 aFilter.append( tr("FLT_ALL_FILES") );
168 QFileInfo aFileInfo =
169 SUIT_FileDlg::getFileName(GetDesktop(this),
172 tr("MEN_IMPORT_FROM_FILE"),
174 if(aFileInfo.exists()){
175 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
177 VISU::Result_var aResult;
178 bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
179 if(VisuGUI_FileDlg::IsBuild){
180 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
181 if(!CORBA::is_nil(aResult.in()))
182 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
183 if(!aRes->IsPossible())
184 SUIT_MessageBox::warn1(GetDesktop(this),
186 tr("ERR_CANT_BUILD_PRESENTATION"),
192 aResourceMgr->setValue("VISU", "full_med_loading", false);
193 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
194 aResourceMgr->setValue("VISU", "full_med_loading", anIsBuild);
197 if(CORBA::is_nil(aResult.in())) {
198 SUIT_MessageBox::warn1(GetDesktop(this),
200 tr("ERR_ERROR_IN_THE_FILE"),
203 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
214 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
215 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
218 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
221 aFilter.append( tr("FLT_MED_FILES") );
222 aFilter.append( tr("FLT_ALL_FILES") );
224 QFileInfo aFileInfo =
225 SUIT_FileDlg::getFileName(GetDesktop(this),
228 tr("MEN_EXPLORE_MED_FILE"),
230 if(aFileInfo.exists()){
231 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
232 std::string aStudyName = aStudy->Name();
233 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
234 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
235 //updateObjBrowser();
236 getApp()->updateObjectBrowser(true); // as need to update MED tree
243 OnImportTableFromFile()
245 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
246 CheckLock(GetCStudy(GetAppStudy(this)));
249 aFilter.append( tr("FLT_TABLE_FILES") );
250 aFilter.append( tr("FLT_ALL_FILES") );
252 QFileInfo aFileInfo =
253 SUIT_FileDlg::getFileName(GetDesktop(this),
256 tr("MEN_IMPORT_TABLE"),
258 if(aFileInfo.exists()){
259 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
261 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
263 if(CORBA::is_nil(anObject.in())) {
264 SUIT_MessageBox::warn1(GetDesktop(this),
266 tr("ERR_ERROR_IN_THE_FILE"),
269 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
277 OnExportTableToFile()
279 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
286 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
287 if (CheckLock(aCStudy))
289 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
291 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
292 SALOME_ListIO aListIO;
293 aSelectionMgr->selectedObjects(aListIO);
295 SALOME_ListIteratorOfListIO It (aListIO);
296 QApplication::setOverrideCursor(Qt::waitCursor);
297 for (; It.More(); It.Next()) {
298 Handle(SALOME_InteractiveObject) anIO = It.Value();
299 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
300 if (!aSObject->_is_nil()) {
301 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
302 if (!CORBA::is_nil(anObject)) {
303 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
304 if (!CORBA::is_nil(aMED.in()))
305 GetVisuGen(this)->ImportMed(aSObject);
306 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
307 if (!CORBA::is_nil(aField.in()))
308 GetVisuGen(this)->ImportMedField(aField);
310 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
311 SALOMEDS::GenericAttribute_var anAttr;
312 aSFather->FindAttribute(anAttr, "AttributeName");
313 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
314 CORBA::String_var aValue = aName->Value();
315 if (strcmp(aValue.in(), "MEDFIELD") == 0)
316 GetVisuGen(this)->ImportMed(aSObject);
320 updateObjBrowser(true);
321 QApplication::restoreOverrideCursor();
325 CreateCurves( SalomeApp_Module* theModule,
326 VISU::CutLines_i* thePrs,
328 const bool theCreate = true )
332 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
336 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
337 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() );
339 if ( !theCreate && aSObject ){
341 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
342 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
343 _PTR(SObject) aTblObj = aIter->Value();
345 _PTR(GenericAttribute) anAttr;
346 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
347 aBuilder->RemoveObjectWithChildren( aIter->Value() ); // We should have only one child
354 if ( aCutDlg->isGenerateTable() ) {
355 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() );
356 if ( aCutDlg->isGenerateCurves() ) {
358 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
359 for ( _PTR(ChildIterator) aIter = aStudy->NewChildIterator( aSObject ); aIter->More(); aIter->Next() ) {
360 _PTR(SObject) aTblObj = aIter->Value();
362 _PTR(GenericAttribute) anAttr;
363 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
364 CreatePlot( theModule, aTblObj );
373 template<class TPrs3d_i>
375 CreatePrs3d(SalomeApp_Module* theModule,
376 _PTR(SObject) theTimeStamp,
377 const char* theMeshName,
378 VISU::Entity theEntity,
379 const char* theFieldName,
382 VISU::Result_var aResult;
383 if (CheckResult(theModule,theTimeStamp,aResult)){
384 QApplication::setOverrideCursor(Qt::waitCursor);
385 typedef typename TPrs3d_i::TInterface TPrs3d;
386 typename TPrs3d::_var_type aPrs3d =
387 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
388 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
389 QApplication::restoreOverrideCursor();
390 if (!CORBA::is_nil(aPrs3d.in()))
391 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
393 SUIT_MessageBox::warn1(GetDesktop(theModule),
394 QObject::tr("WRN_VISU"),
395 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
396 QObject::tr("BUT_OK") );
401 template<class TPrs3d_i, class TDlg, int IsDlgModal>
403 CreatePrs3d(SalomeApp_Module* theModule,
404 _PTR(SObject) theTimeStamp,
405 const Handle(SALOME_InteractiveObject)& theIO)
407 using namespace VISU;
408 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
410 QString aType = Storable::FindValue(aMap,"myType",&isExist);
411 if(!isExist || aType.toInt() != TTIMESTAMP )
413 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
414 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
415 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
416 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
417 QApplication::setOverrideCursor(Qt::waitCursor);
419 CreatePrs3d<TPrs3d_i>(theModule,
422 (Entity)anEntity.toInt(),
424 aTimeStampId.toInt());
425 QApplication::restoreOverrideCursor();
427 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
428 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
430 if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode
431 aDlg->initFromPrsObject(aPrs3d);
433 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
434 // Optionally, create table and curves for cut lines
435 QApplication::setOverrideCursor(Qt::waitCursor);
436 CreateCurves( theModule, dynamic_cast<VISU::CutLines_i*>( aPrs3d ), aDlg, true ); // in creation mode
437 QApplication::restoreOverrideCursor();
440 DeletePrs3d(theModule,aPrs3d,theIO);
450 PublishInView(theModule,aPrs3d);
457 template<class TPrs3d_i, class TDlg, int IsDlgModal>
459 CreatePrs3d(SalomeApp_Module* theModule)
461 if (CheckLock(GetCStudy(GetAppStudy(theModule))))
464 _PTR(SObject) aTimeStampSObj;
465 Handle(SALOME_InteractiveObject) anIO;
466 if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
469 if (!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
472 theModule->application()->putInfo(QObject::tr("INF_DONE"));
473 theModule->updateObjBrowser();
475 if (SVTK_ViewWindow* aView = GetViewWindow(theModule))
483 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
484 if (CheckLock(aStudy))
487 // Get selected SObject
488 Handle(SALOME_InteractiveObject) anIO;
489 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
490 if (anIO.IsNull() || !anIO->hasEntry())
493 CreateMesh(this, anIO);
500 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
501 if (CheckLock(aStudy))
504 // Get selected SObject
505 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
506 SALOME_ListIO aListIO;
507 aSelectionMgr->selectedObjects(aListIO);
508 SALOME_ListIteratorOfListIO anIter (aListIO);
509 for (; anIter.More(); anIter.Next()) {
510 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
511 if (anIO.IsNull() || !anIO->hasEntry())
514 CreateMesh(this, anIO);
522 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
528 OnCreateDeformedShape()
530 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
537 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
542 OnCreateIsoSurfaces()
544 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
551 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
558 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
563 OnCreateStreamLines()
565 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
572 CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,1>(this);
579 CheckLock(GetCStudy(GetAppStudy(this)));
580 GetVisuGen( this )->CreateContainer();
588 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
590 QApplication::setOverrideCursor(Qt::waitCursor);
592 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
593 mgr->selectedObjects(aList);
595 Handle(SALOME_InteractiveObject) anIO;
596 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
598 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
599 if ( !CORBA::is_nil( anObject ) ) {
600 // is it Prs3d object ?
601 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
603 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
604 UpdateViewer( this, aPrsObject );
605 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
606 vw->highlight(anIO, 1);
611 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
613 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
614 PlotCurve( this, aCurve, VISU::eDisplay );
618 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
620 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
621 PlotContainer( this, aContainer, VISU::eDisplay );
625 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
627 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
628 PlotTable( this, aTable, VISU::eDisplay );
633 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
634 vw->getRenderer()->ResetCameraClippingRange();
637 QApplication::restoreOverrideCursor();
652 if(MYDEBUG) MESSAGE("OnErasePrs");
654 QApplication::setOverrideCursor(Qt::waitCursor);
656 SVTK_ViewWindow* vw = GetViewWindow(this);
657 if (vw) vw->unHighlightAll();
660 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
661 mgr->selectedObjects(aList);
663 Handle(SALOME_InteractiveObject) anIO;
664 for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
666 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
667 ErasePrs(this, anObject, false);
670 if (vw) vw->Repaint();
672 QApplication::restoreOverrideCursor();
675 template<class TPrs3d_i, class TDlg>
677 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
679 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
681 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
682 TDlg* aDlg = new TDlg (theModule);
683 aDlg->initFromPrsObject(aPrsObject);
685 if (!(aDlg->storeToPrsObject(aPrsObject))) {
689 RecreateActor(theModule, aPrsObject);
690 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
691 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
692 vw->getRenderer()->ResetCameraClippingRange();
705 if (CheckLock(GetCStudy(GetAppStudy(this))))
708 Handle(SALOME_InteractiveObject) anIO;
709 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
710 if (CORBA::is_nil(anObject)) return;
711 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
712 if (!aServant.in()) return;
714 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
717 switch (aPrs3d->GetType()) {
720 case VISU::TSCALARMAP:
721 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
723 case VISU::TDEFORMEDSHAPE:
724 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
726 case VISU::TCUTPLANES:
727 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
729 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
731 VisuGUI_CutPlanesDlg* aDlg =
732 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
733 aDlg->initFromPrsObject(aPrsObject);
738 case VISU::TCUTLINES:
739 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
741 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
743 VisuGUI_CutLinesDlg* aDlg =
744 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
745 aDlg->initFromPrsObject(aPrsObject);
750 case VISU::TISOSURFACE:
751 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
754 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
756 case VISU::TSTREAMLINES:
757 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
760 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg>(this, aPrs3d);
762 VISU::Plot3D_i* aPrsObject = dynamic_cast<VISU::Plot3D_i*>(aPrs3d);
764 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg();
765 aDlg->initFromPrsObject(aPrsObject);
767 myActiveDialogBox = aDlg;
775 if (SVTK_ViewWindow* vw = GetViewWindow())
776 vw->highlight(anIO, 1);
783 if (SVTK_ViewWindow* vw = GetViewWindow()) {
784 vw->unHighlightAll();
785 if (vtkRenderer *aRen = vw->getRenderer()) {
787 vtkActorCollection *anActColl = aRen->GetActors();
788 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
789 if (anActor->GetVisibility() > 0)
790 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
791 anVISUActor = anVISUActor->GetParent();
792 anVISUActor->VisibilityOff();
797 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
806 ChangeRepresentation(this, VISU::SURFACEFRAME);
813 ChangeRepresentation(this, VISU::INSIDEFRAME);
820 ChangeRepresentation(this, VISU::WIREFRAME);
827 ChangeRepresentation(this, VISU::SHADED);
834 ChangeRepresentation(this, VISU::POINT);
841 ChangeRepresentation(this, VISU::SHRINK);
848 Handle(SALOME_InteractiveObject) anIO;
849 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
850 if (CORBA::is_nil(anObject)) return;
851 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
852 if (!aServant.in()) return;
854 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
857 SVTK_ViewWindow* vw = GetViewWindow();
860 VISU_Actor* anActor = GetActor(aPrs3d, vw);
861 if (!anActor) return;
863 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
864 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
865 SALOMEDS::Color anOldColor, aNewColor;
866 int aRepresent = anActor->GetRepresentation();
868 switch (aRepresent) {
870 anOldColor = aMesh->GetNodeColor();
872 case VISU::WIREFRAME :
873 case VISU::INSIDEFRAME :
874 anOldColor = aMesh->GetLinkColor();
877 case VISU::SURFACEFRAME :
878 anOldColor = aMesh->GetCellColor();
881 } else if (aDeformedShape) {
882 anOldColor = aDeformedShape->GetColor();
887 QColor aColor (int(255*anOldColor.R),
888 int(255*anOldColor.G),
889 int(255*anOldColor.B));
890 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
891 if (aColorNew.isValid()) {
892 aNewColor.R = aColorNew.red()/255.;
893 aNewColor.G = aColorNew.green()/255.;
894 aNewColor.B = aColorNew.blue()/255.;
896 switch (aRepresent) {
898 aMesh->SetNodeColor(aNewColor);
900 case VISU::WIREFRAME :
901 case VISU::INSIDEFRAME :
902 aMesh->SetLinkColor(aNewColor);
905 case VISU::SURFACEFRAME :
906 aMesh->SetCellColor(aNewColor);
910 aDeformedShape->SetColor(aNewColor);
912 RecreateActor(this, aPrs3d);
918 OnChangeWireframeColor()
920 Handle(SALOME_InteractiveObject) anIO;
921 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
922 if (CORBA::is_nil(anObject)) return;
923 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
924 if (!aServant.in()) return;
926 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
929 SVTK_ViewWindow* vw = GetViewWindow();
932 VISU_Actor* anActor = GetActor(aPrs3d, vw);
933 if (!anActor) return;
935 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
936 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
937 QColor aColor (int(255*anOldColor.R),
938 int(255*anOldColor.G),
939 int(255*anOldColor.B));
940 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
941 if (aColorNew.isValid()) {
942 aNewColor.R = aColorNew.red()/255.;
943 aNewColor.G = aColorNew.green()/255.;
944 aNewColor.B = aColorNew.blue()/255.;
945 aMesh->SetLinkColor(aNewColor);
946 RecreateActor(this, aMesh);
955 Handle(SALOME_InteractiveObject) anIO;
956 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
957 if (CORBA::is_nil(anObject)) return;
958 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
959 if (!aServant.in()) return;
961 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
962 if (!aPrsObject) return;
964 SVTK_ViewWindow* vw = GetViewWindow();
967 VISU_Actor* anActor = GetActor(aPrsObject, vw);
968 if (!anActor) return;
970 VisuGUI_CursorDlg* CursorDlg =
971 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_OPACITY_TITLE"), TRUE);
973 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
974 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
975 CursorDlg->SpinBox1->setMinValue(0);
976 CursorDlg->SpinBox1->setMaxValue(100);
978 float oldopac = anActor->GetOpacity();
979 int intopac = int(oldopac*100. + 0.5);
980 CursorDlg->SpinBox1->setValue(intopac);
982 int ret = CursorDlg->exec();
984 intopac = CursorDlg->SpinBox1->value();
985 float newopac = intopac/100.;
986 anActor->SetOpacity(newopac);
995 Handle(SALOME_InteractiveObject) anIO;
996 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
997 if (CORBA::is_nil(anObject)) return;
998 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
999 if (!aServant.in()) return;
1001 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1002 if (!aPrsObject) return;
1004 SVTK_ViewWindow* vw = GetViewWindow();
1007 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1008 if (!anActor) return;
1010 VisuGUI_CursorDlg* CursorDlg =
1011 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1013 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1014 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1015 CursorDlg->SpinBox1->setMinValue(1);
1016 CursorDlg->SpinBox1->setMaxValue(10);
1018 float oldlwid = anActor->GetLineWidth();
1019 int intlwid = int(oldlwid);
1020 CursorDlg->SpinBox1->setValue(intlwid);
1022 int ret = CursorDlg->exec();
1024 intlwid = CursorDlg->SpinBox1->value();
1025 float newlwid = intlwid;
1026 anActor->SetLineWidth(newlwid);
1035 Handle(SALOME_InteractiveObject) anIO;
1036 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1038 if ( !CORBA::is_nil( anObject ) ) {
1039 VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject );
1040 if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
1041 CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
1042 if( !CORBA::is_nil( aTable ) ) {
1043 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
1045 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
1050 // possibly this is Table SObject
1051 SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
1054 if( !IsSObjectTable( SO ) )
1057 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1060 //SAL2670 Orientation of show tables
1061 VisuGUI_TableDlg::ttAuto,
1070 Handle(SALOME_InteractiveObject) anIO;
1071 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1072 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1073 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1074 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1075 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1076 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1085 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1086 if (CheckLock(aCStudy))
1089 SALOME_ListIO aList;
1090 SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
1091 mgr->selectedObjects(aList);
1092 int i = 0, nbSelected = aList.Extent();
1093 if (nbSelected < 1) return;
1095 const char* entries [nbSelected];
1096 Handle(SALOME_InteractiveObject) anIO;
1097 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1099 if (anIO->hasEntry())
1100 entries[i++] = anIO->getEntry();
1103 if (nbSelected < 1) return;
1105 // There is a transaction
1106 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1107 aStudyBuilder->NewCommand();
1109 for (i = 0; i < nbSelected; i++) {
1110 _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
1112 DeleteSObject(this, aCStudy, aSObject);
1116 // Finish transaction
1117 aStudyBuilder->CommitCommand();
1119 //GetActiveStudy()->unHighlightAll();
1120 updateObjBrowser(true);
1127 Handle(SALOME_InteractiveObject) anIO;
1128 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1130 _PTR(GenericAttribute) anAttr;
1131 _PTR(AttributeName) aName;
1133 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1135 if ( !CORBA::is_nil( anObject ) ) {
1136 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1137 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1138 // Table (VISU object) is selected
1139 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1140 if( !CORBA::is_nil( aTbl ) ) {
1141 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1143 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1144 if ( IsSObjectTable(SO) ) {
1145 // get name of SObject
1146 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1148 SOName = QString( aName->Value().c_str() );
1150 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1151 if ( dlg->exec() == QDialog::Accepted ) {
1152 if ( !IsStudyLocked( aStudy ) ) {
1153 // if study is not locked - create new container, create curves and insert them
1154 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1156 QValueList<int> verIndices;
1157 dlg->getCurvesSource( horIndex, verIndices );
1158 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1159 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1160 if( !CORBA::is_nil( aContainer ) ) {
1161 VISU::Container_i* pContainer =
1162 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1164 for ( int i = 0; i < verIndices.count(); i++ ) {
1165 CORBA::Object_var aNewCurve =
1166 GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1167 if( !CORBA::is_nil( aNewCurve ) ) {
1168 VISU::Curve_i* pCrv =
1169 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1172 int marker, line, lineWidth;
1174 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1175 line, lineWidth, color) && !isAuto ) {
1177 c.R = color.red() /255.;
1178 c.G = color.green()/255.;
1179 c.B = color.blue() /255.;
1180 pCrv->SetColor( c );
1181 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1182 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1184 pContainer->AddCurve( pCrv->_this() );
1189 PlotContainer( this, pContainer, VISU::eDisplay );
1195 // if study is locked just get curves info and plot them
1196 // if current viewer is of VIEW_PLOT2D type
1197 QPtrList<Plot2d_Curve> container;
1198 dlg->getCurves( container );
1199 if ( !container.isEmpty() ) {
1200 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1201 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1211 else if ( !anIO.IsNull() ) {
1212 // check if Table SObject is selected
1213 SO = aStudy->FindObjectID( anIO->getEntry() );
1214 if ( IsSObjectTable(SO) ) {
1215 // get name of SObject
1216 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1218 SOName = QString( aName->Value().c_str() );
1220 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1221 if ( dlg->exec() == QDialog::Accepted ) {
1222 if ( !IsStudyLocked( aStudy ) ) {
1223 // if study is not locked - create new table and container objects, create curves
1224 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1226 QValueList<int> verIndices;
1227 dlg->getCurvesSource( horIndex, verIndices );
1228 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1229 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1230 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1231 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1232 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1233 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1235 if ( pContainer && pTable ) {
1236 for ( int i = 0; i < verIndices.count(); i++ ) {
1237 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
1238 ( pTable->_this(), horIndex+1, verIndices[i]+1 );
1239 if( !CORBA::is_nil( aNewCurve ) ) {
1240 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1243 int marker, line, lineWidth;
1245 if ( dlg->getCurveAttributes(verIndices[i], isAuto, marker,
1246 line, lineWidth, color) && !isAuto ) {
1248 c.R = color.red()/255.;
1249 c.G = color.green()/255.;
1250 c.B = color.blue()/255.;
1251 pCrv->SetColor( c );
1252 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1253 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1255 pContainer->AddCurve( pCrv->_this() );
1260 PlotContainer( this, pContainer, VISU::eDisplay );
1265 // if study is locked just get curves info and plot them
1266 QPtrList<Plot2d_Curve> container;
1267 dlg->getCurves( container );
1268 if ( !container.isEmpty() ) {
1269 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1270 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1283 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1284 SALOME_ListIO aListIO;
1285 aSelectionMgr->selectedObjects(aListIO);
1286 if (aListIO.Extent() != 1) return;
1288 SalomeApp_Study* aAppStudy = GetAppStudy(this);
1289 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1290 CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
1291 if (CORBA::is_nil( anObject )) return;
1293 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1294 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
1296 CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
1297 if( !CORBA::is_nil( aCurve ) ) {
1298 VISU::Curve_i* aDSCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1299 if ( aDSCurve && (!IsStudyLocked( GetCStudy(aAppStudy) )) ) {
1300 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1302 aDlg.setLine( (int)aDSCurve->GetLine(), aDSCurve->GetLineWidth() );
1303 aDlg.setMarker( (int)aDSCurve->GetMarker() );
1304 SALOMEDS::Color aColor = aDSCurve->GetColor();
1305 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1306 if( aDlg.exec() == QDialog::Accepted ) {
1307 aDSCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1308 aDSCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1309 SALOMEDS::Color newColor;
1310 newColor.R = aDlg.getColor().red()/255.;
1311 newColor.G = aDlg.getColor().green()/255.;
1312 newColor.B = aDlg.getColor().blue()/255.;
1313 aDSCurve->SetColor( newColor );
1314 PlotCurve(this, aDSCurve, VISU::eDisplay);
1325 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1326 if (CheckLock(aCStudy))
1328 Handle(SALOME_InteractiveObject) anIO;
1329 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1330 if (anIO.IsNull() || CORBA::is_nil(anObject))
1333 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1334 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1336 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1337 if (!CORBA::is_nil(aCnt)) {
1338 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1339 if (container && container->GetNbCurves() > 0) {
1351 Handle(SALOME_InteractiveObject) anIO;
1352 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1353 if (CORBA::is_nil(anObject)) return;
1355 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1356 if (!aServant.in()) return;
1357 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1358 if (!aContainer) return;
1360 //VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1361 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1362 aDlg->initFromPrsObject(aContainer);
1364 aDlg->storeToPrsObject(aContainer);
1365 updateObjBrowser(true);
1374 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1375 if (CheckLock(aCStudy))
1378 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1379 if (aViewMgr->getType() != SVTK_Viewer::Type())
1382 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1383 SALOME_ListIO aListIO;
1384 aSelectionMgr->selectedObjects(aListIO);
1385 if (aListIO.Extent() > 1)
1388 if (aListIO.Extent() == 0) {
1389 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1391 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1392 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1399 OnRestoreViewParams()
1401 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1402 if (aViewMgr->getType() != SVTK_Viewer::Type())
1405 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1406 SALOME_ListIO aListIO;
1407 aSelectionMgr->selectedObjects(aListIO);
1408 if (aListIO.Extent() != 1)
1411 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1412 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1413 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1414 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1415 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1422 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1423 if (CheckLock(aCStudy))
1426 Handle(SALOME_InteractiveObject) anIO;
1427 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1429 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1432 //TEST DU PARENT == VISU
1433 _PTR(GenericAttribute) anAttr;
1434 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1435 _PTR(AttributeName) aName (anAttr);
1436 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1437 if (!Name.isEmpty()) {
1438 QApplication::setOverrideCursor(Qt::waitCursor);
1440 // rename specific objects
1441 if (!CORBA::is_nil(anObject)) {
1442 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1443 if (!CORBA::is_nil(aVisuObj)) {
1444 switch (aVisuObj->GetType()) {
1445 case VISU::TCURVE: // Curve object
1447 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1448 if (!CORBA::is_nil(aCurve)) {
1449 VISU::Curve_i* curve =
1450 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1452 curve->SetName(Name.latin1());
1456 case VISU::TTABLE: // Table object
1458 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1459 if (!CORBA::is_nil(aTable)) {
1460 VISU::Table_i* table =
1461 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1463 table->SetName(Name.latin1());
1467 case VISU::TCONTAINER: // Container object
1469 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1470 if (!CORBA::is_nil(aContainer)) {
1471 VISU::Container_i* container =
1472 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1474 container->SetName(Name.latin1());
1485 // rename the study object
1486 //getApp()->activeStudy()->renameIObject(anIO, Name);
1487 aName->SetValue(Name.latin1()); // rename the SObject
1488 anIO->setName(Name.latin1()); // rename the InteractiveObject
1489 updateObjBrowser(false);
1491 QApplication::restoreOverrideCursor();
1500 new VisuGUI_ClippingDlg (this, "", false);
1508 Handle(SALOME_InteractiveObject) anIO;
1509 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1510 if (CORBA::is_nil(anObject)) return;
1511 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1512 if (!aServant.in()) return;
1514 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1515 if (!aPrsObject) return;
1517 SVTK_ViewWindow* vw = GetViewWindow();
1520 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1521 if (!aActor) return;
1523 if (!aActor->GetVisibility()) {
1524 aActor->VisibilityOn();
1527 // Get sweep parameters
1528 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1530 double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1);
1531 int aTemp = int(1.E6 * aTempoDbl);
1533 int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1);
1534 int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40);
1537 QApplication::setOverrideCursor(Qt::waitCursor);
1539 for (int j = 0; j < aCycles; j++) {
1540 for (int i = 0; i <= aSteps; i++) {
1541 float aPercents = float(i)/aSteps;
1542 aPrsObject->SetMapScale(aPercents);
1543 aPrsObject->UpdateActor(aActor);
1544 vw->getRenderWindow()->getRenderWindow()->Render();
1548 } catch (std::exception& exc) {
1549 INFOS("Follow exception was occured :\n" << exc.what());
1551 INFOS("Unknown exception was occured!");
1553 QApplication::restoreOverrideCursor();
1560 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1561 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1562 // new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
1563 new VisuGUI_TimeAnimationDlg (this, aCStudy);
1565 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1566 SALOME_ListIO aListIO;
1567 aSelectionMgr->selectedObjects(aListIO);
1569 bool isDefined = false;
1571 SALOME_ListIteratorOfListIO It (aListIO);
1572 for (; It.More(); It.Next()) {
1573 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1574 if (!aSObject) continue;
1575 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1576 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1580 aAnimationDlg->addField(aSObject);
1582 } else if (aNbTimes == aNumber) {
1583 aAnimationDlg->addField(aSObject);
1588 if (isDefined) aAnimationDlg->show();
1589 else delete aAnimationDlg;
1592 //************************************************************************
1597 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1598 SALOME_ListIO aListIO;
1599 aSelectionMgr->selectedObjects(aListIO);
1601 if (aListIO.Extent() != 1)
1604 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1606 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1608 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1611 VISU::Storable::TRestoringMap aMap;
1612 _PTR(GenericAttribute) anAttr;
1613 if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
1615 _PTR(AttributeComment) aComment (anAttr);
1616 string aComm = aComment->Value();
1617 QString strIn (aComm.c_str());
1618 VISU::Storable::StrToMap(strIn, aMap);
1620 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
1621 if (aType != VISU::TANIMATION) return;
1623 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1624 new VisuGUI_TimeAnimationDlg(this, aCStudy);
1625 aAnimationDlg->restoreFromStudy(aSObj);
1626 aAnimationDlg->show();
1631 OnCopyPresentation()
1633 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1634 if (CheckLock(aCStudy))
1637 Handle(SALOME_InteractiveObject) anIO;
1638 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1639 if (CORBA::is_nil(anObject)) return;
1640 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1641 if (!aServant.in()) return;
1643 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1644 if (!aPrsObject) return;
1646 switch (aPrsObject->GetType()) {
1649 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1650 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1651 aSameMesh->SameAs(aMeshPrs);
1652 UpdateViewer(this, aSameMesh);
1655 case VISU::TSCALARMAP:
1657 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1658 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1659 aSameScalar->SameAs(aScalarPrs);
1660 UpdateViewer(this, aSameScalar);
1663 case VISU::TDEFORMEDSHAPE:
1665 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1666 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1667 aSameDeformed->SameAs(aDefPrs);
1668 UpdateViewer(this, aSameDeformed);
1671 case VISU::TCUTPLANES:
1673 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1674 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1675 aSameCut->SameAs(aCutPrs);
1676 UpdateViewer(this, aSameCut);
1679 case VISU::TCUTLINES:
1681 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1682 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1683 aSameCut->SameAs(aCutPrs);
1684 UpdateViewer(this, aSameCut);
1687 case VISU::TISOSURFACE:
1689 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1690 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1691 aSameIso->SameAs(aIsoPrs);
1692 UpdateViewer(this, aSameIso);
1695 case VISU::TSTREAMLINES:
1697 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1698 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1699 aSameLines->SameAs(aLinesPrs);
1700 UpdateViewer(this, aSameLines);
1703 case VISU::TVECTORS:
1705 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1706 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1707 aSameVectors->SameAs(aVectorsPrs);
1708 UpdateViewer(this, aSameVectors);
1713 VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
1714 VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
1715 aSamePlot3D->SameAs(aPlot3DPrs);
1716 UpdateViewer(this, aSamePlot3D);
1727 if (GetViewWindow())
1728 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1730 SUIT_MessageBox::warn1(GetDesktop(this),
1732 tr("ERR_ACTIVATE_VIEW3D"),
1740 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1741 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1742 false, Qt::WDestructiveClose);
1743 m_NonIsoDlg->show();
1750 //Show dialog that allows to select scale function and corresponding scale factor
1751 VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this));
1759 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1760 SALOME_ListIO aListIO;
1761 aSelectionMgr->selectedObjects(aListIO);
1763 SALOME_ListIteratorOfListIO It (aListIO);
1765 // first find the bounds
1766 double aMin, aMax; bool first = true;
1767 for (; It.More(); It.Next()) {
1768 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1769 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1770 if (!aPrsList.empty()) {
1771 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1772 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1774 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1778 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
1780 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
1781 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
1789 // set the computed range to every selected ScalarMap
1790 bool update = false;
1791 for (It.Initialize(aListIO); It.More(); It.Next() ) {
1792 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1793 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1794 if (!aPrsList.empty()) {
1795 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1796 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1798 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1800 aScalar->SetRange(aMin, aMax);
1801 RecreateActor(this, aScalar);
1809 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1810 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1811 vw->getRenderer()->ResetCameraClippingRange();
1822 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1823 SALOME_ListIO aListIO;
1824 aSelectionMgr->selectedObjects(aListIO);
1826 SALOME_ListIteratorOfListIO It (aListIO);
1828 // restore the source range for every ScalarMap
1829 bool update = false;
1830 for (; It.More(); It.Next()) {
1831 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1832 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1833 if (!aPrsList.empty()) {
1834 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1835 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1837 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1839 aScalar->SetSourceRange();
1840 RecreateActor(this, aScalar);
1848 if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
1849 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
1850 vw->getRenderer()->ResetCameraClippingRange();
1861 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
1862 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
1864 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1866 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1867 SALOME_ListIO aListIO;
1868 aSelectionMgr->selectedObjects(aListIO);
1870 SALOME_ListIteratorOfListIO It (aListIO);
1871 for (; It.More(); It.Next()) {
1872 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1873 if (anIO->hasEntry()) {
1874 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1876 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
1877 if (!CORBA::is_nil(aCORBAObject)) {
1878 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1879 if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())) {
1880 aDlg->addPresentation(aPrsObject);
1886 if (aDlg->getPrsCount() > 0)
1896 SVTK_ViewWindow* vw = GetViewWindow();
1898 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
1907 initialize( CAM_Application* theApp )
1909 SalomeApp_Module::initialize( theApp );
1922 QWidget* aParent = application()->desktop();
1923 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1926 createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1927 this, SLOT(OnImportFromFile()));
1928 createAction( VISU_EXPLORE_MED, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1929 this, SLOT(OnExploreMEDFile()));
1930 createAction( VISU_IMPORT_TABLE, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1931 this, SLOT(OnImportTableFromFile()));
1933 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1934 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1935 this, SLOT(OnCreateScalarMap()));
1937 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1938 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1939 this, SLOT(OnCreateDeformedShape()));
1941 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1942 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1943 this, SLOT(OnCreateVectors()));
1945 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1946 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1947 this, SLOT(OnCreateIsoSurfaces()));
1949 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1950 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1951 this, SLOT(OnCreateCutPlanes()));
1953 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1954 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1955 this, SLOT(OnCreateStreamLines()));
1957 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1958 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1959 this, SLOT(OnCreateCutLines()));
1961 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
1962 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIconSet(aPixmap),
1963 tr("MEN_PLOT_3D"), "", 0, aParent, false,
1964 this, SLOT(OnCreatePlot3D()));
1966 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
1967 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
1968 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1969 this, SLOT(OnCreatePlot2dView()));
1971 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
1972 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
1973 this, SLOT(OnDeleteObjects()));
1975 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1976 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1977 //this, SLOT(OnRenameTable()));
1979 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1980 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIconSet(), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1981 this, SLOT(OnShowTable()));
1983 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1984 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIconSet(), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1985 this, SLOT(OnPlotData()));
1987 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1988 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1989 this, SLOT(OnExportTableToFile()));
1991 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
1992 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
1993 this, SLOT(OnImportMedField()));
1995 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
1996 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
1997 this, SLOT(OnImportMedField()));
1999 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
2000 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2001 this, SLOT(OnImportMedField()));
2003 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2004 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2005 this, SLOT(OnCreateMesh()));
2007 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2008 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIconSet(),
2009 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2010 this, SLOT(OnCreateManyMesh()));
2012 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIconSet(),
2013 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2014 this, SLOT(OnTranslatePrs()));
2016 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIconSet(),
2017 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2018 this, SLOT(OnMergeScalarBars()));
2020 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIconSet(),
2021 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2022 this, SLOT(OnFreeScalarBars()));
2024 //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE"));
2025 createAction( VISU_ERASE, tr("MEN_ERASE"), QIconSet(), tr("MEN_ERASE"), "", 0, aParent, false,
2026 this, SLOT(OnErasePrs()));
2028 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2029 createAction( VISU_DISPLAY, tr("MEN_DISPLAY"), QIconSet(), tr("MEN_DISPLAY"), "", 0, aParent, false,
2030 this, SLOT(OnDisplayPrs()));
2032 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2033 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2034 this, SLOT(OnDisplayOnlyPrs()));
2036 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2037 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false,
2038 this, SLOT(OnCopyPresentation()));
2040 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2041 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIconSet(), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2042 this, SLOT(OnCurveProperties()));
2044 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2045 createAction( VISU_RENAME, tr("MEN_RENAME"), QIconSet(), tr("MEN_RENAME"), "", 0, aParent, false,
2046 this, SLOT(OnRename()));
2048 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2049 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIconSet(), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2050 this, SLOT(OnEditContainer()));
2052 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2053 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
2054 //this, SLOT(OnRenameContainer()));
2056 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2057 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2058 this, SLOT(OnClearContainer()));
2060 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2061 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2062 this, SLOT(OnSaveViewParams()));
2063 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
2064 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2065 this, SLOT(OnSaveViewParams()));
2067 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2068 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
2069 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2070 this, SLOT(OnRestoreViewParams()));
2072 createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
2073 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2074 //this, SLOT(OnDeleteViewParams()));
2075 this, SLOT(OnDeleteObjects()));
2077 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
2078 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2079 this, SLOT(OnArrangeActors()));
2081 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2082 createAction( VISU_POINTS, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
2083 this, SLOT(OnMakePoints()));
2085 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2086 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
2087 this, SLOT(OnMakeWireframe()));
2089 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2090 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
2091 this, SLOT(OnMakeSurface()));
2093 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2094 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIconSet(), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2095 this, SLOT(OnMakeInsideframe()));
2097 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2098 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIconSet(), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2099 this, SLOT(OnMakeSurfaceframe()));
2101 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2102 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIconSet(), tr("MEN_SHRINK"), "", 0, aParent, false,
2103 this, SLOT(OnMakeShrink()));
2105 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2106 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(), tr("MEN_UNSHRINK"), "", 0, aParent, false,
2107 this, SLOT(OnMakeShrink()));
2109 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2110 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2111 this, SLOT(OnChangeColor()));
2113 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2114 createAction( VISU_COLOR, tr("MEN_COLOR"), QIconSet(), tr("MEN_COLOR"), "", 0, aParent, false,
2115 this, SLOT(OnChangeColor()));
2117 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2118 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIconSet(), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2119 this, SLOT(OnChangeWireframeColor()));
2121 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2122 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIconSet(), tr("MEN_OPACITY"), "", 0, aParent, false,
2123 this, SLOT(OnChangeOpacity()));
2125 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2126 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIconSet(), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2127 this, SLOT(OnChangeLines()));
2129 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2130 createAction( VISU_EDIT_PRS, tr("MEN_EDIT_PRS"), QIconSet(), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2131 this, SLOT(OnEditPrs()));
2133 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2134 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIconSet(), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2135 this, SLOT(OnCreateTable()));
2137 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP"));
2138 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
2139 this, SLOT(OnSweep()));
2141 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIconSet(),
2142 tr("MEN_CLIPPING"), "", 0, aParent, false,
2143 this, SLOT(OnClippingPlanes()));
2145 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
2146 createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIconSet(),
2147 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
2148 this, SLOT(OnSelectionInfo()));
2150 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2151 createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
2152 this, SLOT(OnTimeAnimation()));
2154 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2155 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
2156 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2157 this, SLOT(OnEraseAll()));
2159 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
2160 createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
2161 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
2162 //this, SLOT(OnEraseAll()));
2165 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
2166 createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
2167 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
2168 //this, SLOT(OnEraseAll()));
2171 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
2172 createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
2173 tr("MEN_SCALING"), "", 0, aParent, false,
2174 this, SLOT(OnScaling()));
2176 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
2177 createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap),
2178 tr("MEN_CUBE_AXES"), "", 0, aParent, false,
2179 this, SLOT(OnCubeAxes()));
2181 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
2182 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2183 this, SLOT(OnShowAnimation()));
2190 // Add actions to menus
2192 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2193 createMenu( separator(), aMenuId, -1, 10 );
2194 createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
2195 createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
2196 createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
2198 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2199 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2200 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2201 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2202 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2203 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2204 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2205 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2206 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2208 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
2209 createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info
2211 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2213 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2214 createMenu( VISU_POINTS, parentId, 10 ); // points
2215 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2216 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2217 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2218 createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
2219 createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
2220 createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
2221 createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling
2228 int aToolId = createTool(tr("TOOL_VISUALISATION"));
2229 createTool( VISU_SCALAR_MAP, aToolId );
2230 createTool( VISU_DEFORMED_SHAPE, aToolId );
2231 createTool( VISU_VECTORS, aToolId );
2232 createTool( VISU_ISO_SURFACES, aToolId );
2233 createTool( VISU_CUT_PLANES, aToolId );
2234 createTool( VISU_CUT_LINES, aToolId );
2235 createTool( VISU_STREAM_LINES, aToolId );
2236 createTool( VISU_PLOT_3D, aToolId );
2238 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2239 createTool( VISU_POINTS, aToolId );
2240 createTool( VISU_WIREFRAME, aToolId );
2241 createTool( VISU_SURFACE, aToolId );
2242 createTool( VISU_ERASE_ALL, aToolId );
2243 createTool( VISU_GLOBAL_SELECTION, aToolId );
2244 createTool( VISU_PARTIAL_SELECTION, aToolId );
2245 createTool( VISU_SCALING, aToolId );
2246 createTool( VISU_CUBE_AXES, aToolId );
2253 // Prepare popup menus
2254 QtxPopupMgr* mgr = popupMgr();
2256 // VISU root commands
2257 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2258 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2259 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2261 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2264 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2265 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2266 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2267 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2268 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2269 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2270 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2271 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2273 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2274 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2276 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2279 mgr->insert( action( VISU_EDIT_PRS ), -1, -1, -1 );
2280 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2283 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2286 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2289 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2292 //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2293 //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2294 //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2296 mgr->insert( separator(), -1, -1, -1 );
2298 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2299 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2300 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2302 // "Representation" submenu
2303 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2304 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2305 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2306 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2307 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2308 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2309 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2310 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2312 // "Properties" submenu
2313 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2314 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2315 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2316 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2317 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2318 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2320 mgr->insert( separator(), -1, -1, -1 );
2322 // Other presentations management
2323 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2324 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2326 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2327 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2329 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2330 mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
2332 mgr->insert( separator(), -1, -1, -1 );
2334 // view parameters commands
2335 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2336 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2337 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2338 mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2340 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2342 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2344 mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info
2348 QString aSel_One_ObjBr ("client='ObjectBrowser' and selcount=1");
2349 QString aSel_Some_ObjBr ("client='ObjectBrowser' and selcount>0");
2350 QString aSel_Many_ObjBr ("client='ObjectBrowser' and selcount>1");
2352 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2353 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
2355 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
2357 // VISU root commands
2358 QString aRule = aSel_One_ObjBr + " and type='VISU::TVISUGEN'";
2359 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
2360 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
2361 mgr->setRule( action( VISU_PLOT2D ), aRule, true );
2363 // timestamp commands
2364 aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'";
2365 mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
2366 mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
2367 mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
2368 mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
2369 mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
2370 aRule += " and nbComponents>1";
2371 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
2372 mgr->setRule( action( VISU_VECTORS ), aRule, true );
2373 mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
2376 //aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'";
2377 //mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
2378 //mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
2379 //mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
2381 aRule = "(" + aSel_Some_ObjBr + " and ((type='VISU::TTABLE' and nbChildren>0) or"
2382 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))"
2383 ") or (selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "})";
2385 mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true );
2386 mgr->setRule( action( VISU_DISPLAY ), aRule + "and (isVisible=false)", true );// TODO: aRule.arg(" and isVisible=0"), true );
2387 mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true );
2389 aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2390 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
2392 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2393 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
2394 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
2397 aRule = "selcount=1 and type='VISU::TVIEW3D'";
2398 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
2399 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true );
2400 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2401 mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2403 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "client='VTKViewer' and selcount=0", true );
2405 // 3D presentations commands
2406 QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
2407 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2408 QString aSurfType = " and $type in {'VISU::TMESH'}";
2409 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' "
2410 "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D'}";
2411 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2412 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'}";
2414 aRule = "selcount=1";
2415 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true );
2417 // "Representation" submenu
2418 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2419 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2420 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
2421 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}";
2422 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}";
2424 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true );
2425 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true );
2426 mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true );
2427 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true );
2428 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true );
2430 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true );
2431 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
2433 // "Properties" submenu
2434 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2435 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2436 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
2437 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2438 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2439 mgr->setRule( action( VISU_OPACITY ), aRule + aShrinkType + " and hasActor=1", true );
2440 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
2443 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' " + aCurveAll + " " + aPrsAll + "})";
2444 mgr->setRule( action( VISU_RENAME ), aRule, true );
2446 // copy presentation command
2447 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2448 mgr->setRule( action( VISU_COPY_PRS ), aRule, true );
2451 aRule = "selcount=1 and type='VISU::TCURVE'";
2452 mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
2454 // curve container commands
2455 aRule = aSel_One_ObjBr + " and type='VISU::TCONTAINER'";
2456 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
2457 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
2459 aRule = "selcount=1 and $type in {" + aPrsAll + "}";
2460 mgr->setRule( action( VISU_EDIT_PRS ), aRule, true );
2462 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2463 mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true );
2465 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
2466 mgr->setRule( action( VISU_SWEEP ), aRule, true );
2468 // Selection info popup item
2469 aRule = "client='VTKViewer' and selcount=1" + aInsideType;
2470 mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
2472 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2473 mgr->setRule( action( VISU_ANIMATION ), aRule, true );
2475 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2476 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
2477 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
2479 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
2480 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
2483 //***************************************************************************
2484 void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
2486 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
2488 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2489 SALOME_ListIO aListIO;
2490 aSelectionMgr->selectedObjects(aListIO);
2492 if (aListIO.Extent() < 1) return;
2494 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2496 // Check if "Merge Scalar Range" can be applied
2498 SALOME_ListIteratorOfListIO It (aListIO);
2499 for (; It.More(); It.Next()) {
2500 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2501 /*std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2502 nbPrs += aPrsList.size();*/
2504 if (!anIO.IsNull() && anIO->hasEntry()) {
2505 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
2506 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
2507 if (CORBA::is_nil(aCORBAObject)) {
2508 _PTR(GenericAttribute) anAttr;
2509 if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
2510 _PTR(AttributeComment) aComment (anAttr);
2511 string aComm = aComment->Value();
2512 QString strIn (aComm.c_str());
2513 VISU::Storable::TRestoringMap pMap;
2514 VISU::Storable::StrToMap(strIn, pMap);
2516 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
2517 if (isExist && aType == VISU::TTIMESTAMP) {
2518 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
2520 for (; anIter->More(); anIter->Next()) {
2521 aPrs = anIter->Value();
2522 if (!aPrs) continue;
2523 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
2524 nbPrs += aSubList.size();
2533 theMenu->insertSeparator();
2534 action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
2535 action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
2538 theMenu->insertSeparator();
2540 // Check if some (nb > 0) removable objects selected
2541 if (IsRemovableSelected(this)) {
2542 action( VISU_DELETE_OBJS )->addTo(theMenu);
2545 // Check single selection
2546 if (aListIO.Extent() != 1) return;
2548 Handle(SALOME_InteractiveObject) anIO;
2549 VISU::Storable::TRestoringMap aMap;
2550 CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
2552 _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
2554 VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
2556 if (aType == VISU::TANIMATION) {
2557 action( VISU_SHOW_ANIMATION )->addTo(theMenu);
2559 } else if (IsSObjectTable(SO)) {
2560 action( VISU_SHOW_TABLE )->addTo(theMenu);
2561 action( VISU_CREATE_CURVES )->addTo(theMenu);
2562 action( VISU_EXPORT_TABLE )->addTo(theMenu);
2563 theMenu->insertSeparator();
2566 if (!CORBA::is_nil(anObject)) {
2567 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
2568 if (!CORBA::is_nil(aMED.in())) {
2569 action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
2572 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
2573 if (!CORBA::is_nil(aField)) {
2574 action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
2577 _PTR(SObject) aSFather = SO->GetFather();
2579 _PTR(GenericAttribute) anAttr;
2580 aSFather->FindAttribute(anAttr, "AttributeName");
2582 _PTR(AttributeName) aName (anAttr);
2583 std::string aValue = aName->Value();
2584 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
2585 action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
2594 //***************************************************************************
2597 windows( QMap<int, int>& theMap ) const
2600 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2601 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
2607 viewManagers( QStringList& theList ) const
2610 theList.append( SVTK_Viewer::Type() );
2618 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2619 return QString(anIOR.in());
2625 activateModule( SUIT_Study* theStudy )
2627 SalomeApp_Module::activateModule( theStudy );
2629 setMenuShown( true );
2630 setToolShown( true );
2637 deactivateModule( SUIT_Study* theStudy )
2639 setMenuShown( false );
2640 setToolShown( false );
2642 SalomeApp_Module::deactivateModule( theStudy );
2646 SalomeApp_Selection*
2648 createSelection() const
2650 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2653 //******************************************************************
2654 void VisuGUI::studyActivated()
2656 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
2664 return new VisuGUI();
2668 void VisuGUI::createPreferences()
2670 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
2672 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
2673 int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, SalomeApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
2674 addPreference( tr( "VISU_TITLE" ), fontGr, SalomeApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
2675 int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, SalomeApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
2676 addPreference( tr( "VISU_LABELS" ), fontGr, SalomeApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
2679 fam.append( tr( "VISU_FONT_ARIAL" ) );
2680 fam.append( tr( "VISU_FONT_COURIER" ) );
2681 fam.append( tr( "VISU_FONT_TIMES" ) );
2682 int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) );
2684 setPreferenceProperty( tfont, "families", fam );
2685 setPreferenceProperty( tfont, "system", false );
2686 setPreferenceProperty( tfont, "widget_flags", wflag );
2687 setPreferenceProperty( lfont, "families", fam );
2688 setPreferenceProperty( lfont, "system", false );
2689 setPreferenceProperty( lfont, "widget_flags", wflag );
2691 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
2693 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
2694 setPreferenceProperty( numcol, "min", 2 );
2695 setPreferenceProperty( numcol, "max", 64 );
2697 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
2698 setPreferenceProperty( numlab, "min", 2 );
2699 setPreferenceProperty( numlab, "max", 65 );
2701 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab );
2702 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr, SalomeApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
2703 QStringList orients;
2704 orients.append( tr( "VISU_VERTICAL" ) );
2705 orients.append( tr( "VISU_HORIZONTAL" ) );
2706 QValueList<QVariant> indices;
2707 indices.append( 0 );
2708 indices.append( 1 );
2709 setPreferenceProperty( orient, "strings", orients );
2710 setPreferenceProperty( orient, "indexes", indices );
2712 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab );
2713 int xv = addPreference( tr( "VISU_X" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
2714 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
2715 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
2716 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
2717 setPreferenceProperty( xv, "step", 0.1 );
2718 setPreferenceProperty( yv, "step", 0.1 );
2719 setPreferenceProperty( wv, "step", 0.1 );
2720 setPreferenceProperty( hv, "step", 0.1 );
2721 setPreferenceProperty( xv, "min", 0.0 );
2722 setPreferenceProperty( yv, "min", 0.0 );
2723 setPreferenceProperty( wv, "min", 0.0 );
2724 setPreferenceProperty( hv, "min", 0.0 );
2725 setPreferenceProperty( xv, "max", 1.0 );
2726 setPreferenceProperty( yv, "max", 1.0 );
2727 setPreferenceProperty( wv, "max", 1.0 );
2728 setPreferenceProperty( hv, "max", 1.0 );
2730 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab );
2731 int xh = addPreference( tr( "VISU_X" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
2732 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
2733 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
2734 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
2735 setPreferenceProperty( xh, "step", 0.1 );
2736 setPreferenceProperty( yh, "step", 0.1 );
2737 setPreferenceProperty( wh, "step", 0.1 );
2738 setPreferenceProperty( hh, "step", 0.1 );
2739 setPreferenceProperty( xh, "min", 0.0 );
2740 setPreferenceProperty( yh, "min", 0.0 );
2741 setPreferenceProperty( wh, "min", 0.0 );
2742 setPreferenceProperty( hh, "min", 0.0 );
2743 setPreferenceProperty( xh, "max", 1.0 );
2744 setPreferenceProperty( yh, "max", 1.0 );
2745 setPreferenceProperty( wh, "max", 1.0 );
2746 setPreferenceProperty( hh, "max", 1.0 );
2748 int srangeTab = addPreference( tr( "Scalar range, Sweep, MED import" ) );
2750 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), srangeTab );
2751 setPreferenceProperty( rangeGr, "columns", 1 );
2753 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, SalomeApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
2755 modes.append( tr( "VISU_MODULUS" ) );
2756 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
2757 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
2758 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
2760 indices.append( 0 );
2761 indices.append( 1 );
2762 indices.append( 2 );
2763 indices.append( 3 );
2764 setPreferenceProperty( mode, "strings", modes );
2765 setPreferenceProperty( mode, "indexes", indices );
2767 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, SalomeApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
2769 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, SalomeApp_Preferences::Selector, "VISU", "scalar_range_type" );
2771 types.append( tr( "VISU_FIELD_RANGE" ) );
2772 types.append( tr( "VISU_IMPOSED_RANGE" ) );
2774 indices.append( 0 );
2775 indices.append( 1 );
2776 setPreferenceProperty( rangetype, "strings", types );
2777 setPreferenceProperty( rangetype, "indexes", indices );
2779 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), srangeTab );
2781 int min = addPreference( tr( "VISU_MIN" ), imposedGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
2782 int max = addPreference( tr( "VISU_MAX" ), imposedGr, SalomeApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
2783 setPreferenceProperty( min, "step", 0.1 );
2784 setPreferenceProperty( max, "step", 0.1 );
2786 int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
2787 setPreferenceProperty( sweepGr, "columns", 1 );
2789 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, SalomeApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
2790 int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, SalomeApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );
2791 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, SalomeApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
2792 setPreferenceProperty( timestep, "min", 0.1 );
2793 setPreferenceProperty( timestep, "step", 0.1 );
2794 setPreferenceProperty( timestep, "max", 1000 );
2795 setPreferenceProperty( nbcycles, "max", 100 );
2796 setPreferenceProperty( nbsteps, "max", 200 );
2798 int importGr = addPreference( tr( "MED files import" ), srangeTab );
2799 addPreference( tr( "Full MED loading" ), importGr, SalomeApp_Preferences::Bool, "VISU", "full_med_loading" );
2802 void VisuGUI::preferencesChanged( const QString&, const QString& )