-// VISU VISUGUI : GUI of VISU component
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// VISU VISUGUI : GUI of VISU component
// File : VisuGUI.cxx
-// Author : Laurent CORNABE
+// Author :
// Module : VISU
-// $Header$
+
+#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
+#ifdef HAVE_FINITE
+#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
+#endif
+#include "Python.h"
#include "VisuGUI.h"
-#include "VISU_Gen_i.hh"
-#include "VISU_Result_i.hh"
-#include "VISU_PrsObject_i.hh"
-#include "VISU_ViewManager_i.hh"
+// STL Includes
+#include <exception>
+#include <typeinfo>
+#include <vector>
+
+// QT Includes
+#include <QList>
+#include <QVector>
+#include <QColorDialog>
+#include <QDateTime>
+#include <QMenu>
+
+// VTK Includes
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkActorCollection.h>
+#include <vtkTimerLog.h>
+
+// SALOME Includes
+#include "SALOME_LifeCycleCORBA.hxx"
-#include "VISU_PipeLine.hxx"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
-#include "VISU_Prs3d_i.hh"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_DataBrowser.h"
+#include "SUIT_OverrideCursor.h"
+
+#include "CAM_Module.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_Functor.h"
+//#include "SVTK_MainWindow.h"
+
+#include "VTKViewer_Algorithm.h"
+#include "VTKViewer_MarkerDlg.h"
+
+#include "SPlot2d_ViewModel.h"
+#include "VisuGUI_SetupPlot2dDlg.h"
+#include "Plot2d_SetupCurveDlg.h"
+#include "Plot2d_ViewManager.h"
+#include "Plot2d_SetupCurveScaleDlg.h"
+
+#include "QtxPagePrefMgr.h"
+#include "OB_Browser.h"
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_DataModel.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_DataObject.h"
+#include "SalomeApp_CheckFileDlg.h"
+
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_Selection.h"
+#include "LightApp_Preferences.h"
+#include "LightApp_DataOwner.h"
+
+#include "QtxAction.h"
+#include "QtxFontEdit.h"
+
+#include "VISUConfig.hh"
+#include "VISU_Gen_i.hh"
#include "VISU_Mesh_i.hh"
-#include "VISU_ScalarMap_i.hh"
-#include "VISU_IsoSurfaces_i.hh"
-#include "VISU_DeformedShape_i.hh"
-#include "VISU_CutPlanes_i.hh"
-#include "VISU_CutLines_i.hh"
-#include "VISU_Vectors_i.hh"
-#include "VISU_StreamLines_i.hh"
#include "VISU_Table_i.hh"
+#include "VISU_PointMap3d_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_View_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_Plot3D_i.hh"
#include "VISU_Actor.h"
-#include "VISU_MeshAct.h"
-#include "VisuGUI_MagnitudeDlg.h"
+#include "VisuGUI_Prs3dTools.h"
+#include "VisuGUI_Tools.h"
+
+#include "VisuGUI_SelectionPanel.h"
+#include "VisuGUI_FeatureEdgesPanel.h"
+#include "VisuGUI_NameDlg.h"
#include "VisuGUI_CursorDlg.h"
+#include "VisuGUI_Selection.h"
+#include "VisuGUI_TimeAnimation.h"
+#include "VisuGUI_EvolutionDlg.h"
+#include "VisuGUI_EditContainerDlg.h"
+#include "VisuGUI_ClippingDlg.h"
+#include "VisuGUI_Plot3DDlg.h"
+#include "VisuGUI_OffsetDlg.h"
+#include "VisuGUI_Displayer.h"
+#include "VisuGUI_BuildProgressDlg.h"
+#include "VisuGUI_TransparencyDlg.h"
+#include "VisuGUI_ShrinkFactorDlg.h"
+//#include "VisuGUI_CacheDlg.h"
+#include "VisuGUI_Table3dDlg.h"
+#include "VisuGUI_ClippingPanel.h"
+#include "VisuGUI_FilterScalarsDlg.h"
+
+#include "VISU_ScalarMap_i.hh"
#include "VisuGUI_ScalarBarDlg.h"
-#include "VisuGUI_SweepPrefDlg.h"
+
+#include "VISU_DeformedShape_i.hh"
+#include "VisuGUI_DeformedShapeDlg.h"
+
+#include "VISU_DeformedShapeAndScalarMap_i.hh"
+#include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
+
+#include "VISU_IsoSurfaces_i.hh"
+#include "VisuGUI_IsoSurfacesDlg.h"
+
+#include "VISU_CutPlanes_i.hh"
#include "VisuGUI_CutPlanesDlg.h"
+
+#include "VISU_CutLines_i.hh"
#include "VisuGUI_CutLinesDlg.h"
-#include "VisuGUI_VectorsDlg.h"
-#include "VisuGUI_IsoSurfacesDlg.h"
+
+#include "VISU_CutSegment_i.hh"
+#include "VisuGUI_CutSegmentDlg.h"
+
+#include "VISU_StreamLines_i.hh"
#include "VisuGUI_StreamLinesDlg.h"
-#include "VisuGUI_EditContainerDlg.h"
-#include "VisuGUI_TimeAnimation.h"
-#include "VisuGUI_Selection.h"
-#include "VisuGUI_NonIsometricDlg.h"
+#include "VISU_Vectors_i.hh"
+#include "VisuGUI_VectorsDlg.h"
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "utilities.h"
+#include "VISU_TableDlg.h"
+#include "VisuGUI_FileInfoDlg.h"
-#include "QAD_Config.h"
-
-#include "QAD_Settings.h"
-#include "QAD_Tools.h"
-#include "QAD_LeftFrame.h"
-#include "QAD_RightFrame.h"
-#include "QAD_MessageBox.h"
-#include "QAD_ObjectBrowser.h"
-#include "QAD_ObjectBrowserItem.h"
-#include "QAD_Menus.h"
-#include "QAD_Resource.h"
-#include "QAD_ResourceMgr.h"
-#include "QAD_FileDlg.h"
-#include "QAD_WaitCursor.h"
-#include "SALOME_Selection.h"
-#include "SALOMEGUI_NameDlg.h"
-#include "SALOMEGUI_TableDlg.h"
-#include "SALOMEGUI_SetupCurveDlg.h"
-#include "SALOMEGUI_SetValueDlg.h"
-#include "SALOMEGUI_Desktop.h"
-#include "Plot2d_SetupPlot2dDlg.h"
-#include "Plot2d_ViewFrame.h"
-#include "VTKViewer_ViewFrame.h"
-#include "VTKViewer_RenderWindow.h"
-#include "VTKViewer_InteractorStyleSALOME.h"
-#include "VTKViewer_RenderWindowInteractor.h"
-#include "VisuGUI_FileDlg.h"
+#ifdef WITH_MEDGEN
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(MED_Gen)
+#endif // WITH_MEDGEN
-// QT Includes
-#define INCLUDE_MENUITEM_DEF
-#include <qpopupmenu.h>
-#include <qfont.h>
-#include <qpainter.h>
-#include <qstring.h>
-#include <qapplication.h>
-#include <qinputdialog.h>
-#include <qcolordialog.h>
-#include <qlabel.h>
-#include <qspinbox.h>
-#include <qradiobutton.h>
-#include <qthread.h>
-#include <qlistbox.h>
-#include <qcombobox.h>
-#include <qregexp.h>
-
-//VRV: porting on Qt 3.0.5
-#if QT_VERSION >= 0x030005
-#include <qlistview.h>
-#endif
-//VRV: porting on Qt 3.0.5
-#include <qmessagebox.h>
+#include "utilities.h"
-#include CORBA_CLIENT_HEADER(MED_Gen)
+#include "VisuGUI_ActionsDef.h"
-#include <vtkActor.h>
-#include <vtkRenderer.h>
-#include <vtkDataSetMapper.h>
-#include <vtkActorCollection.h>
+#include "VisuGUI_Timer.h"
-// Open CASCADE Include
-#include <TCollection_AsciiString.hxx>
+//#include "VVTK_ViewModel.h"
-//#define CHECKTIME
-#ifdef CHECKTIME
-static int MYCHECKTIME = 1;
-#else
-static int MYCHECKTIME = 0;
-#endif
-#include <Utils_Timer.hxx>
+#include "VisuGUI_Slider.h"
+#include "VisuGUI_Sweep.h"
+#include <VISU_ScalarMapAct.h>
+#include <VISU_GaussPtsAct.h>
+#include "VisuGUI_ValuesLabelingDlg.h"
-using namespace std;
+using namespace VISU;
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 0;
#endif
-class CustomItem : public QCustomMenuItem
-{
-public:
- CustomItem(const QString& s, const QFont& f) : myString(s), myFont(f) {}
- ~CustomItem() {}
-
- void paint(QPainter* p, const QColorGroup& cg, bool act, bool /*enabled*/, int x, int y, int w, int h)
- {
- p->save();
- p->fillRect( x, y, w, h, act ? cg.highlight() : cg.mid() );
- p->setPen( act ? cg.highlightedText() : cg.buttonText() );
- p->setFont( myFont );
- p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
- p->restore();
- }
+#ifdef WIN32
+#define usleep(A) _sleep(A/1000)
+#endif
- QSize sizeHint()
- {
- return QFontMetrics( myFont ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
- }
+#include <vtkMatplotlibMathTextUtilities.h>
- bool fullSpan() const
+class MatplotlibMathTextUtilities : public vtkMatplotlibMathTextUtilities
+{
+public:
+ static void Disable()
{
- return true;
+ vtkMatplotlibMathTextUtilities::MPLMathTextAvailable = vtkMatplotlibMathTextUtilities::UNAVAILABLE;
}
private:
- QString myString;
- QFont myFont;
+ MatplotlibMathTextUtilities() {}
+ ~MatplotlibMathTextUtilities() {}
};
-inline bool IsSObjectTable(SALOMEDS::SObject_ptr theSObject){
- if(!theSObject->_is_nil()) {
- SALOMEDS::GenericAttribute_var anAttr;
- if(theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
- return true;
- if(theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
- return true;
- }
- return false;
+//////////////////////////////////////////////////
+// Class: VisuGUI
+//////////////////////////////////////////////////
+
+VisuGUI
+::VisuGUI():
+ SalomeApp_Module( "VISU" ),
+ myDisplayer( 0 ),
+ mySlider( NULL ),
+ mySweep( NULL )
+{
}
+VisuGUI
+::~VisuGUI()
+{
+ if( myDisplayer ) {
+ delete myDisplayer;
+ myDisplayer = 0;
+ }
-static VisuGUI MYVISUGUI;
-VisuGUI *visuGUI = &MYVISUGUI;
+ if( mySlider ) {
+ delete mySlider;
+ mySlider = 0;
+ }
-VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){
- VISU::VISU_Gen_i::GetVisuGenImpl()->SetCurrentStudy(GetStudyDocument());
- return VISU::VISU_Gen_i::GetVisuGenImpl();
+ if( mySweep ) {
+ delete mySweep;
+ mySweep = 0;
+ }
}
-static int ComputeVisiblePropBounds(VTKViewer_ViewFrame* theViewFrame, float allBounds[6],
- const char* theActorClassName = "VISU_Actor")
+void
+VisuGUI
+::OnImportFromSauvFile()
{
- vtkRenderer *aRen = theViewFrame->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
- vtkProp *prop;
- float *bounds;
- int nothingVisible=1;
-
- allBounds[0] = allBounds[2] = allBounds[4] = VTK_LARGE_FLOAT;
- allBounds[1] = allBounds[3] = allBounds[5] = -VTK_LARGE_FLOAT;
- // loop through all props
- for (anActColl->InitTraversal(); (prop = anActColl->GetNextProp()); ){
- // if it's invisible, or has no geometry, we can skip the rest
- if ( prop->GetVisibility() && prop->IsA(theActorClassName)){
- bounds = prop->GetBounds();
- // make sure we haven't got bogus bounds
- if ( bounds != NULL &&
- bounds[0] > -VTK_LARGE_FLOAT && bounds[1] < VTK_LARGE_FLOAT &&
- bounds[2] > -VTK_LARGE_FLOAT && bounds[3] < VTK_LARGE_FLOAT &&
- bounds[4] > -VTK_LARGE_FLOAT && bounds[5] < VTK_LARGE_FLOAT )
- {
- nothingVisible = 0;
- if (bounds[0] < allBounds[0]) allBounds[0] = bounds[0];
- if (bounds[1] > allBounds[1]) allBounds[1] = bounds[1];
- if (bounds[2] < allBounds[2]) allBounds[2] = bounds[2];
- if (bounds[3] > allBounds[3]) allBounds[3] = bounds[3];
- if (bounds[4] < allBounds[4]) allBounds[4] = bounds[4];
- if (bounds[5] > allBounds[5]) allBounds[5] = bounds[5];
- }//not bogus
- }
- }
- return nothingVisible;
-}
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromSauvFile()");
-VisuGUI::CameraOrient VisuGUI::SetFitAll(VTKViewer_ViewFrame* theViewFrame){
- static float PRECISION = 0.000001;
- static float DEVIATION = 600;
- float XYZ_Bnd[6];
- if(ComputeVisiblePropBounds(theViewFrame,XYZ_Bnd)) return e3D;
+ if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
+ return;
- float absX = XYZ_Bnd[1]-XYZ_Bnd[0];
-
- float absY = XYZ_Bnd[3]-XYZ_Bnd[2];
-
- float absZ = XYZ_Bnd[5]-XYZ_Bnd[4];
-
- CameraOrient aCameraOrient = e3D;
- if(absX <= PRECISION) aCameraOrient = eFront;
- else {if(absY <= PRECISION) aCameraOrient = eLeft;
- else {if(absZ <= PRECISION) aCameraOrient = eTop;}}
-
- float dev_abs_XY = absX / absY;
- float dev_abs_YZ = absY / absZ;
- float dev_abs_XZ = absX / absZ;
- if(dev_abs_XY >= DEVIATION || 1./dev_abs_YZ >= DEVIATION) aCameraOrient = eLeft;
- else{if(1./dev_abs_XY >= DEVIATION || 1./dev_abs_XZ >= DEVIATION) aCameraOrient = eFront;
- else {if(dev_abs_XZ >= DEVIATION || dev_abs_YZ >= DEVIATION) aCameraOrient = eTop;}}
-
- switch(aCameraOrient){
- case eFront: theViewFrame->onViewFront(); break;
- case eLeft: theViewFrame->onViewLeft(); break;
- case eTop: theViewFrame->onViewTop(); break;
- case e3D: theViewFrame->onViewReset(); break;
- }
- theViewFrame->getRenderer()->ResetCameraClippingRange();
- theViewFrame->onViewFitAll();
- return aCameraOrient;
-}
-
-QAD_Desktop* VisuGUI::GetDesktop(){
- return QAD_Application::getDesktop() ;
-}
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
-QAD_Study* VisuGUI::GetActiveStudy(){
- return GetDesktop()->getActiveStudy() ;
-}
+ // Get file name(s)
+ QStringList aFilter;
+ aFilter.append( tr( "FLT_SAUV_FILES" ) );
+ aFilter.append( tr( "FLT_ALL_FILES" ) );
-vtkRenderer* VisuGUI::GetRenderer(){
- if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame())
- return aViewFrame->getRenderer();
- return NULL;
-}
+ bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
-VTKViewer_ViewFrame* VisuGUI::GetVtkViewFrame(){
- QAD_ViewFrame* aViewFrame = GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- return dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
-}
+ SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
+ fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
+ fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
+ fd.setFilters( aFilter );
+ fd.SetChecked( toUseBuildProgress );
+ if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
+ fd.setDirectory( QDir::currentPath() );
-static void UpdateViewFrame() {
- QList<QAD_StudyFrame> aFrameList = VisuGUI::GetActiveStudy()->getStudyFrames();
-
- for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
- if (aStudyFrame->getTypeView() == VIEW_VTK) {
- QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame();
- VTKViewer_ViewFrame* aVtkViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame);
- if (!aVtkViewFrame) continue;
- VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
- if (anInteractor) {
- anInteractor->SetSelectionProp();
- anInteractor->SetSelectionTolerance();
- VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
- if (aStyle) {
- aStyle->setPreselectionProp();
- }
- }
- }
- }
-}
+ QStringList fileNames;
+ if ( !fd.exec() )
+ return; // cancelled, return
-SALOMEDS::Study_var VisuGUI::GetStudyDocument(){
- return GetActiveStudy()->getStudyDocument();
-}
+ fileNames = fd.selectedFiles();
+ toUseBuildProgress = fd.IsChecked();
-SALOMEDS::StudyBuilder_var VisuGUI::NewBuilder(){
- return GetStudyDocument()->NewBuilder();
-}
+ if ( fileNames.count() == 0 )
+ return; // nothing selected, return
+ SUIT_OverrideCursor wc;
+ QStringList errors;
-/**
- * Finds value by given key
- */
+ for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
+ QFileInfo aFileInfo( *it );
-VISU::Storable::TRestoringMap VisuGUI::getMapOfValue(SALOMEDS::SObject_var theSObject) {
- VISU::Storable::TRestoringMap aMap;
- if(!theSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (theSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- CORBA::String_var aString = aComment->Value();
- QString strIn(aString.in());
- VISU::Storable::StrToMap(strIn,aMap);
+ if ( !aFileInfo.exists() ) {
+ // file not exist
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
}
+ else {
+ std::string file_in = aFileInfo.filePath().toLatin1().constData();
+ std::string file_tmp = file_in + ".med";
+#ifdef WNT
+ std::string cmd = "%PYTHONBIN% ";
+#else
+ std::string cmd = "python ";
+#endif
+ cmd += "-c \"";
+ cmd += "from medutilities import convert ; convert(r'" + file_in + "', 'GIBI', 'MED', 1, r'" + file_tmp + "')";
+ cmd += "\"";
+ system(cmd.c_str());
+ QString fff(file_tmp.c_str());
+ aFileInfo = fff;
+ try {
+ if ( !toUseBuildProgress ) {
+ // build progress is not used, use build flags from settings
+ bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
+ bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
+ bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
+ bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
+ bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
+
+ QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
+ application()->putInfo( anInfo );
+
+ VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
+
+ if ( CORBA::is_nil( aResult.in() ) ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ aResult->SetBuildFields( toBuildFields, toBuildMinMax );
+ aResult->SetBuildGroups( toBuildGroups );
+ aResult->Build( toBuildAll, toBuildAtOnce );
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ } // if ( !toUseBuildProgress )
+ else {
+ // use build progress
+ wc.suspend();
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setFileName( aFileInfo.filePath() );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->exec();
+ wc.resume();
+ }
+ } // try
+ catch(...) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ }
+ } // else // if ( !aFileInfo.exists() )
+ } // for (...)
+
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( GetDesktop(this),
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ }
+ else {
+ UpdateObjBrowser(this);
}
- return aMap;
}
-QString VisuGUI::getValue(SALOMEDS::SObject_var theSObject, QString theKey) {
- QString aStr("");
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
- if(!aMap.empty())
- aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
- return aStr;
-}
+void
+VisuGUI
+::OnImportFromFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
+ if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
+ return;
-CORBA::Object_var GetSelectedObj(Handle(SALOME_InteractiveObject)* pIO = NULL, QAD_Study* theStudy = NULL,
- VISU::Storable::TRestoringMap* pMap = NULL)
-{
- if(theStudy == NULL) theStudy = VisuGUI::GetActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection(theStudy->getSelection());
- if(aSel->IObjectCount() > 0){
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- if(pIO != NULL) *pIO = anIO;
- if(anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = theStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- SALOMEDS::GenericAttribute_var anAttr;
- if (pMap != NULL && aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,*pMap);
- }
- return VISU::SObjectToObject(aSObject);
- }
- }
- }
- return CORBA::Object::_nil();
-}
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ // Get file name(s)
+ QStringList aFilter;
+ aFilter.append( tr( "FLT_MED_FILES" ) );
+ aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
+ aFilter.append( tr( "FLT_ALL_FILES" ) );
-int IsTrihedronDisplayed(){
- if(VTKViewer_ViewFrame* aVTKViewFrame = VisuGUI::GetVtkViewFrame())
- return aVTKViewFrame->isTrihedronDisplayed();
- return 1;
-}
+ bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
+ SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
+ fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
+ fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
+ fd.setFilters( aFilter );
+ fd.SetChecked( toUseBuildProgress );
+ if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
+ fd.setDirectory( QDir::currentPath() );
-void RepaintCurrentView(){
- if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()) vf->Repaint();
-}
+ QStringList fileNames;
+ if ( !fd.exec() )
+ return; // cancelled, return
+ fileNames = fd.selectedFiles();
+ toUseBuildProgress = fd.IsChecked();
-VisuGUI::VisuGUI( const QString& theName, QObject* theParent ):
- SALOMEGUI( theName, theParent )
-{
- mySelectionDlg = 0;
-}
+ if ( fileNames.count() == 0 )
+ return; // nothing selected, return
-/* ==================================================================================== */
-/* ==================================================================================== */
-/* ONGUI EVENT */
-/* ==================================================================================== */
-/* ==================================================================================== */
+ SUIT_OverrideCursor wc;
+ QStringList errors;
+ QStringList anEntryList;
-static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
- return theStudy->GetProperties()->IsLocked();
-}
+ for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
+ QFileInfo aFileInfo( *it );
+
+ if ( !aFileInfo.exists() ) {
+ // file not exist
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
+ }
+ else {
+ try {
+ if ( !toUseBuildProgress ) {
+ // build progress is not used, use build flags from settings
+ bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
+ bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
+ bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
+ bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
+ bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
+
+ QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
+ application()->putInfo( anInfo );
+
+ VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
+
+ if ( CORBA::is_nil( aResult.in() ) ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ aResult->SetBuildFields( toBuildFields, toBuildMinMax );
+ aResult->SetBuildGroups( toBuildGroups );
+ aResult->Build( toBuildAll, toBuildAtOnce );
+ if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
+ anEntryList.append( aCResult->GetEntry().c_str() );
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ } // if ( !toUseBuildProgress )
+ else {
+ // use build progress
+ wc.suspend();
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setFileName( aFileInfo.filePath() );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->exec();
+ wc.resume();
+ }
+ } // try
+ catch(...) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ }
+ } // else // if ( !aFileInfo.exists() )
+ } // for (...)
-static int checkLock(const SALOMEDS::Study_var& theStudy) {
- if (isStudyLocked(theStudy)) {
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
- return true;
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( GetDesktop(this),
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ }
+ else {
+ UpdateObjBrowser(this);
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
}
- return false;
}
+void
+VisuGUI
+::OnImportTableFromFile()
+{
+ if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
+ if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
+ return;
+
+ QStringList aFilter;
+ aFilter.append( tr("FLT_TABLE_FILES") );
+ aFilter.append( tr("FLT_ALL_FILES") );
+
+ //QString anInitialPath = "";
+ //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ // anInitialPath = QDir::currentPath();
+
+ //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
+ // anInitialPath,
+ // aFilter,
+ // tr("TLT_IMPORT_TABLE"));
+
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
+
+ SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
+ fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
+ fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
+ fd.setFilters( aFilter );
+ fd.SetChecked( aFirstStrAsTitle );
+ if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
+ fd.setDirectory( QDir::currentPath() );
+
+ QStringList aFiles;
+ if ( !fd.exec() )
+ return; // cancelled, return
+ aFiles = fd.selectedFiles();
+ aFirstStrAsTitle = fd.IsChecked();
+
+ if ( aFiles.count() == 0 )
+ return; // nothing selected
+
+ QStringList errors;
+ QStringList anEntryList;
+ for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
+ QFileInfo aFileInfo( *it );
+
+ if ( !aFileInfo.exists() ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
+ }
+ else {
+ try {
+ QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
+ application()->putInfo( anInfo );
+
+ SALOMEDS::SObject_var anObject =
+ GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
+ aFirstStrAsTitle);
+
+ if (CORBA::is_nil(anObject.in())) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ anEntryList.append( anObject->GetID() );
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ }
+ catch(...) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
+ }
+ }
+ }
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( GetDesktop(this),
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ }
+ else {
+ UpdateObjBrowser(this);
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
+ }
+}
-bool VisuGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+void
+VisuGUI
+::OnExportTableToFile()
{
- try{
- QString VisuInputDir = getVisuInputDir();
- QString VisuOutputDir = getVisuOutputDir();
-
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument(); //Document OCAF de l'etude active
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var anIOR;
-
- switch (theCommandID){
- /* ======================================================================================== */
- /* Import Table from file */
- /* ======================================================================================== */
- case 199:
- {
- if(checkLock(aStudy)) break;
- visuGUI->ImportTablesFromFile();
- break;
+ if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() > 0) {
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ if (anIO->hasEntry()) {
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj) return;
+
+ // find table attribute
+ bool isTOR = true;
+ _PTR(GenericAttribute) anAttr;
+
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
+ isTOR = false;
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ // if the current SObject is a table title
+ // we take a father contaning the table
+ aSObj = aSObj->GetFather();
+
+ if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
+ isTOR = true;
+ } else {
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ return;
+ }
+ }
+ }
}
- /* ======================================================================================== */
- /* Import Mesh from MED, DAT file */
- /* ======================================================================================== */
-
- case 111:
- {
- visuGUI->CopyAndImportFile();
- break;
+ // get table title in order to have default name of the file
+ QString aTitle;
+ if (isTOR) {
+ _PTR(AttributeTableOfReal) aTabAttr (anAttr);
+ if (!aTabAttr) return;
+ aTitle = aTabAttr->GetTitle().c_str();
+ } else {
+ _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
+ if (!aTabAttr) return;
+ aTitle = aTabAttr->GetTitle().c_str();
}
- case 112:
- {
- visuGUI->ImportFile();
- break;
+ aTitle.simplified();
+ aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
+
+ // get default path for the file
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
+ if (aDir.isEmpty()) {
+ aDir = aResourceMgr->stringValue("VISU","InputDir","");
+ if (aDir.isEmpty()) {
+ aDir = getenv("CSF_PATHData");
+ }
}
+ QString aPath = Qtx::addSlash(aDir) + aTitle;
+
+ // get name for the file
+ QStringList aFilter;
+ aFilter.append("Table Files (*.txt *.tab)");
+ aFilter.append("CSV Table Files (*.csv)");
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ aPath,
+ aFilter,
+ tr("MEN_EXPORT_TABLE"), // "Export Table To File"
+ false);
+
+ // export
+ QString aFile = aFileInfo.filePath();
+ if (!aFile.isEmpty()) {
+ application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
+ aDir = Qtx::dir(aFile, true);
+ aResourceMgr->setValue("VISU", "OutputDir", aDir);
+
+ try {
+ GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
+ application()->putInfo(aFile + " " + tr("INF_DONE"));
+ } catch(std::exception& exc) {
+ INFOS(exc.what());
+ SUIT_MessageBox::warning(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
+
+ } catch(...) {
+ INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
+ SUIT_MessageBox::warning( GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ERROR_DURING_EXPORT") );
+
+ }
+ }
+ }
+ }
+}
- /* ======================================================================================== */
- /* Export results and mesh into a file format */
- /* ======================================================================================== */
+void
+VisuGUI
+::OnImportMedField()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ QStringList anEntryList;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = It.Value();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
- case 122:
+ // try to load a component data from an opened (presumably) study
+ // The same in SUPERVISION: NPAL14522
{
- //visuGUI->ExportToFile();
- break;
+ SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
+ CORBA::String_var aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ CORBA::String_var aCompDataType = aSComp->ComponentDataType();
+
+ // obtain a driver by a component data type
+ // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
+ SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
+ try {
+ CORBA::Object_var
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
+ if (CORBA::is_nil(anEngineObj))
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
+
+ if (!CORBA::is_nil(anEngineObj))
+ anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
+
+ if (!CORBA::is_nil(anEngine)) {
+ // try to load
+ SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
+ aStudyBuilder->LoadWith(aSComp, anEngine);
+ }
+ }
+ catch (...) {
+ }
+ }
}
- /* ========================================================================== */
- /* Visualization of Results : */
- /* 4011 : Scalar Map */
- /* 4012 : Deformed Shape */
- /* 4013 : Vectors */
- /* 4014 : Iso-Surfaces */
- /* 4015 : Cut Planes */
- /* 4016 : Stream Lines */
- /* ========================================================================== */
-
- case 4011 :
- visuGUI->CreateScalarMap();
- break;
- case 4012 :
- visuGUI->CreateDeformedShape();
- break;
- case 4013 :
- visuGUI->CreateVectors();
- break;
- case 4014 :
- visuGUI->CreateIsoSurfaces();
- break;
- case 4015 :
- visuGUI->CreateCutPlanes();
- break;
- case 4018 :
- visuGUI->CreateCutLines();
- break;
- case 4016 :
- visuGUI->CreateStreamLines();
- break;
-
- case 4111 :
- visuGUI->SelectionInfo();
- break;
+ VISU::Result_var aResult;
+ CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
+ if (!CORBA::is_nil(aMED.in()))
+ aResult = GetVisuGen(this)->ImportMed(aSObject);
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
+ if (!CORBA::is_nil(aField.in()))
+ aResult = GetVisuGen(this)->ImportMedField(aField);
+ } else {
+ SALOMEDS::SObject_var aSFather = aSObject->GetFather();
+ SALOMEDS::GenericAttribute_var anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ CORBA::String_var aValue = aName->Value();
+ if (strcmp(aValue.in(), "MEDFIELD") == 0)
+ aResult = GetVisuGen(this)->ImportMed(aSObject);
+ }
- /* ========================================================================================================================= */
- /* Visualization - Wireframe */
- /* ========================================================================================================================= */
+ if( !CORBA::is_nil( aResult ) )
+ if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
+ anEntryList.append( aCResult->GetEntry().c_str() );
+ }
+ }
+ UpdateObjBrowser(this, true);
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
+ QApplication::restoreOverrideCursor();
+}
- case 4211 :
- ChangeViewer(1);
- break;
+void VisuGUI::OnLoadComponentData()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
- /* ========================================================================================================================= */
- /* Visualization - Surface */
- /* ========================================================================================================================= */
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- case 4212 :
- ChangeViewer(2);
- break;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = It.Value();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
- /* ========================================================================================================================= */
- /* Visualization - Points */
- /* ========================================================================================================================= */
+ // try to load a component data from an opened (presumably) study
+ // The same in SUPERVISION: NPAL14522
+ {
+ SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
+ CORBA::String_var aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ CORBA::String_var aCompDataType = aSComp->ComponentDataType();
+
+ QString anInfo ("Loading ");
+ anInfo = anInfo + aCompDataType.in() + " Component Data ...";
+ application()->putInfo( anInfo );
+
+ // obtain a driver by a component data type
+ // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
+ SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
+ try {
+ CORBA::Object_var
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
+ if (CORBA::is_nil(anEngineObj))
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
+
+ if (!CORBA::is_nil(anEngineObj))
+ anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
+
+ if (!CORBA::is_nil(anEngine)) {
+ // try to load
+ SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
+ aStudyBuilder->LoadWith(aSComp, anEngine);
+ }
+
+ application()->putInfo( anInfo + tr("INF_DONE"));
+ }
+ catch (...) {
+ application()->putInfo( anInfo + tr("INF_FAILED"));
+ }
+ }
+ }
+ }
+ }
+ QApplication::restoreOverrideCursor();
+}
- case 4213 :
- ChangeViewer(0);
- break;
+void
+CreateCurves( SalomeApp_Module* theModule,
+ VISU::CutLinesBase_i* thePrs,
+ QDialog* theDlg,
+ const bool theCreate = true )
+{
+ if ( !thePrs )
+ return;
- /* ========================================================================================================================= */
- /* Visualization - Erase */
- /* ========================================================================================================================= */
+ // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
+ // should have common intermediate interface with at least two methods called below)
+ bool isGenerateTable = false;
+ bool isGenerateCurves = false;
+ if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
+ isGenerateTable = aCutDlg->isGenerateTable();
+ isGenerateCurves = aCutDlg->isGenerateCurves();
+ }
+ else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
+ isGenerateTable = aCutDlg->isGenerateTable();
+ isGenerateCurves = aCutDlg->isGenerateCurves();
+ }
+ else
+ return;
- case 422 :
- ChangeViewer(-1);
- break;
+ _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
+ _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
+
+ if ( !theCreate && aSObject ) {
+ // Remove old Table
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
+ for (; aIter->More(); aIter->Next()) {
+ _PTR(SObject) aTblObj = aIter->Value();
+ if( aTblObj ) {
+ _PTR(GenericAttribute) anAttr;
+ if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
+ _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
+ SalomeApp_Study* salome_study = GetAppStudy( theModule );
+ for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
+ salome_study->deleteReferencesTo( aChildIter->Value() );
+ _PTR(SObject) aSO = aChildIter->Value();
+ if(aSO){
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
+ if (aRestoringMap["myComment"] == "CURVE") {
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
+ if(!CORBA::is_nil(aCORBAObject)){
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
+ PlotRemoveCurve(theModule, aCurve);
+ }
+ }
+ }
+ }
+
+ }
+
+ aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
+
+ //UpdateObjBrowser(theModule,true,aTblObj);
+ break;
+ }
+ }
+ }
+ }
- /* ========================================================================================================================= */
- /* Visualization - Global */
- /* ========================================================================================================================= */
-
- //case 423 :
-
- /* ========================================================================================================================= */
- /* Visualization - Partial */
- /* ========================================================================================================================= */
-
- //case 424 :
-
- case 430 :
- {
- //Show dialog that allows to select scale function and corresponding scale factor
- VisuGUI_NonIsometricDlg* m_NonIsoDlg = new VisuGUI_NonIsometricDlg ( QAD_Application::getDesktop(), "m_NonIsoDlg",
- FALSE, Qt::WDestructiveClose );
- m_NonIsoDlg->show();
- break;
- }
+ if ( isGenerateTable ) {
+ GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
+ if ( isGenerateCurves ) {
+ if ( aSObject ) {
+ _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
+ _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
+ for (; aIter->More(); aIter->Next()) {
+ _PTR(SObject) aTblObj = aIter->Value();
+ if ( aTblObj ) {
+ _PTR(GenericAttribute) anAttr;
+ if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
+ CreatePlot( theModule, aTblObj );
+ }
+ }
+ }
+ }
+ }
+ }
- /* ============================ */
- /* POP-UP OBJECTS BROWSER */
- /* ============================ */
+ if (!theCreate && aSObject) {
+ UpdateObjBrowser(theModule);
+ }
+}
- case 900 : // Rename object
- visuGUI->Rename();
- break;
+void
+VisuGUI
+::OnCreateMesh()
+{
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy,GetDesktop(this)))
+ return;
- // ---------------- For Popup in Viewer
- case 802 : // Erase
- case 902 : // Erase
- visuGUI->ErasePrs();
- break;
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
- case 803 : // Display only
- case 903 : // Display only
- visuGUI->DisplayOnlyPrs();
- break;
+ // Get selected SObject
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
- case 901 : // Display
- visuGUI->DisplayPrs();
- break;
+ // create a VTK view window if it does not exist
+ SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
- case 8041 : // Object representation : Wireframe
- case 9041 : // Object representation : Wireframe
- visuGUI->ChangeRepresentation(VISU::WIREFRAME);
- break;
+ // create mesh presentation and display it in aViewWindow
+ VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
+ aViewWindow->highlight(anIO, 1);
+ processPresentationCreated(aPrs);
+}
- case 8042 : // Object representation : Surface
- case 9042 : // Object representation : Surface
- visuGUI->ChangeRepresentation(VISU::SHADED);
- break;
+void
+VisuGUI
+::OnCreateManyMesh()
+{
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aStudy,GetDesktop(this)))
+ return;
- case 8043 : // Object representation : Points
- case 9043 : // Object representation : Points
- visuGUI->ChangeRepresentation(VISU::POINT);
- break;
+ // create a VTK view window if it does not exist
+ SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
+
+ // Get selected SObject
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter (aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (anIO.IsNull() || !anIO->hasEntry())
+ return;
- case 8044 : // Object representation : Shrink/Unshrink
- case 9044 : // Object representation : Shrink/Unshrink
- visuGUI->ChangeRepresentation(VISU::SHRINK);
- break;
+ // create mesh presentation and display it in aViewWindow
+ VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
+ aViewWindow->highlight(anIO, 1);
+ processPresentationCreated(aPrs);
+ }
+}
- case 8051 : // Change object color
- case 9051 : // Change object color
- visuGUI->ChageColor();
- break;
+void
+VisuGUI
+::OnCreateScalarMap()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
+ processPresentationCreated(aPrs);
+}
- case 8052 : // Change object opacity
- case 9052 : // Change object opacity
- visuGUI->ChangeOpacity();
- break;
- case 8053 : // Change object line width
- case 9053 : // Change object line width
- visuGUI->ChangeLines();
- break;
+void
+VisuGUI
+::OnCreateDeformedShape()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
+ processPresentationCreated(aPrs);
+}
- case 808 : // Sweep IsoSurfaces or Cutplanes
- case 908 : // Sweep IsoSurfaces or Cutplanes
- visuGUI->Sweep();
- break;
+void
+VisuGUI
+::OnCreateDeformedShapeAndScalarMap()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
+ processPresentationCreated(aPrs);
+}
-/* ======================================================================================== */
-/* Preferences for Scalar Bar */
-/* ======================================================================================== */
- case 51:
- {
- ChangeScalarBar();
- break;
- }
+void
+VisuGUI
+::OnCreateVectors()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
+ processPresentationCreated(aPrs);
+}
-/* ======================================================================================== */
-/* Preferences for Sweeping */
-/* ======================================================================================== */
- case 52:
- {
- SetSweepingPreferences();
- }
- break;
+void
+VisuGUI
+::OnCreateIsoSurfaces()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
+ processPresentationCreated(aPrs);
+}
-/* ======================================================================================== */
-/* Preferences for Full loading */
-/* ======================================================================================== */
- case 53:
- case 54:
- {
- QMenuData* pp;
- bool check = !pp->isItemChecked(theCommandID);
- pp->setItemChecked(theCommandID,check);
- switch(theCommandID){
- case 53:
- QAD_CONFIG->addSetting( "Visu:BuildResult", check );
- break;
- case 54:
- QAD_CONFIG->addSetting( "Visu:BuildDefaultPrs3d", check );
- break;
- }
- }
- break;
+void
+VisuGUI
+::OnCreateCutPlanes()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
+ processPresentationCreated(aPrs);
+}
- case 113: // Load MED using MED component
- {
- if (checkLock(GetStudyDocument())) break;
-
- Engines::Component_var aMedComp = GetDesktop()->getEngine("FactoryServer", "MED");
- if (CORBA::is_nil(aMedComp)) return false;
- SALOME_MED::MED_Gen_var aMedGen = SALOME_MED::MED_Gen::_narrow(aMedComp);
- if (CORBA::is_nil(aMedGen)) return false;
-
- QStringList filtersList ;
-
- filtersList.append( tr("MED_MEN_IMPORT_MED") );
- filtersList.append( tr("MED_MEN_ALL_FILES") ) ;
- QString aFileName = QAD_FileDlg::getFileName(GetDesktop(),
- "",
- filtersList,
- tr("MED_MEN_IMPORT"),
- true);
- if (!aFileName.isEmpty()) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- aMedGen->readStructFileWithFieldType(aFileName.latin1(), GetActiveStudy()->getTitle());
- GetActiveStudy()->updateObjBrowser();
- QApplication::restoreOverrideCursor();
- }
- }
- break;
-
- default:
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("MSG_NOT_IMPLEMENTED"),
- tr ("VISU_BUT_OK") );
- break;
- }
- } catch (const std::bad_alloc& e ) {
- INFOS("bad_alloc exception is caught "<<e.what());
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_NO_MEMORY") + " " + tr(e.what()),
- tr("VISU_BUT_OK") );
- return false;
- }
- catch (std::exception& e){
- INFOS(e.what());
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr(e.what()),
- tr("VISU_BUT_OK") );
- }catch (const SALOME::SALOME_Exception& S_ex) {
- INFOS("const SALOME::SALOME_Exception& S_ex");
- QtCatchCorbaException(S_ex);
- return false;
- }
- catch(...) {
- INFOS(tr("ERR_UNKNOWN_EXCEPTION").latin1());
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_UNKNOWN_EXCEPTION"),
- tr("VISU_BUT_OK") );
- return false;
- }
- return true;
-}
-
-void VisuGUI::SelectionInfo() {
- mySelectionDlg = new VisuGUI_SelectionDlg();
- mySelectionDlg->show();
+void
+VisuGUI
+::OnCreateCutLines()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
+ processPresentationCreated(aPrs);
}
-
-
-
-/* ********************************************************************************** */
-/* Function ShowTrihedron */
-/* ********************************************************************************** */
-
-void VisuGUI::ShowTrihedron(bool ShowThd){
- bool ThdIsVisible = true;
- if( ShowThd && !ThdIsVisible)
- ((VTKViewer_ViewFrame*)visuGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTrihedron();
- if( !ShowThd && ThdIsVisible)
- ((VTKViewer_ViewFrame*)visuGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTrihedron();
+void
+VisuGUI
+::OnCreateCutSegment()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
+ processPresentationCreated(aPrs);
}
-/* ********************************************************************************** */
-/* Destructor */
-/* Clear all tmp files used in VISU */
-/* ********************************************************************************** */
-
-VisuGUI::~VisuGUI(){
- if(MYDEBUG) MESSAGE("VisuGUI::~VisuGUI");
-}
-
-/* ********************************************************************************** */
-/* Function ChangeViewer */
-/* Change representation of all actors */
-/* ********************************************************************************** */
-
-void VisuGUI::ChangeViewer(int theType){
- if(theType < 0 )
- GetActiveStudy()->unHighlightAll();
- if(vtkRenderer *aRen = GetRenderer()){
- vtkActor *anActor;
- vtkActorCollection *anActColl = aRen->GetActors();
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(anActor->GetVisibility() > 0)
- if(VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)){
- anVISUActor = anVISUActor->GetParent();
- if(theType >= 0)
- anVISUActor->SetRepresentation(theType);
- else
- anVISUActor->VisibilityOff();
- }
- }
- RepaintCurrentView();
- }
+void
+VisuGUI
+::OnCreateStreamLines()
+{
+ Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
+ processPresentationCreated(aPrs);
}
-// -----------------------------------------------------------------------------------------
-// EVENTS
-// -----------------------------------------------------------------------------------------
-
-bool VisuGUI::OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI
+::OnCreatePlot3D()
{
- return true;
+ Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
+ processPresentationCreated(aPrs);
}
-// ====================================================================================================================
-
-bool VisuGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI
+::OnCreatePlot2dView()
{
- return true;
+ CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
+ VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
+ UpdateObjBrowser(this);
+
+ if( !CORBA::is_nil( aContainer.in() ) ) {
+ if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
+ QStringList anEntryList;
+ anEntryList.append( aCContainer->GetEntry().c_str() );
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
+ }
+ }
}
-// ===================================================================================================================
-
-bool VisuGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
+void
+VisuGUI
+::OnDisplayPrs()
{
- if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) // true = Viewer OCC
- return false;
+ if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
- if(MYDEBUG) MESSAGE( "VisuGUI::onKeyPress : " << pe->key() )
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ if (!aSelectionMgr)
+ return;
- switch ( pe->key() )
- {
- case Key_Escape :
- {
- if(MYDEBUG) MESSAGE("--> Key : Escape")
- return true;
- }
- default :
- return true;
- break;
- }
- return true;
-}
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ SALOME_ListIO aSel, aList;
+ aSelectionMgr->selectedObjects(aSel);
+ extractContainers(aSel, aList);
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = it.Value();
+ TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ if(!aBase)
+ continue;
-//=====================================================================================
-// Slot-functions for presentations creation
-//=====================================================================================
+ VISU::VISUType aType = aBase->GetType();
+ switch (aType) {
+ case VISU::TPOINTMAP3D:
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+ displayer()->Display(anIO->getEntry());
+ aViewWindow->highlight(anIO, 1);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
+ break;
+ }
+ else {
+ if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
+ aPlot2d->Repaint();
+ displayer()->Display(anIO->getEntry());
+ }
+ case VISU::TCURVE:
+ case VISU::TCONTAINER:
+ case VISU::TTABLE:
+ getViewManager(SPlot2d_Viewer::Type(), true);
+ displayer()->Display(anIO->getEntry());
+ aSelectionMgr->setSelectedObjects(aList);
+ break;
+ default: {
+ VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
+ if(aPrs3d){
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+ displayer()->Display(anIO->getEntry());
+ aViewWindow->highlight(anIO, 1);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
+ }
+ }
+ }
+ }
+ }
-#define CREATEPRESENTATION(FunctionName) \
- void FunctionName() { \
- if (checkLock(GetStudyDocument())) return; \
- SALOMEDS::SObject_var objVisu; \
- if (!TestObjectBrowser(objVisu)) return; \
- if(!FunctionName(objVisu)) return; \
- GetActiveStudy()->updateObjBrowser(); \
- GetDesktop()->putInfo("Ready"); \
- VTKViewer_ViewFrame* vf = GetVtkViewFrame(); \
- if (vf) { \
- /*vf->getRenderer()->ResetCameraClippingRange();*/ \
- vf->onViewFitAll(); \
- } \
- }
+ QApplication::restoreOverrideCursor();
+}
+void
+VisuGUI
+::OnDisplayOnlyPrs()
+{
+ /// to correct IMP 0016100
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ if (!aSelectionMgr)
+ return;
-CREATEPRESENTATION(VisuGUI::CreateScalarMap);
-CREATEPRESENTATION(VisuGUI::CreateDeformedShape);
-CREATEPRESENTATION(VisuGUI::CreateVectors);
-CREATEPRESENTATION(VisuGUI::CreateIsoSurfaces);
-CREATEPRESENTATION(VisuGUI::CreateCutPlanes);
-CREATEPRESENTATION(VisuGUI::CreateCutLines);
-CREATEPRESENTATION(VisuGUI::CreateStreamLines);
+ SALOME_ListIO aSel, aList;
+ aSelectionMgr->selectedObjects(aSel);
+ extractContainers(aSel, aList);
+ Handle(SALOME_InteractiveObject) anIO = aList.First();
+ activateAppropriateViewer(anIO);
+ OnEraseAll();
+ OnDisplayPrs();
+}
+void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
+{
+ TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ if(!aBase)
+ return;
+ std::string anEntry = theIO->getEntry();
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
-//=====================================================================================
-// function : SetSettings()
-// purpose :
-//=====================================================================================
-bool VisuGUI::SetSettings(QAD_Desktop* parent)
-{
- int anId = 53;
- QMenuData* pp;
- QMenuItem* item = parent->menuBar()->findItem(anId,&pp);
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildResult");
-
- if(aValue.isEmpty()? 0 : aValue.toInt())
- pp->setItemChecked(anId, true);
-
- anId = 54;
- item = parent->menuBar()->findItem(anId,&pp);
- aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
-
- if(aValue.isEmpty()? 0 : aValue.toInt())
- pp->setItemChecked(anId, true);
-
- anId = 50;
- parent->menuBar()->changeItem(anId,parent->getComponentUserName("VISU"));
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
+ if(CORBA::is_nil(aCORBAObject))
+ return;
- ::UpdateViewFrame();
+ VISU::VISUType aType = aBase->GetType();
- return true;
-}
+ if ( VISU::GetPrs3dFromBase(aBase) ) {
+ // activate SVTK Viewer
+ getApp()->getViewManager( SVTK_Viewer::Type(), true );
+ return;
+ }
-//=====================================================================================
-// function : DisplayPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayPrs() {
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs");
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Prs3d object");
- UpdateViewer(aPrsObject);
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
+ switch (aType) {
+ case VISU::TCURVE:
+ case VISU::TCONTAINER:
+ case VISU::TTABLE: {
+ // Activate Plot2d
+ GetPlot2dViewer(this, true);
+ break;
+ }
+ case VISU::TCOLOREDPRS3DHOLDER :
+ case VISU::TPOINTMAP3D : {
+ //find curves under pointmap 3d
+ bool hasCurvesChildren = false;
+
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ QString aViewerType = aViewMgr->getType();
+
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
+ _PTR(SObject) aChild;
+ for (; anIter->More(); anIter->Next()) {
+ aChild = anIter->Value();
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
+ if(!CORBA::is_nil(aCORBAObject)){
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
+ hasCurvesChildren = true;
}
- return;
}
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Curve object");
- PlotCurve(aCurve, VISU::eDisplay );
- return;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplay );
+
+ if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
return;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
- PlotTable(aTable, VISU::eDisplay );
+ } else {
+ // activate SVTK Viewer
+ getApp()->getViewManager( SVTK_Viewer::Type(), true );
return;
}
+ break;
}
-}
-
-//=====================================================================================
-// function : DisplayOnlyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayOnlyPrs() {
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs");
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Prs3d object");
- UpdateViewer(aPrsObject, true);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Curve object");
- PlotCurve(aCurve, VISU::eDisplayOnly );
- }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplayOnly );
- }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant.in())){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Table object");
- PlotTable(aTable, VISU::eDisplayOnly );
- }
}
}
-//=====================================================================================
-// function : ErasePrs()
-// purpose :
-//=====================================================================================
-static void ErasePrs(CORBA::Object_ptr theObject) {
- if(MYDEBUG) MESSAGE("ErasePrs");
- if ( !CORBA::is_nil( theObject ) ) {
- VISU::Base_var aBase = VISU::Base::_narrow(theObject);
- if ( CORBA::is_nil( aBase ) ) return;
- VISU::VISUType aType = aBase->GetType();
- switch (aType){
- case VISU::TCURVE:{
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
- VisuGUI::PlotCurve(aCurve, VISU::eErase );
- break;
- }
- case VISU::TCONTAINER:{
- if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
- VisuGUI::PlotContainer(aContainer, VISU::eErase );
- break;
- }
- case VISU::TTABLE:{
- if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
- VisuGUI::PlotTable(aTable, VISU::eErase );
- break;
- }
- default:{
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
- VisuGUI::ErasePrs(aPrsObject);
- if (VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame())
- vf->Repaint();
- }
- }}
+void
+VisuGUI
+::OnErasePrs()
+{
+ if(MYDEBUG) MESSAGE("OnErasePrs");
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+
+ SALOME_ListIO aList, aSel;
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ aSelectionMgr->selectedObjects(aSel);
+ extractContainers(aSel, aList);
+
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = it.Value();
+ TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ ErasePrs(this, aBase, /*repaint_view_window = */true);
}
-}
-void VisuGUI::ErasePrs() {
- ::ErasePrs(GetSelectedObj());
+ QApplication::restoreOverrideCursor();
}
-
-//=====================================================================================
-// function : DisplayManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayManyPrs()
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEraseAll()
{
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Prs3d object");
- UpdateViewer(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs: Curve object");
- PlotCurve(aCurve, VISU::eDisplay );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Container object");
- PlotContainer(aContainer, VISU::eDisplay );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Table object");
- PlotTable(aTable, VISU::eDisplay );
- continue;
- }
- }
- }
- }
- }
-}
-
-//=====================================================================================
-// function : DisplayOnlyManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::DisplayOnlyManyPrs() {
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- bool aFirstElem = true;
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Prs3d object");
- UpdateViewer(aPrsObject, aFirstElem);
- if (aFirstElem) aFirstElem = false;
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- vf->highlight(anIO, 1);
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs: Curve object");
- if (aFirstElem) {
- PlotCurve(aCurve, VISU::eDisplayOnly );
- aFirstElem = false;
- }
- else PlotCurve(aCurve, VISU::eDisplay );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Container object");
- if (aFirstElem) {
- PlotContainer(aContainer, VISU::eDisplayOnly );
- aFirstElem = false;
- }
- else PlotContainer(aContainer, VISU::eDisplay );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Table object");
- if (aFirstElem) {
- PlotTable(aTable, VISU::eDisplayOnly );
- aFirstElem = false;
- }
- else PlotTable(aTable, VISU::eDisplay );
- continue;
- }
- }
+ startOperation( myEraseAll );
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+ vw->unHighlightAll();
+ if (vtkRenderer *aRen = vw->getRenderer()) {
+ vtkActor *anActor;
+ VTK::ActorCollectionCopy aCopy(aRen->GetActors());
+ vtkActorCollection *anActColl = aCopy.GetActors();
+ for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
+ if (anActor->GetVisibility() > 0)
+ if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
+ RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
+ anVISUActor->VisibilityOff();
+ }
}
+ vw->Repaint();
}
+ } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
+ aPlot2d->EraseAll();
}
}
-//=====================================================================================
-// function : EraseManyPrs()
-// purpose :
-//=====================================================================================
-void VisuGUI::EraseManyPrs()
+namespace
{
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs");
- SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
- SALOME_ListIO LIO; LIO = Sel->StoredIObjects();
- SALOME_ListIteratorOfListIO It( LIO );
- for ( ; It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
- if(aPrsObject){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Prs3d object");
- ErasePrs(aPrsObject);
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf) {
- vf->Repaint();
- }
- continue;
- }
- // is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
- if(aCurve){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Curve object");
- PlotCurve(aCurve, VISU::eErase );
- continue;
- }
- // is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
- if(aContainer){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Container object");
- PlotContainer(aContainer, VISU::eErase );
- continue;
- }
- // is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
- if(aTable){
- if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Table object");
- PlotTable(aTable, VISU::eErase );
- continue;
- }
- }
- }
- }
- }
-}
+ //----------------------------------------------------------------------------
+ VISU::Prs3d_i*
+ GetPrsToModify(const SalomeApp_Module* theModule,
+ Handle(SALOME_InteractiveObject)& theIO)
+ {
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+ if(aSelectionInfo.empty())
+ return NULL;
-//=====================================================================================
-// function : RecreateActor()
-// purpose :
-//=====================================================================================
-void VisuGUI::RecreateActor(VISU::Prs3d_i* thePrs) {
- QApplication::setOverrideCursor(Qt::waitCursor);
- try{
- thePrs->Update();
- //UpdateViewer(thePrs); Avoid unnessary settings of visibility on for thePrs
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame))
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame))
- thePrs->UpdateActor(anActor);
- }
- }catch(std::runtime_error& ex){
- INFOS(ex.what());
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION") + " " + tr(ex.what()),
- tr ("VISU_BUT_OK") );
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)) {
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)) {
- aViewFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- }
- }
- return;
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ theIO = aSelectionItem.myIO;
+ return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
}
- QApplication::restoreOverrideCursor();
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditScalarMap()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
+}
-//=====================================================================================
-// function : EditPrs()
-// purpose :
-//=====================================================================================
-#define EDITPRS(PrsName, DlgName) \
- { \
- PrsName* aPrsObject = dynamic_cast<PrsName*>(aPrs3d); \
- if (aPrsObject) { \
- DlgName* aDlg = new DlgName(); \
- aDlg->initFromPrsObject(aPrsObject); \
- if ( aDlg->exec() ) { \
- if(!(aDlg->storeToPrsObject(aPrsObject))){ \
- delete aDlg; \
- return; \
- } \
- RecreateActor(aPrsObject); \
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) { \
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { \
- vf->getRenderer()->ResetCameraClippingRange(); \
- vf->Repaint(); \
- }\
- } \
- } \
- delete aDlg; \
- } \
- }
-
-void VisuGUI::EditPrs() {
- VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
-
- switch (aPrs3d->GetType()) {
- case VISU::TMESH: // Mesh 13
- break;
-
- case VISU::TSCALARMAP: // ScalarMap 18
- EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
- break;
-
- case VISU::TDEFORMEDSHAPE: // Deformed Shape 28
- EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
- break;
-
- case VISU::TCUTPLANES: // Cut planes 42
- //EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
- {
- VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
- if (aPrsObject) {
- VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, false);
- aDlg->initFromPrsObject(aPrsObject);
- aDlg->show();
- myActiveDialogBox = aDlg;
-// if ( aDlg->exec() ) {
-// if(!(aDlg->storeToPrsObject(aPrsObject))){
-// delete aDlg;
-// return;
-// }
-// RecreateActor(aPrsObject);
-// if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
-// if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
-// vf->getRenderer()->ResetCameraClippingRange();
-// vf->Repaint();
-// }
-// }
-// }
-// delete aDlg;
- }
- }
- break;
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditDeformedShape()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
+ // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
+}
- case VISU::TCUTLINES: // Cut planes 42
- //EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
- {
- VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
- if (aPrsObject) {
- VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(false);
- aDlg->initFromPrsObject(aPrsObject);
- aDlg->show();
- myActiveDialogBox = aDlg;
-// if ( aDlg->exec() ) {
-// aDlg->storeToPrsObject(aPrsObject);
-// RecreateActor(aPrsObject);
-// if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
-// if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
-// vf->getRenderer()->ResetCameraClippingRange();
-// vf->Repaint();
-// }
-// }
-// // Remove old Table
-// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
-// SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(aPrsObject->GetEntry());
-// if(!aSObject->_is_nil()) {
-// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-// for ( ;aIter->More(); aIter->Next()) {
-// SALOMEDS::SObject_var aTblObj = aIter->Value();
-// if (!aTblObj->_is_nil()) {
-// SALOMEDS::GenericAttribute_var anAttr;
-// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-// aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
-// break;
-// }
-// }
-// }
-// if (aDlg->isGenerateTable()) {
-// GetVisuGen()->CreateTable(aSObject->GetID());
-// if (aDlg->isGenerateCurves()) {
-// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
-// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-// for ( ;aIter->More(); aIter->Next()) {
-// SALOMEDS::SObject_var aTblObj = aIter->Value();
-// if (!aTblObj->_is_nil()) {
-// SALOMEDS::GenericAttribute_var anAttr;
-// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-// CreatePlot(aTblObj);
-// }
-// }
-
-// }
-// }
-// }
-// GetActiveStudy()->updateObjBrowser();
-// }
-// }
-// delete aDlg;
- }
- }
- break;
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditDeformedShapeAndScalarMap()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
+}
- case VISU::TISOSURFACE: // Iso surfaces
- EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
- break;
- case VISU::TVECTORS: // Vectors 64
- EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
- break;
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditCutPlanes()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
+}
- case VISU::TSTREAMLINES:
- EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
- break;
- default:
- return;
- }
-
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditCutLines()
+{
Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if ( !CORBA::is_nil( anObject ) )
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->highlight(anIO, 1);
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditCutSegment()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
+}
-//=====================================================================================
-// function : CreateMesh()
-// purpose :
-//=====================================================================================
-void VisuGUI::CreateMesh() {
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOMEDS::SObject_var aSObject = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
-
- if (checkLock(GetStudyDocument())) return;
-
- SALOMEDS::SObject_var aSObj = aSObject->GetFather();
- aSObj = aSObj->GetFather();
- aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) {
- aSObj = aSObj->GetFather();
- anObject = VISU::SObjectToObject(aSObj);
- }
- VISU::Result_var aResult;
- if (!CORBA::is_nil(anObject)) {
- aResult = VISU::Result::_narrow(anObject);
- }
- if(CORBA::is_nil(aResult)) {
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- return;
- }
- VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- bool isExist;
- string aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if(!isExist) return;
- CORBA::Object_var aMesh;
- string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
- if(aComment == "ENTITY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
- aMesh = GetVisuGen()->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- }else if(aComment == "FAMILY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = VISU::Storable::FindValue(aMap,"myName").latin1();
- if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()))
- aMesh = GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- }else if(aComment == "GROUP"){
- string aGroupName = VISU::Storable::FindValue(aMap,"myName").latin1();
- if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str()))
- aMesh = GetVisuGen()->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - CREATE MESH");
- timer.Show();
-#endif
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditIsoSurfaces()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
+}
- QApplication::restoreOverrideCursor();
- VISU::Mesh_i* pPresent = NULL;
- if(!CORBA::is_nil(aMesh))
- pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- if (pPresent == NULL) {
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
- return;
- }
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditVectors()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
+}
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
- try{
- VISU_Actor *anActor = pPresent->CreateActor();
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- vf->AddActor(anActor);
- SetFitAll(vf);
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
- timer.Show();
-#endif
- //GetActiveStudy()->updateObjBrowser(); //not necessary
- GetDesktop()->putInfo("Ready");
- }catch(std::runtime_error& exc){
- INFOS(exc.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_CREATE_ACTOR") + " " + tr(exc.what()),
- tr ("VISU_BUT_OK") );
- }
- }
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditStreamLines()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
}
-//=====================================================================================
-// function : CreateManyMesh()
-// purpose :
-//=====================================================================================
-void VisuGUI::CreateManyMesh(){
- if (checkLock(GetStudyDocument())) return;
-
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(It.Value()->getEntry());
- SALOMEDS::SObject_var aSObj = aSObject->GetFather();
- aSObj = aSObj->GetFather();
- aSObj = aSObj->GetFather();
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) {
- aSObj = aSObj->GetFather();
- anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return;
- }
- VISU::Result_var aResult = VISU::Result::_narrow(anObject);
- if(CORBA::is_nil(aResult)) return;
-
- VISU::Storable::TRestoringMap aMap;
- SALOMEDS::GenericAttribute_var anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeComment")) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- string aComm = aComment->Value();
- QString strIn(aComm.c_str());
- VISU::Storable::StrToMap(strIn,aMap);
- }
- bool isExist;
- string aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist).latin1();
- if(!isExist) return;
- CORBA::Object_var aMesh;
- string aMeshName = VISU::Storable::FindValue(aMap,"myMeshName").latin1();
- if(aComment == "ENTITY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
- aMesh = GetVisuGen()->MeshOnEntity(aResult,aMeshName.c_str(),anEntity);
- }else if(aComment == "FAMILY"){
- VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
- string aFamilyName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str());
- }else if(aComment == "GROUP"){
- string aGroupName = VISU::Storable::FindValue(aMap,"myName").latin1();
- aMesh = GetVisuGen()->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str());
- }
- QApplication::restoreOverrideCursor();
- if(CORBA::is_nil(aMesh)) return;
-
- VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
- try{
- VISU_Actor *anActor = pPresent->CreateActor();
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
- vf->AddActor(anActor);
- SetFitAll(vf);
- }
- GetDesktop()->putInfo("Ready");
- }catch(std::runtime_error& exc){
- INFOS(exc.what());
- }
- }
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditPlot3D()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
+ EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
}
-//=====================================================================================
-// function : ChangeRepresentation()
-// purpose :
-//=====================================================================================
-static void ShrinkMesh(VISU_Actor *theActor){
- if(theActor->IsShrunk())
- theActor->UnShrink();
- else
- theActor->SetShrink();
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeSurfaceframe()
+{
+ ChangeRepresentation(this, VISU::SURFACEFRAME);
}
-void VisuGUI::ChangeRepresentation(VISU::PresentationType theType) {
- if(VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d())
- if(VISU_Actor* anActor = GetActor(aPrsObject)){
- switch (theType) {
- case VISU::SHRINK:
- ShrinkMesh(anActor);
- break;
- default:
- if(VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrsObject)){
- aMesh->SetPresentationType(theType);
- RecreateActor(aMesh);
- }else
- anActor->SetRepresentation(theType);
- }
- if (VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->Repaint();
- }
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeInsideframe()
+{
+ ChangeRepresentation(this, VISU::INSIDEFRAME);
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeWireframe()
+{
+ ChangeRepresentation(this, VISU::WIREFRAME);
+}
-void VisuGUI::MakeSurfaceframe() {
- ChangeRepresentation(VISU::SURFACEFRAME);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeSurface()
+{
+ ChangeRepresentation(this, VISU::SHADED);
}
-void VisuGUI::MakeInsideframe() {
- ChangeRepresentation(VISU::INSIDEFRAME);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakePoints()
+{
+ ChangeRepresentation(this, VISU::POINT);
}
-void VisuGUI::MakeWireframe() {
- ChangeRepresentation(VISU::WIREFRAME);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeShrink()
+{
+ ChangeRepresentation(this, VISU::SHRINK);
}
-void VisuGUI::MakeSurface() {
- ChangeRepresentation(VISU::SHADED);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMakeFeatureEdges()
+{
+ ChangeRepresentation(this, VISU::FEATURE_EDGES);
}
-void VisuGUI::MakePoints() {
- ChangeRepresentation(VISU::POINT);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSetShadingOn()
+{
+ SetShading(this, true);
}
-void VisuGUI::MakeShrink() {
- ChangeRepresentation(VISU::SHRINK);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSetShadingOff()
+{
+ SetShading(this, false);
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeColor()
+{
+ VISU_Actor* anActor = NULL;
+ VISU::Prs3d_i* aPrs3d = NULL;
+ SVTK_ViewWindow* aViewWindow = NULL;
+ if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+ return;
-//=====================================================================================
-// functions : Change Propertise
-// purpose :
-//=====================================================================================
-VISU::Prs3d_i* VisuGUI::GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO) {
- CORBA::Object_var anObject = GetSelectedObj(theIO);
- if(CORBA::is_nil(anObject)) return NULL;
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if(!aServant.in()) return NULL;
- return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-}
+ VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
+ VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
-void VisuGUI::ChageColor() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+ SALOMEDS::Color anOldColor, aNewColor;
+ int aRepresent = anActor->GetRepresentation();
+ if (aMesh) {
+ switch (aRepresent) {
+ case VISU::POINT :
+ anOldColor = aMesh->GetNodeColor();
+ break;
+ case VISU::WIREFRAME :
+ case VISU::INSIDEFRAME :
+ case VISU::FEATURE_EDGES :
+ anOldColor = aMesh->GetLinkColor();
+ break;
+ case VISU::SHADED :
+ case VISU::SURFACEFRAME :
+ anOldColor = aMesh->GetCellColor();
+ break;
+ }
+ } else if (aDeformedShape) {
+ anOldColor = aDeformedShape->GetColor();
+ } else {
+ return;
+ }
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewColor(anActor);
+ QColor aColor (int(255*anOldColor.R),
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
+ QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+ if (aColorNew.isValid()) {
+ aNewColor.R = aColorNew.red()/255.;
+ aNewColor.G = aColorNew.green()/255.;
+ aNewColor.B = aColorNew.blue()/255.;
+ if (aMesh) {
+ switch (aRepresent) {
+ case VISU::POINT :
+ aMesh->SetNodeColor(aNewColor);
+ break;
+ case VISU::WIREFRAME :
+ case VISU::INSIDEFRAME :
+ aMesh->SetLinkColor(aNewColor);
+ break;
+ case VISU::SHADED :
+ case VISU::SURFACEFRAME :
+ case VISU::FEATURE_EDGES :
+ aMesh->SetCellColor(aNewColor);
+ break;
+ }
+ } else {
+ aDeformedShape->SetColor(aNewColor);
+ }
+ RecreateActor(this, aPrs3d);
+ }
}
-void VisuGUI::ChangeWireframeColor() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeWireframeColor()
+{
+ VISU_Actor* anActor = NULL;
+ VISU::Prs3d_i* aPrs3d = NULL;
+ SVTK_ViewWindow* aViewWindow = NULL;
+ if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
+ return;
+
+ VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
+ VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
+ if(!aMesh && !aScalarMap)
+ return;
+
+ SALOMEDS::Color anOldColor, aNewColor;
+ if (aMesh)
+ anOldColor = aMesh->GetLinkColor();
+ else if (aScalarMap)
+ anOldColor = aScalarMap->GetLinkColor();
+
+
+ QColor aColor (int(255*anOldColor.R),
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
+ QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
+ if (aColorNew.isValid()) {
+ aNewColor.R = aColorNew.red()/255.;
+ aNewColor.G = aColorNew.green()/255.;
+ aNewColor.B = aColorNew.blue()/255.;
+ if (aMesh)
+ aMesh->SetLinkColor(aNewColor);
+ else
+ aScalarMap->SetLinkColor(aNewColor);
+ RecreateActor(this, aPrs3d);
+ }
+}
- VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(GetActor(aPrsObject));
- if (!anActor) return;
- NewWireframeColor(anActor);
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeOpacity()
+{
+ VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
+ aDialog->show();
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeLines()
+{
+ VISU_Actor* anActor = NULL;
+ VISU_ActorBase* anActorBase = NULL;
+ VISU::Prs3d_i* aPrs3d = NULL;
+ SVTK_ViewWindow* aViewWindow = NULL;
+ float oldlwid = 1;
+ bool isPrs3d = false;
+
+ if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
+ isPrs3d = true;
+ oldlwid = anActor->GetLineWidth();
+ }
+ else {
+ aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ anActorBase = VISU::FindActorBase(aViewWindow, aTable);
+ oldlwid = anActorBase->GetLineWidth();
+ }
-void VisuGUI::ChangeOpacity() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewOpacity(anActor);
-}
+ VisuGUI_CursorDlg* CursorDlg =
+ new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
+ CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
+ CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
+ CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
+ CursorDlg->SpinBox1->setMinimum(1);
+ CursorDlg->SpinBox1->setMaximum(10);
-void VisuGUI::ChangeLines() {
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if(!aPrsObject) return;
+ int intlwid = int(oldlwid);
+ CursorDlg->SpinBox1->setValue(intlwid);
- VISU_Actor* anActor = GetActor(aPrsObject);
- if (!anActor) return;
- NewLinewidth(anActor);
+ int ret = CursorDlg->exec();
+ if (ret == 1) {
+ intlwid = CursorDlg->SpinBox1->value();
+ float newlwid = intlwid;
+ if (isPrs3d)
+ anActor->SetLineWidth(newlwid);
+ else
+ anActorBase->SetLineWidth(newlwid);
+ }
+ delete CursorDlg;
}
-void VisuGUI::PlotTable( VISU::Table_i* table, int theDisplaying )
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangePointMarker()
{
- if ( table && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( theDisplaying == VISU::eDisplayOnly )
- aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- SALOMEDS::SObject_var TableSO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetEntry() );
- if ( !TableSO->_is_nil() ) {
- SALOMEDS::ChildIterator_var Iter = GetActiveStudy()->getStudyDocument()->NewChildIterator( TableSO );
- for ( ; Iter->More(); Iter->Next() ) {
- CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() );
- if( !CORBA::is_nil( childObject ) ) {
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
- if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- Plot2d_Curve* plotCurve = 0;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- plotCurve = clist.at( i );
- break;
- }
- }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve ) {
- aPlot->eraseCurve( plotCurve, false );
- clist.remove( plotCurve );
- }
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
- //plotCurve->setVerTitle( theCurve->GetVerTitle().c_str() );
- plotCurve->setVerTitle( theCurve->GetName() );
- plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
- plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
- /* - DATA NOT UPDATED */
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- plotCurve->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- }
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- }
- }
+ SALOME_ListIO aListIO;
+ GetSelectionMgr( this )->selectedObjects( aListIO );
+ if( aListIO.Extent() < 1 )
+ return;
+
+ VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
+ _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
+ int aStudyId = aCStudy->StudyId();
+
+ QPixmap aPointSpritePixmap;
+ if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
+ aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
+
+ bool update = false;
+ for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
+ {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
+ for( int i = 0, n = aPrsList.size(); i < n; i++ )
+ {
+ if( VISU::Prs3d_i* aPrs = aPrsList[i] )
+ {
+ VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
+ aDlg->setHelpData( "VISU", "point_marker_page.html" );
+
+ aDlg->setCustomMarkers( aMarkerMap[ aStudyId ] );
+
+ aDlg->addMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
+
+ VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
+ VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
+ int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
+ if( aMarkerTypeCurrent != VISU::MT_USER )
+ aDlg->setMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
+ else
+ aDlg->setCustomMarker( aMarkerTextureCurrent );
+
+ if( aDlg->exec() )
+ {
+ aMarkerMap[ aStudyId ] = aDlg->customMarkers();
+
+ VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->markerType();
+ VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->markerScale();
+ int aMarkerTextureNew = aDlg->markerId();
+ if( aMarkerTypeNew != VISU::MT_USER )
+ aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
+ else
+ aPrs->SetMarkerTexture( aMarkerTextureNew );
+
+ aPrs->UpdateActors();
+ update = true;
+ }
+
+ delete aDlg;
}
- aPlot->Repaint();
}
}
+
+ if( update )
+ if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
+ vw->Repaint();
}
-void VisuGUI::PlotCurve( VISU::Curve_i* theCurve, int theDisplaying )
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnChangeShrinkFactor()
{
- if ( theCurve && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
-// if ( theDisplaying == VISU::eDisplayOnly )
-// aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- Plot2d_Curve* plotCurve = 0;
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
- plotCurve = clist.at( i );
- }
- else if ( theDisplaying == VISU::eDisplayOnly ) {
- aPlot->eraseCurve( clist.at( i ) );
- }
- }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve )
- aPlot->eraseCurve( plotCurve, false );
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
- //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( theCurve->GetName() );
- plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
- plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- plotCurve->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- }
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- aPlot->Repaint();
- }
+ VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
+ aDialog->show();
}
-void VisuGUI::PlotContainer( VISU::Container_i* container, int theDisplaying )
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnShowTable()
{
- if ( container && GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
- if ( theDisplaying == VISU::eDisplayOnly )
- aPlot->EraseAll();
- QList<Plot2d_Curve> clist;
- aPlot->getCurves( clist );
- if ( container->GetNbCurves() > 0 ) {
- int nbCurves = container->GetNbCurves();
- for ( int k = 1; k <= nbCurves; k++ ) {
- VISU::Curve_i* theCurve = container->GetCurve( k );
- if ( theCurve && theCurve->IsValid() ) {
- Plot2d_Curve* plotCurve = aPlot->getCurveByIO( new SALOME_InteractiveObject( theCurve->GetEntry(), "", "" ) );
-// for ( int i = 0; i < clist.count(); i++ ) {
-// if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
-// plotCurve = clist.at( i );
-// break;
-// }
-// }
- if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve ) {
- aPlot->eraseCurve( plotCurve, false );
- clist.remove( plotCurve );
- }
- }
- else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
- if ( plotCurve ) {
- plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() );
- //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) );
- plotCurve->setVerTitle( theCurve->GetName() );
- plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
- plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
- double* xList = 0;
- double* yList = 0;
- int nbPoints = theCurve->GetData( xList, yList );
- if ( nbPoints > 0 && xList && yList ) {
- plotCurve->setData( xList, yList, nbPoints );
- }
- if ( !theCurve->IsAuto() ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() );
- SALOMEDS::Color color = theCurve->GetColor();
- plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- }
- plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
- }
- else {
- Plot2d_Curve* crv = theCurve->CreatePresentation();
- if ( crv ) {
- aPlot->displayCurve( crv, false );
- theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
- theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = crv->getColor().red()/255.;
- newColor.G = crv->getColor().green()/255.;
- newColor.B = crv->getColor().blue()/255.;
- theCurve->SetColor( newColor );
- crv->setAutoAssign( theCurve->IsAuto() );
- }
- }
- }
- }
- }
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
+
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
+ aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
+ if( IsSObjectTable( aSObject ) ) {
+ VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
+ GetCStudy( GetAppStudy( this ) ),
+ aTable,
+ false,
+ //SAL2670 Orientation of show tables
+ VISU_TableDlg::ttAuto,
+ Qt::Vertical );
+ dlg->show();
}
- aPlot->Repaint();
}
}
-/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::ShowTable() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnShowTablePlot()
+{
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
return;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- SALOMEDS::SObject_var SO;
- if ( !CORBA::is_nil( anObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
- CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
- if( !CORBA::is_nil( aTable ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- if ( table ) {
- SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
- }
- }
- }
- } else {
- // possibly this is Table SObject
- SO = GetActiveStudy()->getStudyDocument()->FindObjectID( anIO->getEntry() );
+
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
+ VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
+ aDlg->initFromPrsObject( aTable );
+ if ( runAndWait(aDlg, 0) > 0 ) {
+ aDlg->storeToPrsObject(aTable);
+ aTable->UpdateActors();
+ }
+ delete aDlg;
}
+}
- if(!IsSObjectTable(SO))
- return;
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnShowScalarBar()
+{
+ SetScalarBarVisibility(true);
+}
- SALOMEGUI_TableDlg* dlg = new SALOMEGUI_TableDlg( QAD_Application::getDesktop(),
- SO,
- false,
- //SAL2670 Orientation of show tables
- SALOMEGUI_TableDlg::ttAuto,
- Qt::Vertical );
- dlg->show();
+void
+VisuGUI
+::OnHideScalarBar()
+{
+ SetScalarBarVisibility(false);
}
+void
+VisuGUI
+::SetScalarBarVisibility(bool theVisibility)
+{
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
-/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::CreateTable() {
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( aSel->IObjectCount() !=1 )
- return;
+ SALOME_ListIteratorOfListIO It (aListIO);
- Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
- if (anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()) {
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
- VISU::CutLines_var aCutLines = VISU::CutLines::_narrow( anObject );
- if(!aCutLines->_is_nil() || IsSObjectTable(aSObject)) {
- GetVisuGen()->CreateTable(aSObject->GetID());
- GetActiveStudy()->updateObjBrowser();
+ bool update = false;
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
+ if ( aPrsList.size()>0 ) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
+ aScalar->SetBarVisible( theVisibility );
+ RecreateActor(this, aScalar);
+ update = true;
+ } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
+ aGauss->SetBarVisible( theVisibility );
+ RecreateActor(this, aGauss);
+ update = true;
+ }
+ }
}
}
}
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
+ vw->Repaint();
+ }
}
-
-/*!
- Slot : deletes SObject with all subobjects
-*/
-void VisuGUI::DeleteObject() {
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- if (checkLock(aStudy)) return;
-
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( aSel->IObjectCount() !=1 )
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnCreateTable()
+{
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
return;
- Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
- if (anIO->hasEntry()){
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- ::ErasePrs(aChildObj);
- }
- SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
- // There is a transaction
- aStudyBuilder->NewCommand();
- CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
- if(!CORBA::is_nil(anObj)){
- VISU::Base_var aBase = VISU::Base::_narrow(anObj);
- if(!CORBA::is_nil(aBase)){
- VISU::VISUType aType = aBase->GetType();
- switch (aType){
- case VISU::TRESULT:
- {
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
- DeletePresentation(pPrs3d);
- }
- break;
- }
- case VISU::TTABLE:
- {
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( aChildObj );
- if(CORBA::is_nil(aCurve)) continue;
- VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- DeletePresentation(pCurve);
- }
- break;
- }
- }
- }
- }
- aStudyBuilder->RemoveObjectWithChildren(aSObject);
- aStudyBuilder->CommitCommand();
- GetActiveStudy()->unHighlightAll();
- GetActiveStudy()->updateObjBrowser(true);
- }
- }
-}
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
-/*!
- Slot : deletes empty container
-*/
-void VisuGUI::CreatePlot2dView() {
- if (checkLock(GetStudyDocument())) return;
- GetVisuGen()->CreateContainer();
- GetActiveStudy()->updateObjBrowser( true );
+ if(aBase &&
+ (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
+ IsSObjectTable(aSObject)) {
+ GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
+ UpdateObjBrowser(this);
+ }
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnDeleteObjects()
+{
+ SalomeApp_Study* anAppStudy = GetAppStudy(this);
+ _PTR(Study) aCStudy = GetCStudy(anAppStudy);
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
+ SALOME_ListIO aList;
+ LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
+ mgr->selectedObjects(aList,QString::null,false);
+ int i = 0, nbSelected = aList.Extent();
+ if (nbSelected < 1) return;
-/*!
- Opens dialog box for curves creation. Acts only for selected SObject with table attribute.
-*/
-void VisuGUI::PlotData() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
- return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if ( !CORBA::is_nil( anObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
- // Table (VISU object) is selected
- CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
- if( !CORBA::is_nil( aTbl ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
- if ( table ) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- QString SOName;
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
- if ( IsSObjectTable(SO) ) {
- // get name of SObject
- if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- SOName = aName->Value();
- }
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
- if ( dlg->exec() == QDialog::Accepted ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // if study is not locked - create new container, create curves
- // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
- int horIndex;
- QValueList<int> verIndices;
- dlg->getCurvesSource( horIndex, verIndices );
- if ( horIndex >= 0 && verIndices.count() > 0 ) {
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if( !CORBA::is_nil( aContainer ) ) {
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
- if ( pContainer ) {
- for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
- if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
- if ( pCrv ) {
- bool isAuto;
- int marker, line, lineWidth;
- QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
- pCrv->SetColor( c );
- pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
- pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
- }
- pContainer->AddCurve( pCrv->_this() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
- }
- else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
- Plot2d_CurveContainer container;
- dlg->getCurves( container );
- if ( !container.isEmpty() ) {
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->displayCurves( container, true );
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->setTitle( SOName );
- }
- }
- }
- delete dlg;
- }
- }
+ std::vector<std::string> anEntries (nbSelected);
+ QString aNameList;
+ Handle(SALOME_InteractiveObject) anIO;
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ anIO = it.Value();
+ if (anIO->hasEntry()) {
+ if (IsRemovable(anIO->getEntry(), this)) {
+ aNameList.append("\n - ");
+ // Get Name Of the Main Object if it's a referenced object
+ VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+ _PTR(SObject) aRefSObject;
+ if (aSObject->ReferencedObject(aRefSObject)) {
+ QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
+ aNameList.append( aRefName );
+ }
+ else
+ aNameList.append(anIO->getName());
+ }
+ anEntries[i++] = anIO->getEntry();
}
}
}
- else {
- // possibly this is Table SObject
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- QString SOName;
-
- // check if Table SObject is selected
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( IsSObjectTable(SO) ) {
- // get name of SObject
- if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- SOName = aName->Value();
+ nbSelected = i;
+ if (nbSelected < 1) {
+ SUIT_MessageBox::warning(GetDesktop(this),
+ QObject::tr("WRN_VISU"),
+ QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
+ return;
+ }
+
+ if ( SUIT_MessageBox::question( GetDesktop(this),
+ QObject::tr( "WRN_VISU" ),
+ QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
+ return;
+
+ // There is a transaction
+ _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
+ aStudyBuilder->NewCommand();
+
+ for (i = 0; i < nbSelected; i++) {
+ VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
+ if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+ emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
+ _PTR(SObject) aRefSObject;
+ if (aSObject->ReferencedObject(aRefSObject)) {
+ // It can be a reference on curve, published under a container.
+ // In this case the curve should be removed from the container.
+ // See bug 10441.
+ VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
+ VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
+ if(aRefBase && aRefBase->GetType() == VISU::TMESH){
+ DeleteSObject(this, aCStudy, aRefSObject);
+ UpdateObjBrowser(this, true, aRefSObject);
+ }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
+ CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
+ VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
+ _PTR(SObject) aParentSO = aSObject->GetFather();
+ VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
+ if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
+ if(aContainer->GetNbCurves() > 0){
+ aContainer->RemoveCurve(aCurve);
+ UpdateObjBrowser(this, true, aParentSO);
+ }
+ }
+ }
+ }
}
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
- if ( dlg->exec() == QDialog::Accepted ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // if study is not locked - create new table and container objects, create curves
- // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
- int horIndex;
- QValueList<int> verIndices;
- dlg->getCurvesSource( horIndex, verIndices );
- if ( horIndex >= 0 && verIndices.count() > 0 ) {
- CORBA::Object_var aTable = GetVisuGen()->CreateTable( SO->GetID() );
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
-
- if ( pContainer && pTable ) {
- for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
- if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
- if ( pCrv ) {
- bool isAuto;
- int marker, line, lineWidth;
- QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
- pCrv->SetColor( c );
- pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
- pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
- }
- pContainer->AddCurve( pCrv->_this() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
- }
- }
- }
- } else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_CurveContainer container;
- dlg->getCurves( container );
- if ( !container.isEmpty() ) {
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->displayCurves( container, true );
- ((Plot2d_ViewFrame*)(GetActiveStudy()->getActiveStudyFrame()->
- getRightFrame()->getViewFrame()))->setTitle( SOName );
- }
- }
- }
+ else{
+ DeleteSObject(this, aCStudy, aSObject);
+ UpdateObjBrowser(this, true, aSObject);
}
- delete dlg;
- }
+ }
}
+
+ // Finish transaction
+ aStudyBuilder->CommitCommand();
+ mgr->clearSelected();
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnPlotData()
+{
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
-void VisuGUI::CreatePlot(SALOMEDS::SObject_var theTableSO) {
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
-
- if ( IsSObjectTable(theTableSO) ) {
- CORBA::Object_var aTable = VISU::SObjectToObject(theTableSO);
- CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
- if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant(aContainer).in() );
-
- if ( pContainer && pTable ) {
- for ( int i = 2; i <= pTable->GetNbRows(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), 1, i );
- if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aNewCurve).in() );
- if ( pCrv ) {
- pContainer->AddCurve( pCrv->_this() );
- }
- }
- }
- GetActiveStudy()->updateObjBrowser( true );
- PlotContainer( pContainer, VISU::eDisplay );
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+ if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
+ if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
+ if(IsSObjectTable(aSObject)){
+ VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, aTable ,GetDesktop(this));
+ if(aDlg->exec() == QDialog::Accepted){
+ if(!IsStudyLocked(aStudy)){
+ // if study is not locked - create new container, create curves and insert them
+ // into container, then plot container if current viewer is of VIEW_PLOT2D type
+ int horIndex;
+ QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
+ aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
+ verIndices = ver1Indices + ver2Indices;
+ if( horIndex >= 0 && verIndices.count() > 0 ){
+ CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
+ for( int i = 0; i < verIndices.count(); i++ ){
+ bool isV2 = ver2Indices.contains(verIndices[i]);
+ VISU::Curve_var aCurveObject =
+ GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(),
+ aDlg->idx(horIndex)+1,
+ aDlg->idx(verIndices[i])+1,
+ aDlg->idx(zIndices[i])+1, isV2 );
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+ bool isAuto;
+ int marker, line, lineWidth;
+ QColor color;
+ if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+ line, lineWidth, color) && !isAuto )
+ {
+ SALOMEDS::Color c;
+ c.R = color.red() /255.;
+ c.G = color.green()/255.;
+ c.B = color.blue() /255.;
+ aCurve->SetColor( c );
+ aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+ aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+ }
+ aContainer->AddCurve(aCurveObject);
+ }
+ }
+ UpdateObjBrowser(this);
+ PlotContainer( this, aContainer, VISU::eDisplay );
+ }
+ }
+ } else {
+ // get name of SObject
+ QString aSObjectName;
+ _PTR(GenericAttribute) anAttr;
+ if(aSObject->FindAttribute( anAttr, "AttributeName" )){
+ _PTR(AttributeName) aName = anAttr;
+ aSObjectName = QString( aName->Value().c_str() );
+ }
+ // if study is locked just get curves info and plot them
+ // if current viewer is of VIEW_PLOT2D type
+ QList<Plot2d_Curve*> container;
+ aDlg->getCurves( container );
+ if ( !container.isEmpty() ) {
+ GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+ GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
+ }
+ }
+ }
+ delete aDlg;
+ }
+ }
+ }
+ }else if(!aSelectionItem.myIO.IsNull()){
+ // check if Table SObject is selected
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ if(IsSObjectTable(aSObject)){
+ VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, NULL, GetDesktop(this));
+ if(aDlg->exec() == QDialog::Accepted){
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ if(!IsStudyLocked(aStudy)){
+ // if study is not locked - create new table and container objects, create curves
+ // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
+ int horIndex;
+ QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
+ aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
+ verIndices = ver1Indices + ver2Indices;
+ if ( horIndex >= 0 && verIndices.count() > 0 ) {
+ VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
+ if(!CORBA::is_nil(aTableObject)){
+ VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
+ for ( int i = 0; i < verIndices.count(); i++ ) {
+ bool isV2 = ver2Indices.contains(verIndices[i]);
+ VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
+ ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+ bool isAuto;
+ int marker, line, lineWidth;
+ QColor color;
+ if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+ line, lineWidth, color) && !isAuto )
+ {
+ SALOMEDS::Color c;
+ c.R = color.red()/255.;
+ c.G = color.green()/255.;
+ c.B = color.blue()/255.;
+ aCurve->SetColor( c );
+ aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+ aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+ }
+ aContainerObject->AddCurve(aCurveObject);
+ }
+ }
+ UpdateObjBrowser(this);
+ PlotContainer( this, aContainer, VISU::eDisplay );
+ }
+ }
+ } else {
+ // get name of SObject
+ QString aSObjectName;
+ _PTR(GenericAttribute) anAttr;
+ if(aSObject->FindAttribute(anAttr, "AttributeName")){
+ _PTR(AttributeName) aName = anAttr;
+ aSObjectName = QString( aName->Value().c_str() );
+ }
+ // if study is locked just get curves info and plot them
+ QList<Plot2d_Curve*> container;
+ aDlg->getCurves( container );
+ if ( !container.isEmpty() ) {
+ GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+ GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
+ }
+ }
}
+ delete aDlg;
}
}
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnCurveProperties()
+{
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.size() != 1)
+ return;
-/*!
- Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
-*/
-void VisuGUI::CurveProperties() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if (CORBA::is_nil( anObject )) return;
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
+ if(aBase->GetType() == VISU::TCURVE) {
// Curve object
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
- if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- if ( curve && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- SALOMEGUI_SetupCurveDlg* dlg = new SALOMEGUI_SetupCurveDlg( QAD_Application::getDesktop() );
- dlg->setLine( (int)curve->GetLine(), curve->GetLineWidth() );
- dlg->setMarker( (int)curve->GetMarker() );
- SALOMEDS::Color color = curve->GetColor();
- dlg->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
- if( dlg->exec() == QDialog::Accepted ) {
- curve->SetLine( (VISU::Curve::LineType)dlg->getLine(), dlg->getLineWidth() );
- curve->SetMarker( (VISU::Curve::MarkerType)dlg->getMarker());
- SALOMEDS::Color newColor;
- newColor.R = dlg->getColor().red()/255.;
- newColor.G = dlg->getColor().green()/255.;
- newColor.B = dlg->getColor().blue()/255.;
- curve->SetColor( newColor );
- QList<QAD_StudyFrame> sfList = GetActiveStudy()->getStudyFrames();
- if ( sfList.count() > 0 ) {
- QListIterator<QAD_StudyFrame> it( sfList );
- for ( ; it.current(); ++it ) {
- if ( it.current()->getTypeView() == VIEW_PLOT2D ) {
- Plot2d_ViewFrame* aPlot = (Plot2d_ViewFrame*)it.current()->getRightFrame()->getViewFrame();
- Handle(SALOME_InteractiveObject) IO = aPlot->FindIObject( curve->GetEntry() );
- if ( IO.IsNull() )
- continue;
- Plot2d_Curve* plotCurve = aPlot->getCurveByIO( IO );
- if ( plotCurve ) {
- plotCurve->setLine( (Plot2d_Curve::LineType)dlg->getLine(), dlg->getLineWidth() );
- plotCurve->setMarker( (Plot2d_Curve::MarkerType)dlg->getMarker() );
- plotCurve->setColor( dlg->getColor() );
- aPlot->updateCurve( plotCurve, true );
- }
- }
- }
- }
- }
- }
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
+ if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
+ Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
+
+ aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
+ aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
+ SALOMEDS::Color aColor = aCurve->GetColor();
+ aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
+ if( aDlg.exec() == QDialog::Accepted ) {
+ aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
+ aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
+ SALOMEDS::Color newColor;
+ newColor.R = aDlg.getColor().red()/255.;
+ newColor.G = aDlg.getColor().green()/255.;
+ newColor.B = aDlg.getColor().blue()/255.;
+ aCurve->SetColor( newColor );
+ PlotCurve(this, aCurve, VISU::eDisplay);
+ }
+ }
}
}
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnCurveScale()
+{
+ if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
+ return;
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
+ int nbSel = aSelectionInfo.size();
+ QList<VISU::Curve_i*> curList;
+ bool isValuesEquals = true;
+ double value;
-/*!
- Slot : Clears container contents : for Container object selected
-*/
-void VisuGUI::ClearContainer() {
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( Sel->IObjectCount() !=1 )
+ for (int i = 0; i < nbSel; i++ ) {
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
+ continue;
+
+ if(aBase->GetType() == VISU::TCURVE)
+ // Curve object
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
+ curList.append(aCurve);
+ if( i>0 && isValuesEquals )
+ isValuesEquals = (value == aCurve->GetScale());
+ value = aCurve->GetScale();
+ }
+ }
+
+ Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
+ if( isValuesEquals )
+ aDlg.setScale(value);
+
+ if( aDlg.exec() == QDialog::Accepted )
+ for ( int i = 0; i < curList.size(); ++i )
+ curList.at(i)->SetScale( aDlg.getScale() );
+}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnClearContainer()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
return;
- CORBA::Object_var anObject = GetSelectedObj();
- SALOMEDS::SObject_var SO;
- if (CORBA::is_nil( anObject )) return;
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
+ return;
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
+ if(aBase->GetType() == VISU::TCONTAINER){
// Container object
- CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aCnt ) ) {
- VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
- if ( container && container->GetNbCurves() > 0 && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- container->Clear();
- GetActiveStudy()->updateObjBrowser();
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
+ if(aContainer && aContainer->GetNbCurves() > 0){
+ aContainer->Clear();
+ VISU::updateContainerVisibility(aContainer);
+ UpdateObjBrowser(this);
}
}
}
}
-/*!
- Slot : Edit container contents : for Container object selected
-*/
-void VisuGUI::EditContainer() {
- CORBA::Object_var anObject = GetSelectedObj();
- if(CORBA::is_nil(anObject)) return;
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
- if(!aServant.in()) return;
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
- if(!aContainer) return;
-
- VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg();
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnEditContainer()
+{
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
+
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
+ return;
+
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
+ if(!aContainer)
+ return;
+
+ VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
aDlg->initFromPrsObject(aContainer);
if (aDlg->exec()) {
aDlg->storeToPrsObject(aContainer);
- GetActiveStudy()->updateObjBrowser( true );
+ UpdateObjBrowser(this, true);
+ delete aDlg;
+ VISU::updateContainerVisibility(aContainer);
}
- delete aDlg;
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSaveViewParams()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
-void VisuGUI::DeletePrs() {
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- if (checkLock(aStudy)) return;
-
- // There is a transaction
- SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
- aStudyBuilder->NewCommand();
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ if (aViewMgr->getType() != SVTK_Viewer::Type())
+ return;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if(aPrsObject)
- DeletePresentation(aPrsObject);
- // is it Curve object ?
- VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if(aCurveObject)
- DeletePresentation(aCurveObject);
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() > 1)
+ return;
+
+ if (aListIO.Extent() == 0) {
+ VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
+ } else {
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
}
- aStudyBuilder->CommitCommand();
+ UpdateObjBrowser(this);
}
-
-void VisuGUI::SaveViewParams()
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnRestoreViewParams()
{
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- QAD_StudyFrame* aStudyFrame = GetActiveStudy()->getActiveStudyFrame();
- if ( aSel->IObjectCount() > 1 || aStudyFrame->getTypeView() != VIEW_VTK )
+ SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
+ if (aViewMgr->getType() != SVTK_Viewer::Type())
return;
- if ( aSel->IObjectCount() == 0 ) {
- VISU::View3D_i::SaveViewParams(aStudyFrame,VISU::View3D_i::GenerateViewParamsName().latin1());
- }else{
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- VISU::View3D_i::SaveViewParams(aStudyFrame,anIO->getName());
- }
- GetActiveStudy()->updateObjBrowser( true );
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ if (aListIO.Extent() != 1)
+ return;
+
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+ //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
+ if ( aSObj )
+ VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnClippingPlanes()
+{
+ new VisuGUI_ClippingDlg (this, false);
+}
-void VisuGUI::RestoreViewParams()
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSweep()
{
- SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- QAD_StudyFrame* aStudyFrame = GetActiveStudy()->getActiveStudyFrame();
- if ( aSel->IObjectCount() > 1 || aStudyFrame->getTypeView() != VIEW_VTK )
- return;
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- VISU::View3D_i::RestoreViewParams(aStudyFrame,anIO->getName());
+ OnDisplayPrs();
+ if ( !mySweep->toggleViewAction()->isChecked() )
+ mySweep->toggleViewAction()->trigger();
+ mySweep->onSelectionChanged();
+ mySweep->onFirst();
+ mySweep->onPlay(true);
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
+{
+ if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
+ return;
-//=====================================================================================
-// function : DeleteViewParams()
-// purpose :
-//=====================================================================================
-void VisuGUI::DeleteViewParams() {
- bool isExist;
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist && aType == VISU::TVIEW3D){
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- aStudy->NewBuilder()->RemoveObject(aSObject);
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ VisuGUI_TimeAnimationDlg* aAnimationDlg =
+ new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
- SALOME_Selection* aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- aSel->RemoveIObject(anIO, 0);
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- GetActiveStudy()->updateObjBrowser( true );
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
+ if ( !aAnimationDlg->addField(aSObject) ) {
+ SUIT_MessageBox::warning(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_CANT_CREATE_ANIMATION") );
+ delete aAnimationDlg;
+ return;
+ }
}
+ aAnimationDlg->show();
}
+//----------------------------------------------------------------------------
+void
+VisuGUI::
+OnParallelTimeAnimation()
+{
+ OnTimeAnimation(VISU::Animation::PARALLEL);
+}
-//=====================================================================================
-// function : Sweep()
-// purpose :
-//=====================================================================================
-void VisuGUI::Sweep() {
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(GetSelectedPrs3d());
- if (!aPrsObject) return;
-
- VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame();
- if(!vf) return;
+void
+VisuGUI::
+OnSucccessiveTimeAnimation()
+{
+ OnTimeAnimation(VISU::Animation::SUCCESSIVE);
+}
- int aTemp=100000;
- QString aTempoStr = QAD_CONFIG->getSetting("Visu:SweepTempo");
- if ( !aTempoStr.isEmpty() )
- aTemp = int(1.E6*(aTempoStr.toFloat()));
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnShowAnimation()
+{
+ if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
+ return;
- int aCycles=1;
- QString aCyclesStr = QAD_CONFIG->getSetting("Visu:SweepCycles");
- if ( !aCyclesStr.isEmpty() )
- aCycles = aCyclesStr.toInt();
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
- int aSteps=40;
- QString aStepsStr = QAD_CONFIG->getSetting("Visu:SweepSteps");
- if ( !aStepsStr.isEmpty() )
- aSteps = aStepsStr.toInt();
+ if (aListIO.Extent() != 1)
+ return;
- VISU_Actor* aActor = GetActor(aPrsObject);
- if (!aActor) return;
-
- if (!aActor->GetVisibility()) {
- aActor->VisibilityOn();
- }
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
- QApplication::setOverrideCursor( Qt::waitCursor );
- try{
- for (int j=0 ; j<aCycles; j++) {
- for (int i=0 ; i<=aSteps; i++) {
- float aPercents = float(i)/aSteps;
- aPrsObject->SetMapScale(aPercents);
- aPrsObject->UpdateActor(aActor);
- vf->getRW()->getRenderWindow()->Render();
- usleep(aTemp);
- }
- }
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was occured!");
- }
- QApplication::restoreOverrideCursor();
-}
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+ if (!aSObj)
+ return;
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
+ if (aType != VISU::TANIMATION)
+ return;
-void VisuGUI::TimeAnimation() {
- VisuGUI_TimeAnimationDlg* aAnimationDlg = new VisuGUI_TimeAnimationDlg(GetStudyDocument());
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
-
- bool isDefined = false;
- long aNbTimes = 0;
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- for (; It.More(); It.Next()) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID( It.Value()->getEntry() );
- if (aSObject->_is_nil()) continue;
- if (getValue(aSObject, "myComment") == QString("FIELD")) {
- long aNumber = getValue(aSObject, "myNbTimeStamps").toLong();
- if (aNumber > 1) {
- if (!isDefined) {
- aNbTimes = aNumber;
- aAnimationDlg->addField(aSObject);
- isDefined = true;
- } else if (aNbTimes == aNumber) {
- aAnimationDlg->addField(aSObject);
- }
- }
- }
- }
- if (isDefined) aAnimationDlg->show();
- else delete aAnimationDlg;
+ VisuGUI_TimeAnimationDlg* aAnimationDlg =
+ new VisuGUI_TimeAnimationDlg(this, aCStudy);
+ aAnimationDlg->restoreFromStudy(aSObj);
+ aAnimationDlg->show();
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnPointEvolution()
+{
+ _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
+ VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
-void VisuGUI::ImportMedField() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
- QApplication::setOverrideCursor( Qt::waitCursor );
- for(;It.More();It.Next()) {
- Handle(SALOME_InteractiveObject) anIO = It.Value();
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
- if(!CORBA::is_nil(anObject)){
- SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow( anObject );
- if(!CORBA::is_nil(aMED.in()))
- GetVisuGen()->ImportMed( aSObject );
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow( anObject );
- if(!CORBA::is_nil(aField.in()))
- GetVisuGen()->ImportMedField( aField );
- }else{
- SALOMEDS::SObject_var aSFather = aSObject->GetFather();
- SALOMEDS::GenericAttribute_var anAttr;
- aSFather->FindAttribute(anAttr, "AttributeName");
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- CORBA::String_var aValue = aName->Value();
- if(strcmp(aValue.in(),"MEDFIELD") == 0)
- GetVisuGen()->ImportMed(aSObject);
- //if(strcmp(aValue.in(),"MEDMESH") == 0)
- // VisuGUI::myComponent->ImportMed(aSObject);
- }
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects( aListIO );
+
+ SALOME_ListIteratorOfListIO It( aListIO );
+ for( ; It.More(); It.Next() )
+ {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
+ if( !aDlg->setField( aSObject ) )
+ {
+ SUIT_MessageBox::warning( GetDesktop( this ),
+ tr( "WRN_VISU" ),
+ tr( "ERR_CANT_CREATE_EVOLUTION" ) );
+ delete aDlg;
+ return;
}
}
- GetActiveStudy()->updateObjBrowser( true );
- QApplication::restoreOverrideCursor();
+ aDlg->show();
}
-//=====================================================================================
-// functions : Rename()
-// purpose :
-//=====================================================================================
-void VisuGUI::Rename() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnShowEvolution()
+{
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects( aListIO );
+
+ if( aListIO.Extent() != 1 )
return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Curve_i* curve = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) {
- // Curve object
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
- if( !CORBA::is_nil( aCurve ) ) {
- curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- }
- }
- }
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( curve )
- curve->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
-}
+ const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
-//=====================================================================================
-// functions : RenameTable()
-// purpose :
-//=====================================================================================
-void VisuGUI::RenameTable() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
+ _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
+ _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
+ if( !aSObj )
return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Table_i* table = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
- // Table object
- CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
- if( !CORBA::is_nil( aTable ) ) {
- table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
- }
- }
- }
-
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( table )
- table->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
-}
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
+ if( aType != VISU::TEVOLUTION )
+ return;
+ VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
+ aDlg->restoreFromStudy( aSObj );
+ aDlg->show();
+}
-//=====================================================================================
-// functions : RenameContainer()
-// purpose :
-//=====================================================================================
-void VisuGUI::RenameContainer() {
- if (checkLock(GetStudyDocument())) return;
- SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if ( Sel->IObjectCount() != 1 )
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnCopyPresentation()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
return;
- SALOMEDS::SObject_var aSObj = GetStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if( aSObj->_is_nil() ) return;
-
- VISU::Container_i* container = 0;
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject )) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
- // Curve object
- CORBA::Object_ptr aContainer = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aContainer ) ) {
- container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
- }
- }
- }
- //TEST DU PARENT == VISU
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- if ( aSObj->FindAttribute(anAttr, "AttributeName") ) {
- aName = SALOMEDS::AttributeName::_narrow( anAttr );
- QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), aName->Value() );
- if ( !Name.isEmpty() ) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- if ( container )
- container->SetName( Name.latin1() );
- GetActiveStudy()->renameIObject( Sel->firstIObject(), Name );
- QApplication::restoreOverrideCursor();
-
- //int TypeMode; bool InViewer;
- //VISU_Actor *ActorTmp = ActorSelected(parent,InViewer,&TypeMode);
- //ActorTmp->setName((Standard_CString)Name.latin1());
- }
- }
-}
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(!aBase)
+ return;
+ VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
+ if(!aPrs3d)
+ return;
-//=====================================================================================
-// function : CopyPresentation()
-// purpose :
-//=====================================================================================
-void VisuGUI::CopyPresentation(){
- if (checkLock(GetStudyDocument())) return;
- VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
- if (!aPrsObject) return;
- switch (aPrsObject->GetType()) {
- case VISU::TMESH:
- {
- VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
- VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
- aSameMesh->SameAs(aMeshPrs);
- UpdateViewer(aSameMesh);
- }
- break;
- case VISU::TSCALARMAP:
- {
- VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
- VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult());
- aSameScalar->SameAs(aScalarPrs);
- UpdateViewer(aSameScalar);
- }
- break;
- case VISU::TDEFORMEDSHAPE:
- {
- VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
- VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult());
- aSameDeformed->SameAs(aDefPrs);
- UpdateViewer(aSameDeformed);
- }
- break;
- case VISU::TCUTPLANES:
- {
- VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
- VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult());
- aSameCut->SameAs(aCutPrs);
- UpdateViewer(aSameCut);
- }
- break;
+ if(aBase->GetType() != VISU::TMESH){
+ VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
+ switch (aBase->GetType()) {
+ case VISU::TSCALARMAP:
+ TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TDEFORMEDSHAPE:
+ TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TSCALARMAPONDEFORMEDSHAPE:
+ case VISU::TDEFORMEDSHAPEANDSCALARMAP:
+ TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TCUTPLANES:
+ TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
case VISU::TCUTLINES:
+ TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TCUTSEGMENT:
+ TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TISOSURFACES:
+ TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TSTREAMLINES:
+ TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TVECTORS:
+ TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ case VISU::TPLOT3D:
+ TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
+ break;
+ }
+ UpdateObjBrowser(this);
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnToggleSelectionPanel()
+{
+ if (GetActiveViewWindow<SVTK_ViewWindow>(this))
+ {
+ if( myPanels.find( SelectionPanelId ) != myPanels.end() )
{
- VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
- VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult());
- aSameCut->SameAs(aCutPrs);
- UpdateViewer(aSameCut);
- }
- break;
- case VISU::TISOSURFACE:
- {
- VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
- VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult());
- aSameIso->SameAs(aIsoPrs);
- UpdateViewer(aSameIso);
- }
- break;
- case VISU::TSTREAMLINES:
- {
- VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
- VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult());
- aSameLines->SameAs(aLinesPrs);
- UpdateViewer(aSameLines);
- }
- break;
- case VISU::TVECTORS:
- {
- VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
- VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult());
- aSameVectors->SameAs(aVectorsPrs);
- UpdateViewer(aSameVectors);
- }
- break;
- }
- GetActiveStudy()->updateObjBrowser();
+ if( VisuGUI_SelectionPanel* aSelectionPanel =
+ dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+ {
+ if( aSelectionPanel->isVisible() )
+ aSelectionPanel->hide();
+ else
+ aSelectionPanel->show();
+ }
+ }
+ }
+ else
+ SUIT_MessageBox::warning(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ACTIVATE_VIEW3D") );
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSwitchSelectionMode()
+{
+ QAction* anAction = dynamic_cast<QAction*>( sender() );
+ if( !anAction )
+ return;
+ bool isAnyChecked = false;
+ for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
+ {
+ QAction* aRefAction = action( anId );
+ isAnyChecked |= aRefAction->isChecked();
+ if( anAction != aRefAction )
+ aRefAction->setChecked( false );
+ else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
+ {
+ if( VisuGUI_SelectionPanel* aSelectionPanel =
+ dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+ aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
+ }
+ }
+ // At least one action must be checked
+ if( !isAnyChecked )
+ anAction->setChecked( true );
+}
-//=====================================================================================
-// function : DefinePopup()
-// purpose :
-//=====================================================================================
-void VisuGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject )
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSwitchSelectionMode( int theId )
{
- theObject = "";
- theContext = "";
+ for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
+ {
+ QAction* aRefAction = action( anId );
+ aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
+ }
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnMergeScalarBars()
+{
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+
+ // first find the bounds
+ double aMin, aMax; bool first = true;
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ if (first) {
+ first = false;
+ aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
+ } else {
+ if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
+ if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
+ }
+ }
+ }
+ }
+ }
+ }
-//=====================================================================================
-// function : checkHomoSelection()
-// purpose :
-//=====================================================================================
-enum { homoNone=0, homoCurves, homoPresentations, homoPresentable, homoAnimatable, homoOther };
-int VisuGUI::checkHomoSelection()
+ // set the computed range to every selected ScalarMap
+ bool update = false;
+ for (It.Initialize(aListIO); It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if(aPrsObject){
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ aScalar->SetRange(aMin, aMax);
+ RecreateActor(this, aScalar);
+ update = true;
+ }
+ }
+ }
+ }
+ }
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnFreeScalarBars()
{
- int selMode = homoNone;
- SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
- int selNext = homoOther;
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+
+ // restore the source range for every ScalarMap
+ bool update = false;
+ for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject)& anIO = It.Value();
- if ( anIO->hasEntry() ) {
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( anIO->getEntry() );
- VISU::Storable::TRestoringMap pMap;
- if( !aSObject->_is_nil() ) {
- CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
- if ( !CORBA::is_nil( aCORBAObject ) ) {
- VISU::Base_var aVisuObj = VISU::Base::_narrow( aCORBAObject );
- if ( !CORBA::is_nil( aVisuObj ) ) {
- VISU::VISUType aType = aVisuObj->GetType();
- switch( aType ) {
- case VISU::TTABLE:
- case VISU::TCURVE:
- case VISU::TCONTAINER:
- selNext = homoCurves; break;
- case VISU::TMESH:
- case VISU::TSCALARMAP:
- case VISU::TISOSURFACE:
- case VISU::TDEFORMEDSHAPE:
- case VISU::TCUTPLANES:
- case VISU::TCUTLINES:
- case VISU::TVECTORS:
- case VISU::TSTREAMLINES:
- selNext = homoPresentations; break;
- case VISU::TFIELD:
- if (getValue(aSObject, "myNbTimeStamps").toLong() > 1) {
- selNext = homoAnimatable; break;
- }
- selNext = homoOther; break;
- default:
- selNext = homoOther;
- }
- }
- }
- else {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aSObject->FindAttribute( anAttr, "AttributeComment") ) {
- SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow( anAttr );
- string aComm = aComment->Value();
- QString strIn( aComm.c_str() );
- VISU::Storable::StrToMap( strIn, pMap );
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if( isExist ) {
- switch ( aType ) {
- case VISU::TENTITY:
- case VISU::TFAMILY:
- case VISU::TGROUP:
- selNext = homoPresentable; break;
- case VISU::TFIELD:
- if (getValue(aSObject, "myNbTimeStamps").toLong() > 1) {
- selNext = homoAnimatable; break;
- }
- selNext = homoOther; break;
- default:
- selNext = homoOther;
- }
- }
- }
- }
+ std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
+ if (!aPrsList.empty()) {
+ for (int i = 0, n = aPrsList.size(); i < n; i++) {
+ VISU::Prs3d_i* aPrsObject = aPrsList[i];
+ if (aPrsObject) {
+ VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+ if (aScalar) {
+ aScalar->SetSourceRange();
+ RecreateActor(this, aScalar);
+ update = true;
+ }
+ }
}
}
- if ( selMode == homoNone )
- selMode = selNext;
- else {
- if ( selMode != selNext )
- return homoNone;
+ }
+ if (update) {
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
}
}
- return selMode;
}
-//=====================================================================================
-// function : GetNbChildren() [ static ]
-// purpose : get number of children
-//=====================================================================================
-int GetNbChildren( SALOMEDS::SObject_var SO, bool refToo )
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnTranslatePrs()
{
- if ( SO->_is_nil() )
- return 0;
- int cnt = 0;
- SALOMEDS::ChildIterator_var Iter = SO->GetStudy()->NewChildIterator( SO );
- for ( ; Iter->More(); Iter->Next() ) {
- SALOMEDS::SObject_var refSO;
- if ( !Iter->Value()->ReferencedObject( refSO ) || refToo )
- cnt++;
+ if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
+ VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
+ aDlg->exec();
+}
+
+void
+VisuGUI
+::OnArrangeActors()
+{
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+ ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
+ aDlg->exec();
+ delete aDlg;
}
- return cnt;
}
-//=====================================================================================
-// function : CustomPopup()
-// purpose :
-//=====================================================================================
-bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QString & theContext,
- const QString & theParent, const QString & theObject)
+
+void
+VisuGUI
+::initialize( CAM_Application* theApp )
{
- QAD_ResourceMgr* rmgr = parent->createResourceManager();
+ MatplotlibMathTextUtilities::Disable();
- bool aIsLocked = isStudyLocked( GetActiveStudy()->getStudyDocument() );
-
- bool isVTKViewer = (GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK);
- SALOME_Selection* aSelection = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- QString aParentComponent = ((SALOMEGUI_Desktop*)parent)->getComponentFromSelection();
- int nbSel = aSelection->IObjectCount();
+ SalomeApp_Module::initialize( theApp );
- thePopup->clear();
+ mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
- if ( nbSel == 0 ) {
- if ( theParent == "Viewer" && isVTKViewer && !aIsLocked)
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- return false;
+ mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
+
+ createActions();
+ createMenus();
+ createToolBars();
+ createPopupMenus();
+ createPanels();
+
+ // tmp
+ action( VISU_ACTOR_SELECTION )->setChecked( true );
+}
+
+void
+VisuGUI
+::createActions()
+{
+ QPixmap aPixmap;
+ QWidget* aParent = application()->desktop();
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ // Create actions
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
+ createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
+ tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
+ this, SLOT(OnImportFromFile()));
+
+ createAction( VISU_IMPORT_SAUV, "", QIcon(),
+ tr("MEN_IMPORT_SAUV"), "", 0, aParent, false,
+ this, SLOT(OnImportFromSauvFile()));
+
+ createAction( VISU_IMPORT_TABLE, "", QIcon(),
+ tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnImportTableFromFile()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
+ createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
+ tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
+ this, SLOT(OnCreateScalarMap()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
+ createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
+ tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
+ this, SLOT(OnCreateDeformedShape()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
+ createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
+ tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
+ this, SLOT(OnCreateDeformedShapeAndScalarMap()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
+ createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
+ tr("MEN_VECTORS"), "", 0, aParent, false,
+ this, SLOT(OnCreateVectors()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
+ createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
+ tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
+ this, SLOT(OnCreateIsoSurfaces()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
+ createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
+ tr("MEN_CUT_PLANES"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutPlanes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
+ createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
+ tr("MEN_STREAM_LINES"), "", 0, aParent, false,
+ this, SLOT(OnCreateStreamLines()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
+ createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
+ tr("MEN_CUT_LINES"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutLines()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
+ createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
+ tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
+ this, SLOT(OnCreateCutSegment()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
+ createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
+ tr("MEN_PLOT_3D"), "", 0, aParent, false,
+ this, SLOT(OnCreatePlot3D()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
+ createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
+ tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
+ this, SLOT(OnCreatePlot2dView()));
+
+ createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
+ tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
+ this, SLOT(OnDeleteObjects()));
+
+ createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
+ tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnShowTable()));
+
+ createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnShowTablePlot()));
+
+ createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
+ tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
+ this, SLOT(OnPlotData()));
+
+ createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
+ tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnExportTableToFile()));
+
+ createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
+ tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
+ createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
+ tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
+ createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
+ tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
+ createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
+ tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
+ this, SLOT(OnLoadComponentData()));
+
+ createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
+ tr("MEN_CREATE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCreateMesh()));
+
+ createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
+ tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCreateManyMesh()));
+
+ createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
+ tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
+ this, SLOT(OnTranslatePrs()));
+
+ createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
+ tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
+ this, SLOT(OnMergeScalarBars()));
+
+ createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
+ tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
+ this, SLOT(OnFreeScalarBars()));
+
+ createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
+ tr("MEN_HIDE"), "", 0, aParent, false,
+ this, SLOT(OnErasePrs()));
+
+ createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
+ tr("MEN_SHOW"), "", 0, aParent, false,
+ this, SLOT(OnDisplayPrs()));
+
+ createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
+ tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
+ this, SLOT(OnDisplayOnlyPrs()));
+
+ createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
+ tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
+ this, SLOT(OnShowScalarBar()));
+
+ createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
+ tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
+ this, SLOT(OnHideScalarBar()));
+
+ createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
+ tr("MEN_COPY_PRS"), "", 0, aParent, false,
+ this, SLOT(OnCopyPresentation()));
+
+ createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
+ tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
+ this, SLOT(OnCurveProperties()));
+
+ createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
+ tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
+ this, SLOT(OnCurveScale()));
+
+ createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
+ tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnEditContainer()));
+
+ createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
+ tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
+ this, SLOT(OnClearContainer()));
+
+ createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
+ tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnSaveViewParams()));
+ createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
+ tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnSaveViewParams()));
+
+ createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
+ tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
+ this, SLOT(OnRestoreViewParams()));
+
+ //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
+ // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
+ // this, SLOT(OnDeleteObjects()));
+
+ createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
+ tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
+ this, SLOT(OnArrangeActors()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
+ createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
+ tr("MEN_POINTS"), "", 0, aParent, false,
+ this, SLOT(OnMakePoints()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
+ createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
+ tr("MEN_WIREFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeWireframe()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
+ createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
+ tr("MEN_SURFACE"), "", 0, aParent, false,
+ this, SLOT(OnMakeSurface()));
+
+ createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
+ tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeInsideframe()));
+
+ createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
+ tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
+ this, SLOT(OnMakeSurfaceframe()));
+
+ createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
+ tr("MEN_SHRINK"), "", 0, aParent, false,
+ this, SLOT(OnMakeShrink()));
+
+ createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
+ tr("MEN_UNSHRINK"), "", 0, aParent, false,
+ this, SLOT(OnMakeShrink()));
+
+ createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
+ tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
+ this, SLOT(OnMakeFeatureEdges()));
+
+ createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
+ tr("MEN_SHADING"), "", 0, aParent, false,
+ this, SLOT(OnSetShadingOn()));
+
+ createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
+ tr("MEN_NOSHADING"), "", 0, aParent, false,
+ this, SLOT(OnSetShadingOff()));
+
+ createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
+ tr("MEN_CELL_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeColor()));
+
+ createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
+ tr("MEN_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeColor()));
+
+ createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
+ tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeWireframeColor()));
+
+ createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
+ tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
+ this, SLOT(OnChangeOpacity()));
+
+ createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
+ tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
+ this, SLOT(OnChangeLines()));
+
+ createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
+ tr("MEN_POINT_MARKER"), "", 0, aParent, false,
+ this, SLOT(OnChangePointMarker()));
+
+ createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
+ tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
+ this, SLOT(OnChangeShrinkFactor()));
+
+
+ createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditScalarMap()));
+
+ createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditDeformedShape()));
+
+ createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditCutPlanes()));
+
+ createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditCutLines()));
+
+ createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditCutSegment()));
+
+ createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditIsoSurfaces()));
+
+ createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditVectors()));
+
+ createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditStreamLines()));
+
+ createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditPlot3D()));
+
+ createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
+ tr("MEN_EDIT_PRS"), "", 0, aParent, false,
+ this, SLOT(OnEditDeformedShapeAndScalarMap()));
+
+ createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
+ tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
+ this, SLOT(OnCreateTable()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
+ createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
+ tr("MEN_SWEEP"), "", 0, aParent, false,
+ this, SLOT(OnSweep()));
+
+ createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
+ tr("MEN_CLIPPING"), "", 0, aParent, false,
+ this, SLOT(OnClippingPlanes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
+ createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
+ tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnParallelTimeAnimation()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
+ createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
+ tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnSucccessiveTimeAnimation()));
+
+ createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
+ tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
+ this, SLOT(OnPointEvolution()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
+ createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
+ tr("MEN_ERASE_ALL"), "", 0, aParent, false,
+ this, SLOT(OnEraseAll()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
+ createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
+ tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
+ this, SLOT(OnToggleSelectionPanel()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
+ createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
+ tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
+ createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
+ tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
+ createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
+ tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
+ createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
+ tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ // Definition of the actions for the "Navigation" tool bar
+ registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
+ registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
+
+ createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
+ tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
+ this, SLOT(OnShowAnimation()));
+
+ createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
+ tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
+ this, SLOT(OnShowEvolution()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
+ createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
+ tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
+ this, SLOT(OnPlot3dFromCutPlane()));
+
+ createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
+ tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
+ this, SLOT( OnManageCache() ) );
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
+ createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
+ tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
+ this, SLOT(OnMultiprViewFullRes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
+ createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
+ tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
+ this, SLOT(OnMultiprViewMediumRes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
+ createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
+ tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
+ this, SLOT(OnMultiprViewLowRes()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
+ createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
+ tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
+ this, SLOT(OnMultiprViewHide()));
+
+ createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
+ tr("MEN_FILE_INFO"), "", 0, aParent, false,
+ this, SLOT(OnFileInfo()));
+
+ createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
+ tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
+ this, SLOT(OnExportMED()));
+
+ createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
+ tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
+ this, SLOT(OnFilterScalars()));
+
+ createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
+ tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
+ this, SLOT(OnValuesLabeling()));
+
+ createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
+ tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
+ this, SLOT(OnValuesLabelingParams()));
+
+ createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
+ tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
+ this, SLOT(OnArcQuadMode()));
+
+ createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
+ tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
+ this, SLOT(OnLineQuadMode()));
+
+ createAction(VISU_SHOW_DEVIATION, tr("MEN_VISU_SHOW_DEVIATION"),QIcon(),
+ tr("MEN_VISU_SHOW_DEVIATION"), "",0, aParent, true,
+ this, SLOT(OnShowDeviation()));
+
+}
+
+void
+VisuGUI
+::createMenus()
+{
+ // Add actions to menus
+ int aMenuId;
+ aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
+ createMenu( separator(), aMenuId, -1, 10 );
+
+ int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
+ createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
+ createMenu( VISU_IMPORT_SAUV, anImportId ); // import sauv file
+ createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
+
+ aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
+ createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
+ createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
+ createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
+ createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
+ createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
+ createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
+ createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
+ createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
+ createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
+ createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
+
+ aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
+ int parentId =
+ createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
+ createMenu( VISU_POINTS, parentId, 10 ); // points
+ createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
+ createMenu( VISU_SURFACE, parentId, 10 ); // surface
+ createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
+
+ parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
+ createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
+ createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
+
+}
+
+void
+VisuGUI
+::createToolBars()
+{
+ int aToolId = createTool( tr("TOOL_IMPORT") );
+ createTool( VISU_IMPORT_FROM_FILE, aToolId );
+
+ aToolId = createTool(tr("TOOL_VISUALISATION"));
+ createTool( VISU_SCALAR_MAP, aToolId );
+ createTool( VISU_DEFORMED_SHAPE, aToolId );
+ createTool( VISU_VECTORS, aToolId );
+ createTool( VISU_ISO_SURFACES, aToolId );
+ createTool( VISU_CUT_PLANES, aToolId );
+ createTool( VISU_CUT_LINES, aToolId );
+ createTool( VISU_CUT_SEGMENT, aToolId );
+ createTool( VISU_STREAM_LINES, aToolId );
+ createTool( VISU_PLOT_3D, aToolId );
+ createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
+
+ aToolId = createTool(tr("TOOL_REPRESENTATION"));
+ createTool( VISU_POINTS, aToolId );
+ createTool( VISU_WIREFRAME, aToolId );
+ createTool( VISU_SURFACE, aToolId );
+ createTool( VISU_ERASE_ALL, aToolId );
+
+ aToolId = createTool(tr("TOOL_SELECTION"));
+ createTool( VISU_SELECTION_PANEL, aToolId );
+ createTool( separator(), aToolId );
+ createTool( VISU_ACTOR_SELECTION, aToolId );
+ createTool( VISU_CELL_SELECTION, aToolId );
+ createTool( VISU_POINT_SELECTION, aToolId );
+ createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
+
+ aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
+ createTool( VISU_SLIDER_PANEL, aToolId );
+ createTool( separator(), aToolId );
+ createTool( VISU_SWEEP_PANEL, aToolId );
+}
+
+void
+VisuGUI
+::createPopupMenus()
+{
+ // Prepare popup menus
+ QtxPopupMgr* mgr = popupMgr();
+
+ // VISU root commands
+ mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
+ mgr->insert( action( VISU_IMPORT_SAUV ), -1, -1, -1 ); // import SAUV file
+ mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
+ mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
+
+ //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
+
+ // create
+ mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
+ mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
+ mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
+ mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
+ mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
+ mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
+ mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
+ mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
+ mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
+ mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
+
+ mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
+ mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
+
+ mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
+
+ // edit
+ mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
+ mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
+
+ // copy
+ mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
+
+ // delete
+ mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
+
+ // labeling
+ mgr->insert( separator(), -1, -1, -1 );
+ mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
+ mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // table commands
+ mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
+ mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
+ mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
+ mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
+ mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
+
+ mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
+ mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
+
+ // "Representation" submenu
+ int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
+ mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
+ mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
+ mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
+ mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
+ mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
+ mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
+ mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
+ mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
+ mgr->insert( separator(), parentId, -1, -1 );
+ mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
+ mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
+
+ //"2D Quadratic" submenu
+ parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
+ mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
+ mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
+
+ // "Properties" submenu
+ parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
+ mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
+ mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
+ mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
+ mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
+ mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
+ mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
+ mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // Other presentations management
+ mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
+ mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
+ mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
+ mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
+ mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
+
+ mgr->insert( separator(), -1, -1, -1 );
+
+ // view parameters commands
+ mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
+ mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
+ mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
+ //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
+
+ mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
+
+ mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
+ mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
+ //Show deviation command on curve
+ mgr->insert( action( VISU_SHOW_DEVIATION ), -1, -1, -1 ); // deviation
+
+ mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
+ mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
+ mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
+ mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
+
+ mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
+ mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
+
+ // Rules
+
+ QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+ "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+ "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
+ QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+ "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+ "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
+
+ // VISU root commands
+ QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
+ mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
+ mgr->setRule( action( VISU_IMPORT_SAUV ), aRule );
+ mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
+ mgr->setRule( action( VISU_PLOT2D ), aRule );
+
+ // timestamp commands
+ aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
+ mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
+ mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
+ mgr->setRule( action( VISU_CUT_PLANES ), aRule );
+ mgr->setRule( action( VISU_CUT_LINES ), aRule );
+ mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
+ mgr->setRule( action( VISU_PLOT_3D ), aRule );
+ aRule += " and nbComponents>1";
+ mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
+ mgr->setRule( action( VISU_VECTORS ), aRule );
+ mgr->setRule( action( VISU_STREAM_LINES ), aRule );
+ mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
+
+ // display/erase commands
+ QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
+ QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
+ QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
+ QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
+ QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
+ QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
+ QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
+ QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
+
+ QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
+ " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
+
+ QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
+ " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
+
+ QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
+ " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
+ " (type='VISU::TCURVE')))) ) or" + aComponent;
+
+ QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
+ QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and ( isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and (not isScalarBarVisible) )";
+
+ mgr->setRule( action( VISU_ERASE ), anEraseRule );
+ mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
+ mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
+
+ mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
+ mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
+
+ aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
+ mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
+
+ aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
+ mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
+ mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
+
+ aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
+ mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
+
+ // labeling
+
+ aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
+ mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
+ mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
+
+ //2D quadratic
+ aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+ mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
+ mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
+
+ mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
+ mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
+
+
+ // view parameters
+ aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
+ mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
+ mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
+ mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
+ //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
+
+ mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
+
+ // 3D presentations commands
+ QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
+ QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
+ QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+ //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+ QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
+ //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
+ QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+ " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
+ QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
+ QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
+ "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
+
+ QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
+
+ aRule = "selcount=1";
+ mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
+ aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
+
+ // "Representation" submenu
+ QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+ QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+ QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+ QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
+ QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
+ QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
+
+ mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
+ mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
+ mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
+ mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
+ mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
+ mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
+
+ mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
+ mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
+
+ mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
+ mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
+
+ // "Properties" submenu
+ mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
+ mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
+ mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
+ " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
+ "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
+ mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
+ mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
+ mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
+ mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
+
+ QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
+
+ // copy presentation command
+ aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
+ mgr->setRule( action( VISU_COPY_PRS ), aRule );
+
+ // Curve commands
+ aRule = "selcount=1 and type='VISU::TCURVE'";
+ mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
+ mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
+
+ // Table Commands
+ aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
+ mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
+ mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
+ mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
+
+ // curve container commands
+ aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
+ mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
+ mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
+
+ mgr->setRule( action( VISU_EDIT_SCALARMAP ),
+ "selcount=1 and type='VISU::TSCALARMAP'" );
+ mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
+ "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
+ mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
+ "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
+ mgr->setRule( action( VISU_EDIT_CUTPLANES ),
+ "selcount=1 and type='VISU::TCUTPLANES'" );
+ mgr->setRule( action( VISU_EDIT_CUTLINES ),
+ "selcount=1 and type='VISU::TCUTLINES'" );
+ mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
+ "selcount=1 and type='VISU::TCUTSEGMENT'" );
+ mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
+ "selcount=1 and type='VISU::TISOSURFACES'" );
+ mgr->setRule( action( VISU_EDIT_VECTORS ),
+ "selcount=1 and type='VISU::TVECTORS'" );
+ mgr->setRule( action( VISU_EDIT_STREAMLINES ),
+ "selcount=1 and type='VISU::TSTREAMLINES'" );
+ mgr->setRule( action( VISU_EDIT_PLOT3D ),
+ "selcount=1 and type='VISU::TPLOT3D'" );
+ mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
+ "selcount=1 and type='VISU::TPOINTMAP3D'" );
+
+ aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
+ mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
+
+ aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
+ mgr->setRule( action( VISU_SWEEP ), aRule );
+
+ aRule = "client='ObjectBrowser' and selcount>0";
+ aRule += " and $type in {'VISU::TFIELD'}";
+ aRule += " and nbTimeStamps>1";
+ aRule += " and activeView in {'VTKViewer' 'SVTK'}";
+ mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
+
+ aRule = "client='ObjectBrowser'";
+ aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
+ aRule += " and $type in {'VISU::TFIELD'}";
+ aRule += " and activeView in {'VTKViewer' 'SVTK'}";
+ mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
+
+ aRule = "client='ObjectBrowser' and selcount>0";
+ aRule += " and $type in {'VISU::TFIELD'}";
+ aRule += " and medEntity='NODE_ENTITY'";
+ aRule += " and nbTimeStamps>1";
+ mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
+
+ aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
+ mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
+ mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
+ mgr->setRule( action( VISU_EDIT_PLOT3D ),
+ "selcount=1 and type='VISU::TPLOT3D'" );
+
+ //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
+ //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
+
+ aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
+ {
+ QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
+ mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
}
- if( nbSel > 1 ) {
- int selMode = checkHomoSelection();
- if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup: multiple selection : selMode = "<<selMode );
- if ( selMode == homoCurves ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyManyPrs() ) );
- }
- }
- else if ( selMode == homoPresentations ) {
- if (isVTKViewer) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayManyPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( EraseManyPrs () ) );
- }
- }
- else if ( selMode == homoPresentable ) {
- if (!aIsLocked) thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));
- }
- else if ( selMode == homoAnimatable ) {
- thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
- }
- return true;
+ {
+ QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
+ mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
}
- VISU::Storable::TRestoringMap aMap;
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO,GetActiveStudy(),&aMap);
- if (!CORBA::is_nil(anObject)) {
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
- if (!CORBA::is_nil(aVisuObj)) {
- VISU::VISUType aType = aVisuObj->GetType();
- if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup - VISU object :: "<<aType);
- switch (aType) {
- case VISU::TVISUGEN:
- thePopup->insertItem("Import MED", visuGUI, SLOT(ImportFile()));
- thePopup->insertItem("Import TABLE", visuGUI, SLOT(ImportTablesFromFile()));
- thePopup->insertItem("Create Plot2d View", visuGUI, SLOT(CreatePlot2dView()));
- break;
-
- case VISU::TRESULT:
- if (!aIsLocked) thePopup->insertItem("Delete", visuGUI, SLOT(DeleteObject()));
- break;
-
- case VISU::TTABLE:
- if (!aIsLocked) thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameTable() ) );
- thePopup->insertItem( "Show Table", visuGUI, SLOT( ShowTable() ) );
- if (!aIsLocked) thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
- thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
- thePopup->insertSeparator();
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- if ( GetNbChildren( aSObject, false ) > 0 ) {
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- }
- thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- break;
-
- case VISU::TCURVE:
- if ( !aIsLocked ) {
- thePopup->insertItem( "Properties", visuGUI, SLOT( CurveProperties() ) );
- thePopup->insertItem( "Rename...", visuGUI, SLOT(Rename()));
- }
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->isVisible( anIO ) )
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- else
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- if ( !aIsLocked ) thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
- break;
-
- case VISU::TCONTAINER:
-// if( !CORBA::is_nil( anObject ) ) {
-// CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
-// if( !CORBA::is_nil( aCnt ) ) {
-// VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
-// if ( container ) {
-// if ( !aIsLocked ) {
-// thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
-// thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
-// if (container->GetNbCurves() > 0)
-// thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
-// }
-// if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
-// thePopup->insertSeparator();
-// thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
-// thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
-// thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
-// }
-// }
-// }
-// }
- if ( !aIsLocked ) {
- thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
- thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
- thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
- }
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertSeparator();
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- if ( !aIsLocked ) thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- break;
-
- default: // Presentation
- {
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if (aPrsObject) {
- if (isVTKViewer) {
- // Add Presentation menu
- if (VISU_Actor* anVISUActor = visuGUI->GetActor(aPrsObject)){
- QPopupMenu* aPresMenu = new QPopupMenu(GetDesktop());
- int aRepresent = anVISUActor->GetRepresentation();
- switch(aRepresent){
- case VISU::POINT :
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- if (aType == VISU::TMESH || aType == VISU::TSCALARMAP || aType == VISU::TDEFORMEDSHAPE)
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::WIREFRAME :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- if (aType == VISU::TMESH || aType == VISU::TSCALARMAP || aType == VISU::TDEFORMEDSHAPE)
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::SHADED :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- if (aType == VISU::TMESH || aType == VISU::TSCALARMAP || aType == VISU::TDEFORMEDSHAPE)
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::INSIDEFRAME :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- if (aType == VISU::TMESH)
- aPresMenu->insertItem("Surfaceframe", visuGUI, SLOT(MakeSurfaceframe()));
- break;
- case VISU::SURFACEFRAME :
- aPresMenu->insertItem("Points", visuGUI, SLOT(MakePoints()));
- aPresMenu->insertItem("Surface", visuGUI, SLOT(MakeSurface()));
- aPresMenu->insertItem("Wireframe", visuGUI, SLOT(MakeWireframe()));
- aPresMenu->insertItem("Insideframe", visuGUI, SLOT(MakeInsideframe()));
- break;
- }
- if(anVISUActor->IsShrunkable())
- if(aType != VISU::TVECTORS && aType != VISU::TSTREAMLINES){
- if (anVISUActor->IsShrunk())
- aPresMenu->insertItem("Unshrink", visuGUI, SLOT(MakeShrink()));
- else
- aPresMenu->insertItem("Shrink", visuGUI, SLOT(MakeShrink()));
- }
- thePopup->insertItem("Representation", aPresMenu);
-
- // Add Properties
- QPopupMenu* aPropMenu = new QPopupMenu(GetDesktop());
- if(aType == VISU::TMESH){
- if(aRepresent == VISU::SURFACEFRAME){
- aPropMenu->insertItem("Cell Color", visuGUI, SLOT(ChageColor()));
- aPropMenu->insertItem("Edge Color", visuGUI, SLOT(ChangeWireframeColor()));
- }else
- aPropMenu->insertItem("Color", visuGUI, SLOT(ChageColor()));
- }else if(aType == VISU::TDEFORMEDSHAPE)
- aPropMenu->insertItem("Color", visuGUI, SLOT(ChageColor()));
-
- if (aType != VISU::TVECTORS && aType != VISU::TSTREAMLINES)
- aPropMenu->insertItem("Opacity", visuGUI, SLOT(ChangeOpacity()));
- if (aType != VISU::TVECTORS){
- aPropMenu->insertItem("Line width", visuGUI, SLOT(ChangeLines()));
- thePopup->insertItem("Properties", aPropMenu);
- }
- thePopup->insertSeparator();
- }
- }
- if ( !aIsLocked ) thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
- if (aType != VISU::TMESH) {
- //if (aType != VISU::TSCALARMAP)
- if ( !aIsLocked ) thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
-
- if (aType == VISU::TCUTLINES) {
- // Check: Does it has living children (tables)
- SALOMEDS::ChildIterator_var aIter =
- GetActiveStudy()->getStudyDocument()->NewChildIterator( aSObject );
- bool isPresent = false;
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDS::SObject_var aTblObj = aIter->Value();
- isPresent = !aTblObj->_is_nil();
- if (isPresent) {
- SALOMEDS::GenericAttribute_var anAttr;
- isPresent = aTblObj->FindAttribute(anAttr, "AttributeName");
- if (isPresent) break; // We have at least a one child
- }
- }
- if ((!isPresent) && (!aIsLocked) )
- thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) );
- }
- thePopup->insertItem("Sweep", visuGUI, SLOT(Sweep()));
-
- }
- if (isVTKViewer) {
- if ( theParent == "Viewer" &&
- ( aType == VISU::TMESH ||
- aType == VISU::TSCALARMAP ||
- aType == VISU::TDEFORMEDSHAPE ) ) {
- thePopup->insertSeparator();
- thePopup->insertItem("Selection info...", visuGUI, SLOT(SelectionInfo()));
- }
- thePopup->insertSeparator();
-
- if (visuGUI->IsDisplayed(aPrsObject) ){
- thePopup->insertItem("Erase", visuGUI, SLOT(ErasePrs()));
- }
- else
- thePopup->insertItem("Display", visuGUI, SLOT(DisplayPrs()));
-
- thePopup->insertItem("Display Only", visuGUI, SLOT(DisplayOnlyPrs()));
- }
- thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
- if ((aType != VISU::TMESH) && (!aIsLocked)) {
- thePopup->insertSeparator();
- thePopup->insertItem("Same As", visuGUI, SLOT(CopyPresentation()));
- }
- }
- }
+ {
+ QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
+ mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
+ }
+ {
+ QString aCustomRule = aRule + "resolutionState!='H'";
+ mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
+ }
+
+ mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
+ mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
+
+ aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation";
+ mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
+ aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
+ mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
+}
+
+void VisuGUI::createPanels()
+{
+ myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
+ myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
+ myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
+
+ VisuGUI_Panel* aPanel;
+ foreach( aPanel, myPanels ) {
+ getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
+ aPanel->setVisible( false );
+ }
+}
+
+//***************************************************************************
+void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
+{
+ SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
+
+ //TODO: object Browser DONE
+ SUIT_DataBrowser* ob = getApp()->objectBrowser();
+ bool isOBClient = (ob && theClient == ob->popupClientType());
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() < 1) return;
+
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+
+ // Check if "Merge Scalar Range" can be applied
+ int nbPrs = 0;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+
+ if (!anIO.IsNull() && anIO->hasEntry()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !aSObject )
+ continue;
+
+ if ( !isOBClient ) {
+ QString aName = QString( aSObject->GetName().c_str() );
+ while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
+ aName.remove( (aName.length() - 1), 1 );
+ theTitle = aName;
}
- return false;
- }
-
- else {
- // possibly this is the MED field/mesh and support objects
- SALOME_MED::MED_ptr aMED = SALOME_MED::MED::_narrow( anObject );
- if(!CORBA::is_nil(aMED))
- thePopup->insertItem( "Import Structure", visuGUI, SLOT( ImportMedField() ) );
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow( anObject );
- if(!CORBA::is_nil(aField))
- thePopup->insertItem( "Import TimeStamp", visuGUI, SLOT( ImportMedField() ) );
- if ( aParentComponent != parent->getActiveComponent() ) {
- //insert pre-defined Display/Erase items
- if ( thePopup->count() > 0 ) {
- thePopup->insertSeparator();
- }
- thePopup->insertItem (tr ("MEN_APP_DISPLAY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_Display_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_DISPLAY_ONLY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_DisplayOnly_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_ERASE"), GetActiveStudy()->getApp(), SLOT(onErase()), 0, QAD_Erase_Popup_ID);
+
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
+ if (CORBA::is_nil(aCORBAObject)) {
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ if (aType == VISU::TTIMESTAMP) {
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
+ _PTR(SObject) aPrs;
+ for (; anIter->More(); anIter->Next()) {
+ aPrs = anIter->Value();
+ if (!aPrs)
+ continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
+ nbPrs += aSubList.size();
+ }
+ }
}
- return false;
}
- }else{
- SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- bool isExist;
- VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
- if(isExist){
- switch (aType) {
- case VISU::TENTITY:
- case VISU::TFAMILY:
- case VISU::TGROUP:
- if ( !aIsLocked )thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));
- break;
- case VISU::TVIEW3D:
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
- thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
- if ( !aIsLocked ) {
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // Available only for VTK viewer
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- }
- thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
- thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
- }
- break;
- case VISU::TFIELD:
- if ((getValue(aSObject, "myNbTimeStamps").toLong() > 1) && isVTKViewer)
- thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
- break;
- case VISU::TTIMESTAMP: {
- int aNunComponent = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist).toInt();
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_SCALAR_MAP") ),
- "Scalar Map...", visuGUI, SLOT(CreateScalarMap()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_ISO_SURFACES") ),
- "Iso Surfaces...", visuGUI, SLOT(CreateIsoSurfaces()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_CUT_PLANES") ),
- "Cut Planes...", visuGUI, SLOT(CreateCutPlanes()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_CUT_LINES") ),
- "Cut Lines...", visuGUI, SLOT(CreateCutLines()));
- if(aNunComponent > 1){
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_DEFORMED_SHAPE") ),
- "Deformed Shape...", visuGUI, SLOT(CreateDeformedShape()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_VECTORS") ),
- "Vectors...", visuGUI, SLOT(CreateVectors()));
- thePopup->insertItem(rmgr->loadPixmap( "VISU", tr("ICON_STREAM_LINES") ),
- "Stream lines...", visuGUI, SLOT(CreateStreamLines()));
- }
- break;
- }
- }
- return false;
- }else{
-
- if(IsSObjectTable(aSObject)){
- thePopup->insertItem( "Show Table", visuGUI, SLOT(ShowTable()));
- thePopup->insertItem( "Create Curves", visuGUI, SLOT(PlotData()));
- thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
- thePopup->insertSeparator();
- thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- return false;
- }
-
- CORBA::Long aTag = 1;
- SALOMEDS::SObject_var aSubObject;
- if(aSObject->FindSubObject(aTag,aSubObject) && IsSObjectTable(aSubObject)) {
- thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
- return false;
- }
+ }
+ if (nbPrs > 1) {
+ theMenu->addSeparator();
+ theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
+ theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
+ }
- aSObject = aSObject->GetFather();
- if(aSObject->_is_nil()) return false;
- SALOMEDS::GenericAttribute_var anAttr;
- aSObject->FindAttribute(anAttr, "AttributeName");
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- if(aName->_is_nil()) return false;
- CORBA::String_var aValue = aName->Value();
- //if(strcmp(aValue.in(),"MEDMESH") == 0)
- // thePopup->insertItem( "Import MED", visuGUI, SLOT( ImportMedField() ) );
- if(strcmp(aValue.in(),"MEDFIELD") == 0)
- thePopup->insertItem( "Import Field", visuGUI, SLOT( ImportMedField() ) );
- if ( aParentComponent != parent->getActiveComponent() ) {
- //insert pre-defined Display/Erase items
- if ( thePopup->count() > 0 ) {
- thePopup->insertSeparator();
- }
- thePopup->insertItem (tr ("MEN_APP_DISPLAY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_Display_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_DISPLAY_ONLY"), GetActiveStudy()->getApp(), SLOT(onDisplay(int)), 0, QAD_DisplayOnly_Popup_ID);
- thePopup->insertItem (tr ("MEN_APP_ERASE"), GetActiveStudy()->getApp(), SLOT(onErase()), 0, QAD_Erase_Popup_ID);
- }
- return false;
+ // Check if some curves selected (for bug PAL10611)
+ bool isCurves = false;
+ bool isOneCutPlane = false;
+ SALOME_ListIteratorOfListIO It1 (aListIO);
+ for (; It1.More() && !isCurves; It1.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It1.Value();
+ if (!anIO.IsNull() && anIO->hasEntry()) {
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !aSObject )
+ continue;
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ if (aType == VISU::TCURVE) {
+ isCurves = true;
+ } else {
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+ if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+ if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
+ isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
+ }
+ }
}
}
}
- return false;
-}
-//===========================================================================
-// BuildPresentation
-//===========================================================================
-void VisuGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
- QAD_ViewFrame* )
-{
- BEGIN_OF("VisuGUI::BuildPresentation");
+ if (isOneCutPlane)
+ theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
- if (theIO.IsNull()) {
- if(MYDEBUG) MESSAGE("VisuGUI::BuildPresentation(): null SALOME_InteractiveObject passed");
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
return;
+
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+
+ if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
+ if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
+ theMenu->addAction( action( VISU_MANAGE_CACHE ) );
}
- SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ theMenu->addSeparator();
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK &&
- GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_PLOT2D) return;
+ // Check if some (nb > 0) removable objects selected
+ if (isOBClient && IsRemovableSelected(this)) {
+ theMenu->addAction( action( VISU_DELETE_OBJS ) );
+ }
+ if (isCurves) {
+ theMenu->removeAction( action( myDisplay ) );
+ theMenu->removeAction( action( myErase ) );
+ theMenu->removeAction( action( myDisplayOnly ) );
+ theMenu->removeAction( action( myEraseAll ) );
+ }
- SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID ( theIO->getEntry() );
- SCRUTE(aSObj);
- if (aSObj -> _is_nil() ) {
- if(MYDEBUG) MESSAGE("No SObject for interacative object is found");
+ // Check single selection
+ if (aListIO.Extent() != 1)
return;
+
+ // Check if the object's data is loaded
+ _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
+ std::string aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ //std::string aCompDataType = aSComp->ComponentDataType();
+ theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
}
-
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(!CORBA::is_nil(anObject)) {
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if ( aPrsObject ) {
- VISU_Actor *SelectedActor = visuGUI->GetActor(aPrsObject);
- if(!SelectedActor) {
- try{
- SelectedActor = aPrsObject -> CreateActor();
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame())
- vf->AddActor(SelectedActor);
- }catch(std::runtime_error& exc){
- INFOS(exc.what());
- throw exc;
- }
+
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
+ if (aType == VISU::TANIMATION) {
+ theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
+ } else if (aType == VISU::TEVOLUTION) {
+ theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
+ } else if (isOBClient) {
+ if (IsSObjectTable(aSObject)) {
+ /* action( VISU_SHOW_TABLE )->addTo(theMenu);
+ theMenu->addAction( action( VISU_CREATE_CURVES ) );
+ theMenu->addAction( action( VISU_EXPORT_TABLE ) );
+ theMenu->addSeparator();
+ action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
+ } else {
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
+ if (!CORBA::is_nil(aMED.in())) {
+ theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
+ }
+
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
+ if (!CORBA::is_nil(aField)) {
+ theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
+ }
+ } else {
+ _PTR(SObject) aSFather1 = aSObject->GetFather();
+ if (aSFather1) {
+ std::string aValue = aSFather1->GetName();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
+ theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
+ }
+ }
}
}
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
- if ( aTable ) {
- // table object
- PlotTable(aTable, VISU::eDisplay );
- }
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
- if ( aContainer ) {
- // container object
- PlotContainer(aContainer, VISU::eDisplay );
- }
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if ( aCurve ) {
- // curve object
- PlotCurve(aCurve, VISU::eDisplay );
- }
- }else
- if(MYDEBUG) MESSAGE("CORBA::is_nil(anObject) = true");
- END_OF("VisuGUI::BuildPresentation");
+ }
}
-//===========================================================================
-// SupportedViewType
-//===========================================================================
-void VisuGUI::SupportedViewType(int* buffer, int bufferSize)
+//***************************************************************************
+void
+VisuGUI
+::windows( QMap<int, int>& theMap ) const
{
- if (!buffer || !bufferSize) return;
- buffer[0] = (int)VIEW_VTK;
- if (--bufferSize) buffer[1] = (int)VIEW_PLOT2D;
-}
+ theMap.clear();
+ theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+ theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+}
+
-extern "C"
+void
+VisuGUI
+::viewManagers( QStringList& theList ) const
{
- Standard_EXPORT SALOMEGUI* GetComponentGUI() {
- if ( !visuGUI )
- visuGUI = new VisuGUI( "" );
- return visuGUI;
- }
+ theList.clear();
+ // append SVTK viewer only if there is no opened VVTK
+// SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
+// if( vm && vm->getViewsCount()>0 )
+// theList.append( VVTK_Viewer::Type() );
+// else
+ theList.append( SVTK_Viewer::Type() );
}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR COLOR ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-///////////////// /////////////////////////////////////////////////////////////////
-// change actor color
-// In : Name of Actor
-//
-//
+QString
+VisuGUI
+::engineIOR() const
+{
+ CORBA::String_var anIOR = GetVisuGen(this)->GetID();
+ return QString(anIOR.in());
+}
-void VisuGUI::NewColor(VISU_Actor *theActor){
- if(VISU::Prs3d_i* aPrs3d = theActor->GetPrs3d()){
- VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
- VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
- SALOMEDS::Color anOldColor, aNewColor;
- int aRepresent = theActor->GetRepresentation();
- if(aMesh)
- switch(aRepresent){
- case VISU::POINT :
- anOldColor = aMesh->GetNodeColor();
- break;
- case VISU::WIREFRAME :
- case VISU::INSIDEFRAME :
- anOldColor = aMesh->GetLinkColor();
- break;
- case VISU::SHADED :
- case VISU::SURFACEFRAME :
- anOldColor = aMesh->GetCellColor();
- break;
- }
- else if(aDeformedShape)
- anOldColor = aDeformedShape->GetColor();
- else
- return;
- QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
- QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop());
- if(aColorNew.isValid()){
- aNewColor.R = aColorNew.red()/255.;
- aNewColor.G = aColorNew.green()/255.;
- aNewColor.B = aColorNew.blue()/255.;
- if(aMesh)
- switch(aRepresent){
- case VISU::POINT :
- aMesh->SetNodeColor(aNewColor);
- break;
- case VISU::WIREFRAME :
- case VISU::INSIDEFRAME :
- aMesh->SetLinkColor(aNewColor);
- break;
- case VISU::SHADED :
- case VISU::SURFACEFRAME :
- aMesh->SetCellColor(aNewColor);
- break;
- }
- else
- aDeformedShape->SetColor(aNewColor);
- RecreateActor(aPrs3d);
+
+bool
+VisuGUI
+::activateModule( SUIT_Study* theStudy )
+{
+ bool aResult = SalomeApp_Module::activateModule( theStudy );
+
+ studyActivated();
+ setMenuShown( true );
+ setToolShown( true );
+
+ // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
+ if(pluginsmanager==NULL)
+ PyErr_Print();
+ else
+ {
+ PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
+ if(result==NULL)
+ PyErr_Print();
+ Py_XDECREF(result);
}
- }
+ PyGILState_Release(gstate);
+ // end of GEOM plugins loading
+
+ // Reset actions accelerator keys
+ QList<QKeySequence> shortcuts;
+ shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
+ action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
+
+ action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
+
+ ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
+ GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
+ emit moduleActivated();
+
+ return aResult;
}
-void VisuGUI::NewWireframeColor(VISU_MeshAct *theActor){
- if(VISU::Prs3d_i* aPrs3d = theActor->GetPrs3d()){
- if(VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)){
- SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
- QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
- QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop());
- if(aColorNew.isValid()){
- aNewColor.R = aColorNew.red()/255.;
- aNewColor.G = aColorNew.green()/255.;
- aNewColor.B = aColorNew.blue()/255.;
- aMesh->SetLinkColor(aNewColor);
- VisuGUI::RecreateActor(aMesh);
- }
- }
+
+bool
+VisuGUI
+::deactivateModule( SUIT_Study* theStudy )
+{
+ setMenuShown( false );
+ setToolShown( false );
+
+ // Unset actions accelerator keys
+ action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
+
+ action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
+
+ bool aResult = SalomeApp_Module::deactivateModule( theStudy );
+
+ emit moduleDeactivated();
+
+ return aResult;
+}
+
+LightApp_Selection*
+VisuGUI
+::createSelection() const
+{
+ return new VisuGUI_Selection( (SalomeApp_Module*)this );
+}
+
+void
+VisuGUI
+::processPresentationCreated( VISU::Prs3d_i* thePrs )
+{
+ if( thePrs )
+ {
+ QString anEntry = thePrs->GetEntry().c_str();
+ if( anEntry.isEmpty() )
+ if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
+ anEntry = aColoredPrs->GetHolderEntry().c_str();
+
+ QStringList anEntryList( anEntry );
+ if( getApp() )
+ getApp()->browseObjects( anEntryList );
+
+ emit presentationCreated( thePrs );
}
}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR OPACITY ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-// change actor opacity
-// In : Name of Actor
-//
-// Use CursorDlg to select a value between 0 and 100
-//
+//******************************************************************
+void VisuGUI::studyActivated()
+{
+ GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
-void VisuGUI::NewOpacity(VISU_Actor *Actor)
+}
+
+/*
+extern "C" {
+ CAM_Module*
+ createModule()
+ {
+ return new VisuGUI();
+ }
+}
+*/
+
+void VisuGUI::createPreferences()
{
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+ // TAB: General
+ int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
+ // Quantities with individual precision settings
+ int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
+ setPreferenceProperty( precGroup, "columns", 2 );
+
+ // Default precision used by some input fieklds and data visualization code
+ // Moved here from "Representation" tab to have all precisions in the same place
+ int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
+ setPreferenceProperty( point_precision, "min", -16 );
+ setPreferenceProperty( point_precision, "max", 16 );
+ setPreferenceProperty( point_precision, "step", 1 );
- VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg(QAD_Application::getDesktop(), tr("Opacity"), TRUE );
-
- float oldopac,newopac;
- int intopac;
- CursorDlg->Comment1->setText( tr( "Set value between") );
- CursorDlg->Comment2->setText( tr( "0 (transparent) and 100 (opaque)" ) );
- oldopac=Actor->GetOpacity();
- intopac=int(oldopac*100.+0.5);
- CursorDlg->SpinBox1->setMinValue(0);
- CursorDlg->SpinBox1->setMaxValue(100);
- CursorDlg->SpinBox1->setValue(intopac);
+ const int nbQuantities = 5;
+ int precs[nbQuantities], ii = 0;
+ precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "VISU", "length_precision" );
+ precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
+ precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
+ precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
+ precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
- int ret = CursorDlg->exec();
- if (ret == 1)
+ // Set property for precision value for spinboxes
+ for ( ii = 0; ii < nbQuantities; ii++ ){
+ setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
+ setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
+ setPreferenceProperty( precs[ii], "precision", 2 );
+ }
+
+
+ // TAB: "MED import"
+ int importTab = addPreference( tr( "MED import" ) );
+ //printf( "++++++++++++++++++ Tab index %d\n", importTab );
+
+ //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
+ //printf( "Frame index %d\n", importFrame );
+
+ // group: "MED files import"
+ int importGr = addPreference( tr( "MED files import" ), importTab );
+ //printf( "Group index %d\n", importGr );
+ setPreferenceProperty( importGr, "columns", 2 );
+
+ addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
+ addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
+ addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
+ addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
+ addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
+ addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
+ addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
+
+ // TAB: "Scalar Bar"
+ int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
+
+ int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
+ setPreferenceProperty( rangeGr, "columns", 2 );
+
+ int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
+ QStringList modes;
+ modes.append( tr( "VISU_MODULUS" ) );
+ modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
+ modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
+ modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
+ QList<QVariant> indices;
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ indices.append( 3 );
+ setPreferenceProperty( mode, "strings", modes );
+ setPreferenceProperty( mode, "indexes", indices );
+
+ addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
+
+ int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
+ QStringList types;
+ types.append( tr( "VISU_FIELD_RANGE" ) );
+ types.append( tr( "VISU_IMPOSED_RANGE" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( rangetype, "strings", types );
+ setPreferenceProperty( rangetype, "indexes", indices );
+
+ int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
+ QStringList metrics;
+ metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
+ metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
+ metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ setPreferenceProperty( gaussMetric, "strings", metrics );
+ setPreferenceProperty( gaussMetric, "indexes", indices );
+
+ int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
+ setPreferenceProperty( imposedGr, "columns", 4 );
+
+ int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
+ int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
+ setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+ setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+
+ // group: "Font"
+ int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
+ setPreferenceProperty( fontGr, "columns", 2 );
+
+ addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
+ addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
+
+ addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
+ addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
+
+ // group: "Colors & Labels"
+ int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
+ setPreferenceProperty( colorsLabelsGr, "columns", 4 );
+
+ int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
+ setPreferenceProperty( numcol, "min", 2 );
+ setPreferenceProperty( numcol, "max", 256 );
+
+ addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
+ LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
+
+ int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
+ setPreferenceProperty( numlab, "min", 2 );
+ setPreferenceProperty( numlab, "max", 65 );
+
+ int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
+
+ setPreferenceProperty( lPrec, "min", 1 );
+ setPreferenceProperty( lPrec, "max", 100 );
+
+ int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
+ //setPreferenceProperty( frame, "orientation", "vertical" );
+ setPreferenceProperty( frame, "columns", "2" );
+
+ // group: "Orientation"
+ int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
+ setPreferenceProperty( orientGr, "columns", 2 );
+ int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
+ LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
+ QStringList orients;
+ orients.append( tr( "VISU_VERTICAL" ) );
+ orients.append( tr( "VISU_HORIZONTAL" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( orient, "strings", orients );
+ setPreferenceProperty( orient, "indexes", indices );
+
+ // group: "Scalar bars default position"
+ int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
+ addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
+
+
+ // group: "Origin & Size Vertical"
+ //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
+ //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
+ //setPreferenceProperty( psSzFrame, "columns", "2" );
+
+ int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
+ frame, LightApp_Preferences::GroupBox );
+ setPreferenceProperty( posVSizeGr, "columns", 2 );
+ int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
+ int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
+
+ int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
+ int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
+
+ int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
+
+ int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
+
+ int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
+ int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
+
+ setPreferenceProperty( xv, "step", 0.1 );
+ setPreferenceProperty( yv, "step", 0.1 );
+ setPreferenceProperty( wv, "step", 0.1 );
+ setPreferenceProperty( hv, "step", 0.1 );
+ setPreferenceProperty( xv, "min", 0.0 );
+ setPreferenceProperty( yv, "min", 0.0 );
+ setPreferenceProperty( wv, "min", 0.0 );
+ setPreferenceProperty( hv, "min", 0.0 );
+ setPreferenceProperty( twv, "min", 0 );
+ setPreferenceProperty( twv, "special", "auto" );
+ setPreferenceProperty( lwv, "min", 0 );
+ setPreferenceProperty( lwv, "special", "auto" );
+ setPreferenceProperty( bwv, "min", 0 );
+ setPreferenceProperty( bwv, "special", "auto" );
+ setPreferenceProperty( bhv, "min", 0 );
+ setPreferenceProperty( bhv, "special", "auto" );
+ setPreferenceProperty( xv, "max", 1.0 );
+ setPreferenceProperty( yv, "max", 1.0 );
+ setPreferenceProperty( wv, "max", 1.0 );
+ setPreferenceProperty( hv, "max", 1.0 );
+ setPreferenceProperty( twv, "max", 100 );
+ setPreferenceProperty( lwv, "max", 100 );
+ setPreferenceProperty( bwv, "max", 100 );
+ setPreferenceProperty( bhv, "max", 100 );
+
+ // group: "Origin & Size Horizontal"
+ int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
+ frame, LightApp_Preferences::GroupBox );
+ setPreferenceProperty( posHSizeGr, "columns", 2 );
+
+ int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
+ int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
+
+ int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
+ int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
+ LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
+
+ int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
+
+ int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
+
+ int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
+ int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
+
+ setPreferenceProperty( xh, "step", 0.1 );
+ setPreferenceProperty( yh, "step", 0.1 );
+ setPreferenceProperty( wh, "step", 0.1 );
+ setPreferenceProperty( hh, "step", 0.1 );
+ setPreferenceProperty( xh, "min", 0.0 );
+ setPreferenceProperty( yh, "min", 0.0 );
+ setPreferenceProperty( wh, "min", 0.0 );
+ setPreferenceProperty( hh, "min", 0.0 );
+ setPreferenceProperty( twh, "min", 0 );
+ setPreferenceProperty( twh, "special", "auto" );
+ setPreferenceProperty( lwh, "min", 0 );
+ setPreferenceProperty( lwh, "special", "auto" );
+ setPreferenceProperty( bwh, "min", 0 );
+ setPreferenceProperty( bwh, "special", "auto" );
+ setPreferenceProperty( bhh, "min", 0 );
+ setPreferenceProperty( bhh, "special", "auto" );
+ setPreferenceProperty( xh, "max", 1.0 );
+ setPreferenceProperty( yh, "max", 1.0 );
+ setPreferenceProperty( wh, "max", 1.0 );
+ setPreferenceProperty( hh, "max", 1.0 );
+ setPreferenceProperty( twh, "max", 100 );
+ setPreferenceProperty( lwh, "max", 100 );
+ setPreferenceProperty( bwh, "max", 100 );
+ setPreferenceProperty( bhh, "max", 100 );
+
+ // TAB: "CutLines"
+ int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
+
+ // group: "CutLines preferences"
+ int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
+ setPreferenceProperty( cutLineGr, "columns", 1 );
+ addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
+ addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
+ addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
+ addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
+ addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
+
+ // TAB: "StreamLines"
+ int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
+
+ // group: "StreamLines preferences"
+ int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
+ setPreferenceProperty( cutLineGr, "columns", 1 );
+ int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
+ LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
+ setPreferenceProperty( usedPoints, "min", 0 );
+ setPreferenceProperty( usedPoints, "max", 1 );
+ setPreferenceProperty( usedPoints, "step", 0.1 );
+
+ // TAB: "Sweep, Animation, 3D Cache"
+ int animationTab = addPreference( tr( "Sweep, Animation" ) );
+ {
+ // group: "3D Cache System prefereces"
{
- intopac = CursorDlg->SpinBox1->value() ;
- newopac = intopac/100.;
- Actor->SetOpacity(newopac);
+ int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
+ setPreferenceProperty( cacheGroup, "columns", 2 );
+
+ int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
+ LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
+
+ modes.clear();
+ modes.append( tr( "VISU_MINIMAL" ) );
+ modes.append( tr( "VISU_LIMITED" ) );
+ setPreferenceProperty( memory_mode, "strings", modes );
+
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( memory_mode, "indexes", indices );
+
+ int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
+ LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
+ setPreferenceProperty( memory_limit, "min", 1 );
+ setPreferenceProperty( memory_limit, "max", 5000 );
+ setPreferenceProperty( memory_limit, "step", 10 );
}
- delete CursorDlg;
-}
-//////////////////////////////////////////////////////////////////////////////////
-//////////////// CHANGE ACTOR LINEWIDTH ////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-// change actor linewidth
-// In : Name of Actor
-//
-// Use CursorDlg to select a value between 0 and 10
-//
+ // group: "Animation preferences"
+ {
+ int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
+ setPreferenceProperty( animationGroup, "columns", 1 );
+
+ int speed = addPreference( tr( "Speed" ), animationGroup,
+ LightApp_Preferences::IntSpin, "VISU", "speed" );
+ addPreference( tr( "Cycled animation" ), animationGroup,
+ LightApp_Preferences::Bool, "VISU", "cycled_animation" );
+ addPreference( tr( "Use proportional timing" ), animationGroup,
+ LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
+ addPreference( tr( "Clean memory at each frame" ), animationGroup,
+ LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
+
+ setPreferenceProperty( speed, "min", 1 );
+ setPreferenceProperty( speed, "max", 99 );
+
+ int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
+ LightApp_Preferences::Selector, "VISU", "dump_mode" );
+
+ modes.clear();
+ modes.append( tr( "VISU_NO_DUMP" ) );
+ modes.append( tr( "VISU_DUMP_PICTURES" ) );
+ modes.append( tr( "VISU_DUMP_VIDEO" ) );
+ setPreferenceProperty( dump_mode, "strings", modes );
+
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ setPreferenceProperty( dump_mode, "indexes", indices );
+
+ int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
+ LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
+ setPreferenceProperty( time_stamp_frequency, "min", 1 );
+ setPreferenceProperty( time_stamp_frequency, "max", 100 );
+ }
-void VisuGUI::NewLinewidth(VISU_Actor *Actor)
-{
+ // group: "Sweeping preferences"
+ {
+ int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
+ setPreferenceProperty( sweepGroup, "columns", 2 );
+
+ int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
+ LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
+ QStringList sweep_modes;
+ sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
+ sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
+ sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ setPreferenceProperty( modeSw, "strings", sweep_modes );
+ setPreferenceProperty( modeSw, "indexes", indices );
+
+ int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
+ LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
+ /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
+ LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
+ int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
+ LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
+ int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
+ QStringList ranges;
+ ranges.append( tr( "PERIOD_PI" ) );
+ ranges.append( tr( "PERIOD_2PI" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( rangeSw, "strings", ranges );
+ setPreferenceProperty( rangeSw, "indexes", indices );
+
+ setPreferenceProperty( timestep, "min", 0.1 );
+ setPreferenceProperty( timestep, "step", 0.1 );
+ setPreferenceProperty( timestep, "max", 1000 );
+ // setPreferenceProperty( nbcycles, "max", 100 );
+ setPreferenceProperty( nbsteps, "max", 200 );
+ }
+ }
- VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg(QAD_Application::getDesktop(), tr("Line Width"), TRUE );
-
- float oldlwid,newlwid;
- int intlwid;
- CursorDlg->Comment1->setText("Set value between");
- CursorDlg->Comment2->setText("1 (thin) and 10 (thick)");
- oldlwid=Actor->GetLineWidth();
- intlwid=int(oldlwid);
- CursorDlg->SpinBox1->setMinValue(1);
- CursorDlg->SpinBox1->setMaxValue(10);
- CursorDlg->SpinBox1->setValue(intlwid);
-
- int ret = CursorDlg->exec();
- if (ret == 1) {
- intlwid = CursorDlg->SpinBox1->value() ;
- newlwid = intlwid;
- Actor->SetLineWidth(newlwid);
+ // TAB: Representation ; group: "Representation properties"
+ int representationTab = addPreference( tr( "Representation" ) );
+
+ int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
+ setPreferenceProperty( representGr, "columns", 2 );
+
+ QStringList mesh_modes;
+ mesh_modes.append( tr("MEN_POINTS") );
+ mesh_modes.append( tr("MEN_WIREFRAME") );
+ mesh_modes.append( tr("MEN_INSIDEFRAME") );
+ mesh_modes.append( tr("MEN_SURFACEFRAME") );
+ mesh_modes.append( tr("MEN_SURFACE") );
+ mesh_modes.append( tr("VISU_FEATURE_EDGES") );
+ QList<QVariant> mesh_indices;
+ mesh_indices.append( 0 );
+ mesh_indices.append( 1 );
+ mesh_indices.append( 3 );
+ mesh_indices.append( 4 );
+ mesh_indices.append( 2 );
+ mesh_indices.append( 5 );
+
+ QStringList modes0 = mesh_modes;
+ modes0.removeAll( "Feature edges" );
+ QList<QVariant> indices0 = mesh_indices;
+ indices0.removeAll( 5 );
+
+ QStringList modes1 = modes0;
+ modes1.removeAll( "Insideframe" );
+ QList<QVariant> indices1 = indices0;
+ indices1.removeAll( 3 );
+
+ QStringList modes2 = modes1;
+ modes2.removeAll( "Surfaceframe" );
+ QList<QVariant> indices2 = indices1;
+ indices2.removeAll( 4 );
+
+ QStringList modes3 = modes2;
+ modes3.removeAll( "Surface" );
+ QList<QVariant> indices3 = indices2;
+ indices3.removeAll( 2 );
+
+
+ int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
+ setPreferenceProperty( mesh_represent, "strings", mesh_modes );
+ setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
+ addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
+
+ int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
+ setPreferenceProperty( scalar_map_represent, "strings", modes0 );
+ setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
+ addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
+
+ int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
+ setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
+ setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
+ int sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
+ setPreferenceProperty( cut_planes_represent, "strings", modes1 );
+ setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
+ addPreference( "", representGr, LightApp_Preferences::Space );
+
+ int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
+ setPreferenceProperty( cut_lines_represent, "strings", modes3 );
+ setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
+ setPreferenceProperty( cut_segment_represent, "strings", modes3 );
+ setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
+ setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
+ setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
+ addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
+
+ int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
+ setPreferenceProperty( vectors_represent, "strings", modes3 );
+ setPreferenceProperty( vectors_represent, "indexes", indices3 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
+ setPreferenceProperty( stream_lines_represent, "strings", modes3 );
+ setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
+ setPreferenceProperty( plot3d_represent, "strings", modes1 );
+ setPreferenceProperty( plot3d_represent, "indexes", indices1 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
+ setPreferenceProperty( scalar_def_represent, "strings", modes1 );
+ setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
+ addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
+
+ int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
+ QStringList quadraticModes;
+ quadraticModes.append("Lines");
+ quadraticModes.append("Arcs");
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( quadraticmode, "strings", quadraticModes );
+ setPreferenceProperty( quadraticmode, "indexes", indices );
+
+ int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
+ "VISU", "max_angle" );
+ setPreferenceProperty( maxAngle, "min", 1 );
+ setPreferenceProperty( maxAngle, "max", 90 );
+
+ int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
+ setPreferenceProperty( elem0DSize, "min", 1 );
+ setPreferenceProperty( elem0DSize, "max", 10 );
+ addPreference( "", representGr, LightApp_Preferences::Space );
+
+ int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
+ setPreferenceProperty( shrFac, "min", 20 );
+ setPreferenceProperty( shrFac, "max", 100 );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
+ addPreference( "", representGr, LightApp_Preferences::Space );
+
+ int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
+
+ QList<QVariant> aMarkerTypeIndicesList;
+ QList<QVariant> aMarkerTypeIconsList;
+ for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
+ QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
+ QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
+ aMarkerTypeIndicesList << i;
+ aMarkerTypeIconsList << pixmap;
}
- delete CursorDlg;
+ aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
+ aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
+ setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
+ setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
+
+ int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
+
+ QList<QVariant> aMarkerScaleIndicesList;
+ QStringList aMarkerScaleValuesList;
+ for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
+ aMarkerScaleIndicesList << i;
+ aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
+ }
+ setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
+ setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
+
+ addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
+ sp = addPreference( "", representGr, LightApp_Preferences::Space );
+ setPreferenceProperty( sp, "hstretch", 0 );
+ setPreferenceProperty( sp, "vstretch", 0 );
+
+ addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
+ addPreference( "", representGr, LightApp_Preferences::Space );
+
+ addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
+ LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
+
+ // TAB: Tables ; group: "Tables editing properties"
+ int tablesTab = addPreference( tr( "VISU_TABLES" ) );
+
+ int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
+ setPreferenceProperty( tablesGr, "columns", 1 );
+
+ addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
+
+ int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
+ QStringList policies;
+ policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
+ policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
+ policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
+ policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
+ policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ indices.append( 3 );
+ indices.append( 4 );
+ setPreferenceProperty( sortPolicyPref, "strings", policies );
+ setPreferenceProperty( sortPolicyPref, "indexes", indices );
+
+ // TAB: Feature edges ; group: "Feature edges properties"
+ int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
+
+ int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
+ setPreferenceProperty( featureEdgesGr, "columns", 2 );
+
+ int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
+ LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
+ setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
+ setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
+ setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
+
+ addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
+ addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
+ addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
+ addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
+ //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
+
+ // TAB: "Values labels"
+
+ int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
+
+ // "Font" group
+ int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
+ setPreferenceProperty( valLblFontGr, "columns", 2 );
+
+ // font
+ addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
+
+ // color
+ addPreference( tr( "COLOR" ), valLblFontGr,
+ LightApp_Preferences::Color, "VISU", "values_labeling_color" );
+
}
-/* ======================================================================================== */
-/* Setting parameters for Scalar Bar */
-/* ======================================================================================== */
-void VisuGUI::ChangeScalarBar()
+void VisuGUI::preferencesChanged( const QString& a, const QString& b)
{
- VisuGUI_ScalarBarDlg* Scbar = new VisuGUI_ScalarBarDlg(TRUE);
- Scbar->initFromResources();
- int ret = Scbar->exec();
- if ( ret ) {
- Scbar->storeToResources();
+ if (a != QString("VISU")) return;
+ if (b == QString("scalar_bar_orientation")) return;
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ float sbX1,sbY1,sbW,sbH;
+ float aTol = 1.00000009999999;
+ QString aWarning;
+ if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
+ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
+ sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
+ if(sbX1+sbW > aTol){
+ aWarning = "Origin and Size Vertical: X+Width > 1\n";
+ sbX1=0.01;
+ sbW=0.05;
+ aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
+ aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
+ }
+ }
+ else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
+ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
+ sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
+ if(sbY1+sbH > aTol){
+ aWarning = "Origin and Size Vertical: Y+Height > 1\n";
+ sbY1=0.01;
+ sbH=0.5;
+ aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
+ aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
+ }
+ }
+ else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
+ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
+ sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
+ if(sbX1+sbW > aTol){
+ aWarning = "Origin and Size Horizontal: X+Width > 1\n";
+ sbX1=0.2;
+ sbW=0.6;
+ aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
+ aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
+ }
+ }
+ else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
+ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
+ sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
+ if(sbY1+sbH > aTol){
+ aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
+ sbY1=0.01;
+ sbH=0.12;
+ aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
+ aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
+ }
+ }
+ else if(b == "visual_data_precision") {
+ LightApp_Preferences* pref = preferences();
+ QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
+ QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
+ if ( min )
+ setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+ if ( max )
+ setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
+ }
+
+ if ( !aWarning.isEmpty() ){
+ aWarning += "The default values are applied instead.";
+ SUIT_MessageBox::warning(GetDesktop(this),
+ tr("ERR_SCALARBAR_PARAMS"),
+ aWarning );
}
- delete Scbar;
}
-/* ======================================================================================== */
-/* Setting parameters for Sweeping */
-/* ======================================================================================== */
-void VisuGUI::SetSweepingPreferences()
+SUIT_ViewManager*
+VisuGUI
+::getViewManager(const QString& theType,
+ const bool theIsCreate)
{
- float tempo=0.2;
- int cycles=1;
- int steps=20;
-
- QString Tempo = QAD_CONFIG->getSetting("Visu:SweepTempo");
- if ( !Tempo.isEmpty() )
- tempo = Tempo.toFloat();
+ return getApp()->getViewManager(theType,theIsCreate);
+}
- QString Cycles = QAD_CONFIG->getSetting("Visu:SweepCycles");
- if ( !Cycles.isEmpty() )
- cycles = Cycles.toInt();
+VISU::TViewToPrs3d&
+VisuGUI
+::getScalarBarsMap()
+{
+ return myScalarBarsMap;
+}
- QString Steps = QAD_CONFIG->getSetting("Visu:SweepSteps");
- if ( !Steps.isEmpty() )
- steps = Steps.toInt();
+LightApp_Displayer* VisuGUI::displayer()
+{
+ if( !myDisplayer )
+ myDisplayer = new VisuGUI_Displayer( getApp() );
- VisuGUI_SweepPrefDlg* Sweep = new VisuGUI_SweepPrefDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
+ return myDisplayer;
+}
- Sweep->setTimeStep( tempo );
- Sweep->setNbCycles( cycles );
- Sweep->setNbSteps ( steps );
- if ( Sweep->exec() )
- {
- tempo = Sweep->getTimeStep();
- cycles = Sweep->getNbCycles();
- steps = Sweep->getNbSteps();
+void VisuGUI::OnPlot3dFromCutPlane()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy, GetDesktop(this)))
+ return;
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() < 1) return;
+
+
+ VISU::CutPlanes_i* aCutPrs = 0;
+ Handle(SALOME_InteractiveObject) anIO;
+ _PTR(SObject) aSObject;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ anIO = It.Value();
+
+ if (!anIO.IsNull() && anIO->hasEntry()) {
+ aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !aSObject )
+ continue;
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+ if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+ aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+ if (aCutPrs)
+ break;
+ }
+ }
+ }
+ }
- QAD_CONFIG->addSetting("Visu:SweepTempo", tempo);
- QAD_CONFIG->addSetting("Visu:SweepCycles", cycles);
- QAD_CONFIG->addSetting("Visu:SweepSteps", steps);
- }
- delete Sweep;
+ if (aCutPrs) {
+ _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
+ if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
+ QString aViewType = aViewManager->getType();
+ //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
+
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
+ if (aType != TTIMESTAMP )
+ return;
+
+ QString aMeshName = aRestoringMap["myMeshName"];
+ QString anEntity = aRestoringMap["myEntityId"];
+ QString aFieldName = aRestoringMap["myFieldName"];
+ QString aTimeStampId = aRestoringMap["myTimeStampId"];
+
+ int aPos;
+ SUIT_ViewWindow* aViewWindow = 0;
+// if (anIsVVTK) {
+// aViewWindow = GetViewWindow<VVTK_Viewer>(this);
+// aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
+// } else {
+ aViewWindow = GetViewWindow<SVTK_Viewer>(this);
+ aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
+ // }
+ GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
+
+ VISU::Plot3D_i* aPrs3d =
+ CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
+ aTimeStampSObj,
+ (const char*)aMeshName.toLatin1(),
+ (Entity)anEntity.toInt(),
+ (const char*)aFieldName.toLatin1(),
+ aTimeStampId.toInt(),
+ ColoredPrs3d_i::EPublishUnderTimeStamp);
+ if (aPrs3d) {
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
+ if (!aValue) {
+ VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
+ aDlg->initFromPrsObject(aPrs3d, true);
+ int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
+ double aRotX = aCutPrs->GetRotateX();
+ double aRotY = aCutPrs->GetRotateY();
+ double aPlanePos = aCutPrs->GetPlanePosition(0);
+ aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
+
+ if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
+ DeletePrs3d(this, aPrs3d);
+ delete aDlg;
+ return;
+ }
+ delete aDlg;
+ UpdateObjBrowser(this, true, aTimeStampSObj);
+ }
+ SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ if ( aSVtkWindow ) {
+ PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
+ aSVtkWindow->onFitAll();
+
+ AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
+ }
+ processPresentationCreated(aPrs3d);
+ }
+ }
+ application()->putInfo(QObject::tr("INF_DONE"));
+ }
}
-/* ======================================================================================== */
-/* Returns Visu input files directory (default is CSF_PATHData) */
-/* ======================================================================================== */
-QString VisuGUI::getVisuInputDir()
+void VisuGUI::OnManageCache()
{
- QString Tmp = QAD_CONFIG->getSetting("Visu:InputDir");
- if ( Tmp.isEmpty() )
- Tmp = QAD_Tools::addSlash(getenv("CSF_PATHData"));
- Tmp = QAD_Tools::addSlash(Tmp);
- return (Tmp);
+ mySlider->show();
}
-/* ======================================================================================== */
-/* Returns Visu output files directory (default is InputDir) */
-/* ======================================================================================== */
-QString VisuGUI::getVisuOutputDir()
+
+//---------------------------------------------------------------
+void VisuGUI::OnMultiprViewFullRes()
{
- QString Tmp = QAD_CONFIG->getSetting("Visu:OutputDir");
- if ( Tmp.isEmpty() )
- {
- QString Tmp2 = QAD_CONFIG->getSetting("Visu:InputDir");
- if ( Tmp2.isEmpty() )
- Tmp = QAD_Tools::addSlash(getenv("CSF_PATHData"));
- else
- Tmp = Tmp2;
- }
- Tmp = QAD_Tools::addSlash(Tmp);
- return (Tmp);
+ OnMultiprChangeRes(VISU::Result::FULL);
}
-/* ======================================================================================== */
-/* Global Method for Scalar Map */
-/* ======================================================================================== */
-VISU::Result_i* VisuGUI::CreatePresent(SALOMEDS::SObject_var theField, VISU::Result_var& theResult){
- if(MYDEBUG) MESSAGE("VisuGUI::CreatePresent");
- SALOMEDS::SObject_var aSObj = theField->GetFather();
- if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- aSObj = aSObj->GetFather(); if (CORBA::is_nil(aSObj)) return NULL;
- CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
- if(CORBA::is_nil(anObject)) return NULL;
- theResult = VISU::Result::_narrow(anObject);
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
- if(pResult == NULL)
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- return pResult;
+//---------------------------------------------------------------
+void VisuGUI::OnMultiprViewMediumRes()
+{
+ OnMultiprChangeRes(VISU::Result::MEDIUM);
}
-#define CREATEPRS(PRSTYPE, FNAME, FCREATE) \
-PRSTYPE* FNAME(SALOMEDS::SObject_var theField, \
- const char* theMeshName, VISU::Entity theEntity, \
- const char* theFieldName, int theTimeId) {\
- VISU::Result_var aResult; \
- VISU::Result_i* pResult = CreatePresent(theField,aResult); \
- if(pResult != NULL){ \
- QApplication::setOverrideCursor( Qt::waitCursor ); \
- CORBA::Object_var anObject = \
- GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
- QApplication::restoreOverrideCursor(); \
- if(!CORBA::is_nil(anObject)) \
- return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject).in()); \
- } \
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), \
- tr ("ERR_CANT_BUILD_PRESENTATION"), \
- tr ("VISU_BUT_OK") ); \
- return NULL; \
-}
-
-CREATEPRS(VISU::ScalarMap_i, VisuGUI::CreateScalarMapPrs, ScalarMapOnField);
-CREATEPRS(VISU::DeformedShape_i, VisuGUI::CreateDeformedShapePrs, DeformedShapeOnField);
-CREATEPRS(VISU::Vectors_i, VisuGUI::CreateVectorsPrs, VectorsOnField);
-CREATEPRS(VISU::IsoSurfaces_i, VisuGUI::CreateIsoSurfacesPrs, IsoSurfacesOnField);
-CREATEPRS(VISU::CutPlanes_i, VisuGUI::CreateCutPlanesPrs, CutPlanesOnField);
-CREATEPRS(VISU::CutLines_i, VisuGUI::CreateCutLinesPrs, CutLinesOnField);
-CREATEPRS(VISU::StreamLines_i, VisuGUI::CreateStreamLinesPrs, StreamLinesOnField);
-
-
-#define BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) \
-bool FNAME(SALOMEDS::SObject_var theField) { \
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField); \
- bool isExist; \
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist); \
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false; \
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); \
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); \
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); \
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); \
- Utils_Timer timer; \
- if(MYCHECKTIME) timer.Start(); \
- TYPE* pPresent = FCREATE(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toInt()); \
- if(MYCHECKTIME) { \
- timer.Stop(); \
- MESSAGE("BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT"); \
- timer.Show(); \
- } \
- if (pPresent) { \
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d"); \
- if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){ \
- DLGNAME* aDlg = new DLGNAME(); \
- aDlg->initFromPrsObject(pPresent); \
- if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) { \
- delete aDlg; \
- } else { \
- DeletePresentation(pPresent); \
- delete aDlg; \
- return false; \
- } \
- } \
- try { \
- CreateActor(pPresent); \
- }catch (...) {\
- return false;} \
- return true; \
- } \
- return false; \
-}
-BUILDPRS(VISU::ScalarMap_i, CreateScalarMapPrs, VisuGUI::CreateScalarMap, VisuGUI_ScalarBarDlg);
-BUILDPRS(VISU::DeformedShape_i, CreateDeformedShapePrs, VisuGUI::CreateDeformedShape, VisuGUI_MagnitudeDlg);
-BUILDPRS(VISU::Vectors_i, CreateVectorsPrs, VisuGUI::CreateVectors, VisuGUI_VectorsDlg);
-BUILDPRS(VISU::IsoSurfaces_i, CreateIsoSurfacesPrs, VisuGUI::CreateIsoSurfaces, VisuGUI_IsoSurfacesDlg);
-//BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
-//BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
-BUILDPRS(VISU::StreamLines_i, CreateStreamLinesPrs, VisuGUI::CreateStreamLines, VisuGUI_StreamLinesDlg);
-
-
-bool VisuGUI::CreateCutPlanes(SALOMEDS::SObject_var theField) {
- try {
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField);
- bool isExist;
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist);
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false;
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
- Utils_Timer timer;
- if(MYCHECKTIME) timer.Start();
- VISU::CutPlanes_i* pPresent =
- CreateCutPlanesPrs(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toInt());
- if(MYCHECKTIME) {
- timer.Stop();
- MESSAGE("BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT");
- timer.Show();
- }
- if (pPresent) {
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
- if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
- VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(true, false);
- aDlg->initFromPrsObject(pPresent);
- aDlg->show();
- myActiveDialogBox = aDlg;
-// if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) {
-// delete aDlg;
-// } else {
-// DeletePresentation(pPresent);
-// delete aDlg;
-// return false;
-// }
-// }
-// CreateActor(pPresent);
- return true;
- }
- }
-}catch (...){return false;}
- return false;
+//---------------------------------------------------------------
+void VisuGUI::OnMultiprViewLowRes()
+{
+ OnMultiprChangeRes(VISU::Result::LOW);
}
-bool VisuGUI::CreateCutLines(SALOMEDS::SObject_var theField) {
-try {
- VISU::Storable::TRestoringMap aMap = getMapOfValue(theField);
- bool isExist;
- QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist);
- if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false;
- QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
- QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
- QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
- QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
- Utils_Timer timer;
- if(MYCHECKTIME) timer.Start();
- VISU::CutLines_i* pPresent = CreateCutLinesPrs(theField,aMeshName,
- (VISU::Entity)anEntity.toInt(),
- aFieldName,aTimeStampId.toInt());
- if(MYCHECKTIME) {
- timer.Stop();
- MESSAGE("BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg) - CREATE PRSOBJECT");
- timer.Show();
- }
- if (pPresent) {
- QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
- if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
- VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(true);
- aDlg->initFromPrsObject(pPresent);
- aDlg->show();
- myActiveDialogBox = aDlg;
- return true;
-// if (aDlg->exec()) {
-// aDlg->storeToPrsObject(pPresent);
-// if (aDlg->isGenerateTable()) {
-// GetVisuGen()->CreateTable(pPresent->GetEntry());
-// if (aDlg->isGenerateCurves()) {
-// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
-// SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(pPresent->GetEntry());
-// if(!aSObject->_is_nil()) {
-// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
-// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-// for ( ;aIter->More(); aIter->Next()) {
-// SALOMEDS::SObject_var aTblObj = aIter->Value();
-// if (!aTblObj->_is_nil()) {
-// SALOMEDS::GenericAttribute_var anAttr;
-// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
-// CreatePlot(aTblObj);
-// }
-// }
-// }
-// }
-// }
-// GetActiveStudy()->updateObjBrowser();
-// }
-// } else {
-// DeletePresentation(pPresent);
-// delete aDlg;
-// return false;
-// }
-// delete aDlg;
-// }
-// CreateActor(pPresent);
-// return true;
- }
- }
-}catch (...){return false; }
- return false;
+
+//---------------------------------------------------------------
+void VisuGUI::OnMultiprViewHide()
+{
+ OnMultiprChangeRes(VISU::Result::HIDDEN);
}
+//---------------------------------------------------------------
+void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
-/* ======================================================================================== */
-/* Global Method to import tables from file */
-/* ======================================================================================== */
-void VisuGUI::ImportTablesFromFile(){
- if (checkLock(GetActiveStudy()->getStudyDocument())) return;
- QStringList flt;
- flt.append( "Files (*.xls *.txt *.tab)" );
- flt.append( "All Files (*.*)" );
- QString aDir = getVisuInputDir();
- QFileInfo aFileInfo = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Import From File"),true);
-
- if(aFileInfo.exists()){
- QAD_Application::getDesktop()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
- aDir = QAD_Tools::getDirFromPath(aFileInfo.filePath());
- QAD_CONFIG->addSetting("Visu:InputDir",aDir);
- QAD_WaitCursor wc;
-
- CORBA::Object_var anObject;
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
-
- anObject=GetVisuGen()->ImportTables(aFileInfo.filePath());
-
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::ImportTablesFromFile() - IMPORT FILE");
- timer.Show();
-#endif
-
- if(CORBA::is_nil(anObject)) {
- wc.stop();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_IN_THE_FILE"),
- tr ("VISU_BUT_OK") );
- wc.start();
- }
- else {
- QAD_Application::getDesktop()->putInfo(aFileInfo.filePath()+" imported.");
- }
- GetActiveStudy()->updateObjBrowser(); //update Object browser
- }
-}
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
-void VisuGUI::ExportTableToFile()
-{
- QAD_Study *aQADStudy = VisuGUI::GetActiveStudy();
- SALOME_Selection* aSel = SALOME_Selection::Selection ( aQADStudy -> getSelection() );
+ QApplication::setOverrideCursor(Qt::WaitCursor);
- if( aSel->IObjectCount() > 0 ) {
- const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
- if(anIO->hasEntry()){
- SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
- SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID(anIO->getEntry());
- if(CORBA::is_nil(aSObj)) return;
+ typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
+ typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
+ TResult2SObject aResult2SObject;
- QString aTitle;
- SALOMEDS::GenericAttribute_var anAttr;
-
- if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") &&
- !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
- aSObj = aSObj->GetFather(); //if the current SObject is a table title
- // we take a father contaning the table
- if (!CORBA::is_nil(aSObj)) {
- if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") &&
- !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger"))
- return;
- }
- else return;
- }
- if (CORBA::is_nil(anAttr)) return;
+ for (int i=0; i < aSelectionInfo.size(); i++) {
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
- SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
- if (!CORBA::is_nil(aTabAttr))
- aTitle = aTabAttr->GetTitle(); //get table title in order to have default name of the file
- else {
- SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
- if (!CORBA::is_nil(aTabAttr))
- aTitle = aTabAttr->GetTitle(); //get table title in order to have default name of the file
- else return;
- }
- aTitle.simplifyWhiteSpace();
- QStringList flt;
- flt.append("Table Files (*.xls)");
-
- QAD_FileDlg *aDlg = new QAD_FileDlg(QAD_Application::getDesktop(), false, true, true);
- aDlg -> setCaption("Export Table To File");
- aDlg -> setDir( getVisuOutputDir() );
- aDlg -> setFilters(flt);
- aDlg -> setSelection(aTitle.replace(QRegExp(" "), "_"));
- aDlg -> exec();
- QString aFile = aDlg -> selectedFile();
- delete aDlg;
+ _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
+ if (!aSObject)
+ continue;
- if(!aFile.isEmpty()){
- QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
- QString aDir = QAD_Tools::getDirFromPath(aFile);
- QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
-
- try {
- GetVisuGen() -> ExportTableToFile(aSObj, aFile.latin1());
- QAD_Application::getDesktop()->putInfo(aFile+" exported.");
- } catch(std::exception& ex) {
- INFOS(ex.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT") + " " + tr(ex.what()),
- tr ("VISU_BUT_OK") );
- } catch(...) {
- INFOS(tr ("ERR_ERROR_DURING_EXPORT"));
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT"),
- tr ("VISU_BUT_OK") );
- }
- }
- }
+ VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
+ if(CORBA::is_nil(aResult.in()))
+ continue;
+
+ VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
+ if(!aCResult)
+ continue;
+
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
+ bool anIsFound = false;
+ QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
+ if(!anIsFound)
+ continue;
+
+ std::string aPartName = aSObject->GetName();
+
+ aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
+
+ aResult2SObject[TResultPtr(aCResult)] = aSObject;
}
-}
-/* ======================================================================================== */
-/* Global Method to import mesh results in MED and DAT format */
-/* ======================================================================================== */
-void VisuGUI::ImportFile(){
- VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::ImportFile);
-}
-void VisuGUI::CopyAndImportFile(){
- VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::CopyAndImportFile);
-}
-void VisuGUI::ImportFromFile(TImportFun theImportFun){
- if (checkLock(GetActiveStudy()->getStudyDocument())) return;
- QStringList flt;
- //flt.append( "Exportable Files (*.med *.dat)" );
- //flt.append( "Dat Files (*.dat)" );
- flt.append( "Med Files (*.med)" );
- QString aDir = getVisuInputDir();
- QFileInfo aFileInfo = VisuGUI_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Import From File"),true);
-
- if(aFileInfo.exists()){
- QAD_Application::getDesktop()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
- aDir = QAD_Tools::getDirFromPath(aFileInfo.filePath());
- QAD_CONFIG->addSetting("Visu:InputDir",aDir);
- QAD_WaitCursor wc;
-
- VISU::Result_var aResult;
-
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- QString IsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
- bool isBuild = (IsBuild.isEmpty()? 0 : IsBuild.toInt());
- if (VisuGUI_FileDlg::IsBuild){
- aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
- if(!CORBA::is_nil(aResult.in()))
- if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(GetServant(aResult).in())){
- if(!pResult->IsPossible())
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
- else
- aResult->BuildAll();
- }
- }else{
- QAD_CONFIG->addSetting( "Visu:BuildResult", false );
- //aResult=(GetVisuGen()->*theImportFun)(aFileInfo.filePath()); APO: 18/12/03 - fix crash on Linux RedHat 7.1
- aResult=GetVisuGen()->ImportFile(aFileInfo.filePath()); // APO: 18/12/03 - fix crash on Linux RedHat 7.1
- QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
- }
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::ImportFromFile() - IMPORT FILE");
- timer.Show();
-#endif
- if(CORBA::is_nil(aResult.in())) {
- wc.stop();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_IN_THE_FILE"),
- tr ("VISU_BUT_OK") );
- wc.start();
- }
- else {
- QAD_Application::getDesktop()->putInfo(aFileInfo.filePath()+" imported.");
- }
- GetActiveStudy()->updateObjBrowser(); //update Object browser
+ // To update all result observers
+ TResult2SObject::const_iterator anIter = aResult2SObject.begin();
+ for(; anIter != aResult2SObject.end(); anIter++){
+ const TResultPtr& aResultPtr = anIter->first;
+ const _PTR(SObject)& aSObject = anIter->second;
+ aResultPtr->UpdateObservers();
+ VISU::UpdateObjBrowser(this, false, aSObject);
}
+
+ QApplication::restoreOverrideCursor();
}
-void VisuGUI::ExportToFile(){
- CORBA::Object_var anObject = GetSelectedObj();
- if(CORBA::is_nil(anObject)) return;
- VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in());
- if(aBase != NULL && aBase->GetType() == VISU::TRESULT){
- QStringList flt;
- flt.append( "Dat Files (*.dat)" );
- flt.append( "Med Files (*.med)" );
- QString aDir = getVisuOutputDir();
- QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
- aDir,flt,tr("Export To File"),false);
- if(!aFile.isEmpty()){
- QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
- aDir = QAD_Tools::getDirFromPath(aFile);
- QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
- if(dynamic_cast<VISU::Result_i*>(aBase)){
- try{
- //APO - aResult->GetInput()->ToFile(aFile.latin1());
- QAD_Application::getDesktop()->putInfo(aFile+" exported.");
- }catch(std::exception& ex) {
- INFOS(ex.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT") + " " +tr(ex.what()),
- tr ("VISU_BUT_OK") );
- }
- catch(...){
- INFOS(tr ("ERR_ERROR_DURING_EXPORT").latin1());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_ERROR_DURING_EXPORT"),
- tr ("VISU_BUT_OK") );
- }
- }
- }
- }else
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
+//---------------------------------------------------------------
+void VisuGUI::OnFileInfo()
+{
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
+ SUIT_DataOwnerPtrList lst;
+ getApp()->selectionMgr()->selected( lst );
+ LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
+ VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
+ if(!aCResult)
+ return;
+ VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
+ dlg.exec();
}
-/* ======================================================================================== */
-/* Test and Read Object Browser before display */
-/* ======================================================================================== */
-bool VisuGUI::TestObjectBrowser(SALOMEDS::SObject_var& objVisu ){
- if(MYDEBUG) MESSAGE("VisuGUI::TestObjectBrowser");
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if(!anIO.IsNull() && anIO->hasEntry()){
- objVisu = GetStudyDocument()->FindObjectID(anIO->getEntry());
- QString aValue = getValue(objVisu,"myType");
- if((VISU::VISUType)aValue.toInt() == VISU::TTIMESTAMP) return true;
+//---------------------------------------------------------------
+void VisuGUI::OnExportMED()
+{
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
+ SUIT_DataOwnerPtrList lst;
+ getApp()->selectionMgr()->selected( lst );
+ LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
+ VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
+ if(!aResult)
+ return;
+ // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
+ // dlg.exec();
+
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
+
+ // get name for the file
+ QStringList aFilter;
+ aFilter.append("MED Files (*.med)");
+
+ std::string anInitFileName = aResult->GetInitFileName();
+ QFileInfo anInitFileInfo(anInitFileName.c_str());
+ QString aBaseName = anInitFileInfo.fileName();
+
+ QString aPath = Qtx::addSlash(aDir) + aBaseName;
+
+ QFileInfo aFileInfo =
+ SUIT_FileDlg::getFileName(GetDesktop(this),
+ aPath,
+ aFilter,
+ tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
+ false);
+
+ QString aFile = aFileInfo.filePath();
+ if ( aFile.length() > 0 ) {
+ aResult->ExportMED((const char*)aFile.toLatin1());
}
- QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("WRN_NO_AVAILABLE_DATA"),
- tr("VISU_BUT_OK") );
- return false;
}
-/**
- * Returns Actor of presentation if it exists
- */
-VISU_Actor* VisuGUI::GetActor(VISU::Prs3d_i* thePrs, VTKViewer_ViewFrame* theViewFrame){
- VTKViewer_ViewFrame* vf = theViewFrame? theViewFrame: GetVtkViewFrame();
- if (!vf) return NULL;
- vtkActor *anActor;
- vtkActorCollection *anActColl = vf->getRenderer()->GetActors();
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;)
- if(VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
- if(thePrs == anVISUActor->GetPrs3d())
- return anVISUActor->GetParent();
- return NULL;
+void VisuGUI::OnFilterScalars()
+{
+ VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
+ aDlg->show();
}
-/**
- * Displays only actor of given presentation
- * Creates it if it is abcent
- */
-VISU_Actor* VisuGUI::UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly){
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (!vf) return NULL;
-
- vtkRenderer *aRen = vf->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
-
- vtkActor *anActor;
- VISU_Actor* anVISUActor = NULL;
- VISU_Actor* aResActor = NULL;
- for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(!SALOME_Actor::SafeDownCast(anActor))
- continue;
- if(anActor->IsA("VISU_Actor")){
- anVISUActor = VISU_Actor::SafeDownCast(anActor);
- VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
- if(aPrs == NULL) continue;
- if (thePrs == aPrs) {
- aResActor = anVISUActor->GetParent();
- thePrs->UpdateActor(aResActor);
- aResActor->VisibilityOn();
-
- } else if (theDispOnly) {
- anVISUActor->GetParent()->VisibilityOff();
- } else {
- }
- } else if (theDispOnly && anActor->GetVisibility()) {
- anActor->VisibilityOff();
- } else {
- }
+/*!
+ \brief SLOT called when "Labeling" popup menu item of presentation is clicked
+ activates/deactivates labeling of results of the screen. This functionality works
+ to numbering in SMESH module but is intended for showing results on the screen
+ instead of elements numbers
+ \sa OnValuesLabelingParams()
+*/
+void VisuGUI::OnValuesLabeling()
+{
+ // to do: rewrite for several actors if necessary
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
+ if ( aSelectionInfo.empty() )
+ return;
+
+ TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
+ VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+ if (!aPrs3d)
+ return;
+
+ SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ if (!aViewWindow)
+ return;
+
+ VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+ if (!anActor)
+ return;
+
+ if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
+ {
+ aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
+ aViewWindow->Repaint();
}
- if (aResActor) return aResActor;
- try{
- anVISUActor = thePrs->CreateActor();
- vf->AddActor(anVISUActor);
- } catch ( std::runtime_error& exc ){
- INFOS(exc.what());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr("ERR_CANT_VISUALIZE_OBJECT") + " " + tr(exc.what()),
- tr ("VISU_BUT_OK") );
- anVISUActor = NULL;
+ else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
+ {
+ aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
+ aViewWindow->Repaint();
}
- return anVISUActor;
}
-
-/**
- * Returns TRUE if Presentation is displayed
- */
-bool VisuGUI::IsDisplayed(VISU::Prs3d_i* thePrs) {
- VISU_Actor* anVISUActor = GetActor(thePrs);
- return (anVISUActor)? anVISUActor->GetVisibility() : false;
+/*!
+ \brief SLOT called when "Labeling parameters" popup menu item of presentation
+ is clicked launch dialog box for changing parameters of labeling
+ \sa OnValuesLabeling()
+*/
+void VisuGUI::OnValuesLabelingParams()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
+ EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
}
+/*!
+ \brief Adds preferences for dfont of VTK viewer
+ \param label label
+ \param pIf group identifier
+ \param param parameter
+ \return identifier of preferences
+*/
+int VisuGUI::addVtkFontPref(
+ const QString& label,
+ const int pId,
+ const QString& param,
+ const bool useSize )
+{
+ int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
-/**
- * Erases Presentation
- */
-void VisuGUI::ErasePrs(VISU::Prs3d_i* thePrs) {
- GetActiveStudy()->unHighlightAll();
- VISU_Actor* anVISUActor = GetActor(thePrs);
- if (anVISUActor) {
- anVISUActor->VisibilityOff();
- }
+ setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
+
+ QStringList fam;
+ fam.append( tr( "VISU_FONT_ARIAL" ) );
+ fam.append( tr( "VISU_FONT_COURIER" ) );
+ fam.append( tr( "VISU_FONT_TIMES" ) );
+
+ setPreferenceProperty( tfont, "fonts", fam );
+
+ int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
+ if ( useSize )
+ f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
+
+ setPreferenceProperty( tfont, "features", f );
+
+ return tfont;
}
-/**
- * Deletes given presentation from Data structure
+/*!
+ \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
+ \ of presentation is cliked
*/
-void VisuGUI::DeletePresentation(VISU::Prs3d_i* thePrs) {
- if(checkLock(GetStudyDocument()) || !thePrs) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)){
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)){
- aViewFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- aViewFrame->unHighlightAll();
- }
- }
- thePrs->RemoveFromStudy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
+void VisuGUI::OnArcQuadMode(){
+ ChangeQuadratic2DRepresentation(this,VISU::ARCS);
}
-/**
- * Deletes given curve presentation from Data structure
+/*!
+ \brief SLOT called when "2D Quadratic -> Lines" popup menu item
+ \ of presentation is cliked
*/
-void VisuGUI::DeletePresentation(VISU::Curve_i* theCurve) {
- if(checkLock(GetStudyDocument()) || !theCurve) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(Plot2d_ViewFrame* aViewFrame = dynamic_cast<Plot2d_ViewFrame*>(aVFrame)){
- QList<Plot2d_Curve> clist;
- aViewFrame->getCurves( clist );
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) )
- aViewFrame->eraseCurve( clist.at( i ) );
- }
- aViewFrame->Repaint();
- aViewFrame->unHighlightAll();
- }
- }
- theCurve->RemoveFromStudy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
+void VisuGUI::OnLineQuadMode(){
+ ChangeQuadratic2DRepresentation(this,VISU::LINES);
}
-/**
- * Creates new actor of presentation
- */
-void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
- if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
- if (!thePrs) return;
- QApplication::setOverrideCursor( Qt::waitCursor );
- if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
-#endif
- try{
- MESSAGE("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
- VISU_Actor* aActor = thePrs->CreateActor();
- vf->AddActor(aActor);
- }catch(std::runtime_error& exc) {
- INFOS("std::runtime_error "<<exc.what());
- INFOS("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
- QApplication::restoreOverrideCursor();
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_CANT_VISUALIZE_PRS") + " " + tr(exc.what()),
- tr ("VISU_BUT_OK") );
- throw exc;
- } catch (...) {
- MESSAGE(" Unknown exception");
- QApplication::restoreOverrideCursor();
- INFOS("Unknown exception is caught in VisuGUI::CreateActor");
- INFOS("Available memory : "<<VISU_PipeLine::GetAvailableMemory());
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("WRN_CANT_VISUALIZE_PRS") + " " + tr("ERR_UNKNOWN_EXCEPTION"),
- tr ("VISU_BUT_OK") );
- throw ;
+/*!
+ \brief Return \c true if object can be renamed
+*/
+bool VisuGUI::renameAllowed( const QString& entry) const {
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+ SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
+
+ if(!app || !appStudy || !obj)
+ return false;
+
+ if(appStudy->isComponent(entry) || obj->isReference())
+ return false;
+
+
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ if(aBase){
+ VISU::VISUType aType = aBase->GetType();
+ if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
+ CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+ VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+ aType = aHolder->GetPrsType();
}
-#ifdef CHECKTIME
- timer.Stop();
- MESSAGE("VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) - DISPLAY ACTOR");
- timer.Show();
-#endif
+ if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
+ aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
+ aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
+ aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
+ aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
+ aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
+ return true;
+ } else {
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+ bool anIsExist;
+ QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+ return anIsExist && "VIEW3D" == aVal;
}
- QApplication::restoreOverrideCursor();
+ return false;
}
+void VisuGUI::OnShowDeviation() {
+ if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
+ return;
-/* ======================================================================================== */
-/* Functions to State of VisuGUI and Dialog Box */
-/* ======================================================================================== */
-
-void VisuGUI::SetState(int aState )
-{
- this->myState = aState ;
- return ;
-}
+ QAction* anAction = action(VISU_SHOW_DEVIATION);
+ if(!anAction)
+ return;
+ bool anIsShow = anAction->isChecked();
-void VisuGUI::ResetState()
-{
- this->myState = -1 ;
- return ;
-}
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ if(aSelectionInfo.empty())
+ return;
-void VisuGUI::EmitSignalDeactivateDialog()
-{
- emit this->SignalDeactivateActiveDialog() ;
- return ;
+ TSelectionInfo::iterator anIter = aSelectionInfo.begin();
+ for( ; anIter != aSelectionInfo.end(); anIter++ )
+ {
+ VISU::TSelectionItem aSelectionItem = *anIter;
+ Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+ VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+ if(aBase && aBase->GetType() == VISU::TCURVE) {
+ // Curve object
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
+ aCurve->ShowDeviation(anIsShow);
+ if( displayer()->IsDisplayed( anIO->getEntry() ) )
+ PlotCurve(this, aCurve, VISU::eDisplay);
+ }
+ }
+ }
}
-void VisuGUI::EmitSignalCloseAllDialogs()
-{
- emit this->SignalCloseAllDialogs() ;
- return ;
-}
+/*!
+ Rename object by entry.
+ \param entry entry of the object
+ \param name new name of the object
+ \brief Return \c true if rename operation finished successfully, \c false otherwise.
+*/
+bool VisuGUI::renameObject( const QString& entry, const QString& name) {
-QDialog* VisuGUI::GetActiveDialogBox()
-{
- return this->myActiveDialogBox ;
-}
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
+ SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
+
+ if(!appStudy)
+ return false;
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ if(!aStudy)
+ return false;
+
+ bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
+ if ( aLocked ) {
+ SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
+ return false;
+ }
+
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
+
+ _PTR(SObject) aSObject = anObjectInfo.mySObject;
+ if (aSObject) {
+ VISU::Base_i* aBase = anObjectInfo.myBase;
+ VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+ if(aBase){
+ VISU::VISUType aType = aBase->GetType();
+ if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
+ CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
+ VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
+ aType = aHolder->GetPrsType();
+ }
+ if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
+ aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
+ aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
+ aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
+ aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
+ aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
+ aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ if (!name.isEmpty()) {
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ // rename specific objects
+ if (VISU::Base_i* aBase = anObjectInfo.myBase) {
+ switch (aBase->GetType()) {
+ case VISU::TCURVE: { // Curve object
+ if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
+ aCurve->SetName(qPrintable(name), true);
+ break;
+ }
+ case VISU::TTABLE: { // Table object
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
+ aTable->SetName(qPrintable(name), true);
+ break;
+ }
+ case VISU::TPOINTMAP3D: { // Table object
+ if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
+ aTable3d->SetTitle(qPrintable(name));
+ aTable3d->UpdateActors();
+ }
+ break;
+ }
+ case VISU::TCONTAINER: { // Container object
+ if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
+ aContainer->SetName(qPrintable(name), true);
+ break;
+ }
+ default: {
+ }}
+ }
-void VisuGUI::SetActiveDialogBox(QDialog* aDlg)
-{
- this->myActiveDialogBox = (QDialog*)aDlg ;
- return ;
+ // rename the study object
+ aName->SetValue( qPrintable(name) ); // rename the SObject
+
+ ViewManagerList aViewManagerList;
+ getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+ SUIT_ViewManager* aViewManager;
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
+ foreach( aViewManager, aViewManagerList ) {
+ if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
+ if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
+ aViewer->renameAll( anIO, qPrintable(name) );
+ }
+ }
+ QApplication::restoreOverrideCursor();
+ return true;
+ }
+ }
+ //Rename visual params
+ }
+ } else {
+ bool anIsExist;
+ QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+ if(anIsExist && "VIEW3D" == aVal) {
+ _PTR(GenericAttribute) anAttr;
+ if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+ _PTR(AttributeName) aName (anAttr);
+ if (!name.isEmpty()) {
+ aName->SetValue(qPrintable(name));
+ }
+ }
+ }
+ }
+ }
+ return false;
}