From 1fdc3fdbff995745a484521a55869486dd267fb6 Mon Sep 17 00:00:00 2001 From: ouv Date: Mon, 26 May 2014 13:31:14 +0400 Subject: [PATCH] GUITHARE issue 0002109: External 20696 2D 3D surfaces Linux compilation. --- adm_local/win32/Plot3d.vcproj | 24 ++ configure.ac | 12 + src/LightApp/LightApp.pro | 10 + src/LightApp/Makefile.am | 8 + src/Makefile.am | 7 +- src/Plot3d/Makefile.am | 22 +- src/Plot3d/Plot3d_Actor.cxx | 45 ++- src/Plot3d/Plot3d_Actor.h | 8 + src/Plot3d/Plot3d_SetupColorScaleDlg.cxx | 57 ++-- src/Plot3d/Plot3d_SetupColorScaleDlg.h | 20 +- src/Plot3d/Plot3d_SetupSurfacesDlg.cxx | 52 ++- src/Plot3d/Plot3d_SetupSurfacesDlg.h | 17 +- src/Plot3d/Plot3d_ViewWindow.cxx | 230 ++++++++++++- src/Plot3d/Plot3d_ViewWindow.h | 18 +- src/Plot3d/resources/Plot3d_images.ts | 12 +- src/Plot3d/resources/Plot3d_msg_en.ts | 36 +- .../resources/plot3d_merge_scalar_bars.png | Bin 0 -> 1120 bytes src/SVTK/Makefile.am | 17 +- src/SVTK/Plot3d_Actor.cxx | 317 ------------------ src/SVTK/Plot3d_Actor.h | 88 ----- src/SVTK/Plot3d_FitDataDlg.cxx | 286 ---------------- src/SVTK/Plot3d_FitDataDlg.h | 76 ----- src/SVTK/Plot3d_SetupSurfacesDlg.cxx | 223 ------------ src/SVTK/Plot3d_SetupSurfacesDlg.h | 77 ----- src/SVTK/Plot3d_ViewManager.cxx | 36 -- src/SVTK/Plot3d_ViewManager.h | 40 --- src/SVTK/Plot3d_ViewModel.cxx | 49 --- src/SVTK/Plot3d_ViewModel.h | 44 --- src/SVTK/SVTK_View.cxx | 31 +- src/SVTK/SVTK_View.h | 21 +- src/SVTK/SVTK_ViewWindow.cxx | 34 +- src/SVTK/SVTK_ViewWindow.h | 14 +- src/SVTK/resources/vtk_view_minus.png | Bin 173 -> 0 bytes 33 files changed, 555 insertions(+), 1376 deletions(-) create mode 100644 src/Plot3d/resources/plot3d_merge_scalar_bars.png delete mode 100644 src/SVTK/Plot3d_Actor.cxx delete mode 100644 src/SVTK/Plot3d_Actor.h delete mode 100644 src/SVTK/Plot3d_FitDataDlg.cxx delete mode 100644 src/SVTK/Plot3d_FitDataDlg.h delete mode 100644 src/SVTK/Plot3d_SetupSurfacesDlg.cxx delete mode 100644 src/SVTK/Plot3d_SetupSurfacesDlg.h delete mode 100644 src/SVTK/Plot3d_ViewManager.cxx delete mode 100644 src/SVTK/Plot3d_ViewManager.h delete mode 100644 src/SVTK/Plot3d_ViewModel.cxx delete mode 100644 src/SVTK/Plot3d_ViewModel.h delete mode 100644 src/SVTK/resources/vtk_view_minus.png diff --git a/adm_local/win32/Plot3d.vcproj b/adm_local/win32/Plot3d.vcproj index 9d6125e36..9f77799b0 100644 --- a/adm_local/win32/Plot3d.vcproj +++ b/adm_local/win32/Plot3d.vcproj @@ -233,6 +233,30 @@ /> + + + + + + + + diff --git a/configure.ac b/configure.ac index fcdb2018a..33d7b5b83 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,12 @@ else DISABLE_PLOT2DVIEWER="yes" fi +if test "x${enable_plot3dViewer}" != "xno" ; then + DISABLE_PLOT3DVIEWER="no" +else + DISABLE_PLOT3DVIEWER="yes" +fi + if test "x${enable_supervGraphViewer}" != "xno" ; then DISABLE_SUPERVGRAPHVIEWER="no" else @@ -457,6 +463,10 @@ if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then echo "failed : for full configuration of GUI module necessary enable Plot2dViewer !" exit fi + if test "x${DISABLE_PLOT3DVIEWER}" == "xyes" ; then + echo "failed : for full configuration of GUI module necessary enable Plot3dViewer !" + exit + fi if test "x${DISABLE_SUPERVGRAPHVIEWER}" == "xyes" ; then echo "failed : for full configuration of GUI module necessary enable SupervGraphViewer !" exit @@ -570,6 +580,7 @@ AM_CONDITIONAL(ENABLE_PYCONSOLE, [test "$DISABLE_PYCONSOLE" = no]) AM_CONDITIONAL(ENABLE_GLVIEWER, [test "$DISABLE_GLVIEWER" = no]) AM_CONDITIONAL(ENABLE_GRAPHICSVIEW, [test "$DISABLE_GRAPHICSVIEW" = no]) AM_CONDITIONAL(ENABLE_PLOT2DVIEWER, [test "$DISABLE_PLOT2DVIEWER" = no]) +AM_CONDITIONAL(ENABLE_PLOT3DVIEWER, [test "$DISABLE_PLOT3DVIEWER" = no]) AM_CONDITIONAL(ENABLE_SUPERVGRAPHVIEWER, [test "$DISABLE_SUPERVGRAPHVIEWER" = no]) AM_CONDITIONAL(ENABLE_OCCVIEWER, [test "$DISABLE_OCCVIEWER" = no]) AM_CONDITIONAL(ENABLE_VTKVIEWER, [test "$DISABLE_VTKVIEWER" = no]) @@ -631,6 +642,7 @@ AC_OUTPUT([ \ ./src/PyConsole/Makefile \ ./src/Plot2d/Makefile \ ./src/SPlot2d/Makefile \ + ./src/Plot3d/Makefile \ ./src/SUPERVGraph/Makefile \ ./src/QxGraph/Makefile \ ./src/LightApp/Makefile \ diff --git a/src/LightApp/LightApp.pro b/src/LightApp/LightApp.pro index 0af9b729d..4dff8a07d 100644 --- a/src/LightApp/LightApp.pro +++ b/src/LightApp/LightApp.pro @@ -35,6 +35,12 @@ INCLUDEPATH += $${PYTHON_INCLUDES} $${QT_INCLUDES} $${CAS_CPPFLAGS} $${HDF5_INCL # DEFINES += DISABLE_PLOT2DVIEWER #endif +#if ENABLE_PLOT3DVIEWER + INCLUDEPATH += ../Plot3d +#else +# DEFINES += DISABLE_PLOT3DVIEWER +#endif + #if ENABLE_OCCVIEWER INCLUDEPATH += ../OCCViewer #else !ENABLE_OCCVIEWER @@ -124,6 +130,10 @@ LIBS += $${QT_MT_LIBS} -L../../lib -lsuit -lstd -lCAM -lLogWindow $${CAS_KERNEL} #endif #endif +#if ENABLE_PLOT3DVIEWER + LIBS += -lPlot3d +#endif + #if ENABLE_PYCONSOLE LIBS += -lPyInterp -lPyConsole #endif diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index b2e6bae05..82c95d56b 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -178,6 +178,11 @@ if ENABLE_PLOT2DVIEWER else libLightApp_la_CPPFLAGS += -DDISABLE_PLOT2DVIEWER endif +if ENABLE_PLOT3DVIEWER + libLightApp_la_CPPFLAGS += -I$(srcdir)/../Plot3d +else + libLightApp_la_CPPFLAGS += -DDISABLE_PLOT3DVIEWER +endif if ENABLE_OCCVIEWER libLightApp_la_CPPFLAGS += -I$(srcdir)/../OCCViewer else !ENABLE_OCCVIEWER @@ -257,6 +262,9 @@ if ENABLE_SALOMEOBJECT libLightApp_la_LIBADD += ../SPlot2d/libSPlot2d.la endif endif +if ENABLE_PLOT3DVIEWER + libLightApp_la_LIBADD += ../Plot3d/libPlot3d.la +endif if ENABLE_PYCONSOLE libLightApp_la_LIBADD += ../PyInterp/libPyInterp.la ../PyConsole/libPyConsole.la endif diff --git a/src/Makefile.am b/src/Makefile.am index b51129760..a7644ff80 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,6 +59,11 @@ if ENABLE_SALOMEOBJECT SUBDIRS += SPlot2d endif endif +if ENABLE_PLOT3DVIEWER +if ENABLE_SALOMEOBJECT + SUBDIRS += Plot3d +endif +endif if ENABLE_SUPERVGRAPHVIEWER SUBDIRS += SUPERVGraph endif @@ -72,5 +77,5 @@ if GUI_ENABLE_CORBA endif DIST_SUBDIRS = CASCatch Qtx Style DDS QDS ObjBrowser SUIT SUITApp STD CAF CAM LogWindow Prs Event \ - OBJECT GLViewer GraphicsView VTKViewer SVTK OCCViewer SOCC PyInterp PyConsole Plot2d SPlot2d SUPERVGraph \ + OBJECT GLViewer GraphicsView VTKViewer SVTK OCCViewer SOCC PyInterp PyConsole Plot2d SPlot2d Plot3d SUPERVGraph \ QxGraph LightApp ResExporter TOOLSGUI Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT diff --git a/src/Plot3d/Makefile.am b/src/Plot3d/Makefile.am index 050291e1c..971aa095a 100644 --- a/src/Plot3d/Makefile.am +++ b/src/Plot3d/Makefile.am @@ -34,7 +34,8 @@ salomeinclude_HEADERS= \ Plot3d_SetupSpecificColorScaleDlg.h \ Plot3d_SetupSurfacesDlg.h \ Plot3d_ViewManager.h \ - Plot3d_ViewModel.h + Plot3d_ViewModel.h \ + Plot3d_ViewWindow.h dist_libPlot3d_la_SOURCES= \ Plot3d_Actor.cxx \ @@ -44,17 +45,21 @@ dist_libPlot3d_la_SOURCES= \ Plot3d_SetupSpecificColorScaleDlg.cxx \ Plot3d_SetupSurfacesDlg.cxx \ Plot3d_ViewManager.cxx \ - Plot3d_ViewModel.cxx + Plot3d_ViewModel.cxx \ + Plot3d_ViewWindow.cxx MOC_FILES= \ + Plot3d_FitDataDlg_moc.cxx \ Plot3d_SetupColorScaleDlg_moc.cxx \ Plot3d_SetupSpecificColorScaleDlg_moc.cxx \ Plot3d_SetupSurfacesDlg_moc.cxx \ Plot3d_ViewManager_moc.cxx \ - Plot3d_ViewModel_moc.cxx + Plot3d_ViewModel_moc.cxx \ + Plot3d_ViewWindow_moc.cxx nodist_libPlot3d_la_SOURCES= $(MOC_FILES) dist_salomeres_DATA=\ + resources/plot3d_merge_scalar_bars.png \ resources/plot3d_minus.png \ resources/plot3d_mode_2d.png \ resources/plot3d_surfaces_settings.png @@ -72,16 +77,13 @@ libPlot3d_la_CPPFLAGS = \ -I$(srcdir)/../SUIT \ -I$(srcdir)/../OBJECT \ -I$(srcdir)/../Prs \ - -I$(srcdir)/../VTKViewer + -I$(srcdir)/../VTKViewer \ + -I$(srcdir)/../SVTK libPlot3d_la_LDFLAGS = \ $(QT_MT_LIBS) \ - $(CAS_KERNEL) $(CAS_VIEWER) \ + $(CAS_KERNEL) $(CAS_VIEWER) -lTKCDF \ $(VTK_LIBS) $(OGL_LIBS) libPlot3d_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../OBJECT/libSalomeObject.la \ - ../Prs/libSalomePrs.la ../VTKViewer/libVTKViewer.la - -Plot3d_CPPFLAGS = $(libPlot3d_la_CPPFLAGS) -Plot3d_LDFLAGS = $(libPlot3d_la_LDFLAGS) -Plot3d_LDADD = libPlot3d.la $(libPlot3d_la_LIBADD) + ../Prs/libSalomePrs.la ../VTKViewer/libVTKViewer.la ../SVTK/libSVTK.la diff --git a/src/Plot3d/Plot3d_Actor.cxx b/src/Plot3d/Plot3d_Actor.cxx index d42f0cee7..047090a6c 100644 --- a/src/Plot3d/Plot3d_Actor.cxx +++ b/src/Plot3d/Plot3d_Actor.cxx @@ -44,6 +44,9 @@ Plot3d_Actor::Plot3d_Actor() { myColorDic = new Plot3d_ColorDic(); + myIsGlobalColorDic = false; + myGlobalColorDic = 0; + myIsDistance = false; myStartPoint = 0; @@ -181,6 +184,33 @@ Plot3d_ColorDic* Plot3d_Actor::GetColorDic() return myColorDic; } +//======================================================================= +//function : SetIsGlobalColorDic +//purpose : +//======================================================================= +void Plot3d_Actor::SetIsGlobalColorDic( const bool theIsGlobalColorDic ) +{ + myIsGlobalColorDic = theIsGlobalColorDic; +} + +//======================================================================= +//function : IsGlobalColorDic +//purpose : +//======================================================================= +bool Plot3d_Actor::IsGlobalColorDic() const +{ + return myIsGlobalColorDic; +} + +//============================================================================= +// Function : SetGlobalColorDic +// Purpose : +//============================================================================= +void Plot3d_Actor::SetGlobalColorDic( Plot3d_ColorDic* theColorDic ) +{ + myGlobalColorDic = theColorDic; +} + //============================================================================= // Function : GetScalarBarActor // Purpose : @@ -273,19 +303,20 @@ void Plot3d_Actor::Build( const int theNX, //============================================================================= void Plot3d_Actor::RecomputeLookupTable() { - if( !myColorDic ) + Plot3d_ColorDic* aColorDic = IsGlobalColorDic() && myGlobalColorDic ? myGlobalColorDic : myColorDic; + if( !aColorDic ) return; vtkPolyDataMapper* aMapper = dynamic_cast( GetMapper() ); if( !aMapper ) return; - double myMinimum = myColorDic->GetMin(); - double myMaximum = myColorDic->GetMax(); + double myMinimum = aColorDic->GetMin(); + double myMaximum = aColorDic->GetMax(); - int aScaleMode = (int)myColorDic->GetScaleMode(); + int aScaleMode = (int)aColorDic->GetScaleMode(); - int nbColors = myColorDic->GetNumber(); + int nbColors = aColorDic->GetNumber(); if ( aScaleMode == Plot3d_ColorDic::Specific ) { nbColors = 1000; @@ -303,7 +334,7 @@ void Plot3d_Actor::RecomputeLookupTable() double range[2] = { aMin, aMax }; double aHueMin, aHueMax, aSaturationMin, aSaturationMax, aValueMin, aValueMax; - myColorDic->GetHSVRange( aHueMin, aHueMax, aSaturationMin, aSaturationMax, aValueMin, aValueMax ); + aColorDic->GetHSVRange( aHueMin, aHueMax, aSaturationMin, aSaturationMax, aValueMin, aValueMax ); double range1[2] = { 0, 0 }; if ( aScaleMode == Plot3d_ColorDic::Linear || @@ -341,7 +372,7 @@ void Plot3d_Actor::RecomputeLookupTable() { if ( aScaleMode == Plot3d_ColorDic::Specific ) { - const Value2ColorList& aSpecificScale = myColorDic->GetSpecificScale(); + const Value2ColorList& aSpecificScale = aColorDic->GetSpecificScale(); if ( aSpecificScale.size() < 2 ) return; diff --git a/src/Plot3d/Plot3d_Actor.h b/src/Plot3d/Plot3d_Actor.h index 5d3899fa8..aab2b4c38 100644 --- a/src/Plot3d/Plot3d_Actor.h +++ b/src/Plot3d/Plot3d_Actor.h @@ -57,6 +57,11 @@ public: Plot3d_ColorDic* GetColorDic(); + void SetIsGlobalColorDic( const bool ); + bool IsGlobalColorDic() const; + + void SetGlobalColorDic( Plot3d_ColorDic* ); + vtkSmartPointer GetScalarBarActor() const; void DisplayScalarBar( const bool ); @@ -83,6 +88,9 @@ public: protected: Plot3d_ColorDic* myColorDic; + bool myIsGlobalColorDic; + Plot3d_ColorDic* myGlobalColorDic; + vtkLookupTable* myLookupTable; vtkSmartPointer myScalarBarActor; diff --git a/src/Plot3d/Plot3d_SetupColorScaleDlg.cxx b/src/Plot3d/Plot3d_SetupColorScaleDlg.cxx index 8421dab82..1dedd54b2 100644 --- a/src/Plot3d/Plot3d_SetupColorScaleDlg.cxx +++ b/src/Plot3d/Plot3d_SetupColorScaleDlg.cxx @@ -42,8 +42,10 @@ // Function : Plot3d_SetupColorScaleDlg // Purpose : Constructor //============================================================================= -Plot3d_SetupColorScaleDlg::Plot3d_SetupColorScaleDlg( QWidget* theParent ) -: QtxDialog( theParent, true, false, QtxDialog::OKCancel ) +Plot3d_SetupColorScaleDlg::Plot3d_SetupColorScaleDlg( QWidget* theParent, + bool theIsGlobal ) +: QtxDialog( theParent, true, false, QtxDialog::OKCancel ), + myIsGlobal( theIsGlobal ) { setWindowTitle( tr( "SETUP_COLOR_SCALE" ) ); @@ -144,6 +146,10 @@ Plot3d_SetupColorScaleDlg::Plot3d_SetupColorScaleDlg( QWidget* theParent ) connect( aScaleModeSpecific, SIGNAL( toggled( bool ) ), aScaleModeSpecificSetup, SLOT( setEnabled( bool ) ) ); connect( aScaleModeSpecificSetup, SIGNAL( clicked() ), this, SLOT( onColorScaleSpecificSetup() ) ); + aScaleModeSpecific->setVisible( !myIsGlobal ); + aScaleModeSpecificSetup->setVisible( !myIsGlobal ); + aRangeGroup->setVisible( !myIsGlobal ); + onColorModeChanged( 0 ); // Blue-Red by default setButtonPosition( Right, Cancel ); @@ -334,26 +340,35 @@ int Plot3d_SetupColorScaleDlg::checkScaleMode() bool isMaxIncorrect = aMax < 0 || fabs( aMax ) < Precision::Confusion(); if ( isMinIncorrect || isMaxIncorrect ) { - if ( SUIT_MessageBox::warning( this, tr( "WARNING" ), tr( "INCORRECT_RANGE" ), - tr( "CORRECT_RANGE" ), tr( "SWITCH_TO_LINEAR" ), 0, 1 ) == 0 ) - { // correct range - if ( isMinIncorrect ) - aMin = aCorrectValue; - - if ( isMaxIncorrect ) - aMax = aCorrectValue; - - bool minBlock = myMinLimit->blockSignals( true ); - bool maxBlock = myMaxLimit->blockSignals( true ); - - myMinLimit->setValue( aMin ); - myMaxLimit->setValue( aMax ); - - myMinLimit->blockSignals( minBlock ); - myMaxLimit->blockSignals( maxBlock ); - } - else // switch to linear mode + int anAnswer = 0; + if( myIsGlobal ) + { + SUIT_MessageBox::warning( this, tr( "WARNING" ), tr( "INCORRECT_RANGE" ) ); setColorScaleMode( Plot3d_ColorDic::Linear ); + } + else + { + if ( SUIT_MessageBox::warning( this, tr( "WARNING" ), tr( "INCORRECT_RANGE" ), + tr( "CORRECT_RANGE" ), tr( "SWITCH_TO_LINEAR" ), 0, 1 ) == 0 ) + { // correct range + if ( isMinIncorrect ) + aMin = aCorrectValue; + + if ( isMaxIncorrect ) + aMax = aCorrectValue; + + bool minBlock = myMinLimit->blockSignals( true ); + bool maxBlock = myMaxLimit->blockSignals( true ); + + myMinLimit->setValue( aMin ); + myMaxLimit->setValue( aMax ); + + myMinLimit->blockSignals( minBlock ); + myMaxLimit->blockSignals( maxBlock ); + } + else // switch to linear mode + setColorScaleMode( Plot3d_ColorDic::Linear ); + } } } return colorScaleMode(); diff --git a/src/Plot3d/Plot3d_SetupColorScaleDlg.h b/src/Plot3d/Plot3d_SetupColorScaleDlg.h index 3287c8790..defd2c966 100644 --- a/src/Plot3d/Plot3d_SetupColorScaleDlg.h +++ b/src/Plot3d/Plot3d_SetupColorScaleDlg.h @@ -48,6 +48,21 @@ struct ColorDicData TCollection_AsciiString Quantity; int ColorMode; QColor CustomColors[2]; + + ColorDicData() + { + Num = 99; + Min = 0; + Max = 1; + HueMin = 0.667; + HueMax = 0; + SaturationMin = 1; + SaturationMax = 1; + ValueMin = 1; + ValueMax = 1; + TimeStep = 0; + ColorMode = 0; + }; }; typedef QList < ColorDicData > ColorDicDataList; @@ -65,7 +80,8 @@ public: enum { BlueRed = 0, BlueWhite, Monochrome, Custom }; public: - Plot3d_SetupColorScaleDlg( QWidget* theParent = 0 ); + Plot3d_SetupColorScaleDlg( QWidget* theParent = 0, + bool theIsGlobal = false ); virtual ~Plot3d_SetupColorScaleDlg(); void setData( const ColorDicData& theColorDicData ); @@ -91,6 +107,8 @@ private: void updateMinMax(); private: + bool myIsGlobal; + QtxIntSpinBox* myInterval; QComboBox* myColorMode; diff --git a/src/Plot3d/Plot3d_SetupSurfacesDlg.cxx b/src/Plot3d/Plot3d_SetupSurfacesDlg.cxx index d703246f9..36c2ffb14 100644 --- a/src/Plot3d/Plot3d_SetupSurfacesDlg.cxx +++ b/src/Plot3d/Plot3d_SetupSurfacesDlg.cxx @@ -48,15 +48,16 @@ Plot3d_SetupSurfacesDlg::Plot3d_SetupSurfacesDlg( QWidget* theParent ) QVBoxLayout* aMainLay = new QVBoxLayout( aMainFrame ); aMainLay->setMargin( 5 ); - myGrp = new QtxGroupBox( aMainFrame ); - myGrp->setTitle( tr( "PARAMETERS" ) ); - aMainLay->addWidget( myGrp ); + QtxGroupBox* aParamGrp = new QtxGroupBox( aMainFrame ); + aParamGrp->setTitle( tr( "PARAMETERS" ) ); + aMainLay->addWidget( aParamGrp ); - QVBoxLayout* aLay = new QVBoxLayout( myGrp ); - aLay->setMargin( 0 ); + QVBoxLayout* aLay = new QVBoxLayout( aParamGrp ); + aLay->setMargin( 5 ); + aLay->setSpacing( 5 ); // Create table - myTable = new QTableWidget( myGrp ); + myTable = new QTableWidget( aParamGrp ); myTable->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); aLay->addWidget( myTable ); @@ -85,12 +86,18 @@ Plot3d_SetupSurfacesDlg::Plot3d_SetupSurfacesDlg( QWidget* theParent ) // Minus button QPixmap minusPix = aResMgr->loadPixmap( "VTKViewer", tr( "ICON_PLOT3D_MINUS" ) ); - myRemoveBtn = new QToolButton( 0 ); - myRemoveBtn->setIcon( minusPix ); - myRemoveBtn->setFixedSize( minusPix.size() ); - myGrp->insertTitleWidget( myRemoveBtn ); + QToolButton* aRemoveBtn = new QToolButton( 0 ); + aRemoveBtn->setIcon( minusPix ); + aRemoveBtn->setFixedSize( minusPix.size() ); + aParamGrp->insertTitleWidget( aRemoveBtn ); - connect( myRemoveBtn, SIGNAL( clicked() ), SLOT( onRemove() ) ); + connect( aRemoveBtn, SIGNAL( clicked() ), SLOT( onRemove() ) ); + + // "Edit global color scale" button + QPushButton* anEditGlobalBtn = new QPushButton( tr( "EDIT_GLOBAL_COLOR_SCALE" ), aParamGrp ); + aLay->addWidget( anEditGlobalBtn ); + + connect( anEditGlobalBtn, SIGNAL( clicked() ), SLOT( onGlobalColorScale() ) ); setButtonPosition( Right, Cancel ); setMinimumWidth( 300 ); @@ -128,7 +135,8 @@ void Plot3d_SetupSurfacesDlg::setText( const int theRow, // Purpose : //============================================================================= void Plot3d_SetupSurfacesDlg::SetParameters( const QStringList& theTexts, - const ColorDicDataList& theColorDicDataList ) + const ColorDicDataList& theColorDicDataList, + const ColorDicData& theGlobalColorDicData ) { int nbRows = theTexts.size(); @@ -147,6 +155,8 @@ void Plot3d_SetupSurfacesDlg::SetParameters( const QStringList& theTexts, myColorDicDataList = theColorDicDataList; + myGlobalColorDicData = theGlobalColorDicData; + myRemovedIndexes.clear(); } @@ -155,7 +165,8 @@ void Plot3d_SetupSurfacesDlg::SetParameters( const QStringList& theTexts, // Purpose : //============================================================================= void Plot3d_SetupSurfacesDlg::GetParameters( QStringList& theTexts, - ColorDicDataList& theColorDicDataList ) const + ColorDicDataList& theColorDicDataList, + ColorDicData& theGlobalColorDicData ) const { int nbRows = myTable->rowCount(); @@ -170,6 +181,8 @@ void Plot3d_SetupSurfacesDlg::GetParameters( QStringList& theTexts, } theColorDicDataList = myColorDicDataList; + + theGlobalColorDicData = myGlobalColorDicData; } //============================================================================= @@ -265,3 +278,16 @@ void Plot3d_SetupSurfacesDlg::onColorScaleBtn() myColorDicDataList[ aRow ] = aColorDicData; } } + +//============================================================================= +// Function : onGlobalColorScale +// Purpose : +//============================================================================= +void Plot3d_SetupSurfacesDlg::onGlobalColorScale() +{ + Plot3d_SetupColorScaleDlg aDlg( this, true ); + aDlg.setData( myGlobalColorDicData ); + + if( aDlg.exec() ) + myGlobalColorDicData = aDlg.getData(); +} diff --git a/src/Plot3d/Plot3d_SetupSurfacesDlg.h b/src/Plot3d/Plot3d_SetupSurfacesDlg.h index 5d9f53f0e..b70cacf9f 100644 --- a/src/Plot3d/Plot3d_SetupSurfacesDlg.h +++ b/src/Plot3d/Plot3d_SetupSurfacesDlg.h @@ -24,13 +24,10 @@ #include "Plot3d_SetupColorScaleDlg.h" #include -#include + #include -class QtxGroupBox; class QTableWidget; -class QwtLegend; -class QToolButton; /* Class : Plot3d_SetupSurfacesDlg @@ -45,27 +42,29 @@ public: virtual ~Plot3d_SetupSurfacesDlg(); void SetParameters( const QStringList& theTexts, - const ColorDicDataList& theColorDicDataList ); + const ColorDicDataList& theColorDicDataList, + const ColorDicData& theGlobalColorDicData ); + void GetParameters( QStringList& theTexts, - ColorDicDataList& theColorDicDataList ) const; + ColorDicDataList& theColorDicDataList, + ColorDicData& theGlobalColorDicData ) const; const QList< int >& GetRemovedIndexes() const; private slots: void onRemove(); void onColorScaleBtn(); + void onGlobalColorScale(); private: void setText( const int theRow, const int theCol, const QString& theText ); private: - - QtxGroupBox* myGrp; QTableWidget* myTable; - QToolButton* myRemoveBtn; ColorDicDataList myColorDicDataList; + ColorDicData myGlobalColorDicData; QList< int > myRemovedIndexes; }; diff --git a/src/Plot3d/Plot3d_ViewWindow.cxx b/src/Plot3d/Plot3d_ViewWindow.cxx index 8f1dfa466..6b8e7a02d 100644 --- a/src/Plot3d/Plot3d_ViewWindow.cxx +++ b/src/Plot3d/Plot3d_ViewWindow.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -42,9 +43,14 @@ #include #include +#include #include #include #include +#include +#include + +#include /*! Constructor @@ -54,6 +60,56 @@ Plot3d_ViewWindow::Plot3d_ViewWindow( SUIT_Desktop* theDesktop ): myMode2D( false ), myMode2DNormalAxis( AxisZ ) { + // Global scalar bar + myColorDic = new Plot3d_ColorDic(); + + myToDisplayScalarBar = false; + + myScalarBarActor = vtkScalarBarActor::New(); + myScalarBarActor->SetTitle( "All surfaces" ); + myScalarBarActor->SetVisibility( false ); + + // Title props + QColor aTextColor = Qt::white; + + vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New(); + aScalarBarTitleProp->SetColor( aTextColor.redF(), aTextColor.greenF(), aTextColor.blueF() ); + aScalarBarTitleProp->SetFontFamilyToArial(); + int aSize = 24; + aScalarBarTitleProp->SetFontSize( aSize ); + myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp ); + aScalarBarTitleProp->Delete(); + + // Label props + vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New(); + aScalarBarLabelProp->SetColor( aTextColor.redF(), aTextColor.greenF(), aTextColor.blueF() ); + aScalarBarLabelProp->SetFontFamilyToArial(); + myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp ); + aScalarBarLabelProp->Delete(); + + // Position + double aXPos = 0.01, aYPos = 0.1; + myScalarBarActor->SetPosition( aXPos, aYPos ); + + // Width + double aWidth = 0.10, aHeight = 0.80; + myScalarBarActor->SetWidth( aWidth ); + myScalarBarActor->SetHeight( aHeight ); + + // Number of labels and Maximum number of colors + myScalarBarActor->SetNumberOfLabels( 5 ); + myScalarBarActor->SetMaximumNumberOfColors( 99 ); + + // ScalarBar widget + myScalarBarWg = vtkScalarBarWidget::New(); + myScalarBarWg->SetScalarBarActor( myScalarBarActor.GetPointer() ); + + // Lookup table + myLookupTable = vtkLookupTable::New(); + myLookupTable->SetHueRange( 0.667, 0.0 ); + myLookupTable->ForceBuild(); + + myScalarBarActor->SetLookupTable( myLookupTable ); } /*! @@ -61,6 +117,15 @@ Plot3d_ViewWindow::Plot3d_ViewWindow( SUIT_Desktop* theDesktop ): */ Plot3d_ViewWindow::~Plot3d_ViewWindow() { + myScalarBarWg->EnabledOff(); + if( vtkRenderer* aRenderer = getRenderer() ) + aRenderer->RemoveActor( myScalarBarActor.GetPointer() ); + + if( myColorDic ) + { + delete myColorDic; + myColorDic = 0; + } } /*! @@ -71,6 +136,20 @@ void Plot3d_ViewWindow::Initialize( SVTK_ViewModelBase* theModel ) myPlot3dToolBar = toolMgr()->createToolBar( tr( "PLOT3D" ), -1, this ); SVTK_ViewWindow::Initialize( theModel ); + + // Initialize global scalar bar + if( vtkRenderWindow* aRenderWindow = getRenderWindow() ) + { + if( vtkRenderWindowInteractor* aRWI = aRenderWindow->GetInteractor() ) + { + myScalarBarWg->SetInteractor( aRWI ); + if( myToDisplayScalarBar ) + myScalarBarWg->EnabledOn(); + } + } + + if( vtkRenderer* aRenderer = getRenderer() ) + aRenderer->AddActor( myScalarBarActor.GetPointer() ); } /*! @@ -109,6 +188,14 @@ void Plot3d_ViewWindow::createActions( SUIT_ResourceMgr* theResourceMgr ) anAction->setStatusTip( tr( "DSC_PLOT3D_SURFACES_SETTINGS" ) ); connect( anAction, SIGNAL( activated() ), this, SLOT( onSurfacesSettings() ) ); mgr->registerAction( anAction, SurfacesSettingsId ); + + anAction = new QtxAction( tr( "MNU_PLOT3D_MERGE_SCALAR_BARS" ), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_PLOT3D_MERGE_SCALAR_BARS" ) ), + tr( "MNU_PLOT3D_MERGE_SCALAR_BARS" ), 0, this ); + anAction->setStatusTip( tr( "DSC_PLOT3D_MERGE_SCALAR_BARS" ) ); + anAction->setCheckable( true ); + connect( anAction, SIGNAL( toggled( bool ) ), this, SLOT( onMergeScalarBars( bool ) ) ); + mgr->registerAction( anAction, MergeScalarBarsId ); } /*! @@ -122,6 +209,7 @@ void Plot3d_ViewWindow::createToolBar() mgr->append( Mode2DId, myPlot3dToolBar ); mgr->append( SurfacesSettingsId, myPlot3dToolBar ); + mgr->append( MergeScalarBarsId, myPlot3dToolBar ); } /*! @@ -258,12 +346,11 @@ void Plot3d_ViewWindow::onSurfacesSettings() QList< Plot3d_Actor* > aSurfaces; QStringList aTexts; ColorDicDataList aColorDicDataList; - vtkActor* anActor = 0; VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() ); vtkActorCollection* aCollection = aCopy.GetActors(); aCollection->InitTraversal(); - while( anActor = aCollection->GetNextActor() ) + while( vtkActor* anActor = aCollection->GetNextActor() ) { if( Plot3d_Actor* aSurface = dynamic_cast( anActor ) ) { @@ -297,13 +384,27 @@ void Plot3d_ViewWindow::onSurfacesSettings() } } + ColorDicData aGlobalColorDicData; + if( myColorDic ) + { + aGlobalColorDicData.Num = myColorDic->GetNumber(); + aGlobalColorDicData.Min = myColorDic->GetMin(); // non-editable, just to check log scale + aGlobalColorDicData.Max = myColorDic->GetMax(); // non-editable, just to check log scale + myColorDic->GetHSVRange( aGlobalColorDicData.HueMin, aGlobalColorDicData.HueMax, + aGlobalColorDicData.SaturationMin, aGlobalColorDicData.SaturationMax, + aGlobalColorDicData.ValueMin, aGlobalColorDicData.ValueMax ); + aGlobalColorDicData.ScaleMode = myColorDic->GetScaleMode(); + aGlobalColorDicData.ColorMode = myColorDic->GetColorMode(); + myColorDic->GetCustomColors( aGlobalColorDicData.CustomColors[0], aGlobalColorDicData.CustomColors[1] ); + } + Plot3d_SetupSurfacesDlg aDlg( this ); - aDlg.SetParameters( aTexts, aColorDicDataList ); + aDlg.SetParameters( aTexts, aColorDicDataList, aGlobalColorDicData ); if ( aDlg.exec() != QDialog::Accepted ) return; - aDlg.GetParameters( aTexts, aColorDicDataList ); + aDlg.GetParameters( aTexts, aColorDicDataList, aGlobalColorDicData ); // Note: Indexes retrieved from dialog do not correspond to the real indexes of // plot 3d surfaces. They correspond to the user actions. For example, if user removes @@ -368,6 +469,19 @@ void Plot3d_ViewWindow::onSurfacesSettings() } } + if( myColorDic ) + { + myColorDic->SetNumber( aGlobalColorDicData.Num ); + myColorDic->SetHSVRange( aGlobalColorDicData.HueMin, aGlobalColorDicData.HueMax, + aGlobalColorDicData.SaturationMin, aGlobalColorDicData.SaturationMax, + aGlobalColorDicData.ValueMin, aGlobalColorDicData.ValueMax ); + myColorDic->SetScaleMode( aGlobalColorDicData.ScaleMode ); + myColorDic->SetColorMode( aGlobalColorDicData.ColorMode ); + myColorDic->SetCustomColors( aGlobalColorDicData.CustomColors[0], aGlobalColorDicData.CustomColors[1] ); + } + + UpdateScalarBar( false ); + vtkFloatingPointType aGlobalBounds[6] = { VTK_DOUBLE_MAX, VTK_DOUBLE_MIN, VTK_DOUBLE_MAX, VTK_DOUBLE_MIN, VTK_DOUBLE_MAX, VTK_DOUBLE_MIN }; @@ -400,10 +514,19 @@ void Plot3d_ViewWindow::onSurfacesSettings() aScale[0] = fabs( aDX ) > DBL_EPSILON ? 1.0 / aDX : 1.0; aScale[1] = fabs( aDY ) > DBL_EPSILON ? 1.0 / aDY : 1.0; aScale[2] = fabs( aDZ ) > DBL_EPSILON ? 1.0 / aDZ : 1.0; - SetScale( aScale ); + SetScale( aScale, false ); onFitAll(); } +/*! + Merge the scalar bars of all surfaces to a global scalar bar +*/ +void Plot3d_ViewWindow::onMergeScalarBars( bool theOn ) +{ + myToDisplayScalarBar = theOn; + UpdateScalarBar(); +} + /*! Fit 2D surfaces to the specified data range */ @@ -464,3 +587,100 @@ void Plot3d_ViewWindow::clearViewState( const bool theIs2D ) else myStored3DViewState.IsInitialized = false; } + +/*! + Get actor of the global scalar bar + \return actor of the global scalar bar +*/ +vtkSmartPointer Plot3d_ViewWindow::GetScalarBarActor() const +{ + return myScalarBarActor; +} + +/*! + Update representation of the global scalar bar + \param theIsRepaint flag used to repaint the view +*/ +void Plot3d_ViewWindow::UpdateScalarBar( const bool theIsRepaint ) +{ + vtkRenderer* aRenderer = getRenderer(); + if( !aRenderer ) + return; + + QList< Plot3d_Actor* > aSurfaces; + + double aMin = VTK_DOUBLE_MAX; + double aMax = VTK_DOUBLE_MIN; + + VTK::ActorCollectionCopy aCopy( aRenderer->GetActors() ); + vtkActorCollection* aCollection = aCopy.GetActors(); + aCollection->InitTraversal(); + while( vtkActor* anActor = aCollection->GetNextActor() ) + { + if( Plot3d_Actor* aSurface = dynamic_cast( anActor ) ) + { + if( aSurface->GetVisibility() ) + { + if( Plot3d_ColorDic* aColorDic = aSurface->GetColorDic() ) + { + aSurfaces << aSurface; + aMin = qMin( aMin, aColorDic->GetMin() ); + aMax = qMax( aMax, aColorDic->GetMax() ); + } + } + } + } + + bool anIsDisplayedSurfaces = !aSurfaces.isEmpty(); + if( anIsDisplayedSurfaces ) + { + // check the range and reset the scale mode to linear if necessary + if( myColorDic->GetScaleMode() == Plot3d_ColorDic::Logarithmic ) + { + bool isMinIncorrect = aMin < 0 || fabs( aMin ) < Precision::Confusion(); + bool isMaxIncorrect = aMax < 0 || fabs( aMax ) < Precision::Confusion(); + if( isMinIncorrect || isMaxIncorrect ) + { + SUIT_MessageBox::warning( this, tr( "WARNING" ), tr( "INCORRECT_RANGE" ) ); + myColorDic->SetScaleMode( Plot3d_ColorDic::Linear ); + myLookupTable->SetScale( (int)myColorDic->GetScaleMode() ); + } + } + + myColorDic->SetRange( aMin, aMax ); + + myLookupTable->SetRange( aMin, aMax ); + + myLookupTable->SetNumberOfTableValues( myColorDic->GetNumber() ); + + double aHueMin, aHueMax, aSaturationMin, aSaturationMax, aValueMin, aValueMax; + myColorDic->GetHSVRange( aHueMin, aHueMax, aSaturationMin, aSaturationMax, aValueMin, aValueMax ); + myLookupTable->SetHueRange( aHueMin, aHueMax ); + myLookupTable->SetSaturationRange( aSaturationMin, aSaturationMax ); + myLookupTable->SetValueRange( aValueMin, aValueMax ); + + myLookupTable->SetScale( (int)myColorDic->GetScaleMode() ); + myLookupTable->ForceBuild(); + } + + bool anIsDisplayScalarBar = myToDisplayScalarBar && anIsDisplayedSurfaces; + + myScalarBarActor->SetVisibility( anIsDisplayScalarBar ); + myScalarBarWg->SetEnabled( anIsDisplayScalarBar ); + + QListIterator< Plot3d_Actor* > aSurfaceIter( aSurfaces ); + while( aSurfaceIter.hasNext() ) + { + if( Plot3d_Actor* aSurface = aSurfaceIter.next() ) + { + aSurface->SetIsGlobalColorDic( myToDisplayScalarBar ); + aSurface->SetGlobalColorDic( myColorDic ); + + aSurface->RecomputeLookupTable(); + aSurface->DisplayScalarBar( !anIsDisplayScalarBar ); + } + } + + if( theIsRepaint ) + Repaint(); +} diff --git a/src/Plot3d/Plot3d_ViewWindow.h b/src/Plot3d/Plot3d_ViewWindow.h index 61c8d4d7a..d55b4c408 100644 --- a/src/Plot3d/Plot3d_ViewWindow.h +++ b/src/Plot3d/Plot3d_ViewWindow.h @@ -23,13 +23,19 @@ #include +class vtkLookupTable; +class vtkScalarBarActor; +class vtkScalarBarWidget; + +class Plot3d_ColorDic; + class PLOT3D_EXPORT Plot3d_ViewWindow : public SVTK_ViewWindow { Q_OBJECT public: enum { FirstId = SVTK_ViewWindow::LastId, - Mode2DId, SurfacesSettingsId, + Mode2DId, SurfacesSettingsId, MergeScalarBarsId, LastId }; enum Axis { AxisX = 0, AxisY, AxisZ }; @@ -48,9 +54,13 @@ public: void clearViewState( const bool theIs2D ); + vtkSmartPointer GetScalarBarActor() const; + void UpdateScalarBar( const bool theIsRepaint = true ); + public slots: void onMode2D( bool theOn ); void onSurfacesSettings(); + void onMergeScalarBars( bool theOn ); void onFitData(); protected: @@ -83,6 +93,12 @@ protected: int myMode2DNormalAxis; ViewState myStored2DViewState; ViewState myStored3DViewState; + + Plot3d_ColorDic* myColorDic; + vtkSmartPointer myLookupTable; + vtkSmartPointer myScalarBarActor; + vtkSmartPointer myScalarBarWg; + bool myToDisplayScalarBar; }; #endif diff --git a/src/Plot3d/resources/Plot3d_images.ts b/src/Plot3d/resources/Plot3d_images.ts index 09fa563fa..80a805147 100644 --- a/src/Plot3d/resources/Plot3d_images.ts +++ b/src/Plot3d/resources/Plot3d_images.ts @@ -2,16 +2,20 @@ @default - ICON_PLOT3D_SURFACES_SETTINGS - plot3d_surfaces_settings.png + ICON_PLOT3D_MERGE_SCALAR_BARS + plot3d_merge_scalar_bars.png + + + ICON_PLOT3D_MINUS + plot3d_minus.png ICON_PLOT3D_MODE_2D plot3d_mode_2d.png - ICON_PLOT3D_MINUS - plot3d_minus.png + ICON_PLOT3D_SURFACES_SETTINGS + plot3d_surfaces_settings.png diff --git a/src/Plot3d/resources/Plot3d_msg_en.ts b/src/Plot3d/resources/Plot3d_msg_en.ts index 8ab341b40..3cc3c51fd 100644 --- a/src/Plot3d/resources/Plot3d_msg_en.ts +++ b/src/Plot3d/resources/Plot3d_msg_en.ts @@ -6,6 +6,18 @@ ERROR Error + + INCORRECT_RANGE + Logarithmic scale could not be used when the +minimum value of the range is less or equal zero. +The scale has been switched to linear. + + + INCORRECT_RANGE_WITH_QUESTION + Logarithmic scale could not be used when the +minimum value of the range is less or equal zero. +Correct the range or switch to linear scale? + WARNING Warning @@ -80,12 +92,6 @@ CUSTOM Custom - - INCORRECT_RANGE - Logarithmic scale could not be used when the -minimum value of the range is less or equal zero. -Correct the range or switch to linear scale? - LINEAR Linear @@ -200,14 +206,12 @@ Correct the range or switch to linear scale? WRN_INCORRECT_RANGE_MIN_MAX The minimum value of the range should not be greater -or equal the maximum value. - +or equal the maximum value. WRN_INCORRECT_RANGE_LOGARITHMIC The minimum value of the range should not be less -or equal zero in case of logarithmic interpolation. - +or equal zero in case of logarithmic interpolation. WRN_INCONSISTENT_VALUES @@ -228,6 +232,10 @@ or equal zero in case of logarithmic interpolation. EDIT Edit + + EDIT_GLOBAL_COLOR_SCALE + Edit global color scale + PARAMETERS Parameters @@ -250,6 +258,10 @@ or equal zero in case of logarithmic interpolation. Plot3d_ViewWindow + + DSC_PLOT3D_MERGE_SCALAR_BARS + Merge scalar bars + DSC_PLOT3D_MODE_2D Toggle 2D mode @@ -262,6 +274,10 @@ or equal zero in case of logarithmic interpolation. FIT_RANGE Fit range + + MNU_PLOT3D_MERGE_SCALAR_BARS + Merge scalar bars + MNU_PLOT3D_MODE_2D Toggle 2D mode diff --git a/src/Plot3d/resources/plot3d_merge_scalar_bars.png b/src/Plot3d/resources/plot3d_merge_scalar_bars.png new file mode 100644 index 0000000000000000000000000000000000000000..083740f513d9df733e64f0b9f593e981bd53283b GIT binary patch literal 1120 zcmV-m1fTnfP)o35G6tuP3xeGEO9P zJlfhqtJT8B#s-d#j&OE%MvWjqb2!A|aDbze6O6}WxhcJC`&f&`@GB8sF$6z2ZX?R; z%el55k7M6)VCp)Yav5Jgc!1FIO++;f(XfW)l@(a&G<@F&mDpk0G;zA5V#pBOVa+xz z3^*40UH)^vR>!wreTjU%jyP}d3vcAj@tSe-(?#T(O;FkCB5CNTXGucvayfv`EvUX_ zZI58tHgdTN?wUHX)hh0No`FvapneP}3+R!GcqD=XS4O2$7p9Rww@VU&mr4QmFNx!0 zLJ+WK8YmR%c=7#HcIwKw5+Y1LQyB^x%wyqI6g@84aRL~eB-bPf!OP_yl8Gd;4Z=a2 z5RGVPH2OF{|ASn&$NdfCkljy53f_-ZG`Nb`S{TJ5JM6H-1edbpD-wctc#{N|yyPiZ zX3aDV)Cw+sc(H?g-i2)&eCpzss1ltH;nvzJ|Hcjj@iDt1k0b;SxQ7XLNUfQcvQntz zsz~26klW`qmBO0}VLVkaey?D!A#TUqVYk$QZYH4kAql|)J}BW(@mTW~VOusQtiZl+ zqbd{H2)Tp^78oC4sih#y4!weO=&&mT)ZCX4yvKJ<^pF~RQZoz_^+FL(e|io#Ux#H` zAWles&v8Tuv%_}L7Y+}&ZzhOe2R|FhgHlPJGIcwk(;>8I6n(dWKmVFguO1*A)u6N% z*I|*tx3&btzIbL$?h&(UQOY!`Ww{g7|Q$K zxsoh9Tw{ktVXDOUDh+jMAR%}^aA27>$0txj17tE8)G9fcnJ>79S=jt?h~M;$`8iXk z!w%Qr=kp-H{SMJ+jK{<)3BlXP2Z+U@9KV#>?c2BDI9XVk`>5vjIbjO)rh*&eDO3jS zHTY0sGl%_NAKP1xVW$jhjEMHXRAUFE6h?&;lM+lk*7;1|yuDxcpM$P^gauzS{zVM -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -vtkStandardNewMacro(Plot3d_Actor); - -//============================================================================= -// Function : Plot3d_Actor -// Purpose : Constructor -//============================================================================= -Plot3d_Actor::Plot3d_Actor() -{ - myIsDistance = false; - - myStartPoint = 0; - myEndPoint = 0; - - // Scalar bar - myToDisplayScalarBar = false; - - myScalarBarActor = vtkScalarBarActor::New(); - myScalarBarActor->SetVisibility( false ); - - // Title props - QColor aTextColor = Qt::white; - - vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New(); - aScalarBarTitleProp->SetColor( aTextColor.redF(), aTextColor.greenF(), aTextColor.blueF() ); - aScalarBarTitleProp->SetFontFamilyToArial(); - int aSize = 24; - aScalarBarTitleProp->SetFontSize( aSize ); - myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp ); - aScalarBarTitleProp->Delete(); - - // Label props - vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New(); - aScalarBarLabelProp->SetColor( aTextColor.redF(), aTextColor.greenF(), aTextColor.blueF() ); - aScalarBarLabelProp->SetFontFamilyToArial(); - myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp ); - aScalarBarLabelProp->Delete(); - - // Position - double aXPos = 0.01, aYPos = 0.1; - myScalarBarActor->SetPosition( aXPos, aYPos ); - - // Width - double aWidth = 0.10, aHeight = 0.80; - myScalarBarActor->SetWidth( aWidth ); - myScalarBarActor->SetHeight( aHeight ); - - // Number of labels and Maximum number of colors - myScalarBarActor->SetNumberOfLabels( 5 ); - myScalarBarActor->SetMaximumNumberOfColors( 99 ); - - // ScalarBar widget - myScalarBarWg = vtkScalarBarWidget::New(); - myScalarBarWg->SetScalarBarActor( myScalarBarActor.GetPointer() ); - - // Property - this->GetProperty()->ShadingOff(); - this->GetProperty()->LightingOff(); -} - -//============================================================================= -// Function : ~Plot3d_Actor -// Purpose : Destructor -//============================================================================= -Plot3d_Actor::~Plot3d_Actor() -{ -} - -//============================================================================= -// Function : SetVisibility -// Purpose : -//============================================================================= -void Plot3d_Actor::SetVisibility( int theVisibility ) -{ - Superclass::SetVisibility( theVisibility ); - - myScalarBarActor->SetVisibility( GetVisibility() && myToDisplayScalarBar ); - - if ( !theVisibility || !myScalarBarActor->GetLookupTable() || !myToDisplayScalarBar ) - myScalarBarWg->EnabledOff(); - else - myScalarBarWg->EnabledOn(); -} - -//============================================================================= -// Function : SetMapper -// Purpose : -//============================================================================= -void Plot3d_Actor::SetMapper( vtkMapper* theMapper ) -{ - Superclass::SetMapper(theMapper); -} - -//============================================================================= -// Function : AddToRender -// Purpose : -//============================================================================= -void Plot3d_Actor::AddToRender( vtkRenderer* theRenderer ) -{ - Superclass::AddToRender( theRenderer ); - - if ( vtkRenderWindow *win = theRenderer->GetRenderWindow() ) - { - if ( vtkRenderWindowInteractor *interactor = win->GetInteractor() ) - { - myScalarBarWg->SetInteractor( interactor ); - if ( myToDisplayScalarBar ) - myScalarBarWg->EnabledOn(); - } - } - - theRenderer->AddActor( myScalarBarActor.GetPointer() ); -} - -//============================================================================= -// Function : RemoveFromRender -// Purpose : -//============================================================================= -void Plot3d_Actor::RemoveFromRender( vtkRenderer* theRenderer ) -{ - myScalarBarWg->EnabledOff(); - theRenderer->RemoveActor( myScalarBarActor.GetPointer() ); - - Superclass::RemoveFromRender( theRenderer ); -} - -//============================================================================= -// Function : GetScalarBarActor -// Purpose : -//============================================================================= -vtkSmartPointer Plot3d_Actor::GetScalarBarActor() const -{ - return myScalarBarActor; -} - -//============================================================================= -// Function : DisplayScalarBar -// Purpose : -//============================================================================= -void Plot3d_Actor::DisplayScalarBar( const bool theToDisplay ) -{ - myToDisplayScalarBar = theToDisplay; - myScalarBarActor->SetVisibility( GetVisibility() && theToDisplay ); - myScalarBarWg->SetEnabled( GetVisibility() && theToDisplay ? 1 : 0 ); -} - -//============================================================================= -// Function : Build -// Purpose : -//============================================================================= -void Plot3d_Actor::Build( const int theNX, - const int theNY, - const QList& thePntList, - const QList& theValueList, - const double theMinValue, - const double theMaxValue ) -{ - vtkPolyData* aPointSet = vtkPolyData::New(); - aPointSet->Allocate( ( theNX - 1 ) * ( theNY - 1 ) ); - - vtkPoints* aPoints = vtkPoints::New(); - QListIterator aPntIter( thePntList ); - while( aPntIter.hasNext() ) - { - const QPointF& aPnt = aPntIter.next(); - aPoints->InsertNextPoint( aPnt.x(), aPnt.y(), 0 ); - } - aPointSet->SetPoints( aPoints ); - - vtkIdType pts[ 4 ]; - for( int i = 0; i < theNX - 1; i++ ) - { - for( int j = 0; j < theNY - 1; j++ ) - { - pts[0] = j + theNY * i; - pts[1] = j + theNY * i + 1; - pts[2] = j + theNY * ( i + 1 ) + 1; - pts[3] = j + theNY * ( i + 1 ); - aPointSet->InsertNextCell( VTK_QUAD, 4, pts ); - } - } - - vtkFloatArray* aFloatArray = vtkFloatArray::New(); - QListIterator aValueIter( theValueList ); - while( aValueIter.hasNext() ) - { - const double aValue = aValueIter.next(); - aFloatArray->InsertNextTuple1( aValue ); - } - - vtkPointData* aPointData = aPointSet->GetPointData(); - aPointData->SetScalars( aFloatArray ); - - vtkWarpScalar* aWarpScalar = vtkWarpScalar::New(); - aWarpScalar->SetInput( aPointSet ); - aWarpScalar->SetScaleFactor( 1 ); - - vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New(); - aMapper->SetInput( aWarpScalar->GetPolyDataOutput() ); - aMapper->SetScalarRange( theMinValue, theMaxValue ); - - SetMapper( aMapper ); - - vtkLookupTable* aLookupTable = vtkLookupTable::New(); - aLookupTable->SetHueRange( 0.66667, 0.0 ); - - aMapper->SetLookupTable( aLookupTable ); - myScalarBarActor->SetLookupTable( aLookupTable ); - - aPoints->Delete(); - aFloatArray->Delete(); - aPointSet->Delete(); -} - -//============================================================================= -// Function : SetUnits -// Purpose : -//============================================================================= -void Plot3d_Actor::SetUnits( const QString& theUnits ) -{ - myUnits = theUnits; -} - -//============================================================================= -// Function : GetUnits -// Purpose : -//============================================================================= -QString Plot3d_Actor::GetUnits() const -{ - return myUnits; -} - -//============================================================================= -// Function : SetIsDistance -// Purpose : -//============================================================================= -void Plot3d_Actor::SetIsDistance( const bool theIsDistance ) -{ - myIsDistance = theIsDistance; -} - -//============================================================================= -// Function : GetIsDistance -// Purpose : -//============================================================================= -bool Plot3d_Actor::GetIsDistance() const -{ - return myIsDistance; -} - -//============================================================================= -// Function : SetBoundaryPoints -// Purpose : -//============================================================================= -void Plot3d_Actor::SetBoundaryPoints( const int theStartPoint, - const int theEndPoint ) -{ - myStartPoint = theStartPoint; - myEndPoint = theEndPoint; -} - -//============================================================================= -// Function : GetBoundaryPoints -// Purpose : -//============================================================================= -void Plot3d_Actor::GetBoundaryPoints( int& theStartPoint, - int& theEndPoint ) -{ - theStartPoint = myStartPoint; - theEndPoint = myEndPoint; -} - -//============================================================================= -// Function : SetTextColor -// Purpose : -//============================================================================= -void Plot3d_Actor::SetTextColor( const QColor& theColor ) -{ - vtkTextProperty* aScalarBarTitleProp = myScalarBarActor->GetTitleTextProperty(); - aScalarBarTitleProp->SetColor( theColor.redF(), theColor.greenF(), theColor.blueF() ); - - vtkTextProperty* aScalarBarLabelProp = myScalarBarActor->GetLabelTextProperty(); - aScalarBarLabelProp->SetColor( theColor.redF(), theColor.greenF(), theColor.blueF() ); -} diff --git a/src/SVTK/Plot3d_Actor.h b/src/SVTK/Plot3d_Actor.h deleted file mode 100644 index d53d29284..000000000 --- a/src/SVTK/Plot3d_Actor.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -#ifndef PLOT3D_ACTOR_H -#define PLOT3D_ACTOR_H - -#include "SVTK.h" - -#include "SALOME_Actor.h" - -#include -#include -#include -#include - -class vtkScalarBarActor; -class vtkScalarBarWidget; - -/* - Class : Plot3d_Actor - Descrtiption : Class for presentation of the Plot3d graph -*/ - -class SVTK_EXPORT Plot3d_Actor : public SALOME_Actor -{ -public: - static Plot3d_Actor* New(); - vtkTypeMacro( Plot3d_Actor, SALOME_Actor ); - - Plot3d_Actor(); - virtual ~Plot3d_Actor(); - - virtual void AddToRender( vtkRenderer* theRender ); - virtual void RemoveFromRender(vtkRenderer* theRendere); - - virtual void SetVisibility( int ); - - virtual void SetMapper( vtkMapper* theMapper ); - - vtkSmartPointer GetScalarBarActor() const; - void DisplayScalarBar( const bool ); - - void Build( const int theNX, - const int theNY, - const QList& thePntList, - const QList& theValueList, - const double theMinValue, - const double theMaxValue ); - - void SetUnits( const QString& ); - QString GetUnits() const; - - void SetIsDistance( const bool ); - bool GetIsDistance() const; - - void SetBoundaryPoints( const int, const int ); - void GetBoundaryPoints( int&, int& ); - - void SetTextColor( const QColor& theColor ); - -protected: - vtkSmartPointer myScalarBarActor; - vtkSmartPointer myScalarBarWg; - bool myToDisplayScalarBar; - - QString myUnits; - bool myIsDistance; - - int myStartPoint; - int myEndPoint; -}; - -#endif diff --git a/src/SVTK/Plot3d_FitDataDlg.cxx b/src/SVTK/Plot3d_FitDataDlg.cxx deleted file mode 100644 index 44db9e460..000000000 --- a/src/SVTK/Plot3d_FitDataDlg.cxx +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -// File : Plot3d_FitDataDlg.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "Plot3d_FitDataDlg.h" - -#include -#include -#include -#include -#include -#include -#include - -#define SPACING_SIZE 6 -#define MARGIN_SIZE 11 -#define MIN_EDIT_SIZE 100 - -/*! - Constructor -*/ -Plot3d_FitDataDlg::Plot3d_FitDataDlg( QWidget* parent, bool secondAxisY ) - : QDialog( parent ? parent : 0, - Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY ) -{ - setObjectName( "Plot3d_FitDataDlg" ); - setModal( true ); - setWindowTitle( tr( "FIT_DATA_TLT" ) ); - setSizeGripEnabled( TRUE ); - QGridLayout* topLayout = new QGridLayout( this ); - topLayout->setSpacing( SPACING_SIZE ); - topLayout->setMargin( MARGIN_SIZE ); - - // 'Range' group - myRangeGrp = new QGroupBox( this ); - QGridLayout* aGridLayout = new QGridLayout( myRangeGrp ); - myRangeGrp->setLayout( aGridLayout ); - aGridLayout->setAlignment( Qt::AlignTop ); - aGridLayout->setMargin( MARGIN_SIZE ); - aGridLayout->setSpacing( SPACING_SIZE ); - - myModeAllRB = new QRadioButton( tr( "FIT_ALL" ), myRangeGrp ); - myModeHorRB = new QRadioButton( tr( "FIT_HORIZONTAL" ), myRangeGrp ); - myModeVerRB = new QRadioButton( tr( "FIT_VERTICAL" ), myRangeGrp ); - - QDoubleValidator* aValidator = new QDoubleValidator( this ); - myXMinEdit = new QLineEdit( myRangeGrp ); - myXMinEdit->setValidator( aValidator ); - myXMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myXMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myXMinEdit->setText( "0.0" ); - - myYMinEdit = new QLineEdit( myRangeGrp ); - myYMinEdit->setValidator( aValidator ); - myYMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myYMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myYMinEdit->setText( "0.0" ); - - myXMaxEdit = new QLineEdit( myRangeGrp ); - myXMaxEdit->setValidator( aValidator ); - myXMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myXMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myXMaxEdit->setText( "0.0" ); - - myYMaxEdit = new QLineEdit( myRangeGrp ); - myYMaxEdit->setValidator( aValidator ); - myYMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myYMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myYMaxEdit->setText( "0.0" ); - - if (mySecondAxisY) { - myY2MinEdit = new QLineEdit( myRangeGrp ); - myY2MinEdit->setValidator( aValidator ); - myY2MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myY2MinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myY2MinEdit->setText( "0.0" ); - - myY2MaxEdit = new QLineEdit( myRangeGrp ); - myY2MaxEdit->setValidator( aValidator ); - myY2MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myY2MaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myY2MaxEdit->setText( "0.0" ); - } - - QFrame* aHLine = new QFrame( myRangeGrp ); - aHLine->setFrameStyle( QFrame::HLine | QFrame::Sunken ); - - QHBoxLayout* aModeLayout = new QHBoxLayout; - aModeLayout->setMargin( 0 ); - aModeLayout->setSpacing( SPACING_SIZE ); - aModeLayout->addWidget( myModeAllRB ); - aModeLayout->addWidget( myModeHorRB ); - aModeLayout->addWidget( myModeVerRB ); - - QLabel* horLab = new QLabel( tr( "HORIZONTAL_AXIS" ), myRangeGrp ); - QLabel* verLab = new QLabel( tr( "VERTICAL_AXIS" ), myRangeGrp ); - if (mySecondAxisY) - verLab->setText( tr( "VERTICAL_LEFT_AXIS" ) ); - - QFont font = horLab->font(); font.setBold( true ); - horLab->setFont( font ); verLab->setFont( font ); - - aGridLayout->addLayout( aModeLayout, 0, 0, 1, 5 ); - aGridLayout->addWidget( aHLine, 1, 0, 1, 5 ); - aGridLayout->addWidget( horLab, 2, 0 ); - aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ), - 2, 1 ); - aGridLayout->addWidget( myXMinEdit, 2, 2 ); - aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ), - 2, 3 ); - aGridLayout->addWidget( myXMaxEdit, 2, 4 ); - aGridLayout->addWidget( verLab, 3, 0 ); - aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ), - 3, 1 ); - aGridLayout->addWidget( myYMinEdit, 3, 2 ); - aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ), - 3, 3 ); - aGridLayout->addWidget( myYMaxEdit, 3, 4 ); - - if (mySecondAxisY) { - QLabel* ver2Lab = new QLabel(tr( "VERTICAL_RIGHT_AXIS" ), myRangeGrp ); - ver2Lab->setFont( font ); - aGridLayout->addWidget( ver2Lab, 4, 0 ); - aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ), - 4, 1 ); - aGridLayout->addWidget( myY2MinEdit, 4, 2 ); - aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ), - 4, 3 ); - aGridLayout->addWidget( myY2MaxEdit, 4, 4 ); - } - - // OK/Cancel buttons - myOkBtn = new QPushButton( tr( "BUT_OK" ), this ); - myOkBtn->setObjectName( "buttonOk" ); - myOkBtn->setAutoDefault( TRUE ); - myOkBtn->setDefault( TRUE ); - myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this ); - myCancelBtn->setObjectName( "buttonCancel" ); - myCancelBtn->setAutoDefault( TRUE ); - - topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 ); - topLayout->addWidget( myOkBtn, 1, 0 ); - topLayout->setColumnStretch( 1, 5 ); - topLayout->addWidget( myCancelBtn, 1, 2 ); - - // connect signals - connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( myRangeGrp, SIGNAL( clicked( int ) ), this, SLOT( onModeChanged( int ) ) ); - - // initial state - myModeAllRB->setChecked( true ); - onModeChanged( 0 ); -} - -/*! - Sets range -*/ -void Plot3d_FitDataDlg::setRange( const double xMin, - const double xMax, - const double yMin, - const double yMax, - const double y2Min, - const double y2Max) -{ - myXMinEdit->setText( QString::number( xMin ) ); - myXMaxEdit->setText( QString::number( xMax ) ); - myYMinEdit->setText( QString::number( yMin ) ); - myYMaxEdit->setText( QString::number( yMax ) ); - if (mySecondAxisY) { - myY2MinEdit->setText( QString::number( y2Min ) ); - myY2MaxEdit->setText( QString::number( y2Max ) ); - } -} - -/*! - Gets range, returns mode (see getMode()) -*/ -int Plot3d_FitDataDlg::getRange( double& xMin, - double& xMax, - double& yMin, - double& yMax, - double& y2Min, - double& y2Max) -{ - xMin = myXMinEdit->text().toDouble(); - xMax = myXMaxEdit->text().toDouble(); - yMin = myYMinEdit->text().toDouble(); - yMax = myYMaxEdit->text().toDouble(); - if (mySecondAxisY) { - y2Min = myY2MinEdit->text().toDouble(); - y2Max = myY2MaxEdit->text().toDouble(); - } - else { - y2Min = 0; - y2Max = 0; - } - int myMode = 0; - if ( myModeAllRB->isChecked() ) - myMode = 0; - if ( myModeHorRB->isChecked() ) - myMode = 1; - if ( myModeVerRB->isChecked() ) - myMode = 2; - return myMode; -} - -/*! - Gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical -*/ -int Plot3d_FitDataDlg::getMode() -{ - int myMode = 0; - if ( myModeAllRB->isChecked() ) - myMode = 0; - if ( myModeHorRB->isChecked() ) - myMode = 1; - if ( myModeVerRB->isChecked() ) - myMode = 2; - return myMode; -} - -/*! - Called when range mode changed -*/ -void Plot3d_FitDataDlg::onModeChanged(int mode) -{ - bool badFocus; - switch( mode ) { - case 0: // fit all mode - myXMinEdit->setEnabled(true); - myXMaxEdit->setEnabled(true); - myYMinEdit->setEnabled(true); - myYMaxEdit->setEnabled(true); - if (mySecondAxisY) { - myY2MinEdit->setEnabled(true); - myY2MaxEdit->setEnabled(true); - } - break; - case 1: // fit horizontal mode - badFocus = myYMinEdit->hasFocus() || myYMaxEdit->hasFocus(); - myXMinEdit->setEnabled(true); - myXMaxEdit->setEnabled(true); - myYMinEdit->setEnabled(false); - myYMaxEdit->setEnabled(false); - if (mySecondAxisY) { - myY2MinEdit->setEnabled(false); - myY2MaxEdit->setEnabled(false); - } - if (badFocus) - myXMinEdit->setFocus(); - break; - case 2: // fit vertical mode - badFocus = myXMinEdit->hasFocus() || myXMaxEdit->hasFocus(); - myXMinEdit->setEnabled(false); - myXMaxEdit->setEnabled(false); - myYMinEdit->setEnabled(true); - myYMaxEdit->setEnabled(true); - if (mySecondAxisY) { - myY2MinEdit->setEnabled(true); - myY2MaxEdit->setEnabled(true); - } - if (badFocus) - myYMinEdit->setFocus(); - break; - } -} diff --git a/src/SVTK/Plot3d_FitDataDlg.h b/src/SVTK/Plot3d_FitDataDlg.h deleted file mode 100644 index 5b5916aa4..000000000 --- a/src/SVTK/Plot3d_FitDataDlg.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -#ifndef PLOT3D_FITDATADLG_H -#define PLOT3D_FITDATADLG_H - -#include "SVTK.h" - -#include - -class QGroupBox; -class QRadioButton; -class QLineEdit; -class QPushButton; - -class SVTK_EXPORT Plot3d_FitDataDlg : public QDialog -{ - Q_OBJECT - -public: -// constuctor - Plot3d_FitDataDlg( QWidget* parent, bool secondAxisY ); - -// sets range - void setRange(const double xMin, - const double xMax, - const double yMin, - const double yMax, - const double y2Min = 0, - const double y2Max = 0); -// gets range, returns mode (see getMode()) - int getRange(double& xMin, - double& xMax, - double& yMin, - double& yMax, - double& y2Min, - double& y2Max); -// gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical - int getMode(); - -protected slots: -// called when range mode changed - void onModeChanged(int); - -private: - QGroupBox* myRangeGrp; - QRadioButton* myModeAllRB; - QRadioButton* myModeHorRB; - QRadioButton* myModeVerRB; - QLineEdit* myXMinEdit; - QLineEdit* myYMinEdit; - QLineEdit* myY2MinEdit; - QLineEdit* myXMaxEdit; - QLineEdit* myYMaxEdit; - QLineEdit* myY2MaxEdit; - QPushButton* myOkBtn; - QPushButton* myCancelBtn; - bool mySecondAxisY; -}; - -#endif diff --git a/src/SVTK/Plot3d_SetupSurfacesDlg.cxx b/src/SVTK/Plot3d_SetupSurfacesDlg.cxx deleted file mode 100644 index 4fb7d4c62..000000000 --- a/src/SVTK/Plot3d_SetupSurfacesDlg.cxx +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -// SALOME Plot3d : implementation of desktop and GUI kernel -// -// File : Plot3d_SetupSurfacesDlg.cxx -// Author : Sergey LITONIN - -#include "Plot3d_SetupSurfacesDlg.h" - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#define TEXT_COL 0 - -/*! - \brief Constructor - \param theParent parent widget -*/ -Plot3d_SetupSurfacesDlg::Plot3d_SetupSurfacesDlg( QWidget* theParent ) -: QtxDialog( theParent, true, false, QtxDialog::OKCancel ) -{ - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - setWindowTitle( tr( "SETUP_SURFACES" ) ); - - QFrame* aMainFrame = mainFrame(); - - QVBoxLayout* aMainLay = new QVBoxLayout( aMainFrame ); - aMainLay->setMargin( 5 ); - - myGrp = new QtxGroupBox( aMainFrame ); - myGrp->setTitle( tr( "PARAMETERS" ) ); - aMainLay->addWidget( myGrp ); - - QVBoxLayout* aLay = new QVBoxLayout( myGrp ); - aLay->setMargin( 0 ); - - // Create table - myTable = new QTableWidget( myGrp ); - myTable->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); - - aLay->addWidget( myTable ); - - myTable->setRowCount( 0 ); - myTable->setColumnCount( 1 ); - - QStringList aLabels; - aLabels.append( tr( "TEXT" ) ); - myTable->setHorizontalHeaderLabels( aLabels ); - myTable->verticalHeader()->hide(); - myTable->setSelectionMode( QTableWidget::NoSelection ); - - QComboBox* aCombo = new QComboBox( 0 ); - myTable->verticalHeader()->setDefaultSectionSize( aCombo->sizeHint().height() ); - delete aCombo; - - int l, t, r, b; - myTable->getContentsMargins( &l, &t, &r, &b ); - myTable->setContentsMargins( 0, t, r, b ); - - myTable->horizontalHeader()->setResizeMode( TEXT_COL, QHeaderView::Stretch ); - myTable->horizontalHeader()->setHighlightSections( false ); - - // Minus button - QPixmap minusPix = aResMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_MINUS" ) ); - myRemoveBtn = new QToolButton( 0 ); - myRemoveBtn->setIcon( minusPix ); - myRemoveBtn->setFixedSize( minusPix.size() ); - myGrp->insertTitleWidget( myRemoveBtn ); - - connect( myRemoveBtn, SIGNAL( clicked() ), SLOT( onRemove() ) ); - connect( myTable, SIGNAL( valueChanged( int, int ) ), SLOT( onValueChanged( int, int ) ) ); - - setButtonPosition( Right, Cancel ); - setMinimumWidth( 300 ); - setMinimumHeight( 250 ); -} - -/*! - \brief Destructor -*/ -Plot3d_SetupSurfacesDlg::~Plot3d_SetupSurfacesDlg() -{ -} - -/*! - \brief Sets text in specified cell - \param theRow row - \param theCol column - \param theText text -*/ -void Plot3d_SetupSurfacesDlg::setText( const int theRow, - const int theCol, - const QString& theText ) -{ - QTableWidgetItem* anItem = myTable->item( theRow, theCol ); - if ( !anItem ) - { - anItem = new QTableWidgetItem( theText ); - myTable->setItem( theRow, theCol, anItem ); - } - else - anItem->setText( theText ); -} - -//============================================================================= -// Function : SetParameters -// Purpose : -//============================================================================= -void Plot3d_SetupSurfacesDlg::SetParameters( const QVector< QString >& theTexts ) -{ - int nbRows = theTexts.size(); - - myTable->setRowCount( nbRows ); - - for ( int i = 0; i < nbRows; i++ ) - { - QString aText = theTexts[ i ]; - aText.replace( QChar('\n'), QChar( ' ' ) ); - setText( i, TEXT_COL, aText ); - } - - myRemovedIndexes.clear(); -} - -//============================================================================= -// Function : GetParameters -// Purpose : -//============================================================================= -void Plot3d_SetupSurfacesDlg::GetParameters( QVector< QString >& theTexts ) const -{ - int nbRows = myTable->rowCount(); - - theTexts.resize( nbRows ); - - for ( int i = 0; i < nbRows; i++ ) - { - QTableWidgetItem* it = myTable->item( i, TEXT_COL ); - theTexts[ i ] = it ? it->text() : ""; - theTexts[ i ].replace( ' ', '\n' ); - } -} - -//============================================================================= -// Function : GetRemovedIndexes -// Purpose : -//============================================================================= -const QList< int >& Plot3d_SetupSurfacesDlg::GetRemovedIndexes() const -{ - return myRemovedIndexes; -} - -//============================================================================= -// Function : onRemove -// Purpose : -//============================================================================= -void Plot3d_SetupSurfacesDlg::onRemove() -{ - QList< int > toRemove; - - int aCurrRow = myTable->currentRow(); - int aCurrCol = myTable->currentColumn(); - - // get selected rows - QSet< int > aSelRows; - QList aRegs = myTable->selectedRanges(); - QList::iterator selIter; - for ( selIter = aRegs.begin(); selIter != aRegs.end(); ++selIter ) - { - const QTableWidgetSelectionRange& aReg = *selIter; - for ( int i = aReg.topRow(), n = aReg.bottomRow(); i < n; i++ ) - aSelRows.insert( i ); - } - - int i, n; - for ( i = 0, n = myTable->rowCount(); i < n; i++ ) - { - if ( aSelRows.contains( i ) || aCurrRow == i ) - toRemove.append( i ); - } - - if ( !toRemove.count() ) - return; - - int nbRemoved = 0; - QList< int >::iterator anIter; - for ( anIter = toRemove.begin(); anIter != toRemove.end(); ++anIter ) - { - int aRow = *anIter - nbRemoved; - myTable->removeRow( aRow ); - myRemovedIndexes.append( aRow ); - nbRemoved++; - } - - int nbRows = myTable->rowCount(); - if ( aCurrRow < nbRows && aCurrRow >= 0 && aCurrCol >= 0 ) - myTable->setCurrentCell( aCurrRow, aCurrCol ); - else if ( nbRows > 0 && aCurrCol >= 0 ) - myTable->setCurrentCell( nbRows - 1, aCurrCol ); -} diff --git a/src/SVTK/Plot3d_SetupSurfacesDlg.h b/src/SVTK/Plot3d_SetupSurfacesDlg.h deleted file mode 100644 index 20176a05c..000000000 --- a/src/SVTK/Plot3d_SetupSurfacesDlg.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -// SALOME Plot3d : implementation of desktop and GUI kernel -// -// File : Plot3d_SetupSurfacesDlg.h -// Author : Sergey LITONIN - -#ifndef PLOT3D_SETUPSURFACESDLG_H -#define PLOT3D_SETUPSURFACESDLG_H - -#include "SVTK.h" - -#include -#include -#include - -class QtxGroupBox; -class QTableWidget; -class QwtLegend; -class QToolButton; - -#if defined WIN32 -#pragma warning( disable: 4251 ) -#endif - -/*! - \class Plot3d_SetupSurfacesDlg - Dialog box for setup Plot3d surfaces parameters -*/ - -class SVTK_EXPORT Plot3d_SetupSurfacesDlg : public QtxDialog -{ - Q_OBJECT - -public: - Plot3d_SetupSurfacesDlg( QWidget* theParent = 0 ); - virtual ~Plot3d_SetupSurfacesDlg(); - - void SetParameters( const QVector< QString >& theTexts ); - void GetParameters( QVector< QString >& theText ) const; - - const QList< int >& GetRemovedIndexes() const; - -private slots: - - void onRemove(); - -private: - - void setText( const int theRow, - const int theCol, - const QString& theText ); -private: - - QtxGroupBox* myGrp; - QTableWidget* myTable; - QToolButton* myRemoveBtn; - QList< int > myRemovedIndexes; -}; - -#endif diff --git a/src/SVTK/Plot3d_ViewManager.cxx b/src/SVTK/Plot3d_ViewManager.cxx deleted file mode 100644 index 0b8e48048..000000000 --- a/src/SVTK/Plot3d_ViewManager.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -#include "Plot3d_ViewManager.h" -#include "Plot3d_ViewModel.h" - -/*! - Constructor -*/ -Plot3d_ViewManager::Plot3d_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop ) -: SVTK_ViewManager( study, theDesktop, new Plot3d_Viewer() ) -{ - setTitle( Plot3d_ViewManager::tr( "PLOT3D_VIEW_TITLE" ) ); -} - -/*! - Destructor -*/ -Plot3d_ViewManager::~Plot3d_ViewManager() -{ -} diff --git a/src/SVTK/Plot3d_ViewManager.h b/src/SVTK/Plot3d_ViewManager.h deleted file mode 100644 index 61fa7fb37..000000000 --- a/src/SVTK/Plot3d_ViewManager.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -#ifndef PLOT3D_VIEWMANAGER_H -#define PLOT3D_VIEWMANAGER_H - -#include "SVTK.h" -#include "SVTK_ViewManager.h" - -class SUIT_Desktop; - -//! Extend Plot3d_ViewManager to deal with Plot3d_Viewer -class SVTK_EXPORT Plot3d_ViewManager : public SVTK_ViewManager -{ - Q_OBJECT - -public: - //! Construct the view manager - Plot3d_ViewManager( SUIT_Study* study, SUIT_Desktop* ); - - //! Destroy the view manager - virtual ~Plot3d_ViewManager(); -}; - -#endif diff --git a/src/SVTK/Plot3d_ViewModel.cxx b/src/SVTK/Plot3d_ViewModel.cxx deleted file mode 100644 index 27e1cbef0..000000000 --- a/src/SVTK/Plot3d_ViewModel.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -#include "Plot3d_ViewModel.h" - -#include "SVTK_ViewWindow.h" - -/*! - Constructor -*/ -Plot3d_Viewer::Plot3d_Viewer() -{ -} - -/*! - Destructor -*/ -Plot3d_Viewer::~Plot3d_Viewer() -{ -} - -/*!Create new instance of view window on desktop \a theDesktop. - *\retval SUIT_ViewWindow* - created view window pointer. - */ -SUIT_ViewWindow* Plot3d_Viewer::createView( SUIT_Desktop* theDesktop ) -{ - SUIT_ViewWindow* aViewWindow = SVTK_Viewer::createView( theDesktop ); - if( SVTK_ViewWindow* aSVTKViewWindow = dynamic_cast( aViewWindow ) ) - { - aSVTKViewWindow->SetActionVisible( SVTK_ViewWindow::Mode2DId, true ); - aSVTKViewWindow->SetActionVisible( SVTK_ViewWindow::SurfacesSettingsId, true ); - } - return aViewWindow; -} diff --git a/src/SVTK/Plot3d_ViewModel.h b/src/SVTK/Plot3d_ViewModel.h deleted file mode 100644 index 3aaeabf33..000000000 --- a/src/SVTK/Plot3d_ViewModel.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// 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 -// -#ifndef PLOT3D_VIEWMODEL_H -#define PLOT3D_VIEWMODEL_H - -#include "SVTK.h" -#include "SVTK_ViewModel.h" - -//! Extends interface #SVTK_Viewer -class SVTK_EXPORT Plot3d_Viewer : public SVTK_Viewer -{ - Q_OBJECT; - -public: - //! Define string representation of the viewer type - static QString Type() { return "Plot3d"; } - - Plot3d_Viewer(); - virtual ~Plot3d_Viewer(); - - //! See #SUIT_ViewModel::createView - virtual SUIT_ViewWindow* createView( SUIT_Desktop* ); - - //! See #SUIT_ViewModel::getType - virtual QString getType() const { return Type(); } -}; - -#endif diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx index 2fac0c3e3..cd44acd12 100644 --- a/src/SVTK/SVTK_View.cxx +++ b/src/SVTK/SVTK_View.cxx @@ -431,12 +431,13 @@ namespace SVTK */ void SVTK_View -::EraseAll() +::EraseAll(const bool theIsUpdate) { using namespace SVTK; ForEach(getRenderer()->GetActors(), TErase()); - Repaint(); + if(theIsUpdate) + Repaint(); } /*! @@ -444,12 +445,13 @@ SVTK_View */ void SVTK_View -::DisplayAll() +::DisplayAll(const bool theIsUpdate) { using namespace SVTK; ForEach(getRenderer()->GetActors(), TSetVisibility(true)); - Repaint(); + if(theIsUpdate) + Repaint(); } /*! @@ -460,7 +462,7 @@ SVTK_View void SVTK_View ::Erase(SALOME_Actor* theActor, - bool theIsUpdate) + const bool theIsUpdate) { SVTK::TErase()(theActor); @@ -477,7 +479,7 @@ SVTK_View void SVTK_View ::Erase(const Handle(SALOME_InteractiveObject)& theIObject, - bool theIsUpdate) + const bool theIsUpdate) { using namespace SVTK; ForEachIf(getRenderer()->GetActors(), @@ -493,7 +495,7 @@ SVTK_View void SVTK_View ::Display(SALOME_Actor* theActor, - bool theIsUpdate) + const bool theIsUpdate) { GetRenderer()->AddActor(theActor); theActor->SetVisibility(true); @@ -508,7 +510,7 @@ SVTK_View void SVTK_View ::Display(const Handle(SALOME_InteractiveObject)& theIObject, - bool theIsUpdate) + const bool theIsUpdate) { using namespace SVTK; ForEachIf(getRenderer()->GetActors(), @@ -524,10 +526,11 @@ SVTK_View */ void SVTK_View -::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject) +::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject, + const bool theIsUpdate) { - EraseAll(); - Display(theIObject); + EraseAll(theIsUpdate); + Display(theIObject, theIsUpdate); } @@ -553,7 +556,7 @@ namespace SVTK void SVTK_View ::Remove(const Handle(SALOME_InteractiveObject)& theIObject, - bool theIsUpdate) + const bool theIsUpdate) { using namespace SVTK; ForEachIf(getRenderer()->GetActors(), @@ -569,7 +572,7 @@ SVTK_View void SVTK_View ::Remove(SALOME_Actor* theActor, - bool theIsUpdate) + const bool theIsUpdate) { GetRenderer()->RemoveActor(theActor); if(theIsUpdate) @@ -581,7 +584,7 @@ SVTK_View */ void SVTK_View -::RemoveAll(bool theIsUpdate) +::RemoveAll(const bool theIsUpdate) { vtkRenderer* aRenderer = getRenderer(); if(vtkActorCollection* anActors = aRenderer->GetActors()){ diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h index 3861add92..6864e14c9 100644 --- a/src/SVTK/SVTK_View.h +++ b/src/SVTK/SVTK_View.h @@ -198,47 +198,48 @@ public: // Erase Display functions //! To erase all existing VTK presentations void - EraseAll(); + EraseAll(const bool theIsUpdate = true); //! To display all existing VTK presentations void - DisplayAll(); + DisplayAll(const bool theIsUpdate = true); //! To remove from the view all existing VTK presentations void - RemoveAll( const bool immediatly ); + RemoveAll(const bool theIsUpdate = true); //! To erase VTK presentation with defined #SALOME_InteractiveObject void Erase(const Handle(SALOME_InteractiveObject)& IObject, - bool immediatly = true); + const bool theIsUpdate = true); void Remove(const Handle(SALOME_InteractiveObject)& IObject, - bool immediatly = true); + const bool theIsUpdate = true); //! To display VTK presentation with defined #SALOME_InteractiveObject void Display(const Handle(SALOME_InteractiveObject)& IObject, - bool immediatly = true); + const bool theIsUpdate = true); //! To display VTK presentation with defined #SALOME_InteractiveObject and erase all anothers void - DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject); + DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject, + const bool theIsUpdate = true); //! To display the VTK presentation void Display(SALOME_Actor* SActor, - bool immediatly = true); + const bool theIsUpdate = true); //! To erase the VTK presentation void Erase(SALOME_Actor* SActor, - bool immediatly = true); + const bool theIsUpdate = true); //! To remove the VTK presentation void Remove(SALOME_Actor* SActor, - bool updateViewer = true); + const bool theIsUpdate = true); //---------------------------------------------------------------------------- //! Redirect the request to #SVTK_Renderer::SetPreselectionProp diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 20e3569dc..93a788c2a 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -458,48 +458,52 @@ Handle(SALOME_InteractiveObject) SVTK_ViewWindow::FindIObject(const char* theEnt /*! Display object \param theIO - object - \param theImmediatly - update viewer + \param theIsUpdate - update viewer */ void SVTK_ViewWindow::Display(const Handle(SALOME_InteractiveObject)& theIO, - bool theImmediatly) + bool theIsUpdate) { - myView->Display(theIO,theImmediatly); + myView->Display(theIO,theIsUpdate); } /*! Erase object \param theIO - object - \param theImmediatly - update viewer + \param theIsUpdate - update viewer */ void SVTK_ViewWindow::Erase(const Handle(SALOME_InteractiveObject)& theIO, - bool theImmediatly) + bool theIsUpdate) { - myView->Erase(theIO,theImmediatly); + myView->Erase(theIO,theIsUpdate); } /*! Display only passed object \param theIO - object + \param theIsUpdate - update viewer */ -void SVTK_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO) +void SVTK_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO, + bool theIsUpdate) { - myView->DisplayOnly(theIO); + myView->DisplayOnly(theIO,theIsUpdate); } /*! Display all objects in view + \param theIsUpdate - update viewer */ -void SVTK_ViewWindow::DisplayAll() +void SVTK_ViewWindow::DisplayAll(bool theIsUpdate) { - myView->DisplayAll(); + myView->DisplayAll(theIsUpdate); } /*! Erase all objects in view + \param theIsUpdate - update viewer */ -void SVTK_ViewWindow::EraseAll() +void SVTK_ViewWindow::EraseAll(bool theIsUpdate) { - myView->EraseAll(); + myView->EraseAll(theIsUpdate); } /*! @@ -580,11 +584,13 @@ void SVTK_ViewWindow::GetScale( double theScale[3] ) /*! Redirect the request to #SVTK_Renderer::SetScale */ -void SVTK_ViewWindow::SetScale( double theScale[3] ) +void SVTK_ViewWindow::SetScale( double theScale[3], + bool theIsUpdate ) { //myMainWindow->SetScale( theScale ); GetRenderer()->SetScale( theScale ); - Repaint(); + if( theIsUpdate ) + Repaint(); } /*! diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 1ec37344f..c2612fc0f 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -171,27 +171,29 @@ class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow //---------------------------------------------------------------------------- //! Redirect the request to #SVTK_View::Display (to support old code) virtual void Display(const Handle(SALOME_InteractiveObject)& theIObject, - bool theImmediatly = true); + bool theIsUpdate = true); //! Redirect the request to #SVTK_View::DisplayOnly (to support old code) - virtual void DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject); + virtual void DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject, + bool theIsUpdate = true); //! Redirect the request to #SVTK_View::Erase (to support old code) virtual void Erase(const Handle(SALOME_InteractiveObject)& theIObject, - bool theImmediatly = true); + bool theIsUpdate = true); //! Redirect the request to #SVTK_View::DisplayAll (to support old code) - virtual void DisplayAll(); + virtual void DisplayAll(bool theIsUpdate = true); //! Redirect the request to #SVTK_View::EraseAll (to support old code) - virtual void EraseAll(); + virtual void EraseAll(bool theIsUpdate = true); //! To repaint the viewer virtual void Repaint(bool theUpdateTrihedron = true); //---------------------------------------------------------------------------- //! Redirect the request to #SVTK_Renderer::SetScale - virtual void SetScale( double theScale[3] ); + virtual void SetScale( double theScale[3], + bool theIsUpdate = true ); //! Redirect the request to #SVTK_Renderer::GetScale virtual void GetScale( double theScale[3] ); diff --git a/src/SVTK/resources/vtk_view_minus.png b/src/SVTK/resources/vtk_view_minus.png deleted file mode 100644 index 055182e1ac781ed8d8f606e54045aeb043bc574f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijSl0AZa85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP(s_& z#WBRfKRH2y^{_6Bl!U}T;X@UFc`p6gzl>3x?WC|tgOWJUb`43Re~b(qhl~!3-9N1h P)W+cH>gTe~DWM4fT5>HD -- 2.39.2