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>
36 #include <vtkRenderer.h>
37 #include <vtkRenderWindow.h>
38 #include <vtkActorCollection.h>
40 #include "SALOME_LifeCycleCORBA.hxx"
42 #include "SUIT_ResourceMgr.h"
43 #include "SUIT_MessageBox.h"
45 #include "SUIT_ViewWindow.h"
46 #include "SUIT_ViewManager.h"
48 #include "CAM_Module.h"
50 #include "SVTK_RenderWindow.h"
51 #include "SVTK_ViewWindow.h"
53 #include "SVTK_ViewModel.h"
54 #include "SVTK_Functor.h"
56 #include "OB_Browser.h"
58 #include "SALOME_ListIO.hxx"
59 #include "SALOME_ListIteratorOfListIO.hxx"
61 #include "SalomeApp_Application.h"
62 #include "SalomeApp_DataModel.h"
63 #include "SalomeApp_Study.h"
64 #include "SalomeApp_SelectionMgr.h"
65 #include "SalomeApp_Selection.h"
67 #include "VISUConfig.hh"
68 #include "VISU_Gen_i.hh"
69 #include "VISU_Mesh_i.hh"
70 #include "VISU_Table_i.hh"
71 #include "VISU_Result_i.hh"
72 #include "VISU_View_i.hh"
73 #include "VISU_ViewManager_i.hh"
75 #include "VISU_Actor.h"
78 #include "VisuGUI_Tools.h"
79 #include "VisuGUI_PopupTools.h"
80 #include "VisuGUI_FileDlg.h"
81 #include "VisuGUI_Selection.h"
82 #include "VisuGUI_TimeAnimation.h"
83 #include "VisuGUI_EditContainerDlg.h"
85 #include "VISU_ScalarMap_i.hh"
86 #include "VisuGUI_ScalarBarDlg.h"
88 #include "VISU_DeformedShape_i.hh"
89 #include "VisuGUI_DeformedShapeDlg.h"
91 #include "VISU_IsoSurfaces_i.hh"
92 #include "VisuGUI_IsoSurfacesDlg.h"
94 #include "VISU_CutPlanes_i.hh"
95 #include "VisuGUI_CutPlanesDlg.h"
97 #include "VISU_CutLines_i.hh"
98 #include "VisuGUI_CutLinesDlg.h"
100 #include "VISU_StreamLines_i.hh"
101 #include "VisuGUI_StreamLinesDlg.h"
103 #include "VISU_Vectors_i.hh"
104 #include "VisuGUI_VectorsDlg.h"
106 #include "SALOMEconfig.h"
107 #include CORBA_SERVER_HEADER(MED_Gen)
109 #include "utilities.h"
111 using namespace VISU;
114 static int MYDEBUG = 1;
116 static int MYDEBUG = 0;
119 //////////////////////////////////////////////////
121 //////////////////////////////////////////////////
124 SalomeApp_Module( "VISU" )
138 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
139 CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
140 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
143 aFilter.append( tr("FLT_MED_FILES") );
144 aFilter.append( tr("FLT_ALL_FILES") );
146 QFileInfo aFileInfo =
147 SUIT_FileDlg::getFileName(GetDesktop(this),
150 tr("MEN_IMPORT_FROM_FILE"),
152 if(aFileInfo.exists()){
153 application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
155 VISU::Result_var aResult;
156 bool anIsBuild = aResourceMgr->booleanValue("Visu:BuildResult",false);
157 if(VisuGUI_FileDlg::IsBuild){
158 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
159 if(!CORBA::is_nil(aResult.in()))
160 if(Result_i* aRes = dynamic_cast<Result_i*>(GetServant(aResult).in())){
161 if(!aRes->IsPossible())
162 SUIT_MessageBox::warn1(GetDesktop(this),
164 tr("ERR_CANT_BUILD_PRESENTATION"),
170 aResourceMgr->setValue("Visu:BuildResult",false);
171 aResult = GetVisuGen(this)->ImportFile(aFileInfo.filePath());
172 aResourceMgr->setValue("Visu:BuildResult",anIsBuild);
175 if(CORBA::is_nil(aResult.in())) {
176 SUIT_MessageBox::warn1(GetDesktop(this),
178 tr("ERR_ERROR_IN_THE_FILE"),
181 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
192 if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
193 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
194 CheckLock(GetDSStudy(aStudy),this);
196 SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
199 aFilter.append( tr("FLT_MED_FILES") );
200 aFilter.append( tr("FLT_ALL_FILES") );
202 QFileInfo aFileInfo =
203 SUIT_FileDlg::getFileName(GetDesktop(this),
206 tr("MEN_EXPLORE_MED_FILE"),
208 if(aFileInfo.exists()){
209 application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
210 std::string aStudyName = aStudy->Name();
211 aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
212 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
220 OnImportTableFromFile()
222 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
223 CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
226 aFilter.append( tr("FLT_TABLE_FILES") );
227 aFilter.append( tr("FLT_ALL_FILES") );
229 QFileInfo aFileInfo =
230 SUIT_FileDlg::getFileName(GetDesktop(this),
233 tr("MEN_IMPORT_TABLE"),
235 if(aFileInfo.exists()){
236 application()->putInfo( tr("MEN_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
238 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath());
240 if(CORBA::is_nil(anObject.in())) {
241 SUIT_MessageBox::warn1(GetDesktop(this),
243 tr("ERR_ERROR_IN_THE_FILE"),
246 application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
253 template<class TPrs3d_i>
255 CreatePrs3d(SalomeApp_Module* theModule,
256 SALOMEDS::SObject_var theTimeStamp,
257 const char* theMeshName,
258 VISU::Entity theEntity,
259 const char* theFieldName,
262 VISU::Result_var aResult;
263 if(CheckResult(theModule,theTimeStamp,aResult)){
264 QApplication::setOverrideCursor(Qt::waitCursor);
265 typedef typename TPrs3d_i::TInterface TPrs3d;
266 typename TPrs3d::_var_type aPrs3d =
267 GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
268 (aResult,theMeshName,theEntity,theFieldName,theTimeId);
269 QApplication::restoreOverrideCursor();
270 if(!CORBA::is_nil(aPrs3d.in()))
271 return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
273 SUIT_MessageBox::warn1(GetDesktop(theModule),
274 QObject::tr("WRN_VISU"),
275 QObject::tr("ERR_CANT_BUILD_PRESENTATION"),
276 QObject::tr("BUT_OK") );
281 template<class TPrs3d_i, class TDlg, int IsDlgModal>
283 CreatePrs3d(SalomeApp_Module* theModule,
284 SALOMEDS::SObject_var theTimeStamp,
285 const Handle(SALOME_InteractiveObject)& theIO)
287 using namespace VISU;
288 Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
290 QString aType = Storable::FindValue(aMap,"myType",&isExist);
291 if(!isExist || aType.toInt() != TTIMESTAMP )
293 QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
294 QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
295 QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
296 QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
298 CreatePrs3d<TPrs3d_i>(theModule,
301 (Entity)anEntity.toInt(),
303 aTimeStampId.toInt());
305 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
306 int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
308 if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){
309 aDlg->initFromPrsObject(aPrs3d);
311 if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
314 DeletePrs3d(theModule,aPrs3d,theIO);
324 PublishInView(theModule,aPrs3d);
331 template<class TPrs3d_i, class TDlg, int IsDlgModal>
333 CreatePrs3d(SalomeApp_Module* theModule)
335 if(CheckLock(GetDSStudy(GetCStudy(GetAppStudy(theModule))),theModule))
338 SALOMEDS::SObject_var aTimeStampSObj;
339 Handle(SALOME_InteractiveObject) anIO;
340 if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
343 if(!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
346 theModule->application()->putInfo(QObject::tr("INF_DONE"));
347 theModule->updateObjBrowser();
349 if(SVTK_ViewWindow* aView = GetViewWindow(theModule))
357 SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
358 if (CheckLock(aStudy, this))
361 // Get selected SObject
362 SALOMEDS::SObject_var aResultSObj;
363 Handle(SALOME_InteractiveObject) anIO;
364 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
365 if (anIO.IsNull() || !anIO->hasEntry())
368 aResultSObj = aStudy->FindObjectID(anIO->getEntry());
371 VISU::Result_var aResult;
372 VISU::Result_i* pResult = CheckResult(this, aResultSObj, aResult);
376 Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
378 string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
382 CORBA::Object_var aMesh;
383 string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
388 if (aComment == "ENTITY") {
389 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt();
390 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
391 aMesh = GetVisuGen(this)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
392 } else if (aComment == "FAMILY") {
393 VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt();
394 string aFamilyName = Storable::FindValue(aMap,"myName").latin1();
395 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
396 aMesh = GetVisuGen(this)->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
397 } else if (aComment == "GROUP") {
398 string aGroupName = Storable::FindValue(aMap,"myName").latin1();
399 if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
400 aMesh = GetVisuGen(this)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
404 MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
408 QApplication::restoreOverrideCursor();
409 VISU::Mesh_i* pPresent = NULL;
410 if (!CORBA::is_nil(aMesh))
411 pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
412 if (pPresent == NULL) {
413 SUIT_MessageBox::warn1 (GetDesktop(this),
415 tr("ERR_CANT_BUILD_PRESENTATION"),
420 if (SVTK_ViewWindow* aView = GetViewWindow(this)){
426 PublishInView(this, pPresent);
430 MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
433 application()->putInfo(QObject::tr("INF_DONE"));
434 } catch (std::runtime_error& exc) {
436 SUIT_MessageBox::warn1 (GetDesktop(this),
438 tr("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
448 CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
454 OnCreateDeformedShape()
456 CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
463 CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
468 OnCreateIsoSurfaces()
470 CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
477 CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,1>(this);
484 CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,1>(this);
489 OnCreateStreamLines()
491 CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
504 CheckLock(GetDSStudy(GetCStudy(GetAppStudy(this))),this);
505 GetVisuGen( this )->CreateContainer();
513 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
514 Handle(SALOME_InteractiveObject) anIO;
515 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
516 if ( !CORBA::is_nil( anObject ) ) {
517 // is it Prs3d object ?
518 VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
520 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
521 UpdateViewer( this, aPrsObject );
522 if (SVTK_ViewWindow* vw = GetViewWindow( this )) {
523 vw->getRenderer()->ResetCameraClippingRange();
525 vw->highlight(anIO, 1);
530 VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
532 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
533 PlotCurve( this, aCurve, VISU::eDisplay );
537 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
539 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
540 PlotContainer(aContainer, VISU::eDisplay );
544 VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
546 if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
547 PlotTable(aTable, VISU::eDisplay );
559 void VisuGUI::ErasePrs (CORBA::Object_ptr theObject)
561 if (MYDEBUG) MESSAGE("ErasePrs");
563 if ( !CORBA::is_nil( theObject ) ) {
564 VISU::Base_var aBase = VISU::Base::_narrow(theObject);
565 if ( CORBA::is_nil( aBase ) ) return;
566 VISU::VISUType aType = aBase->GetType();
569 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
570 PlotCurve(this, aCurve, VISU::eErase );
573 case VISU::TCONTAINER:{
574 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
575 PlotContainer(this, aContainer, VISU::eErase );
579 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
580 PlotTable(this, aTable, VISU::eErase );
584 if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
585 ErasePrs3d( this, aPrsObject );
586 if (SVTK_ViewWindow* vw = GetViewWindow( this ))
598 if(MYDEBUG) MESSAGE("OnErasePrs");
599 Handle(SALOME_InteractiveObject) anIO;
600 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
630 OnDisplayOnlyManyPrs()
678 OnChangeWireframeColor()
704 Handle(SALOME_InteractiveObject) anIO;
705 CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
706 _PTR(Study) aStudy = GetCStudy( GetAppStudy( this ) );
707 _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
708 VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
709 if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
710 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
719 SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
720 if (CheckLock(aStudy, this))
723 Handle(SALOME_InteractiveObject) anIO;
724 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
725 if (anIO.IsNull() || !anIO->hasEntry())
728 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
729 if (!aSObject->_is_nil()) {
730 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
731 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
732 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
733 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
736 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
737 // There is a transaction
738 aStudyBuilder->NewCommand();
739 CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
740 if (!CORBA::is_nil(anObj)) {
741 VISU::Base_var aBase = VISU::Base::_narrow(anObj);
742 if (!CORBA::is_nil(aBase)) {
743 VISU::VISUType aType = aBase->GetType();
747 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
748 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
749 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
750 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
751 if (CORBA::is_nil(aChildObj)) continue;
752 VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
753 if (CORBA::is_nil(aPrs3d)) continue;
754 VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
755 //jfa tmp:DeletePresentation(pPrs3d);
761 SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
762 for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
763 SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
764 CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
765 if (CORBA::is_nil(aChildObj)) continue;
766 CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
767 if (CORBA::is_nil(aCurve)) continue;
768 VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
769 //jfa tmp:DeletePresentation(pCurve);
776 aStudyBuilder->RemoveObjectWithChildren(aSObject);
777 aStudyBuilder->CommitCommand();
778 //jfa tmp:GetActiveStudy()->unHighlightAll();
779 updateObjBrowser(true);
799 SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(this)));
800 if (CheckLock(aStudy, this))
803 Handle(SALOME_InteractiveObject) anIO;
804 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
805 if (anIO.IsNull() || CORBA::is_nil(anObject))
808 VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
809 if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
811 CORBA::Object_ptr aCnt = VISU::Container::_narrow(anObject);
812 if (!CORBA::is_nil(aCnt)) {
813 VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
814 if (container && container->GetNbCurves() > 0) {
826 Handle(SALOME_InteractiveObject) anIO;
827 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
828 if (CORBA::is_nil(anObject)) return;
830 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
831 if (!aServant.in()) return;
832 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
833 if (!aContainer) return;
835 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this));
836 aDlg->initFromPrsObject(aContainer);
838 aDlg->storeToPrsObject(aContainer);
839 updateObjBrowser(true);
848 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
849 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
850 if (CheckLock(aStudy, this))
853 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
854 if (aViewMgr->getType() != SVTK_Viewer::Type())
857 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
858 SALOME_ListIO aListIO;
859 aSelectionMgr->selectedObjects(aListIO);
860 if (aListIO.Extent() > 1)
863 if (aListIO.Extent() == 0) {
864 VISU::View3D_i::SaveViewParams(aViewMgr, VISU::View3D_i::GenerateViewParamsName().latin1());
866 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
867 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
874 OnRestoreViewParams()
876 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
877 if (aViewMgr->getType() != SVTK_Viewer::Type())
880 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
881 SALOME_ListIO aListIO;
882 aSelectionMgr->selectedObjects(aListIO);
883 if (aListIO.Extent() != 1)
886 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
887 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
888 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
889 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
890 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
897 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
898 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
899 if (CheckLock(aStudy, this))
902 Handle(SALOME_InteractiveObject) anIO;
903 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
904 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
905 if (!aSObject) return;
907 VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
908 if (aType == VISU::TVIEW3D) {
909 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
910 SALOME_ListIO aListIO, aNewListIO;
911 aSelectionMgr->selectedObjects(aListIO);
912 for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
913 if (it.Value()->getEntry() != anIO->getEntry()) {
914 aNewListIO.Append(it.Value());
917 aSelectionMgr->setSelectedObjects(aNewListIO);
919 aCStudy->NewBuilder()->RemoveObject(aSObject);
948 Handle(SALOME_InteractiveObject) anIO;
949 CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
950 if (CORBA::is_nil(anObject)) return;
951 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
952 if (!aServant.in()) return;
954 VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
955 if (!aPrsObject) return;
957 SVTK_ViewWindow* vw = GetViewWindow();
960 VISU_Actor* aActor = GetActor(aPrsObject, vw);
963 if (!aActor->GetVisibility()) {
964 aActor->VisibilityOn();
967 // Get sweep parameters
968 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
970 double aTempoDbl = aResourceMgr->doubleValue("Visu:SweepTempo", 0.1);
971 int aTemp = int(1.E6 * aTempoDbl);
973 int aCycles = aResourceMgr->integerValue("Visu:SweepCycles", 1);
974 int aSteps = aResourceMgr->integerValue("Visu:SweepSteps", 40);
977 QApplication::setOverrideCursor(Qt::waitCursor);
979 for (int j = 0; j < aCycles; j++) {
980 for (int i = 0; i <= aSteps; i++) {
981 float aPercents = float(i)/aSteps;
982 aPrsObject->SetMapScale(aPercents);
983 aPrsObject->UpdateActor(aActor);
984 vw->getRenderWindow()->getRenderWindow()->Render();
988 } catch (std::exception& exc) {
989 INFOS("Follow exception was occured :\n" << exc.what());
991 INFOS("Unknown exception was occured!");
993 QApplication::restoreOverrideCursor();
1000 _PTR(Study) aStudyDS = GetCStudy(GetAppStudy(this));
1001 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1002 new VisuGUI_TimeAnimationDlg(GetDesktop(this), aStudyDS);
1004 SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1005 SALOME_ListIO aListIO;
1006 aSelectionMgr->selectedObjects(aListIO);
1008 bool isDefined = false;
1010 SALOME_ListIteratorOfListIO It (aListIO);
1011 for (; It.More(); It.Next()) {
1012 _PTR(SObject) aSObject = aStudyDS->FindObjectID(It.Value()->getEntry());
1013 if (!aSObject) continue;
1014 if (getValue(aSObject, "myComment") == QString("FIELD")) {
1015 long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
1019 aAnimationDlg->addField(aSObject);
1021 } else if (aNbTimes == aNumber) {
1022 aAnimationDlg->addField(aSObject);
1027 if (isDefined) aAnimationDlg->show();
1028 else delete aAnimationDlg;
1033 OnCopyPresentation()
1041 //mySelectionDlg = new VisuGUI_SelectionDlg();
1042 //mySelectionDlg->show();
1043 (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
1048 initialize( CAM_Application* theApp )
1050 SalomeApp_Module::initialize( theApp );
1063 QWidget* aParent = application()->desktop();
1064 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1067 createAction( 112, "", QIconSet(), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
1068 this, SLOT(OnImportFromFile()));
1069 createAction( 113, "", QIconSet(), tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
1070 this, SLOT(OnExploreMEDFile()));
1071 createAction( 199, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
1072 this, SLOT(OnImportTableFromFile()));
1074 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
1075 createAction( 4011, tr("MEN_SCALAR_MAP"), QIconSet(aPixmap), tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
1076 this, SLOT(OnCreateScalarMap()));
1078 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
1079 createAction( 4012, tr("MEN_DEFORMED_SHAPE"), QIconSet(aPixmap), tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
1080 this, SLOT(OnCreateDeformedShape()));
1082 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
1083 createAction( 4013, tr("MEN_VECTORS"), QIconSet(aPixmap), tr("MEN_VECTORS"), "", 0, aParent, false,
1084 this, SLOT(OnCreateVectors()));
1086 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
1087 createAction( 4014, tr("MEN_ISO_SURFACES"), QIconSet(aPixmap), tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
1088 this, SLOT(OnCreateIsoSurfaces()));
1090 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
1091 createAction( 4015, tr("MEN_CUT_PLANES"), QIconSet(aPixmap), tr("MEN_CUT_PLANES"), "", 0, aParent, false,
1092 this, SLOT(OnCreateCutPlanes()));
1094 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
1095 createAction( 4016, tr("MEN_STREAM_LINES"), QIconSet(aPixmap), tr("MEN_STREAM_LINES"), "", 0, aParent, false,
1096 this, SLOT(OnCreateStreamLines()));
1098 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
1099 createAction( 4018, tr("MEN_CUT_LINES"), QIconSet(aPixmap), tr("MEN_CUT_LINES"), "", 0, aParent, false,
1100 this, SLOT(OnCreateCutLines()));
1102 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1103 createAction( 4020, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
1104 this, SLOT(OnCreatePlot2dView()));
1106 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1107 createAction( 4021, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
1108 this, SLOT(OnDeleteObject()));
1110 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1111 createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
1112 this, SLOT(OnRenameTable()));
1114 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1115 createAction( 4023, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
1116 this, SLOT(OnShowTable()));
1118 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1119 createAction( 4024, tr("MEN_CREATE_CURVES"), QIconSet(aPixmap), tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
1120 this, SLOT(OnPlotData()));
1122 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1123 createAction( 4025, tr("MEN_EXPORT_TABLE"), QIconSet(aPixmap), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
1124 this, SLOT(OnExportTableToFile()));
1126 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1127 createAction( 4026, tr("MEN_CREATE_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
1128 this, SLOT(OnCreateMesh()));
1130 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1131 createAction( 4027, tr("MEN_CREATE_MANY_PRS"), QIconSet(aPixmap), tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
1132 this, SLOT(OnCreateManyMesh()));
1134 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1135 createAction( 4030, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1136 this, SLOT(OnErasePrs()));
1138 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1139 createAction( 4031, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1140 this, SLOT(OnDisplayPrs()));
1142 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1143 createAction( 4032, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1144 this, SLOT(OnDisplayOnlyPrs()));
1146 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1147 createAction( 4033, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1148 this, SLOT(OnDeletePrs()));
1150 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1151 createAction( 4034, tr("MEN_DISPLAY"), QIconSet(aPixmap), tr("MEN_DISPLAY"), "", 0, aParent, false,
1152 this, SLOT(OnDisplayManyPrs()));
1154 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1155 createAction( 4035, tr("MEN_ERASE"), QIconSet(aPixmap), tr("MEN_ERASE"), "", 0, aParent, false,
1156 this, SLOT(OnEraseManyPrs()));
1158 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1159 createAction( 4036, tr("MEN_DISPLAY_ONLY"), QIconSet(aPixmap), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
1160 this, SLOT(OnDisplayOnlyManyPrs()));
1162 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1163 createAction( 4037, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
1164 this, SLOT(OnCopyPresentation()));
1166 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1167 createAction( 4040, tr("MEN_CURVE_PROPS"), QIconSet(aPixmap), tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
1168 this, SLOT(OnCurveProperties()));
1170 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1171 createAction( 4041, tr("MEN_RENAME"), QIconSet(aPixmap), tr("MEN_RENAME"), "", 0, aParent, false,
1172 this, SLOT(OnRename()));
1174 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1175 createAction( 4042, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
1176 this, SLOT(OnEditContainer()));
1178 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1179 createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
1180 this, SLOT(OnRenameContainer()));
1182 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1183 createAction( 4044, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
1184 this, SLOT(OnClearContainer()));
1186 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1187 createAction( 4046, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(aPixmap),
1188 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
1189 this, SLOT(OnSaveViewParams()));
1191 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1192 createAction( 4047, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(aPixmap),
1193 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
1194 this, SLOT(OnRestoreViewParams()));
1196 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1197 createAction( 4048, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(aPixmap),
1198 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
1199 this, SLOT(OnDeleteViewParams()));
1201 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1202 createAction( 4050, tr("MEN_POINTS"), QIconSet(aPixmap), tr("MEN_POINTS"), "", 0, aParent, false,
1203 this, SLOT(OnMakePoints()));
1205 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1206 createAction( 4051, tr("MEN_WIREFRAME"), QIconSet(aPixmap), tr("MEN_WIREFRAME"), "", 0, aParent, false,
1207 this, SLOT(OnMakeWireframe()));
1209 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1210 createAction( 4052, tr("MEN_SURFACE"), QIconSet(aPixmap), tr("MEN_SURFACE"), "", 0, aParent, false,
1211 this, SLOT(OnMakeSurface()));
1213 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1214 createAction( 4053, tr("MEN_INSIDEFRAME"), QIconSet(aPixmap), tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
1215 this, SLOT(OnMakeInsideframe()));
1217 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1218 createAction( 4054, tr("MEN_SURFACEFRAME"), QIconSet(aPixmap), tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
1219 this, SLOT(OnMakeSurfaceframe()));
1221 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1222 createAction( 4055, tr("MEN_SHRINK"), QIconSet(aPixmap), tr("MEN_SHRINK"), "", 0, aParent, false,
1223 this, SLOT(OnMakeShrink()));
1225 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1226 createAction( 4056, tr("MEN_UNSHRINK"), QIconSet(aPixmap), tr("MEN_UNSHRINK"), "", 0, aParent, false,
1227 this, SLOT(OnMakeShrink()));
1229 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1230 createAction( 4057, tr("MEN_CELL_COLOR"), QIconSet(aPixmap), tr("MEN_CELL_COLOR"), "", 0, aParent, false,
1231 this, SLOT(OnChangeColor()));
1233 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1234 createAction( 4058, tr("MEN_COLOR"), QIconSet(aPixmap), tr("MEN_COLOR"), "", 0, aParent, false,
1235 this, SLOT(OnChangeColor()));
1237 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1238 createAction( 4059, tr("MEN_EDGE_COLOR"), QIconSet(aPixmap), tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
1239 this, SLOT(OnChangeWireframeColor()));
1241 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1242 createAction( 4060, tr("MEN_OPACITY"), QIconSet(aPixmap), tr("MEN_OPACITY"), "", 0, aParent, false,
1243 this, SLOT(OnChangeOpacity()));
1245 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1246 createAction( 4061, tr("MEN_LINE_WIDTH"), QIconSet(aPixmap), tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
1247 this, SLOT(OnChangeLines()));
1249 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1250 createAction( 4062, tr("MEN_EDIT_PRS"), QIconSet(aPixmap), tr("MEN_EDIT_PRS"), "", 0, aParent, false,
1251 this, SLOT(OnEditPrs()));
1253 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1254 createAction( 4063, tr("MEN_CREATE_TABLE"), QIconSet(aPixmap), tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
1255 this, SLOT(OnCreateTable()));
1257 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1258 createAction( 4064, tr("MEN_SWEEP"), QIconSet(aPixmap), tr("MEN_SWEEP"), "", 0, aParent, false,
1259 this, SLOT(OnSweep()));
1261 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1262 createAction( 4065, tr("MEN_SELECTION_INFO"), QIconSet(aPixmap),
1263 tr("MEN_SELECTION_INFO"), "", 0, aParent, false,
1264 this, SLOT(OnSelectionInfo()));
1266 aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
1267 createAction( 4066, tr("MEN_ANIMATION"), QIconSet(aPixmap), tr("MEN_ANIMATION"), "", 0, aParent, false,
1268 this, SLOT(OnTimeAnimation()));
1275 // Add actions to menus
1277 aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
1278 createMenu( separator(), aMenuId, 10 );
1279 createMenu( 112, aMenuId, 10 );
1280 createMenu( 113, aMenuId, 10 );
1281 createMenu( 199, aMenuId, 10 );
1283 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
1284 //aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, 90 );
1285 createMenu( 4011, aMenuId, 10 );
1286 createMenu( 4012, aMenuId, 10 );
1287 createMenu( 4013, aMenuId, 10 );
1288 createMenu( 4014, aMenuId, 10 );
1289 createMenu( 4015, aMenuId, 10 );
1290 createMenu( 4016, aMenuId, 10 );
1291 createMenu( 4018, aMenuId, 10 );
1292 createMenu( 4065, aMenuId, 10 );
1299 int aToolId = createTool(tr("TOOL_VISUALISATION"));
1300 createTool( 4011, aToolId );
1301 createTool( 4012, aToolId );
1302 createTool( 4013, aToolId );
1303 createTool( 4014, aToolId );
1304 createTool( 4015, aToolId );
1305 createTool( 4016, aToolId );
1306 createTool( 4018, aToolId );
1313 // Prepare popup menus
1314 QtxPopupMgr* mgr = popupMgr();
1316 // VISU root commands
1317 QString aRule( "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'" );
1318 mgr->insert( action( 112 ), -1, -1, -1 ); // import MED
1319 mgr->setRule( action( 112 ), aRule, true );
1320 mgr->insert( action( 199 ), -1, -1, -1 ); // import tables
1321 mgr->setRule( action( 199 ), aRule, true );
1322 mgr->insert( action( 4020 ), -1, -1, -1 ); // create Plot2d
1323 mgr->setRule( action( 4020 ), aRule, true );
1324 aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
1325 mgr->insert( action( 4021 ), -1, -1, -1 ); // delete object
1326 mgr->setRule( action( 4021 ), aRule, true );
1328 // timestamp commands
1329 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
1330 mgr->insert( action( 4011 ), -1, -1, -1 ); // scalar bar
1331 mgr->setRule( action( 4011 ), aRule, true );
1332 mgr->insert( action( 4014 ), -1, -1, -1 ); // iso surface
1333 mgr->setRule( action( 4014 ), aRule, true );
1334 mgr->insert( action( 4015 ), -1, -1, -1 ); // cut planes
1335 mgr->setRule( action( 4015 ), aRule, true );
1336 mgr->insert( action( 4018 ), -1, -1, -1 ); // cut lines
1337 mgr->setRule( action( 4018 ), aRule, true );
1338 aRule += " and nbComponents>1";
1339 mgr->insert( action( 4012 ), -1, -1, -1 ); // deformed shape
1340 mgr->setRule( action( 4012 ), aRule, true );
1341 mgr->insert( action( 4013 ), -1, -1, -1 ); // vectors
1342 mgr->setRule( action( 4013 ), aRule, true );
1343 mgr->insert( action( 4016 ), -1, -1, -1 ); // stream lines
1344 mgr->setRule( action( 4016 ), aRule, true );
1346 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
1347 mgr->insert( action( 4022 ), -1, -1, -1 ); // rename table
1348 mgr->setRule( action( 4022 ), aRule, true );
1349 mgr->insert( action( 4023 ), -1, -1, -1 ); // show table
1350 mgr->setRule( action( 4023 ), aRule, true );
1351 mgr->insert( action( 4024 ), -1, -1, -1 ); // create curves
1352 mgr->setRule( action( 4024 ), aRule, true );
1353 mgr->insert( action( 4025 ), -1, -1, -1 ); // export table
1354 mgr->setRule( action( 4025 ), aRule, true );
1355 mgr->insert( separator(), -1, -1, -1 );
1356 aRule = "(client='ObjectBrowser' and selcount=1 and ((type='VISU::TTABLE' and nbChildren>0) "
1357 "or (type='VISU::TCURVE'%1) or (type='VISU::TCONTAINER'))) "
1358 " or (selcount>0 and $type in {"
1359 "'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
1360 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'})";
1361 mgr->insert( action( 4030 ), -1, -1, -1 ); // erase
1362 mgr->setRule( action( 4030 ), aRule.arg(" and isVisible=1"), true );
1363 mgr->insert( action( 4031 ), -1, -1, -1 ); // display
1364 mgr->setRule( action( 4031 ), aRule.arg(" and isVisible=0"), true );
1365 mgr->insert( action( 4032 ), -1, -1, -1 ); // display only
1366 mgr->setRule( action( 4032 ), aRule.arg(""), true );
1369 mgr->insert ( action( 4046 ), -1, -1, -1 ); // save view params
1370 //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
1371 mgr->setRule( action( 4046 ), "selcount=0", true ); //jfa tmp
1372 mgr->insert ( action( 4047 ), -1, -1, -1 ); // restore view params
1373 mgr->setRule( action( 4047 ), "selcount=1 and type='VISU::TVIEW3D'", true );
1374 mgr->insert ( action( 4048 ), -1, -1, -1 ); // delete view params
1375 mgr->setRule( action( 4048 ), "selcount=1 and type='VISU::TVIEW3D'", true );
1377 // 3D presentations commands
1378 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
1379 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
1380 QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}";
1381 QString aSurfType = " and $type in {'VISU::TMESH'}";
1382 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
1383 "'VISU::TCUTPLANES' 'VISU::TCUTLINES'}";
1384 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
1385 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES'}";
1386 aRule = "selcount=1";
1388 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 ); // "Representation" submenu
1389 mgr->insert( action( 4050 ), parentId, -1, -1 ); // points
1390 mgr->setRule( action( 4050 ), aRule + aPrsType +
1391 " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
1392 mgr->insert( action( 4051 ), parentId, -1, -1 ); // wireframe
1393 mgr->setRule( action( 4051 ), aRule + aPrsType +
1394 " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
1395 mgr->insert( action( 4052 ), parentId, -1, -1 ); // surface
1396 mgr->setRule( action( 4052 ), aRule + aPrsType +
1397 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}", true );
1398 mgr->insert( action( 4053 ), parentId, -1, -1 ); // insideframe
1399 mgr->setRule( action( 4053 ), aRule + aInsideType +
1400 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}", true );
1401 mgr->insert( action( 4054 ), parentId, -1, -1 ); // surfaceframe
1402 mgr->setRule( action( 4054 ), aRule + aSurfType +
1403 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}", true );
1404 mgr->insert( action( 4055 ), parentId, -1, -1 ); // shrink
1405 mgr->setRule( action( 4055 ), aRule + aShrinkType + " and isShrunk=0", true );
1406 mgr->insert( action( 4056 ), parentId, -1, -1 ); // unshrink
1407 mgr->setRule( action( 4056 ), aRule + aShrinkType + " and isShrunk=1", true );
1409 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 ); // "Properties" submenu
1410 mgr->insert( action( 4057 ), parentId, -1, -1 ); // cell color
1411 mgr->setRule( action( 4057 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
1412 mgr->insert( action( 4059 ), parentId, -1, -1 ); // edge color
1413 mgr->setRule( action( 4059 ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
1414 mgr->insert( action( 4058 ), parentId, -1, -1 ); // color
1415 mgr->setRule( action( 4058 ), aRule + " and ((type='VISU::TMESH'"
1416 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
1417 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true );
1418 mgr->insert( action( 4060 ), parentId, -1, -1 ); // opacity
1419 mgr->setRule( action( 4060 ), aRule + aShrinkType + " and hasActor=1", true );
1420 mgr->insert( action( 4061 ), parentId, -1, -1 ); // line width
1421 mgr->setRule( action( 4061 ), aRule + aLineType + " and hasActor=1", true );
1424 aRule = "selcount=1 and type='VISU::TCURVE'";
1425 mgr->insert( action( 4040 ), -1, -1, -1 ); // curve properties
1426 mgr->setRule( action( 4040 ), aRule, true );
1427 mgr->insert( action( 4041 ), -1, -1, -1 ); // rename curve
1428 mgr->setRule( action( 4041 ), aRule, true );
1429 QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
1430 aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
1431 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
1432 aRule = "client='ObjectBrowser' and selcount>1";
1433 mgr->insert( action( 4034 ), -1, -1, -1 ); // display many
1434 mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
1435 mgr->insert( action( 4035 ), -1, -1, -1 ); // erase many
1436 mgr->setRule( action( 4035 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
1437 mgr->insert( action( 4036 ), -1, -1, -1 ); // display only many
1438 mgr->setRule( action( 4036 ), aRule + " and " + aCurveType, true );
1440 // curve container commands
1441 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
1442 mgr->insert( action( 4042 ), -1, -1, -1 ); // edit container
1443 mgr->setRule( action( 4042 ), aRule, true );
1444 mgr->insert( action( 4043 ), -1, -1, -1 ); // rename container
1445 mgr->setRule( action( 4043 ), aRule, true );
1446 mgr->insert( action( 4044 ), -1, -1, -1 ); // clear container
1447 mgr->setRule( action( 4044 ), aRule, true );
1449 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
1450 mgr->insert( action( 4063 ), -1, -1, -1 ); // create table
1451 mgr->setRule( action( 4063 ), aRule, true );
1453 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TSCALARMAP'";
1454 mgr->insert ( action( 4064 ), -1, -1, -1 ); // sweep
1455 mgr->setRule( action( 4064 ), aRule, true );
1457 // Selection info popup item
1458 aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
1459 mgr->insert( action( 4065 ), -1, -1, -1 ); // Selection info
1460 mgr->setRule( action( 4065 ), aRule, true );
1462 aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
1463 mgr->insert( action( 4066 ), -1, -1, -1 ); // animation
1464 mgr->setRule( action( 4066 ), aRule, true );
1466 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
1467 mgr->insert( action( 4026 ), -1, -1, -1 ); // create presentation
1468 mgr->setRule( action( 4026 ), aRule + " and selcount=1", true );
1469 mgr->insert( action( 4027 ), -1, -1, -1 ); // create presentations
1470 mgr->setRule( action( 4027 ), aRule + " and selcount>1", true );
1475 windows( QMap<int, int>& theMap ) const
1478 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
1484 viewManagers( QStringList& theList ) const
1487 theList.append( SVTK_Viewer::Type() );
1495 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
1496 return QString(anIOR.in());
1502 activateModule( SUIT_Study* theStudy )
1504 SalomeApp_Module::activateModule( theStudy );
1506 setMenuShown( true );
1507 setToolShown( true );
1514 deactivateModule( SUIT_Study* theStudy )
1516 setMenuShown( false );
1517 setToolShown( false );
1519 SalomeApp_Module::deactivateModule( theStudy );
1523 SalomeApp_Selection*
1525 createSelection() const
1527 return new VisuGUI_Selection( (SalomeApp_Module*)this );
1534 return new VisuGUI();