diff --git a/GammaRay.pro b/GammaRay.pro index 050cd9ab..569cb7b1 100644 --- a/GammaRay.pro +++ b/GammaRay.pro @@ -689,7 +689,7 @@ isEmpty(_QWT_LIB){ } INCLUDEPATH += $$_QWT_INCLUDE LIBPATH += $$_QWT_LIB -LIBS += -lqwt +LIBS += -lqwt-qt5 #============================================================== #========== The VTK include and lib paths and libraries================== @@ -744,7 +744,6 @@ LIBS += -lvtkGUISupportQt$$_VTK_VERSION_SUFFIX \ -lvtkImagingGeneral$$_VTK_VERSION_SUFFIX \ -lvtkRenderingVolume$$_VTK_VERSION_SUFFIX \ -lvtkFiltersStatistics$$_VTK_VERSION_SUFFIX \ - -lvtkalglib$$_VTK_VERSION_SUFFIX \ -lvtkImagingStencil$$_VTK_VERSION_SUFFIX \ -lvtkImagingHybrid$$_VTK_VERSION_SUFFIX \ -lvtkRenderingContext2D$$_VTK_VERSION_SUFFIX \ @@ -778,7 +777,8 @@ LIBS += -lITKCommon$$_ITK_VERSION_SUFFIX \ -litkvnl$$_ITK_VERSION_SUFFIX \ -litkvnl_algo$$_ITK_VERSION_SUFFIX \ -lITKIOPNG$$_ITK_VERSION_SUFFIX \ - -lITKTransform$$_ITK_VERSION_SUFFIX + -lITKTransform$$_ITK_VERSION_SUFFIX \ + -lITKSmoothing$$_ITK_VERSION_SUFFIX #============================================================================= @@ -824,7 +824,7 @@ win32 { # The application version # Don't forget to update the Util::importSettingsFromPreviousVersion() method to # enable the import of registry/user settings of previous versions. -VERSION = 6.14 +VERSION = 6.16 # Define a preprocessor macro so we can get the application version in application code. DEFINES += APP_VERSION=\\\"$$VERSION\\\" diff --git a/README.md b/README.md index 89c29749..4235a779 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ If you enjoyed this project, you might also enjoy GeostatsPy: https://github.com Python script to convert Eclipse grids to Paraview-compatible VTU format: https://github.com/BinWang0213/PyGRDECL VERSION HISTORY:
+   Version 6.16 - Upgrade of VTK to 9.1 and other years-old dependencies; some fixes.
   Version 6.14 - Several improvements mainly involving the 3D Viewer and dataset processing.
   Version 6.12 - Several new methods to work with grids. Several fixes and enhancements.
   Version 6.9 - Export geologic grids as Eclipse grids, multiple other new features, enhancements and fixes.
