1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 // Author : Laurent CORNABE
34 #include <qptrvector.h>
35 #include <qcolordialog.h>
37 #include <vtkRenderer.h>
38 #include <vtkRenderWindow.h>
39 #include <vtkActorCollection.h>
41 #include "SALOME_LifeCycleCORBA.hxx"
43 #include "SUIT_ResourceMgr.h"
44 #include "SUIT_MessageBox.h"
46 #include "SUIT_ViewWindow.h"
47 #include "SUIT_ViewManager.h"
49 #include "CAM_Module.h"
51 #include "SVTK_RenderWindow.h"
52 #include "SVTK_ViewWindow.h"
53 #include "SVTK_ViewModel.h"
54 #include "SVTK_Functor.h"
56 #include "SPlot2d_ViewModel.h"
57 #include "SPlot2d_SetupPlot2dDlg.h"
59 #include "OB_Browser.h"
61 #include "SALOME_ListIO.hxx"
62 #include "SALOME_ListIteratorOfListIO.hxx"
64 #include "SalomeApp_Application.h"
65 #include "SalomeApp_DataModel.h"
66 #include "SalomeApp_Study.h"
67 #include "SalomeApp_SelectionMgr.h"
68 #include "SalomeApp_Selection.h"
70 #include "VISUConfig.hh"
71 #include "VISU_Gen_i.hh"
72 #include "VISU_Mesh_i.hh"
73 #include "VISU_Table_i.hh"
74 #include "VISU_Result_i.hh"
75 #include "VISU_View_i.hh"
76 #include "VISU_ViewManager_i.hh"
78 #include "VISU_Actor.h"
81 #include "VisuGUI_Tools.h"
82 #include "VisuGUI_PopupTools.h"
83 #include "VisuGUI_NameDlg.h"
84 #include "VisuGUI_FileDlg.h"
85 #include "VisuGUI_CursorDlg.h"
86 #include "VisuGUI_Selection.h"
87 #include "VisuGUI_TimeAnimation.h"
88 #include "VisuGUI_EditContainerDlg.h"
89 #include "VisuGUI_NonIsometricDlg.h"
91 #include "VISU_ScalarMap_i.hh"
92 #include "VisuGUI_ScalarBarDlg.h"
94 #include "VISU_DeformedShape_i.hh"
95 #include "VisuGUI_DeformedShapeDlg.h"
97 #include "VISU_IsoSurfaces_i.hh"
98 #include "VisuGUI_IsoSurfacesDlg.h"
100 #include "VISU_CutPlanes_i.hh"
101 #include "VisuGUI_CutPlanesDlg.h"
103 #include "VISU_CutLines_i.hh"
104 #include "VisuGUI_CutLinesDlg.h"
106 #include "VISU_StreamLines_i.hh"
107 #include "VisuGUI_StreamLinesDlg.h"
109 #include "VISU_Vectors_i.hh"
110 #include "VisuGUI_VectorsDlg.h"
112 #include "SALOMEconfig.h"
113 #include CORBA_SERVER_HEADER(MED_Gen)
115 #include "utilities.h"
117 using namespace VISU;
120 static int MYDEBUG = 1;
122 static int MYDEBUG = 0;
125 //////////////////////////////////////////////////
127 //////////////////////////////////////////////////
130 SalomeApp_Module( "VISU" )
144 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
145 CheckLock(GetCStudy(GetAppStudy(this)));
146 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
149 aFilter.append( tr("FLT_MED_FILES") );
150 aFilter.append( tr("FLT_ALL_FILES") );
152 QFileInfo aFileInfo =
153 SUIT_FileDlg::getFileName(GetDesktop(this),
156 tr("MEN_IMPORT_FROM_FILE"),
158 if(aFileInfo.exists()){
159 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
161 VISU::Result_var aResult;
162 bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
163 if(VisuGUI_FileDlg::IsBuild){
164 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
165 if(!CORBA::is_nil(aResult.in()))
166 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
167 if(!aRes->IsPossible())
168 SUIT_MessageBox::warn1(GetDesktop(this),
170 tr("ERR_CANT_BUILD_PRESENTATION"),
176 aResourceMgr->setValue("Visu:BuildResult",false);
177 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
178 aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
181 if(CORBA::is_nil(aResult.in())) {
182 SUIT_MessageBox::warn1(GetDesktop(this),
184 tr("ERR_ERROR_IN_THE_FILE"),
187 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
198 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
199 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
202 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
205 aFilter.append( tr("FLT_MED_FILES") );
206 aFilter.append( tr("FLT_ALL_FILES") );
208 QFileInfo aFileInfo =
209 SUIT_FileDlg::getFileName(GetDesktop(this),
212 tr("MEN_EXPLORE_MED_FILE"),
214 if(aFileInfo.exists()){
215 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
216 std::string aStudyName = aStudy->Name();
217 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
218 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
226 OnImportTableFromFile()
228 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
229 CheckLock(GetCStudy(GetAppStudy(this)));
232 aFilter.append( tr("FLT_TABLE_FILES") );
233 aFilter.append( tr("FLT_ALL_FILES") );
235 QFileInfo aFileInfo =
236 SUIT_FileDlg::getFileName(GetDesktop(this),
239 tr("MEN_IMPORT_TABLE"),
241 if(aFileInfo.exists()){
242 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
244 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
246 if(CORBA::is_nil(anObject.in())) {
247 SUIT_MessageBox::warn1(GetDesktop(this),
249 tr("ERR_ERROR_IN_THE_FILE"),
252 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
260 OnExportTableToFile()
262 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
266 template<class TPrs3d_i>
268 CreatePrs3d(SalomeApp_Module* theModule,
269 SALOMEDS::SObject_var theTimeStamp,
270 const char* theMeshName,
271 VISU::Entity theEntity,
272 const char* theFieldName,
275 VISU::Result_var aResult;
276 if(CheckResult(theModule,theTimeStamp,aResult)){
277 QApplication::setOverrideCursor(Qt::waitCursor);
278 typedef typename TPrs3d_i::TInterface TPrs3d;
279 typename TPrs3d::_var_type aPrs3d =
280 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
281 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
282 QApplication::restoreOverrideCursor();
283 if(!CORBA::is_nil(aPrs3d.in()))
284 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
286 SUIT_MessageBox::warn1(GetDesktop(theModule),
287 QObject::tr("WRN_VISU"),
288 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
289 QObject::tr("BUT_OK") );
294 template<class TPrs3d_i, class TDlg, int IsDlgModal>
296 CreatePrs3d(SalomeApp_Module* theModule,
297 SALOMEDS::SObject_var theTimeStamp,
298 const Handle(SALOME_InteractiveObject)& theIO)
300 using namespace VISU;
301 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
303 QString aType = Storable::FindValue(aMap,"myType",&isExist);
304 if(!isExist || aType.toInt() != TTIMESTAMP )
306 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
307 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
308 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
309 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
311 CreatePrs3d<TPrs3d_i>(theModule,
314 (Entity)anEntity.toInt(),
316 aTimeStampId.toInt());
318 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
319 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
321 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){
322 aDlg->initFromPrsObject(aPrs3d);
324 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
327 DeletePrs3d(theModule,aPrs3d,theIO);
337 PublishInView(theModule,aPrs3d);
344 template<class TPrs3d_i, class TDlg, int IsDlgModal>
346 CreatePrs3d(SalomeApp_Module* theModule)
348 if(CheckLock(GetCStudy(GetAppStudy(theModule))))
351 SALOMEDS::SObject_var aTimeStampSObj;
352 Handle(SALOME_InteractiveObject) anIO;
353 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
356 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
359 theModule->application()->putInfo(QObject::tr("INF_DONE"));
360 theModule->updateObjBrowser();
362 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
366 void VisuGUI::CreateMesh (const Handle(SALOME_InteractiveObject)& theIO)
368 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
369 //if (CheckLock(aStudy))
372 SALOMEDS::SObject_var aResultSObj =
373 GetDSStudy(aStudy)->FindObjectID(theIO->getEntry());
376 VISU::Result_var aResult;
377 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
381 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
383 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
387 CORBA::Object_var aMesh;
388 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
393 if (aComment == "ENTITY") {
394 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
395 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
396 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
397 } else if (aComment == "FAMILY") {
398 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
399 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
400 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
401 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
402 } else if (aComment == "GROUP") {
403 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
404 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
405 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
409 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
413 QApplication::restoreOverrideCursor();
414 VISU::Mesh_i* pPresent = NULL;
415 if (!CORBA::is_nil(aMesh))
416 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
417 if (pPresent == NULL) {
418 SUIT_MessageBox::warn1 (GetDesktop(this),
420 tr("ERR_CANT_BUILD_PRESENTATION"),
425 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
431 PublishInView(this, pPresent);
435 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
438 application()->putInfo(QObject::tr("INF_DONE"));
439 } catch (std::runtime_error& exc) {
441 SUIT_MessageBox::warn1 (GetDesktop(this),
443 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
453 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
454 if (CheckLock(aStudy))
457 // Get selected SObject
458 SALOMEDS::SObject_var aResultSObj;
459 Handle(SALOME_InteractiveObject) anIO;
460 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
461 if (anIO.IsNull() || !anIO->hasEntry())
471 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
472 if (CheckLock(aStudy))
475 // Get selected SObject
476 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
477 SALOME_ListIO aListIO;
478 aSelectionMgr->selectedObjects(aListIO);
479 SALOME_ListIteratorOfListIO anIter (aListIO);
480 for (; anIter.More(); anIter.Next()) {
481 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
482 if (anIO.IsNull() || !anIO->hasEntry())
493 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
499 OnCreateDeformedShape()
501 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
508 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
513 OnCreateIsoSurfaces()
515 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
522 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
529 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
534 OnCreateStreamLines()
536 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
543 CheckLock(GetCStudy(GetAppStudy(this)));
544 GetVisuGen( this )->CreateContainer();
552 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
553 Handle(SALOME_InteractiveObject) anIO;
554 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
555 if ( !CORBA::is_nil( anObject ) ) {
556 // is it Prs3d object ?
557 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
559 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
560 UpdateViewer( this, aPrsObject );
561 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
562 vw->getRenderer()->ResetCameraClippingRange();
564 vw->highlight(anIO, 1);
569 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
571 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
572 PlotCurve( this, aCurve, VISU::eDisplay );
576 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
578 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
579 PlotContainer(aContainer, VISU::eDisplay );
583 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
585 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
586 PlotTable(aTable, VISU::eDisplay );
598 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject)
600 if (MYDEBUG) MESSAGE("ErasePrs");
602 if ( !CORBA::is_nil( theObject ) ) {
603 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
604 if ( CORBA::is_nil( aBase ) ) return;
605 VISU::VISUType aType = aBase->GetType();
608 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
609 PlotCurve(this, aCurve, VISU::eErase );
612 case VISU::TCONTAINER:{
613 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
614 PlotContainer(this, aContainer, VISU::eErase );
618 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
619 PlotTable(this, aTable, VISU::eErase );
623 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
624 ErasePrs3d( this, aPrsObject );
625 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
637 if(MYDEBUG) MESSAGE("OnErasePrs");
638 Handle(SALOME_InteractiveObject) anIO;
639 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
643 template<class TPrs3d_i, class TDlg>
645 EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
647 TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
649 //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
650 TDlg* aDlg = new TDlg (GetDesktop(theModule));
651 aDlg->initFromPrsObject(aPrsObject);
653 if (!(aDlg->storeToPrsObject(aPrsObject))) {
657 RecreateActor(theModule, aPrsObject);
658 if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
659 //if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
660 vw->getRenderer()->ResetCameraClippingRange();
673 if (CheckLock(GetCStudy(GetAppStudy(this))))
676 Handle(SALOME_InteractiveObject) anIO;
677 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
678 if (CORBA::is_nil(anObject)) return;
679 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
680 if (!aServant.in()) return;
682 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
685 switch (aPrs3d->GetType()) {
688 case VISU::TSCALARMAP:
689 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg>(this, aPrs3d);
691 case VISU::TDEFORMEDSHAPE:
692 EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg>(this, aPrs3d);
694 case VISU::TCUTPLANES:
695 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg>(this, aPrs3d);
697 VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
699 VisuGUI_CutPlanesDlg* aDlg =
700 new VisuGUI_CutPlanesDlg (GetDesktop(this), false, false);
701 aDlg->initFromPrsObject(aPrsObject);
706 case VISU::TCUTLINES:
707 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg>(this, aPrs3d);
709 VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
711 VisuGUI_CutLinesDlg* aDlg =
712 new VisuGUI_CutLinesDlg (GetDesktop(this), false, false);
713 aDlg->initFromPrsObject(aPrsObject);
718 case VISU::TISOSURFACE:
719 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg>(this, aPrs3d);
722 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg>(this, aPrs3d);
724 case VISU::TSTREAMLINES:
725 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg>(this, aPrs3d);
731 if (SVTK_ViewWindow* vw = GetViewWindow())
732 vw->highlight(anIO, 1);
739 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
740 if (CheckLock(aCStudy))
742 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
744 Handle(SALOME_InteractiveObject) anIO;
745 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
749 // There is a transaction
750 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
751 aStudyBuilder->NewCommand();
753 // is it Prs3d object ?
754 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
756 DeletePrs3d(this, aPrsObject, anIO);
759 // is it Curve object ?
760 VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
762 //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
765 aStudyBuilder->CommitCommand();
782 OnDisplayOnlyManyPrs()
790 SVTK_ViewWindow* vw = GetViewWindow();
793 /*jfa tmp:GetActiveStudy()->unHighlightAll();
794 if (vtkRenderer *aRen = GetRenderer()) {
796 vtkActorCollection *anActColl = aRen->GetActors();
797 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
798 if (anActor->GetVisibility() > 0)
799 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
800 anVISUActor = anVISUActor->GetParent();
801 anVISUActor->VisibilityOff();
808 void VisuGUI::ChangeRepresentation (VISU::PresentationType theType)
810 SVTK_ViewWindow* vw = GetViewWindow();
813 Handle(SALOME_InteractiveObject) anIO;
814 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
815 if (CORBA::is_nil(anObject)) return;
816 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
817 if (!aServant.in()) return;
819 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
821 if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
824 if (anActor->IsShrunk())
827 anActor->SetShrink();
830 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
831 aMesh->SetPresentationType(theType);
832 RecreateActor(this, aMesh);
834 anActor->SetRepresentation(theType);
846 ChangeRepresentation(VISU::SURFACEFRAME);
853 ChangeRepresentation(VISU::INSIDEFRAME);
860 ChangeRepresentation(VISU::WIREFRAME);
867 ChangeRepresentation(VISU::SHADED);
874 ChangeRepresentation(VISU::POINT);
881 ChangeRepresentation(VISU::SHRINK);
888 Handle(SALOME_InteractiveObject) anIO;
889 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
890 if (CORBA::is_nil(anObject)) return;
891 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
892 if (!aServant.in()) return;
894 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
897 SVTK_ViewWindow* vw = GetViewWindow();
900 VISU_Actor* anActor = GetActor(aPrs3d, vw);
901 if (!anActor) return;
903 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
904 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
905 SALOMEDS::Color anOldColor, aNewColor;
906 int aRepresent = anActor->GetRepresentation();
908 switch (aRepresent) {
910 anOldColor = aMesh->GetNodeColor();
912 case VISU::WIREFRAME :
913 case VISU::INSIDEFRAME :
914 anOldColor = aMesh->GetLinkColor();
917 case VISU::SURFACEFRAME :
918 anOldColor = aMesh->GetCellColor();
921 } else if (aDeformedShape) {
922 anOldColor = aDeformedShape->GetColor();
927 QColor aColor (int(255*anOldColor.R),
928 int(255*anOldColor.G),
929 int(255*anOldColor.B));
930 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
931 if (aColorNew.isValid()) {
932 aNewColor.R = aColorNew.red()/255.;
933 aNewColor.G = aColorNew.green()/255.;
934 aNewColor.B = aColorNew.blue()/255.;
936 switch (aRepresent) {
938 aMesh->SetNodeColor(aNewColor);
940 case VISU::WIREFRAME :
941 case VISU::INSIDEFRAME :
942 aMesh->SetLinkColor(aNewColor);
945 case VISU::SURFACEFRAME :
946 aMesh->SetCellColor(aNewColor);
950 aDeformedShape->SetColor(aNewColor);
952 RecreateActor(this, aPrs3d);
958 OnChangeWireframeColor()
960 Handle(SALOME_InteractiveObject) anIO;
961 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
962 if (CORBA::is_nil(anObject)) return;
963 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
964 if (!aServant.in()) return;
966 VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
969 SVTK_ViewWindow* vw = GetViewWindow();
972 VISU_Actor* anActor = GetActor(aPrs3d, vw);
973 if (!anActor) return;
975 if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
976 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
977 QColor aColor (int(255*anOldColor.R),
978 int(255*anOldColor.G),
979 int(255*anOldColor.B));
980 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
981 if (aColorNew.isValid()) {
982 aNewColor.R = aColorNew.red()/255.;
983 aNewColor.G = aColorNew.green()/255.;
984 aNewColor.B = aColorNew.blue()/255.;
985 aMesh->SetLinkColor(aNewColor);
986 RecreateActor(this, aMesh);
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_OPACITY_TITLE"), TRUE);
1013 CursorDlg->Comment1->setText(tr("DLG_OPACITY_CMT1"));
1014 CursorDlg->Comment2->setText(tr("DLG_OPACITY_CMT2"));
1015 CursorDlg->SpinBox1->setMinValue(0);
1016 CursorDlg->SpinBox1->setMaxValue(100);
1018 float oldopac = anActor->GetOpacity();
1019 int intopac = int(oldopac*100. + 0.5);
1020 CursorDlg->SpinBox1->setValue(intopac);
1022 int ret = CursorDlg->exec();
1024 intopac = CursorDlg->SpinBox1->value();
1025 float newopac = intopac/100.;
1026 anActor->SetOpacity(newopac);
1035 Handle(SALOME_InteractiveObject) anIO;
1036 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1037 if (CORBA::is_nil(anObject)) return;
1038 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1039 if (!aServant.in()) return;
1041 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1042 if (!aPrsObject) return;
1044 SVTK_ViewWindow* vw = GetViewWindow();
1047 VISU_Actor* anActor = GetActor(aPrsObject, vw);
1048 if (!anActor) return;
1050 VisuGUI_CursorDlg* CursorDlg =
1051 new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
1053 CursorDlg->Comment1->setText("DLG_LINEWIDTH_CMT1");
1054 CursorDlg->Comment2->setText("DLG_LINEWIDTH_CMT2");
1055 CursorDlg->SpinBox1->setMinValue(1);
1056 CursorDlg->SpinBox1->setMaxValue(10);
1058 float oldlwid = anActor->GetLineWidth();
1059 int intlwid = int(oldlwid);
1060 CursorDlg->SpinBox1->setValue(intlwid);
1062 int ret = CursorDlg->exec();
1064 intlwid = CursorDlg->SpinBox1->value();
1065 float newlwid = intlwid;
1066 anActor->SetLineWidth(newlwid);
1081 Handle(SALOME_InteractiveObject) anIO;
1082 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1083 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1084 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
1085 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
1086 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
1087 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1096 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1097 if (CheckLock(aCStudy))
1099 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1101 Handle(SALOME_InteractiveObject) anIO;
1102 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1103 if (anIO.IsNull() || !anIO->hasEntry())
1106 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
1107 if (!aSObject->_is_nil()) {
1108 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1109 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1110 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1111 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1112 ErasePrs(aChildObj);
1114 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
1115 // There is a transaction
1116 aStudyBuilder->NewCommand();
1117 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
1118 if (!CORBA::is_nil(anObj)) {
1119 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
1120 if (!CORBA::is_nil(aBase)) {
1121 VISU::VISUType aType = aBase->GetType();
1125 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1126 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1127 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1128 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1129 if (CORBA::is_nil(aChildObj)) continue;
1130 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
1131 if (CORBA::is_nil(aPrs3d)) continue;
1132 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
1133 DeletePrs3d(this, pPrs3d, NULL);
1139 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
1140 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
1141 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
1142 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
1143 if (CORBA::is_nil(aChildObj)) continue;
1144 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
1145 if (CORBA::is_nil(aCurve)) continue;
1146 VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1147 //jfa tmp:DeleteCurve(this, pCurve, NULL);
1154 aStudyBuilder->RemoveObjectWithChildren(aSObject);
1155 aStudyBuilder->CommitCommand();
1156 //jfa tmp:GetActiveStudy()->unHighlightAll();
1157 updateObjBrowser(true);
1165 Handle(SALOME_InteractiveObject) anIO;
1166 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
1168 _PTR(GenericAttribute) anAttr;
1169 _PTR(AttributeName) aName;
1171 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
1173 if ( !CORBA::is_nil( anObject ) ) {
1174 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1175 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
1176 // Table (VISU object) is selected
1177 CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
1178 if( !CORBA::is_nil( aTbl ) ) {
1179 VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
1181 _PTR(SObject) SO = aStudy->FindObjectID( table->GetObjectEntry() );
1182 if ( IsSObjectTable(SO) ) {
1183 // get name of SObject
1184 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1186 SOName = aName->Value();
1188 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1189 if ( dlg->exec() == QDialog::Accepted ) {
1190 if ( !IsStudyLocked( aStudy ) ) {
1191 // if study is not locked - create new container, create curves
1192 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1194 QValueList<int> verIndices;
1195 dlg->getCurvesSource( horIndex, verIndices );
1196 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1197 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1198 if( !CORBA::is_nil( aContainer ) ) {
1199 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1201 for ( int i = 0; i < verIndices.count(); i++ ) {
1202 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
1203 if( !CORBA::is_nil( aNewCurve ) ) {
1204 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1207 int marker, line, lineWidth;
1209 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1210 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1211 pCrv->SetColor( c );
1212 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1213 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1215 pContainer->AddCurve( pCrv->_this() );
1220 PlotContainer( this, pContainer, VISU::eDisplay );
1226 // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
1227 QPtrList<Plot2d_Curve> container;
1228 dlg->getCurves( container );
1229 if ( !container.isEmpty() ) {
1230 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1231 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1241 else if ( !anIO.IsNull() ) {
1242 // check if Table SObject is selected
1243 SO = aStudy->FindObjectID( anIO->getEntry() );
1244 if ( IsSObjectTable(SO) ) {
1245 // get name of SObject
1246 if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
1248 SOName = aName->Value();
1250 SPlot2d_SetupPlot2dDlg* dlg = new SPlot2d_SetupPlot2dDlg( SO, GetDesktop( this ) );
1251 if ( dlg->exec() == QDialog::Accepted ) {
1252 if ( !IsStudyLocked( aStudy ) ) {
1253 // if study is not locked - create new table and container objects, create curves
1254 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1256 QValueList<int> verIndices;
1257 dlg->getCurvesSource( horIndex, verIndices );
1258 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1259 CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
1260 CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
1261 if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
1262 VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1263 VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1265 if ( pContainer && pTable ) {
1266 for ( int i = 0; i < verIndices.count(); i++ ) {
1267 CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
1268 if( !CORBA::is_nil( aNewCurve ) ) {
1269 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
1272 int marker, line, lineWidth;
1274 if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
1275 SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
1276 pCrv->SetColor( c );
1277 pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
1278 pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1280 pContainer->AddCurve( pCrv->_this() );
1285 PlotContainer( this, pContainer, VISU::eDisplay );
1290 // if study is locked just get curves info and plot them
1291 QPtrList<Plot2d_Curve> container;
1292 dlg->getCurves( container );
1293 if ( !container.isEmpty() ) {
1294 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1295 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( SOName );
1314 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1315 if (CheckLock(aCStudy))
1317 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1318 Handle(SALOME_InteractiveObject) anIO;
1319 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1320 if (anIO.IsNull() || CORBA::is_nil(anObject))
1323 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1324 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
1326 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
1327 if (!CORBA::is_nil(aCnt)) {
1328 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
1329 if (container && container->GetNbCurves() > 0) {
1341 Handle(SALOME_InteractiveObject) anIO;
1342 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1343 if (CORBA::is_nil(anObject)) return;
1345 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1346 if (!aServant.in()) return;
1347 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
1348 if (!aContainer) return;
1350 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
1351 aDlg->initFromPrsObject(aContainer);
1353 aDlg->storeToPrsObject(aContainer);
1354 updateObjBrowser(true);
1363 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1364 if (CheckLock(aCStudy))
1366 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1368 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1369 if (aViewMgr->getType() != SVTK_Viewer::Type())
1372 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1373 SALOME_ListIO aListIO;
1374 aSelectionMgr->selectedObjects(aListIO);
1375 if (aListIO.Extent() > 1)
1378 if (aListIO.Extent() == 0) {
1379 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
1381 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1382 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1389 OnRestoreViewParams()
1391 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1392 if (aViewMgr->getType() != SVTK_Viewer::Type())
1395 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1396 SALOME_ListIO aListIO;
1397 aSelectionMgr->selectedObjects(aListIO);
1398 if (aListIO.Extent() != 1)
1401 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1402 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1403 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1404 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1405 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1410 OnDeleteViewParams()
1412 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1413 if (CheckLock(aCStudy))
1415 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
1417 Handle(SALOME_InteractiveObject) anIO;
1418 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1419 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1420 if (!aSObject) return;
1422 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
1423 if (aType == VISU::TVIEW3D) {
1424 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1425 SALOME_ListIO aListIO, aNewListIO;
1426 aSelectionMgr->selectedObjects(aListIO);
1427 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
1428 if (it.Value()->getEntry() != anIO->getEntry()) {
1429 aNewListIO.Append(it.Value());
1432 aSelectionMgr->setSelectedObjects(aNewListIO);
1434 aCStudy->NewBuilder()->RemoveObject(aSObject);
1444 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1445 if (CheckLock(aCStudy))
1448 Handle(SALOME_InteractiveObject) anIO;
1449 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1451 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
1454 //TEST DU PARENT == VISU
1455 _PTR(GenericAttribute) anAttr;
1456 if (aSObj->FindAttribute(anAttr, "AttributeName")) {
1457 _PTR(AttributeName) aName (anAttr);
1458 QString Name = VisuGUI_NameDlg::getName(GetDesktop(this), aName->Value());
1459 if (!Name.isEmpty()) {
1460 QApplication::setOverrideCursor(Qt::waitCursor);
1462 // rename specific objects
1463 if (!CORBA::is_nil(anObject)) {
1464 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
1465 if (!CORBA::is_nil(aVisuObj)) {
1466 switch (aVisuObj->GetType()) {
1467 case VISU::TCURVE: // Curve object
1469 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
1470 if (!CORBA::is_nil(aCurve)) {
1471 VISU::Curve_i* curve =
1472 dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
1474 curve->SetName(Name.latin1());
1478 case VISU::TTABLE: // Table object
1480 CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
1481 if (!CORBA::is_nil(aTable)) {
1482 VISU::Table_i* table =
1483 dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
1485 table->SetName(Name.latin1());
1489 case VISU::TCONTAINER: // Container object
1491 CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
1492 if (!CORBA::is_nil(aContainer)) {
1493 VISU::Container_i* container =
1494 dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
1496 container->SetName(Name.latin1());
1507 // rename the study object
1508 //getApp()->activeStudy()->renameIObject(anIO, Name);
1509 aName->SetValue(Name.latin1()); // rename the SObject
1510 anIO->setName(Name.latin1()); // rename the InteractiveObject
1511 updateObjBrowser(false);
1513 QApplication::restoreOverrideCursor();
1523 Handle(SALOME_InteractiveObject) anIO;
1524 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1525 if (CORBA::is_nil(anObject)) return;
1526 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1527 if (!aServant.in()) return;
1529 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
1530 if (!aPrsObject) return;
1532 SVTK_ViewWindow* vw = GetViewWindow();
1535 VISU_Actor* aActor = GetActor(aPrsObject, vw);
1536 if (!aActor) return;
1538 if (!aActor->GetVisibility()) {
1539 aActor->VisibilityOn();
1542 // Get sweep parameters
1543 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
1545 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
1546 int aTemp = int(1.E6 * aTempoDbl);
1548 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
1549 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
1552 QApplication::setOverrideCursor(Qt::waitCursor);
1554 for (int j = 0; j < aCycles; j++) {
1555 for (int i = 0; i <= aSteps; i++) {
1556 float aPercents = float(i)/aSteps;
1557 aPrsObject->SetMapScale(aPercents);
1558 aPrsObject->UpdateActor(aActor);
1559 vw->getRenderWindow()->getRenderWindow()->Render();
1563 } catch (std::exception& exc) {
1564 INFOS("Follow exception was occured :\n" << exc.what());
1566 INFOS("Unknown exception was occured!");
1568 QApplication::restoreOverrideCursor();
1575 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1576 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1577 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1579 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1580 SALOME_ListIO aListIO;
1581 aSelectionMgr->selectedObjects(aListIO);
1583 bool isDefined = false;
1585 SALOME_ListIteratorOfListIO It (aListIO);
1586 for (; It.More(); It.Next()) {
1587 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1588 if (!aSObject) continue;
1589 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1590 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1594 aAnimationDlg->addField(aSObject);
1596 } else if (aNbTimes == aNumber) {
1597 aAnimationDlg->addField(aSObject);
1602 if (isDefined) aAnimationDlg->show();
1603 else delete aAnimationDlg;
1608 OnCopyPresentation()
1610 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1611 if (CheckLock(aCStudy))
1614 //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
1615 Handle(SALOME_InteractiveObject) anIO;
1616 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
1617 if (CORBA::is_nil(anObject)) return;
1618 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1619 if (!aServant.in()) return;
1621 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
1622 if (!aPrsObject) return;
1624 switch (aPrsObject->GetType()) {
1627 VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
1628 VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
1629 aSameMesh->SameAs(aMeshPrs);
1630 UpdateViewer(this, aSameMesh);
1633 case VISU::TSCALARMAP:
1635 VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1636 VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
1637 aSameScalar->SameAs(aScalarPrs);
1638 UpdateViewer(this, aSameScalar);
1641 case VISU::TDEFORMEDSHAPE:
1643 VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
1644 VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
1645 aSameDeformed->SameAs(aDefPrs);
1646 UpdateViewer(this, aSameDeformed);
1649 case VISU::TCUTPLANES:
1651 VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
1652 VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
1653 aSameCut->SameAs(aCutPrs);
1654 UpdateViewer(this, aSameCut);
1657 case VISU::TCUTLINES:
1659 VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
1660 VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
1661 aSameCut->SameAs(aCutPrs);
1662 UpdateViewer(this, aSameCut);
1665 case VISU::TISOSURFACE:
1667 VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
1668 VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
1669 aSameIso->SameAs(aIsoPrs);
1670 UpdateViewer(this, aSameIso);
1673 case VISU::TSTREAMLINES:
1675 VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
1676 VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
1677 aSameLines->SameAs(aLinesPrs);
1678 UpdateViewer(this, aSameLines);
1681 case VISU::TVECTORS:
1683 VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
1684 VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
1685 aSameVectors->SameAs(aVectorsPrs);
1686 UpdateViewer(this, aSameVectors);
1697 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1704 VisuGUI_NonIsometricDlg* m_NonIsoDlg =
1705 new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
1706 false, Qt::WDestructiveClose);
1707 m_NonIsoDlg->show();
1712 initialize( CAM_Application* theApp )
1714 SalomeApp_Module::initialize( theApp );
1727 QWidget* aParent = application()->desktop();
1728 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1731 createAction( 112, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1732 this, SLOT(OnImportFromFile()));
1733 createAction( 113, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1734 this, SLOT(OnExploreMEDFile()));
1735 createAction( 199, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1736 this, SLOT(OnImportTableFromFile()));
1738 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1739 createAction( 4011, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1740 this, SLOT(OnCreateScalarMap()));
1742 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1743 createAction( 4012, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1744 this, SLOT(OnCreateDeformedShape()));
1746 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1747 createAction( 4013, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1748 this, SLOT(OnCreateVectors()));
1750 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1751 createAction( 4014, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1752 this, SLOT(OnCreateIsoSurfaces()));
1754 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1755 createAction( 4015, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1756 this, SLOT(OnCreateCutPlanes()));
1758 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1759 createAction( 4016, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1760 this, SLOT(OnCreateStreamLines()));
1762 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1763 createAction( 4018, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1764 this, SLOT(OnCreateCutLines()));
1766 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1767 createAction( 4020, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1768 this, SLOT(OnCreatePlot2dView()));
1770 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1771 createAction( 4021, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1772 this, SLOT(OnDeleteObject()));
1774 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1775 //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1776 //this, SLOT(OnRenameTable()));
1778 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1779 createAction( 4023, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1780 this, SLOT(OnShowTable()));
1782 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1783 createAction( 4024, tr("MEN_CREATE_CURVES"), QIconSet(aPixmap), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1784 this, SLOT(OnPlotData()));
1786 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1787 createAction( 4025, tr("MEN_EXPORT_TABLE"), QIconSet(aPixmap), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1788 this, SLOT(OnExportTableToFile()));
1790 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1791 createAction( 4026, tr("MEN_CREATE_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
1792 this, SLOT(OnCreateMesh()));
1794 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1795 createAction( 4027, tr("MEN_CREATE_MANY_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
1796 this, SLOT(OnCreateManyMesh()));
1798 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1799 createAction( 4030, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1800 this, SLOT(OnErasePrs()));
1802 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1803 createAction( 4031, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1804 this, SLOT(OnDisplayPrs()));
1806 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1807 createAction( 4032, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1808 this, SLOT(OnDisplayOnlyPrs()));
1810 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1811 createAction( 4033, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1812 this, SLOT(OnDeletePrs()));
1814 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1815 createAction( 4034, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1816 this, SLOT(OnDisplayManyPrs()));
1818 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1819 createAction( 4035, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1820 this, SLOT(OnEraseManyPrs()));
1822 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1823 createAction( 4036, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1824 this, SLOT(OnDisplayOnlyManyPrs()));
1826 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1827 createAction( 4037, tr("MEN_COPY_PRS"), QIconSet(aPixmap), tr("MEN_COPY_PRS"), "", 0, aParent, false,
1828 this, SLOT(OnCopyPresentation()));
1830 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1831 createAction( 4040, tr("MEN_CURVE_PROPS"), QIconSet(aPixmap), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
1832 this, SLOT(OnCurveProperties()));
1834 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1835 createAction( 4041, tr("MEN_RENAME"), QIconSet(aPixmap), tr("MEN_RENAME"), "", 0, aParent, false,
1836 this, SLOT(OnRename()));
1838 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1839 createAction( 4042, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
1840 this, SLOT(OnEditContainer()));
1842 //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1843 //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
1844 //this, SLOT(OnRenameContainer()));
1846 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1847 createAction( 4044, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
1848 this, SLOT(OnClearContainer()));
1850 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1851 createAction( 4046, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(aPixmap),
1852 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
1853 this, SLOT(OnSaveViewParams()));
1855 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1856 createAction( 4047, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(aPixmap),
1857 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
1858 this, SLOT(OnRestoreViewParams()));
1860 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1861 createAction( 4048, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(aPixmap),
1862 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
1863 this, SLOT(OnDeleteViewParams()));
1865 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1866 createAction( 4050, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
1867 this, SLOT(OnMakePoints()));
1869 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1870 createAction( 4051, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
1871 this, SLOT(OnMakeWireframe()));
1873 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1874 createAction( 4052, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
1875 this, SLOT(OnMakeSurface()));
1877 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1878 createAction( 4053, tr("MEN_INSIDEFRAME"), QIconSet(aPixmap), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
1879 this, SLOT(OnMakeInsideframe()));
1881 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1882 createAction( 4054, tr("MEN_SURFACEFRAME"), QIconSet(aPixmap), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
1883 this, SLOT(OnMakeSurfaceframe()));
1885 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1886 createAction( 4055, tr("MEN_SHRINK"), QIconSet(aPixmap), tr("MEN_SHRINK"), "", 0, aParent, false,
1887 this, SLOT(OnMakeShrink()));
1889 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1890 createAction( 4056, tr("MEN_UNSHRINK"), QIconSet(aPixmap), tr("MEN_UNSHRINK"), "", 0, aParent, false,
1891 this, SLOT(OnMakeShrink()));
1893 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1894 createAction( 4057, tr("MEN_CELL_COLOR"), QIconSet(aPixmap), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
1895 this, SLOT(OnChangeColor()));
1897 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1898 createAction( 4058, tr("MEN_COLOR"), QIconSet(aPixmap), tr("MEN_COLOR"), "", 0, aParent, false,
1899 this, SLOT(OnChangeColor()));
1901 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1902 createAction( 4059, tr("MEN_EDGE_COLOR"), QIconSet(aPixmap), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
1903 this, SLOT(OnChangeWireframeColor()));
1905 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1906 createAction( 4060, tr("MEN_OPACITY"), QIconSet(aPixmap), tr("MEN_OPACITY"), "", 0, aParent, false,
1907 this, SLOT(OnChangeOpacity()));
1909 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1910 createAction( 4061, tr("MEN_LINE_WIDTH"), QIconSet(aPixmap), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
1911 this, SLOT(OnChangeLines()));
1913 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1914 createAction( 4062, tr("MEN_EDIT_PRS"), QIconSet(aPixmap), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
1915 this, SLOT(OnEditPrs()));
1917 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1918 createAction( 4063, tr("MEN_CREATE_TABLE"), QIconSet(aPixmap), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
1919 this, SLOT(OnCreateTable()));
1921 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1922 createAction( 4064, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
1923 this, SLOT(OnSweep()));
1925 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1926 createAction( 4065, tr("MEN_SELECTION_INFO"), QIconSet(aPixmap),
1927 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
1928 this, SLOT(OnSelectionInfo()));
1930 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1931 createAction( 4066, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
1932 this, SLOT(OnTimeAnimation()));
1934 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1935 createAction( 4070, tr("MEN_ERASE_ALL"), QIconSet(aPixmap),
1936 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
1937 this, SLOT(OnEraseAll()));
1939 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1940 createAction( 4071, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
1941 tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
1942 //this, SLOT(OnEraseAll()));
1945 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1946 createAction( 4072, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
1947 tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
1948 //this, SLOT(OnEraseAll()));
1951 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1952 createAction( 4073, tr("MEN_SCALING"), QIconSet(aPixmap),
1953 tr("MEN_SCALING"), "", 0, aParent, false,
1954 this, SLOT(OnScaling()));
1961 // Add actions to menus
1963 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
1964 createMenu( separator(), aMenuId, 10 );
1965 createMenu( 112, aMenuId, 10 ); // import from file
1966 createMenu( 113, aMenuId, 10 ); // explore MED file
1967 createMenu( 199, aMenuId, 10 ); // import table
1969 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
1970 createMenu( 4011, aMenuId, 10 ); // scalar map
1971 createMenu( 4012, aMenuId, 10 ); // deformed shape
1972 createMenu( 4013, aMenuId, 10 ); // vectors
1973 createMenu( 4014, aMenuId, 10 ); // iso surfaces
1974 createMenu( 4015, aMenuId, 10 ); // cut planes
1975 createMenu( 4016, aMenuId, 10 ); // stream lines
1976 createMenu( 4018, aMenuId, 10 ); // cut lines
1978 aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 );
1979 createMenu( 4065, aMenuId, 10 ); // selection info
1981 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
1983 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
1984 createMenu( 4050, parentId, 10 ); // points
1985 createMenu( 4051, parentId, 10 ); // wireframe
1986 createMenu( 4052, parentId, 10 ); // surface
1987 createMenu( 4070, aMenuId, 10 ); // erase all
1988 createMenu( 4071, aMenuId, 10 ); // global selection
1989 createMenu( 4072, aMenuId, 10 ); // partial selection
1990 createMenu( 4073, aMenuId, 10 ); // scaling
1997 int aToolId = createTool(tr("TOOL_VISUALISATION"));
1998 createTool( 4011, aToolId );
1999 createTool( 4012, aToolId );
2000 createTool( 4013, aToolId );
2001 createTool( 4014, aToolId );
2002 createTool( 4015, aToolId );
2003 createTool( 4016, aToolId );
2004 createTool( 4018, aToolId );
2011 // Prepare popup menus
2012 QtxPopupMgr* mgr = popupMgr();
2014 // VISU root commands
2015 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
2016 mgr->insert( action( 112 ), -1, -1, -1 ); // import MED
2017 mgr->setRule( action( 112 ), aRule, true );
2018 mgr->insert( action( 199 ), -1, -1, -1 ); // import tables
2019 mgr->setRule( action( 199 ), aRule, true );
2020 mgr->insert( action( 4020 ), -1, -1, -1 ); // create Plot2d
2021 mgr->setRule( action( 4020 ), aRule, true );
2022 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
2023 mgr->insert( action( 4021 ), -1, -1, -1 ); // delete object
2024 mgr->setRule( action( 4021 ), aRule, true );
2026 // timestamp commands
2027 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
2028 mgr->insert( action( 4011 ), -1, -1, -1 ); // scalar bar
2029 mgr->setRule( action( 4011 ), aRule, true );
2030 mgr->insert( action( 4014 ), -1, -1, -1 ); // iso surface
2031 mgr->setRule( action( 4014 ), aRule, true );
2032 mgr->insert( action( 4015 ), -1, -1, -1 ); // cut planes
2033 mgr->setRule( action( 4015 ), aRule, true );
2034 mgr->insert( action( 4018 ), -1, -1, -1 ); // cut lines
2035 mgr->setRule( action( 4018 ), aRule, true );
2036 aRule += " and nbComponents>1";
2037 mgr->insert( action( 4012 ), -1, -1, -1 ); // deformed shape
2038 mgr->setRule( action( 4012 ), aRule, true );
2039 mgr->insert( action( 4013 ), -1, -1, -1 ); // vectors
2040 mgr->setRule( action( 4013 ), aRule, true );
2041 mgr->insert( action( 4016 ), -1, -1, -1 ); // stream lines
2042 mgr->setRule( action( 4016 ), aRule, true );
2044 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
2045 //mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
2046 //mgr->setRule( action( 4022 ), aRule, true );
2047 mgr->insert( action( 4023 ), -1, -1, -1 ); // show table
2048 mgr->setRule( action( 4023 ), aRule, true );
2049 mgr->insert( action( 4024 ), -1, -1, -1 ); // create curves
2050 mgr->setRule( action( 4024 ), aRule, true );
2051 mgr->insert( action( 4025 ), -1, -1, -1 ); // export table
2052 mgr->setRule( action( 4025 ), aRule, true );
2053 mgr->insert( separator(), -1, -1, -1 );
2054 aRule = "(client='ObjectBrowser' and selcount=1 and ((type='VISU::TTABLE' and nbChildren>0) "
2055 "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) "
2056 " or (selcount>0 and $type in {"
2057 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2058 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
2059 mgr->insert( action( 4030 ), -1, -1, -1 ); // erase
2060 mgr->setRule( action( 4030 ), aRule.arg(" and isVisible=1"), true );
2061 mgr->insert( action( 4031 ), -1, -1, -1 ); // display
2062 mgr->setRule( action( 4031 ), aRule.arg(" and isVisible=0"), true );
2063 mgr->insert( action( 4032 ), -1, -1, -1 ); // display only
2064 mgr->setRule( action( 4032 ), aRule.arg(""), true );
2066 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
2067 "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
2068 "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2069 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2070 mgr->insert( action( 4033 ), -1, -1, -1 ); // delete presentation
2071 mgr->setRule( action( 4033 ), aRule.arg(""), true );
2074 mgr->insert ( action( 4046 ), -1, -1, -1 ); // save view params
2075 //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
2076 mgr->setRule( action( 4046 ), "selcount=0", true ); //jfa tmp
2077 mgr->insert ( action( 4047 ), -1, -1, -1 ); // restore view params
2078 mgr->setRule( action( 4047 ), "selcount=1 and type='VISU::TVIEW3D'", true );
2079 mgr->insert ( action( 4048 ), -1, -1, -1 ); // delete view params
2080 mgr->setRule( action( 4048 ), "selcount=1 and type='VISU::TVIEW3D'", true );
2082 // 3D presentations commands
2083 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2084 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2085 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
2086 QString aSurfType = " and $type in {'VISU::TMESH'}";
2087 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2088 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
2089 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2090 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
2091 aRule = "selcount=1";
2093 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
2094 mgr->insert( action( 4050 ), parentId, -1, -1 ); // points
2095 mgr->setRule( action( 4050 ), aRule + aPrsType +
2096 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2097 mgr->insert( action( 4051 ), parentId, -1, -1 ); // wireframe
2098 mgr->setRule( action( 4051 ), aRule + aPrsType +
2099 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2100 mgr->insert( action( 4052 ), parentId, -1, -1 ); // surface
2101 mgr->setRule( action( 4052 ), aRule + aPrsType +
2102 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
2103 mgr->insert( action( 4053 ), parentId, -1, -1 ); // insideframe
2104 mgr->setRule( action( 4053 ), aRule + aInsideType +
2105 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
2106 mgr->insert( action( 4054 ), parentId, -1, -1 ); // surfaceframe
2107 mgr->setRule( action( 4054 ), aRule + aSurfType +
2108 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
2109 mgr->insert( action( 4055 ), parentId, -1, -1 ); // shrink
2110 mgr->setRule( action( 4055 ), aRule + aShrinkType + " and isShrunk=0", true );
2111 mgr->insert( action( 4056 ), parentId, -1, -1 ); // unshrink
2112 mgr->setRule( action( 4056 ), aRule + aShrinkType + " and isShrunk=1", true );
2114 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
2115 mgr->insert( action( 4057 ), parentId, -1, -1 ); // cell color
2116 mgr->setRule( action( 4057 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2117 mgr->insert( action( 4059 ), parentId, -1, -1 ); // edge color
2118 mgr->setRule( action( 4059 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
2119 mgr->insert( action( 4058 ), parentId, -1, -1 ); // color
2120 mgr->setRule( action( 4058 ), aRule + " and ((type='VISU::TMESH'"
2121 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
2122 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
2123 mgr->insert( action( 4060 ), parentId, -1, -1 ); // opacity
2124 mgr->setRule( action( 4060 ), aRule + aShrinkType + " and hasActor=1", true );
2125 mgr->insert( action( 4061 ), parentId, -1, -1 ); // line width
2126 mgr->setRule( action( 4061 ), aRule + aLineType + " and hasActor=1", true );
2129 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
2130 aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2131 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2133 aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
2134 mgr->insert ( action( 4041 ), -1, -1, -1 ); // rename
2135 mgr->setRule( action( 4041 ), aRule, true );
2137 // copy presentation command
2138 aRule = "selcount=1 and " + aPrsType;
2139 mgr->insert ( action( 4037 ), -1, -1, -1 ); // copy
2140 mgr->setRule( action( 4037 ), aRule, true );
2143 aRule = "selcount=1 and type='VISU::TCURVE'";
2144 mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties
2145 mgr->setRule( action( 4040 ), aRule, true );
2147 aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
2148 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
2149 aRule = "client='ObjectBrowser' and selcount>1";
2150 mgr->insert( action( 4034 ), -1, -1, -1 ); // display many
2151 mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
2152 mgr->insert( action( 4035 ), -1, -1, -1 ); // erase many
2153 mgr->setRule( action( 4035 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
2154 mgr->insert( action( 4036 ), -1, -1, -1 ); // display only many
2155 mgr->setRule( action( 4036 ), aRule + " and " + aCurveType, true );
2157 // curve container commands
2158 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
2159 mgr->insert( action( 4042 ), -1, -1, -1 ); // edit container
2160 mgr->setRule( action( 4042 ), aRule, true );
2161 //mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
2162 //mgr->setRule( action( 4043 ), aRule, true );
2163 mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container
2164 mgr->setRule( action( 4044 ), aRule, true );
2166 aRule = "selcount=1 and ";
2167 mgr->insert( action( 4062 ), -1, -1, -1 ); // edit prs
2168 mgr->setRule( action( 4062 ), aRule + aPrsType, true );
2170 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
2171 mgr->insert( action( 4063 ), -1, -1, -1 ); // create table
2172 mgr->setRule( action( 4063 ), aRule, true );
2174 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
2175 mgr->insert ( action( 4064 ), -1, -1, -1 ); // sweep
2176 mgr->setRule( action( 4064 ), aRule, true );
2178 // Selection info popup item
2179 aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
2180 mgr->insert( action( 4065 ), -1, -1, -1 ); // Selection info
2181 mgr->setRule( action( 4065 ), aRule, true );
2183 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
2184 mgr->insert( action( 4066 ), -1, -1, -1 ); // animation
2185 mgr->setRule( action( 4066 ), aRule, true );
2187 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
2188 mgr->insert( action( 4026 ), -1, -1, -1 ); // create presentation
2189 mgr->setRule( action( 4026 ), aRule + " and selcount=1", true );
2190 mgr->insert( action( 4027 ), -1, -1, -1 ); // create presentations
2191 mgr->setRule( action( 4027 ), aRule + " and selcount>1", true );
2196 windows( QMap<int, int>& theMap ) const
2199 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
2205 viewManagers( QStringList& theList ) const
2208 theList.append( SVTK_Viewer::Type() );
2216 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
2217 return QString(anIOR.in());
2223 activateModule( SUIT_Study* theStudy )
2225 SalomeApp_Module::activateModule( theStudy );
2227 setMenuShown( true );
2228 setToolShown( true );
2235 deactivateModule( SUIT_Study* theStudy )
2237 setMenuShown( false );
2238 setToolShown( false );
2240 SalomeApp_Module::deactivateModule( theStudy );
2244 SalomeApp_Selection*
2246 createSelection() const
2248 return new VisuGUI_Selection( (SalomeApp_Module*)this );
2255 return new VisuGUI();