diff --git a/dialogs/dynamicfaciesrelationshipdiagramdialog.cpp b/dialogs/dynamicfaciesrelationshipdiagramdialog.cpp index 6a97659b..e2d01ebb 100644 --- a/dialogs/dynamicfaciesrelationshipdiagramdialog.cpp +++ b/dialogs/dynamicfaciesrelationshipdiagramdialog.cpp @@ -12,6 +12,7 @@ #include #include #include +#include DynamicFaciesRelationshipDiagramDialog::DynamicFaciesRelationshipDiagramDialog( std::vector &categoricalAttributes, diff --git a/dialogs/krigingdialog.cpp b/dialogs/krigingdialog.cpp index 9c83f37b..bf80d1ad 100644 --- a/dialogs/krigingdialog.cpp +++ b/dialogs/krigingdialog.cpp @@ -18,6 +18,7 @@ #include #include +#include #include KrigingDialog::KrigingDialog(QWidget *parent) : diff --git a/dialogs/mcrfsimdialog.cpp b/dialogs/mcrfsimdialog.cpp index 28c4a47c..3afcc6f2 100644 --- a/dialogs/mcrfsimdialog.cpp +++ b/dialogs/mcrfsimdialog.cpp @@ -174,7 +174,7 @@ void MCRFSimDialog::onRun() Application::instance()->logError( " Last error:" + markovSim.getLastError() ); } else { int realNum = 1; - for( const spectral::arrayPtr& simValues : markovSim.getRealizations() ){ + for( spectral::arrayPtr simValues : markovSim.getRealizations() ){ markovSim.m_cgSim->append( m_commonSimulationParameters->getBaseNameForRealizationVariables() + QString::number(realNum), *simValues, markovSim.m_pdf->getCategoryDefinition() ); diff --git a/docs/GammaRayManual.docx b/docs/GammaRayManual.docx index f1719a24..dead3c8d 100755 Binary files a/docs/GammaRayManual.docx and b/docs/GammaRayManual.docx differ diff --git a/docs/figures.pptx b/docs/figures.pptx index c02e4e7e..626cb4c7 100755 Binary files a/docs/figures.pptx and b/docs/figures.pptx differ diff --git a/imagejockey/gabor/gaborfilterdialog.cpp b/imagejockey/gabor/gaborfilterdialog.cpp index dfd9bd16..05da6b6a 100644 --- a/imagejockey/gabor/gaborfilterdialog.cpp +++ b/imagejockey/gabor/gaborfilterdialog.cpp @@ -19,7 +19,7 @@ VTK_MODULE_INIT(vtkRenderingFreeType) #include "imagejockey/paraviewscalarbar/vtkParaViewScalarBar.h" #include "util.h" #include -#include +#include #include #include #include @@ -64,15 +64,15 @@ GaborFilterDialog::GaborFilterDialog(IJAbstractCartesianGrid *inputGrid, } ///-------------------setup the 3D viewer------------------- - _vtkwidget = new QVTKOpenGLWidget(); + _vtkwidget = new QVTKOpenGLNativeWidget(); _renderer = vtkSmartPointer::New(); // enable antialiasing _renderer->SetUseFXAA( true ); - _vtkwidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New()); - _vtkwidget->GetRenderWindow()->AddRenderer(_renderer); + _vtkwidget->setRenderWindow(vtkGenericOpenGLRenderWindow::New()); + _vtkwidget->renderWindow()->AddRenderer(_renderer); _vtkwidget->setFocusPolicy(Qt::StrongFocus); //----------------------adding the orientation axes------------------------- @@ -80,7 +80,7 @@ GaborFilterDialog::GaborFilterDialog(IJAbstractCartesianGrid *inputGrid, _vtkAxesWidget = vtkSmartPointer::New(); _vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300); _vtkAxesWidget->SetOrientationMarker(axes); - _vtkAxesWidget->SetInteractor(_vtkwidget->GetRenderWindow()->GetInteractor()); + _vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); _vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2); _vtkAxesWidget->SetEnabled(1); _vtkAxesWidget->InteractiveOn(); @@ -155,7 +155,8 @@ void GaborFilterDialog::updateDisplay() double featureSizeFinal = ( featureSizeXFinal + featureSizeYFinal ) / 2; //get the feature size step size (intial size is greater because initial frequency is lower) double dFeatureSize = ( featureSizeInitial - featureSizeFinal ) / ( s1 - s0 ) ; - + //get the z coordinate of the origin of the spectrogram + double spectrogramOriginZ = featureSizeFinal - 0.5 * dFeatureSize; /////--------------------code to render the spectrogram cube----------------------- vtkSmartPointer spectrogramActor = vtkSmartPointer::New(); @@ -182,7 +183,7 @@ void GaborFilterDialog::updateDisplay() dFeatureSize); spectrogramGridAsCellCentered->SetOrigin ( m_inputGrid->getOriginX() - m_inputGrid->getCellSizeI()/2, m_inputGrid->getOriginY() - m_inputGrid->getCellSizeJ()/2, - featureSizeFinal - 0.5 * dFeatureSize ); + spectrogramOriginZ ); spectrogramGridAsCellCentered->SetExtent( extent[0], extent[1]+1, extent[2], extent[3]+1, extent[4], extent[5]+1 ); @@ -218,7 +219,8 @@ void GaborFilterDialog::updateDisplay() vtkSmartPointer threshold = vtkSmartPointer::New(); { threshold->SetInputData( spectrogramGridAsCellCentered ); - threshold->ThresholdByUpper(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); threshold->Update(); } @@ -249,7 +251,7 @@ void GaborFilterDialog::updateDisplay() _scalarBar->SetTitle("amplitude"); //scalarBar->SetNumberOfLabels( 4 ); _scalarBar->SetRenderer( _renderer ); - _scalarBar->SetInteractor( _vtkwidget->GetRenderWindow()->GetInteractor() ); + _scalarBar->SetInteractor( _vtkwidget->renderWindow()->GetInteractor() ); // Create a text style for the cube axes vtkSmartPointer tprop = vtkSmartPointer::New(); @@ -282,11 +284,18 @@ void GaborFilterDialog::updateDisplay() spectral::arrayPtr gridData( m_inputGrid->createSpectralArray( m_inputVariableIndex ) ); ImageJockeyUtils::makeVTKImageDataFromSpectralArray( out, *gridData ); - //put the input grid a bit far from the spectrogram cube + //put the input grid a bit below from the spectrogram cube double* origin = out->GetOrigin(); - origin[2] -= 10.0; + origin[0] = m_inputGrid->getOriginX(); + origin[1] = m_inputGrid->getOriginY(); + origin[2] = spectrogramOriginZ - 10.0; out->SetOrigin( origin ); + //render the input grid with the correct cell sizes + out->SetSpacing ( m_inputGrid->getCellSizeI(), + m_inputGrid->getCellSizeJ(), + m_inputGrid->getCellSizeK()); + //Create a color table vtkSmartPointer lut = vtkSmartPointer::New(); { @@ -330,7 +339,7 @@ void GaborFilterDialog::updateDisplay() _renderer->AddActor( gridActor ); _currentActors.push_back( gridActor ); _renderer->ResetCamera(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void GaborFilterDialog::onScan() @@ -408,7 +417,7 @@ void GaborFilterDialog::onFreqAzSelectionsUpdated(const GaborFrequencyAzimuthSel void GaborFilterDialog::onUserEditedAFrequency(QString freqValue) { - Q_UNUSED( freqValue ); + Q_UNUSED( freqValue ) //get the user-entered topological frequencies // the frequencies are topological (that is, inverse of cell counts) // because the Gabor transform involves convolutions, which are cell-centered diff --git a/imagejockey/gabor/gaborfilterdialog.h b/imagejockey/gabor/gaborfilterdialog.h index 87eb903c..d5c512cb 100644 --- a/imagejockey/gabor/gaborfilterdialog.h +++ b/imagejockey/gabor/gaborfilterdialog.h @@ -12,7 +12,7 @@ class GaborFilterDialog; class IJAbstractCartesianGrid; class IJQuick3DViewer; -class QVTKOpenGLWidget; +class QVTKOpenGLNativeWidget; class vtkRenderer; class vtkOrientationMarkerWidget; class vtkPolyData; @@ -50,7 +50,7 @@ class GaborFilterDialog : public QDialog ////////-----members used for 3D display------------------- // the Qt widget containing a VTK viewport - QVTKOpenGLWidget *_vtkwidget; + QVTKOpenGLNativeWidget *_vtkwidget; // the VTK renderer (add VTK actors to it to build the scene). vtkSmartPointer _renderer; // this must be class variable, otherwise a crash ensues due to smart pointer going diff --git a/imagejockey/imagejockeygridplot.cpp b/imagejockey/imagejockeygridplot.cpp index f5029b31..9db840fd 100644 --- a/imagejockey/imagejockeygridplot.cpp +++ b/imagejockey/imagejockeygridplot.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include @@ -41,8 +43,8 @@ class SpectrogramZoomer: public QwtPlotZoomer } }; -///////////////////////////////////////////RASTER DATA ADAPTER: QwtRasterData <-> CartesianGrid /////////////////////// -class SpectrogramData: public QwtRasterData{ +///////////////////////////////////////////RASTER DATA ADAPTER: QwtMatrixRasterData <-> CartesianGrid /////////////////////// +class SpectrogramData: public QwtMatrixRasterData{ public: SpectrogramData() : m_var( nullptr ), m_cg( nullptr ), m_decibelRefValue(100.0) { //set some default values before the user chooses a grid @@ -105,8 +107,8 @@ class SpectrogramData: public QwtRasterData{ double m_decibelRefValue; }; -///////////////////////////////////////////RASTER DATA ADAPTER: QwtRasterData <-> SVDFactor /////////////////////// -class FactorData: public QwtRasterData{ +///////////////////////////////////////////RASTER DATA ADAPTER: QwtMatrixRasterData <-> SVDFactor /////////////////////// +class FactorData: public QwtMatrixRasterData{ public: FactorData() : m_factor( nullptr ), m_colorScaleForSVDFactor( ColorScaleForSVDFactor::LINEAR ) { //set some default values before the user chooses a factor diff --git a/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.cpp b/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.cpp index de0c21d4..062009a7 100644 --- a/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.cpp +++ b/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.cpp @@ -98,7 +98,7 @@ void vtkBoundingRectContextDevice2D::DrawMathTextString(float* point, const vtkS { if (!this->DelegateDevice) { - vtkWarningMacro(<< "No DelegateDevice defined") return; + vtkWarningMacro(<< "No DelegateDevice defined"); return; } // Not sure if this will work for math text diff --git a/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.h b/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.h index f907c773..9de6a5b9 100644 --- a/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.h +++ b/imagejockey/paraviewscalarbar/vtkBoundingRectContextDevice2D.h @@ -58,7 +58,7 @@ class vtkBoundingRectContextDevice2D : public vtkContextDevice2D { public: vtkTypeMacro(vtkBoundingRectContextDevice2D, vtkContextDevice2D) virtual void PrintSelf( - ostream& os, vtkIndent indent) VTK_OVERRIDE; + ostream& os, vtkIndent indent) override; static vtkBoundingRectContextDevice2D* New(); /** @@ -86,27 +86,27 @@ class vtkBoundingRectContextDevice2D : public vtkContextDevice2D /** * Expand bounding box to contain the string's bounding box. */ - void DrawString(float* point, const vtkStdString& string) VTK_OVERRIDE; + void DrawString(float* point, const vtkStdString& string) override; /** * Expand bounding box to contain the string's bounding box. */ - void DrawString(float* point, const vtkUnicodeString& string) VTK_OVERRIDE; + void DrawString(float* point, const vtkUnicodeString& string) override; /** * Expand bounding box to contain the string's bounding box. */ - void DrawMathTextString(float* point, const vtkStdString& string) VTK_OVERRIDE; + void DrawMathTextString(float* point, const vtkStdString& string) override; /** * Expand bounding box to contain the image's bounding box. */ - void DrawImage(float p[2], float scale, vtkImageData* image) VTK_OVERRIDE; + void DrawImage(float p[2], float scale, vtkImageData* image) override; /** * Expand bounding box to contain the image's bounding box. */ - void DrawImage(const vtkRectf& pos, vtkImageData* image) VTK_OVERRIDE; + void DrawImage(const vtkRectf& pos, vtkImageData* image) override; /** * Draw the supplied PolyData at the given x, y (p[0], p[1]) (bottom corner), @@ -122,173 +122,173 @@ class vtkBoundingRectContextDevice2D : public vtkContextDevice2D /** * Implement pure virtual member function. Does not affect bounding rect. */ - void SetColor4(unsigned char color[4]) VTK_OVERRIDE; + void SetColor4(unsigned char color[4]) override; /** * Implement pure virtual member function. Does not affect bounding rect. */ - void SetTexture(vtkImageData* image, int properties) VTK_OVERRIDE; + void SetTexture(vtkImageData* image, int properties) override; /** * Implement pure virtual member function. Does not affect bounding rect. */ - void SetPointSize(float size) VTK_OVERRIDE; + void SetPointSize(float size) override; /** * Implement pure virtual member function. Forward line width to * delegate device. */ - void SetLineWidth(float width) VTK_OVERRIDE; + void SetLineWidth(float width) override; /** * Implement pure virtual member function. Forward line type to * delegate device. */ - void SetLineType(int type) VTK_OVERRIDE; + void SetLineType(int type) override; /** * Forward current matrix to delegate device. */ - void SetMatrix(vtkMatrix3x3* m) VTK_OVERRIDE; + void SetMatrix(vtkMatrix3x3* m) override; /** * Get current matrix from delegate device. */ - void GetMatrix(vtkMatrix3x3* m) VTK_OVERRIDE; + void GetMatrix(vtkMatrix3x3* m) override; /** * Multiply the current matrix in the delegate device by this one. */ - void MultiplyMatrix(vtkMatrix3x3* m) VTK_OVERRIDE; + void MultiplyMatrix(vtkMatrix3x3* m) override; /** * Push matrix in the delegate device. */ - void PushMatrix() VTK_OVERRIDE; + void PushMatrix() override; /** * Pope matrix from the delegate device. */ - void PopMatrix() VTK_OVERRIDE; + void PopMatrix() override; /** * Implement pure virtual member function. Does nothing. */ - void EnableClipping(bool enable) VTK_OVERRIDE; + void EnableClipping(bool enable) override; /** * Implement pure virtual member function. Does nothing. */ - void SetClipping(int* x) VTK_OVERRIDE; + void SetClipping(int* x) override; /** * Forward the pen to the delegate device. */ - void ApplyPen(vtkPen* pen) VTK_OVERRIDE; + void ApplyPen(vtkPen* pen) override; /** * Get the pen from the delegate device. */ - vtkPen* GetPen() VTK_OVERRIDE; + vtkPen* GetPen() override; /** * Forward the brush to the delegate device. */ - void ApplyBrush(vtkBrush* brush) VTK_OVERRIDE; + void ApplyBrush(vtkBrush* brush) override; /** * Get the brush from the delegate device. */ - vtkBrush* GetBrush() VTK_OVERRIDE; + vtkBrush* GetBrush() override; /** * Forward the text property to the delegate device. */ - void ApplyTextProp(vtkTextProperty* prop) VTK_OVERRIDE; + void ApplyTextProp(vtkTextProperty* prop) override; /** * Get the text property from the delegate device. */ - vtkTextProperty* GetTextProp() VTK_OVERRIDE; + vtkTextProperty* GetTextProp() override; /** * Expand bounding box to contain the given polygon. */ - void DrawPoly(float* points, int n, unsigned char* colors = 0, int nc_comps = 0) VTK_OVERRIDE; + void DrawPoly(float* points, int n, unsigned char* colors = 0, int nc_comps = 0) override; /** * Expand bounding rect to contain the given lines. */ - void DrawLines(float* f, int n, unsigned char* colors = 0, int nc_comps = 0) VTK_OVERRIDE; + void DrawLines(float* f, int n, unsigned char* colors = 0, int nc_comps = 0) override; /** * Expand bounding rect to contain the given points. */ - void DrawPoints(float* points, int n, unsigned char* colors = 0, int nc_comps = 0) VTK_OVERRIDE; + void DrawPoints(float* points, int n, unsigned char* colors = 0, int nc_comps = 0) override; /** * Expand bounding rect to contain the point sprites. */ void DrawPointSprites(vtkImageData* sprite, float* points, int n, unsigned char* colors = 0, - int nc_comps = 0) VTK_OVERRIDE; + int nc_comps = 0) override; /** * Expand bounding rect to contain the markers. */ void DrawMarkers(int shape, bool highlight, float* points, int n, unsigned char* colors = 0, - int nc_comps = 0) VTK_OVERRIDE; + int nc_comps = 0) override; /** * Expand bounding rect to contain the ellipse. */ void DrawEllipseWedge(float x, float y, float outRx, float outRy, float inRx, float inRy, - float startAngle, float stopAngle) VTK_OVERRIDE; + float startAngle, float stopAngle) override; /** * Expand bounding rect to contain the elliptic arc. */ void DrawEllipticArc( - float x, float y, float rX, float rY, float startAngle, float stopAngle) VTK_OVERRIDE; + float x, float y, float rX, float rY, float startAngle, float stopAngle) override; /** * Forward string bounds calculation to the delegate device. */ - void ComputeStringBounds(const vtkStdString& string, float bounds[4]) VTK_OVERRIDE; + void ComputeStringBounds(const vtkStdString& string, float bounds[4]) override; /** * Forward string bounds calculation to the delegate device. */ - void ComputeStringBounds(const vtkUnicodeString& string, float bounds[4]) VTK_OVERRIDE; + void ComputeStringBounds(const vtkUnicodeString& string, float bounds[4]) override; /** * Forward string bounds calculation to the delegate device. */ - void ComputeJustifiedStringBounds(const char* string, float bounds[4]) VTK_OVERRIDE; + void ComputeJustifiedStringBounds(const char* string, float bounds[4]) override; /** * Call before drawing to this device. */ - void Begin(vtkViewport*) VTK_OVERRIDE; + void Begin(vtkViewport*) override; /** * Call after drawing to this device. */ - void End() VTK_OVERRIDE; + void End() override; /** * Get value from delegate device. */ - bool GetBufferIdMode() const VTK_OVERRIDE; + bool GetBufferIdMode() const override; /** * Begin ID buffering mode. */ - void BufferIdModeBegin(vtkAbstractContextBufferId* bufferId) VTK_OVERRIDE; + void BufferIdModeBegin(vtkAbstractContextBufferId* bufferId) override; /** * End ID buffering mode. */ - void BufferIdModeEnd() VTK_OVERRIDE; + void BufferIdModeEnd() override; protected: vtkBoundingRectContextDevice2D(); @@ -321,8 +321,8 @@ class vtkBoundingRectContextDevice2D : public vtkContextDevice2D void AddRect(const vtkRectf& rect); private: - vtkBoundingRectContextDevice2D(const vtkBoundingRectContextDevice2D&) VTK_DELETE_FUNCTION; - void operator=(const vtkBoundingRectContextDevice2D&) VTK_DELETE_FUNCTION; + vtkBoundingRectContextDevice2D(const vtkBoundingRectContextDevice2D&) = delete; + void operator=(const vtkBoundingRectContextDevice2D&) = delete; }; #endif // vtkBoundingRectContextDevice2D diff --git a/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.cpp b/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.cpp index 23a439ae..9fa2c1ec 100644 --- a/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.cpp +++ b/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.cpp @@ -32,6 +32,7 @@ #include #include +#include //VTK 9: required for std::* c-string functions (e.g. std::strlen) #if defined(_WIN32) && !defined(__CYGWIN__) #define SNPRINTF _snprintf @@ -76,7 +77,7 @@ class vtkContext2DScalarBarActor::vtkScalarBarItem : public vtkContextItem static vtkScalarBarItem* New() { VTK_OBJECT_FACTORY_NEW_BODY(vtkScalarBarItem); } // Forward calls to vtkContextItem::Paint to vtkContext2DScalarBarActor - bool Paint(vtkContext2D* painter) VTK_OVERRIDE + bool Paint(vtkContext2D* painter) override { bool somethingRendered = false; if (this->Actor) @@ -275,7 +276,19 @@ void vtkContext2DScalarBarActor::UpdateScalarBarTexture(vtkImageData* image) value = pow(10.0, value); } - unsigned char* color = ctf->MapValue(value); + //original VTK 8 code: illegal const char* to char* assignment + //unsigned char* color = ctf->MapValue(value); + + //replacement compatible with VTK 9: color is now a local copy of the const unsigned char* + // containing the RGBA values returned by ctf->MapValue(value). + unsigned char color[4]; + { + const unsigned char* color_original = ctf->MapValue(value); + color[0] = color_original[0]; //R channel + color[1] = color_original[1]; //G channel + color[2] = color_original[2]; //B channel + color[3] = color_original[3]; //alpha channel + } // The opacity function does not take into account the logarithmic // mapping, so we use the original value here. diff --git a/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.h b/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.h index c7fb08b7..eb4b464b 100644 --- a/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.h +++ b/imagejockey/paraviewscalarbar/vtkContext2DScalarBarActor.h @@ -51,7 +51,7 @@ class vtkContext2DScalarBarActor : public vtkScalarBarActor { public: vtkTypeMacro(vtkContext2DScalarBarActor, vtkScalarBarActor); - virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE; + virtual void PrintSelf(ostream& os, vtkIndent indent) override; static vtkContext2DScalarBarActor* New(); //@{ @@ -173,19 +173,19 @@ class vtkContext2DScalarBarActor : public vtkScalarBarActor /** * We only render in the overlay for the context scene. */ - virtual int RenderOverlay(vtkViewport* viewport) VTK_OVERRIDE; + virtual int RenderOverlay(vtkViewport* viewport) override; /** * Draw the scalar bar and annotation text to the screen. */ - int RenderOpaqueGeometry(vtkViewport* viewport) VTK_OVERRIDE; + int RenderOpaqueGeometry(vtkViewport* viewport) override; /** * Release any graphics resources that are being consumed by this actor. * The parameter window could be used to determine which graphic * resources to release. */ - virtual void ReleaseGraphicsResources(vtkWindow* window) VTK_OVERRIDE; + virtual void ReleaseGraphicsResources(vtkWindow* window) override; /** * Responsible for actually drawing the scalar bar. @@ -203,8 +203,8 @@ class vtkContext2DScalarBarActor : public vtkScalarBarActor virtual ~vtkContext2DScalarBarActor(); private: - vtkContext2DScalarBarActor(const vtkContext2DScalarBarActor&) VTK_DELETE_FUNCTION; - void operator=(const vtkContext2DScalarBarActor&) VTK_DELETE_FUNCTION; + vtkContext2DScalarBarActor(const vtkContext2DScalarBarActor&) = delete; + void operator=(const vtkContext2DScalarBarActor&) = delete; vtkContextActor* ActorDelegate; diff --git a/imagejockey/paraviewscalarbar/vtkPVScalarBarRepresentation.h b/imagejockey/paraviewscalarbar/vtkPVScalarBarRepresentation.h index fbcfc292..6d5f99ef 100644 --- a/imagejockey/paraviewscalarbar/vtkPVScalarBarRepresentation.h +++ b/imagejockey/paraviewscalarbar/vtkPVScalarBarRepresentation.h @@ -40,7 +40,7 @@ class vtkPVScalarBarRepresentation { public: vtkTypeMacro(vtkPVScalarBarRepresentation, vtkScalarBarRepresentation) virtual void PrintSelf( - ostream& os, vtkIndent indent) VTK_OVERRIDE; + ostream& os, vtkIndent indent) override; static vtkPVScalarBarRepresentation* New(); enum @@ -74,7 +74,7 @@ class vtkPVScalarBarRepresentation * Override to obtain viewport size and potentially adjust placement * of the representation. */ - virtual int RenderOverlay(vtkViewport*) VTK_OVERRIDE; + virtual int RenderOverlay(vtkViewport*) override; protected: vtkPVScalarBarRepresentation(); @@ -83,8 +83,8 @@ class vtkPVScalarBarRepresentation int WindowLocation; private: - vtkPVScalarBarRepresentation(const vtkPVScalarBarRepresentation&) VTK_DELETE_FUNCTION; - void operator=(const vtkPVScalarBarRepresentation&) VTK_DELETE_FUNCTION; + vtkPVScalarBarRepresentation(const vtkPVScalarBarRepresentation&) = delete; + void operator=(const vtkPVScalarBarRepresentation&) = delete; }; #endif // vtkPVScalarBarRepresentation diff --git a/imagejockey/paraviewscalarbar/vtkParaViewScalarBar.cpp b/imagejockey/paraviewscalarbar/vtkParaViewScalarBar.cpp index 5755d03b..dc88015b 100644 --- a/imagejockey/paraviewscalarbar/vtkParaViewScalarBar.cpp +++ b/imagejockey/paraviewscalarbar/vtkParaViewScalarBar.cpp @@ -182,7 +182,11 @@ void vtkParaViewScalarBar::SetTitle(const std::string& title) //---------------------------------------------------------------------------- const std::string& vtkParaViewScalarBar::GetTitle() { - (this->ScalarBarActor->GetTitle()) ? this->ScalarBarActor->GetTitle() : ""; + //this is necessary because this function returns a reference to an object + //that must live while the program is running (be it static, global, member or dynamically allocated) + static std::string local_non_temporary_string_object; + local_non_temporary_string_object = (this->ScalarBarActor->GetTitle()) ? this->ScalarBarActor->GetTitle() : ""; + return local_non_temporary_string_object; } //---------------------------------------------------------------------------- @@ -194,7 +198,11 @@ void vtkParaViewScalarBar::SetComponentTitle(const std::string& title) //---------------------------------------------------------------------------- const std::string& vtkParaViewScalarBar::GetComponentTitle() { - (this->ScalarBarActor->GetComponentTitle()) ? this->ScalarBarActor->GetComponentTitle() : ""; + //this is necessary because this function returns a reference to an object + //that must live while the program is running (be it static, global, member or dynamically allocated) + static std::string local_non_temporary_string_object; + local_non_temporary_string_object = (this->ScalarBarActor->GetComponentTitle()) ? this->ScalarBarActor->GetComponentTitle() : ""; + return local_non_temporary_string_object; } //---------------------------------------------------------------------------- diff --git a/imagejockey/wavelet/wavelettransformdialog.cpp b/imagejockey/wavelet/wavelettransformdialog.cpp index 5c372226..586dd018 100644 --- a/imagejockey/wavelet/wavelettransformdialog.cpp +++ b/imagejockey/wavelet/wavelettransformdialog.cpp @@ -18,7 +18,7 @@ VTK_MODULE_INIT(vtkRenderingFreeType) #include "imagejockey/ijabstractvariable.h" #include -#include +#include #include #include #include @@ -61,15 +61,15 @@ WaveletTransformDialog::WaveletTransformDialog(IJAbstractCartesianGrid *inputGri ui->splitter->setSizes(QList() << 100 << 200); ///-------------------setup the 3D viewer------------------- - _vtkwidget = new QVTKOpenGLWidget(); + _vtkwidget = new QVTKOpenGLNativeWidget(); _renderer = vtkSmartPointer::New(); // enable antialiasing _renderer->SetUseFXAA( true ); - _vtkwidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New()); - _vtkwidget->GetRenderWindow()->AddRenderer(_renderer); + _vtkwidget->setRenderWindow(vtkGenericOpenGLRenderWindow::New()); + _vtkwidget->renderWindow()->AddRenderer(_renderer); _vtkwidget->setFocusPolicy(Qt::StrongFocus); //----------------------adding the orientation axes------------------------- @@ -77,7 +77,7 @@ WaveletTransformDialog::WaveletTransformDialog(IJAbstractCartesianGrid *inputGri _vtkAxesWidget = vtkSmartPointer::New(); _vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300); _vtkAxesWidget->SetOrientationMarker(axes); - _vtkAxesWidget->SetInteractor(_vtkwidget->GetRenderWindow()->GetInteractor()); + _vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); _vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2); _vtkAxesWidget->SetEnabled(1); _vtkAxesWidget->InteractiveOn(); @@ -324,6 +324,16 @@ void WaveletTransformDialog::updateDisplay() vtkSmartPointer out = vtkSmartPointer::New(); ImageJockeyUtils::makeVTKImageDataFromSpectralArray( out, inputMirrorPaddedAsArray ); + //render the input grid at the correct location in space + out->SetOrigin( m_inputGrid->getOriginX(), + m_inputGrid->getOriginY(), + m_inputGrid->getOriginZ() ); + + //render the input grid with the correct cell sizes + out->SetSpacing ( m_inputGrid->getCellSizeI(), + m_inputGrid->getCellSizeJ(), + m_inputGrid->getCellSizeK() ); + //get max and min of input values for the color scale double colorScaleMin = m_inputGrid->getMin( m_inputVariableIndex ); double colorScaleMax = m_inputGrid->getMax( m_inputVariableIndex ); @@ -546,7 +556,8 @@ void WaveletTransformDialog::updateDisplay() vtkSmartPointer threshold = vtkSmartPointer::New(); { threshold->SetInputData( unstructuredGrid ); - threshold->ThresholdByUpper(1); // Criterion is cells whose flags are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); threshold->Update(); } @@ -605,7 +616,7 @@ void WaveletTransformDialog::updateDisplay() _renderer->AddActor( gridActor ); _currentActors.push_back( gridActor ); _renderer->ResetCamera(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void WaveletTransformDialog::onUpdateWaveletDisplays() diff --git a/imagejockey/wavelet/wavelettransformdialog.h b/imagejockey/wavelet/wavelettransformdialog.h index d4133a2a..7241dc0a 100644 --- a/imagejockey/wavelet/wavelettransformdialog.h +++ b/imagejockey/wavelet/wavelettransformdialog.h @@ -19,7 +19,7 @@ namespace QtCharts{ class IJAbstractCartesianGrid; class IJQuick3DViewer; -class QVTKOpenGLWidget; +class QVTKOpenGLNativeWidget; class vtkRenderer; class vtkOrientationMarkerWidget; class vtkPolyData; @@ -66,7 +66,7 @@ class WaveletTransformDialog : public QDialog ////////-----members used for 3D display------------------- // the Qt widget containing a VTK viewport - QVTKOpenGLWidget* _vtkwidget; + QVTKOpenGLNativeWidget* _vtkwidget; // the VTK renderer (add VTK actors to it to build the scene). vtkSmartPointer _renderer; // this must be class variable, otherwise a crash ensues due to smart pointer going diff --git a/imagejockey/widgets/grcompass.cpp b/imagejockey/widgets/grcompass.cpp index 7e55d364..14d0e08c 100644 --- a/imagejockey/widgets/grcompass.cpp +++ b/imagejockey/widgets/grcompass.cpp @@ -4,6 +4,8 @@ #include #include +#include + GRCompass::GRCompass(int style , QWidget *parent): QwtCompass( parent ) { diff --git a/imagejockey/widgets/ijquick3dviewer.cpp b/imagejockey/widgets/ijquick3dviewer.cpp index a691e1e1..11021686 100644 --- a/imagejockey/widgets/ijquick3dviewer.cpp +++ b/imagejockey/widgets/ijquick3dviewer.cpp @@ -11,7 +11,7 @@ VTK_MODULE_INIT(vtkRenderingFreeType) #include "../imagejockeyutils.h" #include "../../spectral/spectral.h" -#include +#include #include #include #include @@ -36,15 +36,15 @@ IJQuick3DViewer::IJQuick3DViewer( QWidget *parent ) : this->setWindowTitle("Quick 3D Viewer"); - _vtkwidget = new QVTKOpenGLWidget(); + _vtkwidget = new QVTKOpenGLNativeWidget(); _renderer = vtkSmartPointer::New(); // enable antialiasing _renderer->SetUseFXAA( true ); - _vtkwidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New()); - _vtkwidget->GetRenderWindow()->AddRenderer(_renderer); + _vtkwidget->setRenderWindow(vtkGenericOpenGLRenderWindow::New()); + _vtkwidget->renderWindow()->AddRenderer(_renderer); _vtkwidget->setFocusPolicy(Qt::StrongFocus); //----------------------adding the orientation axes------------------------- @@ -52,7 +52,7 @@ IJQuick3DViewer::IJQuick3DViewer( QWidget *parent ) : _vtkAxesWidget = vtkSmartPointer::New(); _vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300); _vtkAxesWidget->SetOrientationMarker(axes); - _vtkAxesWidget->SetInteractor(_vtkwidget->GetRenderWindow()->GetInteractor()); + _vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); _vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2); _vtkAxesWidget->SetEnabled(1); _vtkAxesWidget->InteractiveOn(); @@ -126,7 +126,7 @@ void IJQuick3DViewer::display(vtkPolyData* polyData , int r, int g, int b) _renderer->ResetCamera(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void IJQuick3DViewer::display(vtkPolyData *polyData, float pointSize) @@ -147,7 +147,7 @@ void IJQuick3DViewer::display(vtkPolyData *polyData, float pointSize) _renderer->ResetCamera(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void IJQuick3DViewer::display(vtkImageData * imageData, double colorScaleMin, double colorScaleMax ) @@ -176,7 +176,7 @@ void IJQuick3DViewer::display(vtkImageData * imageData, double colorScaleMin, do _renderer->ResetCamera(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void IJQuick3DViewer::display( const spectral::array & grid, double colorScaleMin, double colorScaleMax ) diff --git a/imagejockey/widgets/ijquick3dviewer.h b/imagejockey/widgets/ijquick3dviewer.h index 57367e04..ce120098 100644 --- a/imagejockey/widgets/ijquick3dviewer.h +++ b/imagejockey/widgets/ijquick3dviewer.h @@ -9,7 +9,7 @@ namespace Ui { class IJQuick3DViewer; } -class QVTKOpenGLWidget; +class QVTKOpenGLNativeWidget; class vtkRenderer; class vtkOrientationMarkerWidget; class vtkPolyData; @@ -61,7 +61,7 @@ class IJQuick3DViewer : public QWidget private: Ui::IJQuick3DViewer *ui; // the Qt widget containing a VTK viewport - QVTKOpenGLWidget *_vtkwidget; + QVTKOpenGLNativeWidget *_vtkwidget; // the VTK renderer (add VTK actors to it to build the scene). vtkSmartPointer _renderer; diff --git a/spatialindex/spatialindex.cpp b/spatialindex/spatialindex.cpp index 69676555..388b9ac3 100644 --- a/spatialindex/spatialindex.cpp +++ b/spatialindex/spatialindex.cpp @@ -556,7 +556,7 @@ QList SpatialIndex::getNearestFromCartesianGrid(const GridCell &gridCell, simulatedData ); //collect the data row indexes of the valued samples found. - for( const GridCellPtr& vCell : vCells ){ + for( GridCellPtr vCell : vCells ){ assert( vCell->_dataIndex >= 0 && "SpatialIndex::getNearestFromCartesianGrid(): tried to return invalid data index." ); result.push_back( vCell->_dataIndex ); } diff --git a/util.cpp b/util.cpp index 542b92f0..e6f25e09 100644 --- a/util.cpp +++ b/util.cpp @@ -1068,7 +1068,8 @@ void Util::importSettingsFromPreviousVersion() QSettings currentSettings; //The list of previous versions (order from latest to oldest version is advised) QStringList previousVersions; - previousVersions << "6.12" << "6.9" << "6.7" << "6.6" << "6.5" << "6.3" << "6.2" << "6.1" << "6.0" << "5.7.1" + previousVersions << "6.14" << "6.12" << "6.9" << "6.7" << "6.6" << "6.5" << "6.3" << "6.2" << "6.1" + << "6.0" << "5.7.1" << "5.7" << "5.5" << "5.3" << "5.1" << "5.0" << "4.9" << "4.7" << "4.5.1" << "4.5" << "4.3.3" << "4.3" << "4.0" << "3.8" << "3.6.1" << "3.6" << "3.5" << "3.2" << "3.0" << "2.7.2" << "2.7.1" << "2.7" << "2.5.1" << "2.5" << "2.4" << "2.3" << "2.2" << "2.1" diff --git a/viewer3d/view3dbuilders.cpp b/viewer3d/view3dbuilders.cpp index f976ef92..186136b1 100644 --- a/viewer3d/view3dbuilders.cpp +++ b/viewer3d/view3dbuilders.cpp @@ -752,7 +752,8 @@ View3DViewData View3DBuilders::buildForAttributeInMapCartesianGridWithVtkStructu // threshold to make unvalued cells invisible vtkSmartPointer threshold = vtkSmartPointer::New(); threshold->SetInputData(sg->GetOutput()); - threshold->ThresholdByUpper(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); threshold->Update(); @@ -989,7 +990,8 @@ View3DViewData View3DBuilders::buildForAttribute3DCartesianGridWithIJKClipping(C // threshold to make unvalued cells invisible vtkSmartPointer threshold = vtkSmartPointer::New(); threshold->SetInputData(subGrid->GetOutput()); - threshold->ThresholdByUpper(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); threshold->Update(); @@ -1142,8 +1144,9 @@ View3DViewData View3DBuilders::buildForAttributeGeoGrid( GeoGrid * geoGrid, Attr // threshold to make unvalued cells invisible vtkSmartPointer threshold = vtkSmartPointer::New(); threshold->SetInputData( unstructuredGrid ); - threshold->ThresholdByUpper(1); // Criterion is cells whose scalars are greater or equal to threshold. - threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); + threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); threshold->Update(); //create a color table according to variable type (continuous or categorical) @@ -1189,7 +1192,8 @@ View3DViewData View3DBuilders::buildForSurfaceCartesianGrid2D(CartesianGrid *car // threshold to make vertexes with unvalued Z's invisible vtkSmartPointer threshold = vtkSmartPointer::New(); threshold->SetInputData( unstructuredGrid ); - threshold->ThresholdByUpper(1); // Criterion is vertexes whose scalars are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "Visibility"); threshold->Update(); @@ -1241,7 +1245,8 @@ View3DViewData View3DBuilders::buildForSurfaceCartesianGrid2Dpainted(CartesianGr // threshold to make vertexes with unvalued Z's invisible vtkSmartPointer threshold = vtkSmartPointer::New(); threshold->SetInputData( unstructuredGrid ); - threshold->ThresholdByUpper(1); // Criterion is vertexes whose scalars are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "Visibility"); threshold->Update(); @@ -1368,7 +1373,8 @@ View3DViewData View3DBuilders::buildForAttributeSection(Section *section, Attrib // threshold to make unvalued cells invisible vtkSmartPointer threshold = vtkSmartPointer::New(); threshold->SetInputData( structuredGrid ); - threshold->ThresholdByUpper(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetUpperThreshold(1); // Criterion is cells whose scalars are greater or equal to threshold. + threshold->SetThresholdFunction( vtkThreshold::THRESHOLD_UPPER ); threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Visibility"); threshold->Update(); diff --git a/viewer3d/view3dwidget.cpp b/viewer3d/view3dwidget.cpp index d0c17832..30ac63de 100644 --- a/viewer3d/view3dwidget.cpp +++ b/viewer3d/view3dwidget.cpp @@ -10,7 +10,7 @@ VTK_MODULE_INIT(vtkRenderingFreeType) #include "ui_view3dwidget.h" #include "view3dwidget.h" -#include +#include #include #include @@ -32,6 +32,15 @@ VTK_MODULE_INIT(vtkRenderingFreeType) #include #include +//VTK 9: these headers are not directly required here, but necessary to avoid compiler conversion +// errors "from vtkSomeClass* to vtkObjectBase*" involving vtkSmartPointers elsewhere that somehow creep here. +#include +#include +#include +#include +#include +#include + #include "domain/application.h" #include "domain/project.h" #include "domain/projectcomponent.h" @@ -70,10 +79,10 @@ View3DWidget::View3DWidget(QWidget *parent) // MSAA aliasing (these must be BEFORE creating a QVTKOpenGLWidget. if( Util::programWasCalledWithCommandLineArgument("-aa=MSAA") ){ vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples ( 8 ); - QSurfaceFormat::setDefaultFormat ( QVTKOpenGLWidget::defaultFormat() ); + QSurfaceFormat::setDefaultFormat ( QVTKOpenGLNativeWidget::defaultFormat() ); } - _vtkwidget = new QVTKOpenGLWidget(); + _vtkwidget = new QVTKOpenGLNativeWidget(); //===========VTK TEST CODE========================================== // vtkSmartPointer sphereSource = @@ -123,14 +132,14 @@ View3DWidget::View3DWidget(QWidget *parent) _rendererForeground->SetActiveCamera( _rendererMainScene->GetActiveCamera() ); _rendererForeground->SetLayer( 1 ); //layers greater than zero have no background and are rendered last. - _vtkwidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New()); - _vtkwidget->GetRenderWindow()->AddRenderer(_rendererMainScene); - _vtkwidget->GetRenderWindow()->AddRenderer(_rendererForeground); + _vtkwidget->setRenderWindow(vtkGenericOpenGLRenderWindow::New()); + _vtkwidget->renderWindow()->AddRenderer(_rendererMainScene); + _vtkwidget->renderWindow()->AddRenderer(_rendererForeground); _vtkwidget->setFocusPolicy(Qt::StrongFocus); //MSAA aliasing if( Util::programWasCalledWithCommandLineArgument("-aa=MSAA")){ - _vtkwidget->GetRenderWindow()->SetMultiSamples( 4 ); + _vtkwidget->renderWindow()->SetMultiSamples( 4 ); } //----------------------adding the orientation axes------------------------- @@ -138,7 +147,7 @@ View3DWidget::View3DWidget(QWidget *parent) _vtkAxesWidget = vtkSmartPointer::New(); _vtkAxesWidget->SetOutlineColor(0.9300, 0.5700, 0.1300); _vtkAxesWidget->SetOrientationMarker(axes); - _vtkAxesWidget->SetInteractor(_vtkwidget->GetRenderWindow()->GetInteractor()); + _vtkAxesWidget->SetInteractor(_vtkwidget->renderWindow()->GetInteractor()); _vtkAxesWidget->SetViewport(0.0, 0.0, 0.2, 0.2); _vtkAxesWidget->SetEnabled(1); _vtkAxesWidget->InteractiveOn(); @@ -149,7 +158,7 @@ View3DWidget::View3DWidget(QWidget *parent) m_myInteractor = vtkSmartPointer::New(); m_myInteractor->setParentView3DWidget( this ); m_myInteractor->SetDefaultRenderer(_rendererMainScene); - _vtkwidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle( m_myInteractor ); + _vtkwidget->renderWindow()->GetInteractor()->SetInteractorStyle( m_myInteractor ); // Set callback for any event vtkSmartPointer callBackCommand = vtkSmartPointer::New(); @@ -163,8 +172,8 @@ View3DWidget::View3DWidget(QWidget *parent) _rendererMainScene->SetUseDepthPeeling(1); _rendererMainScene->SetOcclusionRatio(0.1); _rendererMainScene->SetMaximumNumberOfPeels(4); - _vtkwidget->GetRenderWindow()->SetMultiSamples(0); - _vtkwidget->GetRenderWindow()->SetAlphaBitPlanes(1); + _vtkwidget->renderWindow()->SetMultiSamples(0); + _vtkwidget->renderWindow()->SetAlphaBitPlanes(1); // adjusts view so everything fits in the screen _rendererMainScene->ResetCamera(); @@ -204,7 +213,7 @@ View3DWidget::View3DWidget(QWidget *parent) // Creates, but doesn't show, the distance measuring widget. m_distanceWidget = vtkSmartPointer::New(); - m_distanceWidget->SetInteractor( _vtkwidget->GetRenderWindow()->GetInteractor() ); + m_distanceWidget->SetInteractor( _vtkwidget->renderWindow()->GetInteractor() ); m_distanceWidget->CreateDefaultRepresentation(); static_cast(m_distanceWidget->GetRepresentation()) ->SetLabelFormat("%-#6.3f"); @@ -270,8 +279,8 @@ void View3DWidget::applyCurrentTextStyle(vtkSmartPointer(arg); + QVTKOpenGLNativeWidget *qvtkOGLwidget; // must point to the same object as View3DWidget's _vtkwidget. + qvtkOGLwidget = static_cast(arg); if( ! qvtkOGLwidget ){ Application::instance()->logWarn("View3DWidget::rendererCallback(): arg is not a QVTKOpenGLWidget. Check View3DWidget::_vtkwidget's class."); } else { @@ -313,7 +322,7 @@ void View3DWidget::onNewObject(const View3DListRecord object_info) } // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); // keeps a list of locator-actor pairs to allow management _currentObjects.insert(object_info, viewData); @@ -341,7 +350,7 @@ void View3DWidget::onRemoveObject(const View3DListRecord object_info) } // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); removeCurrentConfigWidget(); @@ -392,7 +401,7 @@ void View3DWidget::onShowHideObject(const View3DListRecord object_info, bool sho actor->SetVisibility( show ); // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onViewAll() @@ -400,7 +409,7 @@ void View3DWidget::onViewAll() // adjusts view so everything fits in the screen _rendererMainScene->ResetCamera(); // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onLookAtXY() @@ -414,7 +423,7 @@ void View3DWidget::onLookAtXY() _rendererMainScene->GetActiveCamera()->SetPosition(fp[0], fp[1], fp[2] + dist); _rendererMainScene->GetActiveCamera()->SetViewUp(0.0, 1.0, 0.0); // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onLookAtXZ() @@ -427,7 +436,7 @@ void View3DWidget::onLookAtXZ() _rendererMainScene->GetActiveCamera()->SetPosition(fp[0], fp[1] - dist, fp[2]); _rendererMainScene->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0); // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onLookAtYZ() @@ -440,7 +449,7 @@ void View3DWidget::onLookAtYZ() _rendererMainScene->GetActiveCamera()->SetPosition(fp[0] + dist, fp[1], fp[2]); _rendererMainScene->GetActiveCamera()->SetViewUp(0.0, 0.0, 1.0); // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onObjectsListItemActivated(QListWidgetItem *item) @@ -494,7 +503,7 @@ void View3DWidget::onConfigWidgetChanged() { Application::instance()->logInfo("View3DWidget::onConfigWidgetChanged()"); _rendererMainScene->Render(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onVerticalExaggeration() @@ -529,14 +538,14 @@ void View3DWidget::onVerticalExaggerationChanged(double value) // redraw the scene (none of these works :( ) { - _vtkwidget->GetRenderWindow()->GetInteractor()->Render(); - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->GetInteractor()->Render(); + _vtkwidget->renderWindow()->Render(); _vtkwidget->repaint(); QApplication::sendPostedEvents(); //this->parentWidget()->update(); _rendererMainScene->Modified(); _rendererMainScene->Render(); - vtkSmartPointer< vtkRenderWindow > renderWindow = _vtkwidget->GetRenderWindow(); + vtkSmartPointer< vtkRenderWindow > renderWindow = _vtkwidget->renderWindow(); renderWindow->Render(); renderWindow->Modified(); QApplication::processEvents(); @@ -578,7 +587,7 @@ void View3DWidget::onTextConfigChanged() } // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } void View3DWidget::onRuler() @@ -603,5 +612,5 @@ void View3DWidget::onProjection() ui->btnProjection->setIcon( QIcon(":icons32/v3DprojPer32") ); } // redraw the scene - _vtkwidget->GetRenderWindow()->Render(); + _vtkwidget->renderWindow()->Render(); } diff --git a/viewer3d/view3dwidget.h b/viewer3d/view3dwidget.h index a619bb25..f9cb2f19 100644 --- a/viewer3d/view3dwidget.h +++ b/viewer3d/view3dwidget.h @@ -18,7 +18,7 @@ namespace Ui class View3DWidget; } -class QVTKOpenGLWidget; +class QVTKOpenGLNativeWidget; class QListWidgetItem; class View3DConfigWidget; class View3DVerticalExaggerationWidget; @@ -56,7 +56,7 @@ class View3DWidget : public QWidget vtkSmartPointer _rendererForeground; // the Qt widget containing a VTK viewport - QVTKOpenGLWidget *_vtkwidget; + QVTKOpenGLNativeWidget *_vtkwidget; // the list of current VTK actors/visual objects indexed by their associated domain // object info.