diff --git a/CMake/FindQwt.cmake b/CMake/FindQwt.cmake index fc2f5254b1ba5d91bdfd54957a1073fff357e298..1c37f55eb89e8d34a759448e4fb60f7976943186 100644 --- a/CMake/FindQwt.cmake +++ b/CMake/FindQwt.cmake @@ -36,15 +36,15 @@ #============================================================================= # Copyright 2010-2013, Julien Schueller # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# +# modification, are permitted provided that the following conditions are met: +# # 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. +# list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. +# and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -58,17 +58,21 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # The views and conclusions contained in the software and documentation are those -# of the authors and should not be interpreted as representing official policies, +# of the authors and should not be interpreted as representing official policies, # either expressed or implied, of the FreeBSD Project. #============================================================================= +# message( "QWT_INCLUDE_DIR: '${QWT_INCLUDE_DIR}'" ) +# message( "QWT_INCLUDE_DIR: '${QT_INCLUDE_DIR}'" ) -find_path ( QWT_INCLUDE_DIR +find_path( QWT_INCLUDE_DIR NAMES qwt_plot.h - HINTS ${QT_INCLUDE_DIR} - PATH_SUFFIXES qwt qwt-qt3 qwt-qt4 qwt-qt5 + PATH_SUFFIXES qwt ) +# message( "QWT_INCLUDE_DIR: '${QWT_INCLUDE_DIR}'" ) +# message( "QWT_INCLUDE_DIR: '${QT_INCLUDE_DIR}'" ) + set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} ) # version @@ -100,7 +104,7 @@ endif () find_library ( QWT_LIBRARY - NAMES qwt qwt-qt3 qwt-qt4 qwt-qt5 qwt${QWT_MAJOR_VERSION} + NAMES qwt qwt${QWT_MAJOR_VERSION} HINTS ${QT_LIBRARY_DIR} ) @@ -126,7 +130,7 @@ endif () mark_as_advanced ( - QWT_LIBRARY + QWT_LIBRARY QWT_LIBRARIES QWT_INCLUDE_DIR QWT_INCLUDE_DIRS diff --git a/Modules/ThirdParty/Qwt/otb-module-init.cmake b/Modules/ThirdParty/Qwt/otb-module-init.cmake index 76973faeaf0e1895fd252326466003684d691837..1c341035fd5897ee92f150aa1c2aae98e7548e6e 100644 --- a/Modules/ThirdParty/Qwt/otb-module-init.cmake +++ b/Modules/ThirdParty/Qwt/otb-module-init.cmake @@ -20,8 +20,8 @@ find_package(Qwt REQUIRED) -if(NOT QWT_MAJOR_VERSION EQUAL 5) - message(FATAL_ERROR "Only Qwt 5 is supported. Found version ${QWT_VERSION_STRING}") +if(NOT QWT_MAJOR_VERSION EQUAL 6) + message(FATAL_ERROR "Only Qwt 6 is supported. Found version '${QWT_VERSION_STRING}'") endif() if(WIN32) diff --git a/Modules/Visualization/MonteverdiCore/src/ConfigureMonteverdi.h.in b/Modules/Visualization/MonteverdiCore/src/ConfigureMonteverdi.h.in index 0ec23e96f1004a511b922420a2a1ced1beeb4ecd..807403395c1cad59641389bb441c708447c0ec72 100644 --- a/Modules/Visualization/MonteverdiCore/src/ConfigureMonteverdi.h.in +++ b/Modules/Visualization/MonteverdiCore/src/ConfigureMonteverdi.h.in @@ -59,6 +59,9 @@ (OTB_VERSION_MAJOR==(M) && (OTB_VERSION_MINOR>(m) || \ OTB_VERSION_MINOR==(m) && OTB_VERSION_PATH>=(p)))) +// +#define QWT_IS_ABOVE_6_1 ( QWT_VERSION >= 0x060100 ) + // // Sub-directories #define Monteverdi_INSTALL_DATA_I18N_DIR Monteverdi_INSTALL_DATA_DIR "/i18n" diff --git a/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx b/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx index e8dbd777530c927cb5d6e6cc51e45a1b8fed3c63..3031c06805d825cb00cf272d419fb6dad8080d02 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx @@ -160,7 +160,7 @@ I18nCoreApplication // get the md5 of the filename QByteArray result = - QCryptographicHash::hash( fileInfo.absoluteFilePath().toAscii(), + QCryptographicHash::hash( fileInfo.absoluteFilePath().toAscii(), QCryptographicHash::Md5 ); // MD5 hash-code. @@ -606,7 +606,7 @@ I18nCoreApplication // Begin from the executable path QDir bin_dir( QDir::cleanPath(QCoreApplication::applicationDirPath()) ); - + // Go up in the directory hierarchy until we have a candidate install prefix bool prefixFound = false; QDir prefix( bin_dir ); @@ -618,7 +618,7 @@ I18nCoreApplication break; } } - + if( !prefixFound ) throw std::runtime_error( ToStdString( @@ -647,7 +647,7 @@ I18nCoreApplication else { m_IsRunningFromBuildDir = false; - + // Report found install prefix qDebug() << tr( "Running from install directory '%1'." ) diff --git a/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h b/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h index 6a6d797a3a79d7c10d41c925c5d957032ebeb8fe..7f574d738bd6ba392fc71c9223db745e16132dc9 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h @@ -161,7 +161,7 @@ protected: using QwtPlotPicker::trackerText; - QwtText trackerText( const QwtDoublePoint & ) const ITK_OVERRIDE; + QwtText trackerTextF( const QPointF & ) const ITK_OVERRIDE; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h index 48792934f9c72e45fce6c61649000fa4c096ee48..cbda62ba086fe927f73952018657d3474de0c7f3 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h @@ -37,8 +37,6 @@ // // Qwt includes. -#include <qwt_double_rect.h> -#include <qwt_polygon.h> // // System includes (sorted by alphabetic order) @@ -328,18 +326,18 @@ private slots: /** */ - void OnAppended( const QwtDoublePoint& pos ); - void OnAppended( const QPoint& pos ); + void OnAppended( const QPointF & ); + void OnAppended( const QPoint & ); - void OnChanged( const QwtPolygon& pa ); + void OnChanged( const QPolygon & ); - void OnMoved( const QwtDoublePoint&pos ); - void OnMoved( const QPoint& pos ); + void OnMoved( const QPointF & ); + void OnMoved( const QPoint & ); - void OnSelected( const QwtDoublePoint& pos ); - void OnSelected( const QwtDoubleRect& rect ); - void OnSelected( const QwtPolygon& pa ); - void OnSelected( const QwtArray< QwtDoublePoint >& pa ); + void OnSelected( const QPointF & ); + void OnSelected( const QRectF & ); + void OnSelected( const QPolygon & ); + void OnSelected( const QVector< QPointF > & ); }; } // end namespace 'mvd' diff --git a/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx b/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx index cfe43291a8e7e0744824952539bf79fddca65839..9f4bcca63df03bd8ac842f4e17619042bdc22af0 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx @@ -30,12 +30,26 @@ // // Qwt includes. + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wshadow" +#endif + #include <qwt_plot_curve.h> -#include <qwt_data.h> #include <qwt_painter.h> +#include <qwt_picker_machine.h> #include <qwt_plot.h> +#if QWT_IS_ABOVE_6_1 +# include <qwt_plot_canvas.h> +#endif // QWT_ABOVE_6_1 #include <qwt_text.h> +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic pop +#endif + // // System includes (sorted by alphabetic order) #include <cassert> @@ -83,7 +97,8 @@ HistogramPlotPicker { assert( m_PlotCurves.size()==HistogramPlotPicker::CURVE_COUNT ); - setSelectionFlags( QwtPicker::PointSelection ); + setStateMachine( new QwtPickerDragPointMachine() ); + setRubberBand( QwtPicker::UserRubberBand ); } @@ -101,7 +116,8 @@ HistogramPlotPicker { assert( m_PlotCurves.size()==HistogramPlotPicker::CURVE_COUNT ); - setSelectionFlags( QwtPicker::PointSelection ); + setStateMachine( new QwtPickerDragPointMachine() ); + setRubberBand( QwtPicker::UserRubberBand ); } @@ -115,7 +131,6 @@ HistogramPlotPicker QwtPlotPicker( xA, yA, - QwtPicker::PointSelection, QwtPicker::UserRubberBand, tracker, can ), @@ -124,6 +139,8 @@ HistogramPlotPicker m_IsGrayscaleActivated( false ) { assert( m_PlotCurves.size()==HistogramPlotPicker::CURVE_COUNT ); + + setStateMachine( new QwtPickerDragPointMachine() ); } /*******************************************************************************/ @@ -175,15 +192,24 @@ HistogramPlotPicker rubberBandPen().style()==Qt::NoPen ) return; - const QwtPolygon& pa = selection(); + const QPolygon & pa = selection(); if( rubberBand()==QwtPicker::UserRubberBand && - ( selectionFlags() & PointSelection ) && + // ( selectionType()==QwtPicker::PointSelection ) && selection().count() >= 1 ) { - const QRect& rect = pickRect(); +#if QWT_IS_ABOVE_6_1 + assert( parentWidget()!=nullptr ); + + const QRect & rect = parentWidget()->contentsRect(); + +#else // QWT_IS_ABOVE_6_1 + const QRect & rect = pickRect(); + +#endif //QWT_IS_ABOVE_6_1 + const QPoint& pos = pa[ 0 ]; - + QwtPainter::drawLine( painter, pos.x(), rect.bottom(), @@ -196,7 +222,7 @@ HistogramPlotPicker if( !RgbwBounds( start, stop, RGBW_CHANNEL_ALL ) ) return; - QwtDoublePoint p( invTransform( pos ) ); + QPointF p( invTransform( pos ) ); for( CountType i=start; i<stop; ++i ) if( m_PlotCurves[ i ]->isVisible() ) @@ -225,10 +251,10 @@ HistogramPlotPicker /*******************************************************************************/ QwtText HistogramPlotPicker -::trackerText( const QwtDoublePoint& point ) const +::trackerTextF( const QPointF & point ) const { if( rubberBand()!=QwtPicker::UserRubberBand ) - return QwtPlotPicker::trackerText( point ); + return QwtPlotPicker::trackerTextF( point ); if( !isActive() ) return QwtText( @@ -270,7 +296,11 @@ double HistogramPlotPicker ::Find( const QwtPlotCurve* curve, double x ) const { - const QwtData& data = curve->data(); + typedef QwtSeriesData< QPointF > SeriesData; + + const SeriesData * data = curve->data(); + + assert( data!=nullptr ); /* #if HISTOGRAM_CURVE_TYPE==0 @@ -282,42 +312,52 @@ HistogramPlotPicker #elif HISTOGRAM_CURVE_TYPE==2 */ - assert( data.size() % 4 == 0 ); + assert( data->size() % 4 == 0 ); CountType steps = 0; - if( data.size()==0 ) + if( data->size()==0 ) return -1.0; CountType i0 = 0; - CountType i1 = data.size() / 4 - 1; + CountType i1 = data->size() / 4 - 1; - // assert( x>=data.x( 4 * i0 ) && x<=data.x( 4 * i1 + 3 ) ); - if( x<data.x( 4 * i0 ) || x>data.x( 4 * i1 + 3 ) ) + // assert( x>=data->sample( 4 * i0 ).x() && x<=data->sample( 4 * i1 + 3 ).x() ); + if( x<data->sample( 4 * i0 ).x() || + x>data->sample( 4 * i1 + 3 ).x() ) return -1.0; while( i0!=i1 ) { - assert( data.x( 4 * i0 )==data.x( 4 * i0 + 1 ) ); - assert( data.x( 4 * i0 + 2 )==data.x( 4 * i0 + 3 ) ); - assert( data.y( 4 * i0 + 1 )==data.y( 4 * i0 + 2 ) ); - assert( data.y( 4 * i0 )==data.y( 4 * i0 + 3 ) ); + assert( data->sample( 4 * i0 ).x()==data->sample( 4 * i0 + 1 ).x() ); + assert( data->sample( 4 * i0 + 2 ).x()==data->sample( 4 * i0 + 3 ).x() ); + assert( data->sample( 4 * i0 + 1 ).y()==data->sample( 4 * i0 + 2 ).y() ); + assert( data->sample( 4 * i0 ).y()==data->sample( 4 * i0 + 3 ).y() ); - assert( data.x( 4 * i1 )==data.x( 4 * i1 + 1 ) ); - assert( data.x( 4 * i1 + 2 )==data.x( 4 * i1 + 3 ) ); - assert( data.y( 4 * i1 + 1 )==data.y( 4 * i1 + 2 ) ); - assert( data.y( 4 * i1 )==data.y( 4 * i1 + 3 ) ); + assert( data->sample( 4 * i1 ).x()==data->sample( 4 * i1 + 1 ).x() ); + assert( data->sample( 4 * i1 + 2 ).x()==data->sample( 4 * i1 + 3 ).x() ); + assert( data->sample( 4 * i1 + 1 ).y()==data->sample( 4 * i1 + 2 ).y() ); + assert( data->sample( 4 * i1 ).y()==data->sample( 4 * i1 + 3 ).y() ); CountType i = (i0 + i1 + 1) / 2; #if 0 qDebug() - << i0 << " (" << data.x( 4*i0 ) << ", " << data.x( 4*i0+2 ) << ") " - << i << " (" << data.x( 4*i ) << ", " << data.x( 4*i+2 ) << ") " - << i1 << " (" << data.x( 4*i1 ) << ", " << data.x( 4*i1+2 ) << ")"; + << i0 + << " (" << data->sample( 4*i0 ).x() + << ", " << data->sample( 4*i0+2 ).x() + << ") " + << i + << " (" << data->sample( 4*i ).x() + << ", " << data->sample( 4*i+2 ).x() + << ") " + << i1 + << " (" << data->sample( 4*i1 ).x() + << ", " << data->sample( 4*i1+2 ).x() + << ")"; #endif - if( x<data.x( 4 * i ) ) + if( x<data->sample( 4 * i ).x() ) i1 = i - 1; else i0 = i; @@ -325,17 +365,17 @@ HistogramPlotPicker ++ steps; } - assert( x>=data.x( 4 * i0 ) && x<=data.x( 4 * i0 + 2 ) ); - assert( x>=data.x( 4 * i0 + 1 ) && x<=data.x( 4 * i0 + 3 ) ); + assert( x>=data->sample( 4 * i0 ).x() && x<=data->sample( 4 * i0 + 2 ).x() ); + assert( x>=data->sample( 4 * i0 + 1 ).x() && x<=data->sample( 4 * i0 + 3 ).x() ); #if 0 qDebug() << steps << ":" - << x << "in [" << data.x( 4 * i0 ) << "; " << data.x( 4 * i0 + 2 ) << "] ->" - << data.y( 4 * i0 + 1 ); + << x << "in [" << data->sample( 4 * i0 ).x() << "; " << data->sample( 4 * i0 + 2 ).x() << "] ->" + << data->sample( 4 * i0 + 1 ).y(); #endif - return data.y( 4 * i0 + 1 ); + return data->sample( 4 * i0 + 1 ).y(); /* #else @@ -354,7 +394,11 @@ HistogramPlotPicker double& xmax, double& y ) const { - const QwtData& data = curve->data(); + typedef QwtSeriesData< QPointF > SeriesData; + + const SeriesData * data = curve->data(); + + assert( data!=nullptr ); /* #if HISTOGRAM_CURVE_TYPE==0 @@ -366,41 +410,51 @@ HistogramPlotPicker #elif HISTOGRAM_CURVE_TYPE==2 */ - assert( data.size() % 4 == 0 ); + assert( data->size() % 4 == 0 ); CountType steps = 0; - if( data.size()==0 ) + if( data->size()==0 ) return 0; CountType i0 = 0; - CountType i1 = data.size() / 4 - 1; + CountType i1 = data->size() / 4 - 1; - if( x<data.x( 4 * i0 ) || x>data.x( 4 * i1 + 3 ) ) + if( x<data->sample( 4 * i0 ).x() || + x>data->sample( 4 * i1 + 3 ).x() ) return 0; while( i0!=i1 ) { - assert( data.x( 4 * i0 )==data.x( 4 * i0 + 1 ) ); - assert( data.x( 4 * i0 + 2 )==data.x( 4 * i0 + 3 ) ); - assert( data.y( 4 * i0 + 1 )==data.y( 4 * i0 + 2 ) ); - assert( data.y( 4 * i0 )==data.y( 4 * i0 + 3 ) ); + assert( data->sample( 4 * i0 ).x()==data->sample( 4 * i0 + 1 ).x() ); + assert( data->sample( 4 * i0 + 2 ).x()==data->sample( 4 * i0 + 3 ).x() ); + assert( data->sample( 4 * i0 + 1 ).y()==data->sample( 4 * i0 + 2 ).y() ); + assert( data->sample( 4 * i0 ).y()==data->sample( 4 * i0 + 3 ).y() ); - assert( data.x( 4 * i1 )==data.x( 4 * i1 + 1 ) ); - assert( data.x( 4 * i1 + 2 )==data.x( 4 * i1 + 3 ) ); - assert( data.y( 4 * i1 + 1 )==data.y( 4 * i1 + 2 ) ); - assert( data.y( 4 * i1 )==data.y( 4 * i1 + 3 ) ); + assert( data->sample( 4 * i1 ).x()==data->sample( 4 * i1 + 1 ).x() ); + assert( data->sample( 4 * i1 + 2 ).x()==data->sample( 4 * i1 + 3 ).x() ); + assert( data->sample( 4 * i1 + 1 ).y()==data->sample( 4 * i1 + 2 ).y() ); + assert( data->sample( 4 * i1 ).y()==data->sample( 4 * i1 + 3 ).y() ); CountType i = (i0 + i1 + 1) / 2; #if 0 qDebug() - << i0 << " (" << data.x( 4*i0 ) << ", " << data.x( 4*i0+2 ) << ") " - << i << " (" << data.x( 4*i ) << ", " << data.x( 4*i+2 ) << ") " - << i1 << " (" << data.x( 4*i1 ) << ", " << data.x( 4*i1+2 ) << ")"; + << i0 + << " (" << data->sample( 4*i0 ).x() + << ", " << data->sample( 4*i0+2 ).x() + << ") " + << i + << " (" << data->sample( 4*i ).x() + << ", " << data->sample( 4*i+2 ).x() + << ") " + << i1 + << " (" << data->sample( 4*i1 ).x() + << ", " << data->sample( 4*i1+2 ).x() + << ")"; #endif - if( x<data.x( 4 * i ) ) + if( x<data->sample( 4 * i ).x() ) i1 = i - 1; else i0 = i; @@ -408,19 +462,19 @@ HistogramPlotPicker ++ steps; } - assert( x>=data.x( 4 * i0 ) && x<=data.x( 4 * i0 + 2 ) ); - assert( x>=data.x( 4 * i0 + 1 ) && x<=data.x( 4 * i0 + 3 ) ); + assert( x>=data->sample( 4 * i0 ).x() && x<=data->sample( 4 * i0 + 2 ).x() ); + assert( x>=data->sample( 4 * i0 + 1 ).x() && x<=data->sample( 4 * i0 + 3 ).x() ); #if 0 qDebug() << steps << ":" - << x << "in [" << data.x( 4 * i0 ) << "; " << data.x( 4 * i0 + 2 ) << "] ->" - << data.y( 4 * i0 + 1 ); + << x << "in [" << data->sample( 4 * i0 ).x() << "; " << data->sample( 4 * i0 + 2 ).x() << "] ->" + << data->sample( 4 * i0 + 1 ).y(); #endif - xmin = data.x( 4 * i0 ); - xmax = data.x( 4 * i0 + 2 ); - y = data.y( 4 * i0 + 1 ); + xmin = data->sample( 4 * i0 ).x(); + xmax = data->sample( 4 * i0 + 2 ).x(); + y = data->sample( 4 * i0 + 1 ).y(); return steps; diff --git a/Modules/Visualization/MonteverdiGui/src/mvdHistogramWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdHistogramWidget.cxx index fbb8e3f2102156f5bae88c952a4a8ce6e205c217..7caa68b8e7fcca7dd90cc849c596993c15af7807 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdHistogramWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdHistogramWidget.cxx @@ -19,8 +19,19 @@ */ #include "mvdHistogramWidget.h" + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wshadow" +#endif + #include "ui_mvdHistogramWidget.h" +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic pop +#endif + /*****************************************************************************/ /* INCLUDE SECTION */ @@ -33,18 +44,14 @@ // Qwt includes #if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#pragma GCC diagnostic ignored "-Wshadow" -#include <qwt_plot_curve.h> -#include <qwt_plot_grid.h> -#include <qwt_plot_magnifier.h> -#include <qwt_plot_marker.h> -#include <qwt_plot_panner.h> -// #include <qwt_plot_zoomer.h> -#include <qwt_scale_engine.h> -#pragma GCC diagnostic pop -#else +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wshadow" +#endif + +#if QWT_IS_ABOVE_6_1 +# include <qwt_plot_canvas.h> +#endif // QWT_IS_ABOVE_6_1 #include <qwt_plot_curve.h> #include <qwt_plot_grid.h> #include <qwt_plot_magnifier.h> @@ -52,7 +59,11 @@ #include <qwt_plot_panner.h> // #include <qwt_plot_zoomer.h> #include <qwt_scale_engine.h> + +#if defined(__GNUC__) || defined(__clang__) +# pragma GCC diagnostic pop #endif + // // System includes (sorted by alphabetic order) @@ -94,7 +105,7 @@ HistogramWidget::CURVE_NAMES[ HistogramWidget::CURVE_COUNT ] = QT_TRANSLATE_NOOP( "mvd::HistogramWidget", "Red" ), QT_TRANSLATE_NOOP( "mvd::HistogramWidget", "Green" ), QT_TRANSLATE_NOOP( "mvd::HistogramWidget", "Blue" ), - QT_TRANSLATE_NOOP( "mvd::HistogramWidget", "Gray" ), + QT_TRANSLATE_NOOP( "mvd::HistogramWidget", "Gray" ), }; const QColor @@ -151,7 +162,7 @@ const QColor RUBBER_BAND_COLOR( 0xFF, 0xFF, 0x00, 0xAA ); /*******************************************************************************/ HistogramWidget -::HistogramWidget( QWidget* p, Qt::WindowFlags flags ): +::HistogramWidget( QWidget* p, Qt::WindowFlags flags ) : QWidget( p, flags ), m_UI( new mvd::Ui::HistogramWidget() ), m_PlotGrid( NULL ), @@ -177,8 +188,14 @@ HistogramWidget m_PlotGrid = new QwtPlotGrid(); m_PlotGrid->attach( m_UI->histogramPlot ); +#if QWT_IS_ABOVE_6_1 + m_PlotGrid->setMajorPen( GRID_MAJ_PEN_COLOR ); + m_PlotGrid->setMinorPen( GRID_MIN_PEN_COLOR ); + +#else // QWT_IS_ABOVE_6_1 m_PlotGrid->setMajPen( GRID_MAJ_PEN_COLOR ); m_PlotGrid->setMinPen( GRID_MIN_PEN_COLOR ); +#endif // QWT_IS_ABOVE_6_1 // // ZOOMER. @@ -252,9 +269,22 @@ HistogramWidget // // PICKER. + assert( + dynamic_cast< QwtPlotCanvas * >( m_UI->histogramPlot->canvas() )!=nullptr + ); m_PlotPicker = - new HistogramPlotPicker( curves, m_UI->histogramPlot->canvas() ); + new HistogramPlotPicker( + curves, +#if QWT_IS_ABOVE_6_1 + dynamic_cast< QwtPlotCanvas * >( +#endif // QWT_IS_ABOVE_6_1 + m_UI->histogramPlot->canvas() +#if QWT_IS_ABOVE_6_1 + ) +#endif // QWT_IS_ABOVE_6_1 + ); + m_PlotPicker->setTrackerMode( QwtPicker::ActiveOnly ); m_PlotPicker->setRubberBandPen( RUBBER_BAND_COLOR ); m_PlotPicker->setTrackerPen( QColor( Qt::yellow ) ); @@ -273,8 +303,8 @@ HistogramWidget // // QObject::connect( - m_PlotPicker, SIGNAL( appended( const QwtDoublePoint& ) ), - this, SLOT( OnAppended( const QwtDoublePoint& ) ) + m_PlotPicker, SIGNAL( appended( const QPointF& ) ), + this, SLOT( OnAppended( const QPointF& ) ) ); QObject::connect( m_PlotPicker, SIGNAL( appended( const QPoint& ) ), @@ -282,25 +312,25 @@ HistogramWidget ); // QObject::connect( - m_PlotPicker, SIGNAL( changed( const QwtPolygon& ) ), - this, SLOT( OnChanged( const QwtPolygon& ) ) + m_PlotPicker, SIGNAL( changed( const QPolygon& ) ), + this, SLOT( OnChanged( const QPolygon& ) ) ); // QObject::connect( - m_PlotPicker, SIGNAL( selected( const QwtDoublePoint& ) ), - this, SLOT( OnSelected( const QwtDoublePoint& ) ) + m_PlotPicker, SIGNAL( selected( const QPointF& ) ), + this, SLOT( OnSelected( const QPointF& ) ) ); QObject::connect( - m_PlotPicker, SIGNAL( selected( const QwtDoubleRect& ) ), - this, SLOT( OnSelected( const QwtDoubleRect& ) ) + m_PlotPicker, SIGNAL( selected( const QRectF& ) ), + this, SLOT( OnSelected( const QRectF& ) ) ); QObject::connect( - m_PlotPicker, SIGNAL( selected( const QwtPolygon& ) ), - this, SLOT( OnSelected( const QwtPolygon& ) ) + m_PlotPicker, SIGNAL( selected( const QPolygon& ) ), + this, SLOT( OnSelected( const QPolygon& ) ) ); QObject::connect( - m_PlotPicker, SIGNAL( selected( const QwtArray< QwtDoublePoint >& ) ), - this, SLOT( OnSelected( const QwtArray< QwtDoublePoint >& ) ) + m_PlotPicker, SIGNAL( selected( const QVector< QPointF >& ) ), + this, SLOT( OnSelected( const QVector< QPointF >& ) ) ); } @@ -404,7 +434,7 @@ HistogramWidget assert( i<HistogramWidget::CURVE_COUNT ); assert( m_PlotCurves[ i ]!=NULL ); - m_PlotCurves[ i ]->setData( xVal, yVal, sizeVal ); + m_PlotCurves[ i ]->setSamples( xVal, yVal, sizeVal ); if( xVal==NULL && yVal==NULL ) m_PlotCurves[ i ]->setVisible( false ); @@ -486,7 +516,7 @@ HistogramWidget /* for( CountType i=0; i<HistogramWidget::CURVE_COUNT; ++i ) { - bool isVisible = + bool isVisible = i<RGBW_CHANNEL_WHITE ? !activated : activated; @@ -555,7 +585,7 @@ HistogramWidget ? i==RGBW_CHANNEL_WHITE : ( index==RGBW_CHANNEL_WHITE ? i<RGBW_CHANNEL_WHITE - : i==index ); + : i==index ); assert( i<HistogramWidget::CURVE_COUNT ); @@ -700,9 +730,9 @@ HistogramWidget /*******************************************************************************/ void HistogramWidget -::OnAppended( const QwtDoublePoint & ) +::OnAppended( const QPointF & ) { - // qDebug() << this << "::OnAppended(" << pos.x() << ", " << pos.y() << ")"; + // qDebug() << this << "::OnAppended(" << p << ")"; } /*******************************************************************************/ @@ -710,23 +740,23 @@ void HistogramWidget ::OnAppended( const QPoint & ) { - // qDebug() << this << "::OnAppended(" << pos << ")"; + // qDebug() << this << "::OnAppended(" << p << ")"; } /*******************************************************************************/ void HistogramWidget -::OnChanged( const QwtPolygon & ) +::OnChanged( const QPolygon & ) { - // qDebug() << this << "::OnChanged(" << pa << ")"; + // qDebug() << this << "::OnChanged(" << p << ")"; } /*******************************************************************************/ void HistogramWidget -::OnMoved( const QwtDoublePoint & ) +::OnMoved( const QPointF & ) { - // qDebug() << this << "::OnMoved(" << pos.x() << ", " << pos.y() << ")"; + // qDebug() << this << "::OnMoved(" << p << ")"; } /*******************************************************************************/ @@ -734,39 +764,39 @@ void HistogramWidget ::OnMoved( const QPoint & ) { - // qDebug() << this << "::OnMoved(" << pos << ")"; + // qDebug() << this << "::OnMoved(" << p << ")"; } /*******************************************************************************/ void HistogramWidget -::OnSelected( const QwtDoublePoint & ) +::OnSelected( const QPointF & ) { - // qDebug() << this << "::OnSelected(" << pos.x() << ", " << pos.y() << ")"; + // qDebug() << this << "::OnSelected(" << p << ")"; } /*******************************************************************************/ void HistogramWidget -::OnSelected( const QwtDoubleRect & ) +::OnSelected( const QRectF & ) { - // qDebug() << this << "::OnSelected(" << rect.x() << ", " << rect.y() << ")"; + // qDebug() << this << "::OnSelected(" << r << ")"; } /*******************************************************************************/ void HistogramWidget -::OnSelected( const QwtPolygon & ) +::OnSelected( const QPolygon & ) { - // qDebug() << this << "::OnSelected(" << pa << ")"; + // qDebug() << this << "::OnSelected(" << p << ")"; } /*******************************************************************************/ void HistogramWidget -::OnSelected( const QwtArray< QwtDoublePoint > & ) +::OnSelected( const QVector< QPointF > & ) { - // qDebug() << this << "::OnSelected(" << pa << ")"; + // qDebug() << this << "::OnSelected(" << v << ")"; } } // end namespace 'mvd' diff --git a/SuperBuild/CMake/External_qwt.cmake b/SuperBuild/CMake/External_qwt.cmake index e2b6e7c6e05fc8a5dce1bf1ae39c78a851dec517..8c2077615c8667d11a070299b376907263c2909a 100644 --- a/SuperBuild/CMake/External_qwt.cmake +++ b/SuperBuild/CMake/External_qwt.cmake @@ -36,36 +36,47 @@ configure_file(${CMAKE_SOURCE_DIR}/patches/QWT/qwtconfig.pri if(_SB_QT_QMAKE_EXECUTABLE) set(QWT_SB_CONFIGURE_PROGRAM ${_SB_QT_QMAKE_EXECUTABLE}) + elseif(QT_QMAKE_EXECUTABLE) set(QWT_SB_CONFIGURE_PROGRAM ${QT_QMAKE_EXECUTABLE}) + else() - set(QT_QMAKE_EXECUTABLE "" CACHE FILEPATH "Path to qmake executable") - message(FATAL_ERROR "Please set the qmake executable to use (QT_QMAKE_EXECUTABLE)") + find_program( QT_QMAKE_EXECUTABLE "qmake" ) + + if( NOT QT_QMAKE_EXECUTABLE ) + set(QT_QMAKE_EXECUTABLE "" CACHE FILEPATH "Path to qmake executable") + message(FATAL_ERROR "Please set the qmake executable to use (QT_QMAKE_EXECUTABLE)") + + else() + set( QWT_SB_CONFIGURE_PROGRAM ${QT_QMAKE_EXECUTABLE} ) + + endif() endif() ExternalProject_Add(QWT PREFIX QWT - URL "http://downloads.sourceforge.net/project/qwt/qwt/5.2.3/qwt-5.2.3.zip" - URL_MD5 310a1c8ab831f4b2219505dcb7691cf1 + URL "http://downloads.sourceforge.net/project/qwt/qwt/6.1.3/qwt-6.1.3.zip" + URL_MD5 558911df37aee4c0c3049860e967401c SOURCE_DIR ${QWT_SB_SRC} - BINARY_DIR ${QWT_SB_BUILD_DIR} + BINARY_DIR ${QWT_SB_SRC} INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} DEPENDS ${QWT_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy_directory ${QWT_SB_SRC} ${QWT_SB_BUILD_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/qwtconfig.pri ${QWT_SB_BUILD_DIR} - CONFIGURE_COMMAND ${QWT_SB_CONFIGURE_PROGRAM} ${QWT_SB_BUILD_DIR}/qwt.pro +PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/QWT/qwtconfig.pri ${QWT_SB_SRC} + CONFIGURE_COMMAND +${QWT_SB_CONFIGURE_PROGRAM} ${QWT_SB_SRC}/qwt.pro BUILD_COMMAND ${QWT_SB_MAKE_PROGRAM} - INSTALL_COMMAND ${QWT_SB_MAKE_PROGRAM} install - LOG_DOWNLOAD 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_INSTALL 1 + INSTALL_COMMAND ${QWT_SB_MAKE_PROGRAM} install INSTALL_ROOT=${SB_INSTALL_PREFIX} + LOG_CONFIGURE 0 + LOG_BUILD 0 + LOG_INSTALL 0 ) -set(_SB_QWT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) -if(WIN32) - set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/qwt5.lib) -elseif(UNIX) - set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libqwt${CMAKE_SHARED_LIBRARY_SUFFIX}) -endif() +#SUPERBUILD_PATCH_SOURCE(QWT) + +# set(_SB_QWT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +# if(WIN32) +# set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/qwt5.lib) +# elseif(UNIX) +# set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libqwt${CMAKE_SHARED_LIBRARY_SUFFIX}) +# endif() diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 4a6a28242a24ec484c1cd725b83ed54d869b7f20..ee0ee6ac9c29a0d3f5a45dc22571ae3799a4154f 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -100,7 +100,7 @@ endif() option(BUILD_EXAMPLES " Build the OTB Examples directory" OFF) option(USE_DEFAULT_INSTALL_PREFIX "Install superbuild to default prefix /usr/local for unix" OFF) - + #get version of OTB from source_dir/CMakeLists.txt get_version( INPUT_FILE "${CMAKE_SOURCE_DIR}/../CMakeLists.txt" @@ -394,4 +394,3 @@ endif() message(STATUS "SuperBuild will be installed to ${CMAKE_INSTALL_PREFIX}") message(STATUS "To install to a different directory, re-run cmake -DCMAKE_INSTALL_PREFIX=/your/preferred/path") - diff --git a/SuperBuild/patches/QWT/qwtconfig.pri b/SuperBuild/patches/QWT/qwtconfig.pri index f39b2c1cacd151704e0a2f1854a613a317482039..42035eb5b2604189188f1d7b6a35ccc433ee9c93 100644 --- a/SuperBuild/patches/QWT/qwtconfig.pri +++ b/SuperBuild/patches/QWT/qwtconfig.pri @@ -1,74 +1,70 @@ +################################################################ +# Qwt Widget Library +# Copyright (C) 1997 Josef Wilgen +# Copyright (C) 2002 Uwe Rathmann +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the Qwt License, Version 1.0 +################################################################ + +QWT_VER_MAJ = 6 +QWT_VER_MIN = 1 +QWT_VER_PAT = 3 +QWT_VERSION = $${QWT_VER_MAJ}.$${QWT_VER_MIN}.$${QWT_VER_PAT} + ###################################################################### # Install paths ###################################################################### -VER_MAJ = 5 -VER_MIN = 2 -VER_PAT = 3 -VERSION = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT} +#QWT_INSTALL_PREFIX = . unix { - INSTALLBASE = @SB_INSTALL_PREFIX@ + #QWT_INSTALL_PREFIX = @SB_INSTALL_PREFIX@ + # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-qt-$$QT_VERSION } win32 { - INSTALLBASE = @SB_INSTALL_PREFIX@ + # QWT_INSTALL_PREFIX = @SB_INSTALL_PREFIX@ + # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-qt-$$QT_VERSION } -target.path = $$INSTALLBASE/lib -headers.path = $$INSTALLBASE/include -doc.path = $$INSTALLBASE/doc +QWT_INSTALL_DOCS = $${QWT_INSTALL_PREFIX}/doc +QWT_INSTALL_HEADERS = $${QWT_INSTALL_PREFIX}/include +QWT_INSTALL_LIBS = $${QWT_INSTALL_PREFIX}/lib ###################################################################### -# qmake internal options +# Designer plugin +# creator/designer load designer plugins from certain default +# directories ( f.e the path below QT_INSTALL_PREFIX ) and the +# directories listed in the QT_PLUGIN_PATH environment variable. +# When using the path below QWT_INSTALL_PREFIX you need to +# add $${QWT_INSTALL_PREFIX}/plugins to QT_PLUGIN_PATH in the +# runtime environment of designer/creator. ###################################################################### -CONFIG += qt # Also for Qtopia Core! -CONFIG += warn_on -CONFIG += thread -CONFIG += silent - -###################################################################### -# release/debug mode -# If you want to build both DEBUG_SUFFIX and RELEASE_SUFFIX -# have to differ to avoid, that they overwrite each other. -###################################################################### +QWT_INSTALL_PLUGINS = $${QWT_INSTALL_PREFIX}/plugins/designer -VVERSION = $$[QT_VERSION] -isEmpty(VVERSION) { +# linux distributors often organize the Qt installation +# their way and QT_INSTALL_PREFIX doesn't offer a good +# path. Also QT_INSTALL_PREFIX is only one of the default +# search paths of the designer - not the Qt creator - # Qt 3 - CONFIG += release # release/debug -} -else { - # Qt 4 - win32 { - # On Windows you can't mix release and debug libraries. - # The designer is built in release mode. If you like to use it - # you need a release version. For your own application development you - # might need a debug version. - # Enable debug_and_release + build_all if you want to build both. - - CONFIG += release # release/debug/debug_and_release - #CONFIG += debug_and_release - #CONFIG += build_all - } - else { - CONFIG += release # release/debug - } -} +#QWT_INSTALL_PLUGINS = $$[QT_INSTALL_PREFIX]/plugins/designer ###################################################################### -# If you want to have different names for the debug and release -# versions you can add a suffix rule below. +# Features +# When building a Qwt application with qmake you might want to load +# the compiler/linker flags, that are required to build a Qwt application +# from qwt.prf. Therefore all you need to do is to add "CONFIG += qwt" +# to your project file and take care, that qwt.prf can be found by qmake. +# ( see http://doc.trolltech.com/4.7/qmake-advanced-usage.html#adding-new-configuration-features ) +# I recommend not to install the Qwt features together with the +# Qt features, because you will have to reinstall the Qwt features, +# with every Qt upgrade. ###################################################################### -DEBUG_SUFFIX = -RELEASE_SUFFIX = - -win32 { - DEBUG_SUFFIX = d -} +QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features +# QWT_INSTALL_FEATURES = $$[QT_INSTALL_PREFIX]/features ###################################################################### # Build the static/shared libraries. @@ -76,50 +72,104 @@ win32 { # it will be a static library. ###################################################################### -CONFIG += QwtDll +QWT_CONFIG += QwtDll ###################################################################### -# QwtPlot enables all classes, that are needed to use the QwtPlot -# widget. +# QwtPlot enables all classes, that are needed to use the QwtPlot +# widget. ###################################################################### -CONFIG += QwtPlot +QWT_CONFIG += QwtPlot ###################################################################### # QwtWidgets enables all classes, that are needed to use the all other -# widgets (sliders, dials, ...), beside QwtPlot. +# widgets (sliders, dials, ...), beside QwtPlot. ###################################################################### -CONFIG += QwtWidgets +QWT_CONFIG += QwtWidgets ###################################################################### -# If you want to display svg imageson the plot canvas, enable the -# line below. Note that Qwt needs the svg+xml, when enabling -# QwtSVGItem. +# If you want to display svg images on the plot canvas, or +# export a plot to a SVG document ###################################################################### -#CONFIG += QwtSVGItem +QWT_CONFIG += QwtSvg ###################################################################### -# You can use the MathML renderer of the Qt solutions package to -# enable MathML support in Qwt. # If you want this, copy -# qtmmlwidget.h + qtmmlwidget.cpp to # textengines/mathml and enable -# the line below. +# If you want to use a OpenGL plot canvas +###################################################################### + +QWT_CONFIG += QwtOpenGL + +###################################################################### +# You can use the MathML renderer of the Qt solutions package to +# enable MathML support in Qwt. Because of license implications +# the ( modified ) code of the MML Widget solution is included and +# linked together with the QwtMathMLTextEngine into an own library. +# To use it you will have to add "CONFIG += qwtmathml" +# to your qmake project file. ###################################################################### -#CONFIG += QwtMathML +#QWT_CONFIG += QwtMathML ###################################################################### -# If you want to build the Qwt designer plugin, +# If you want to build the Qwt designer plugin, # enable the line below. # Otherwise you have to build it from the designer directory. ###################################################################### -#CONFIG += QwtDesigner +QWT_CONFIG += QwtDesigner + +###################################################################### +# Compile all Qwt classes into the designer plugin instead +# of linking it against the shared Qwt library. Has no effect +# when QwtDesigner or QwtDll are not both enabled. +# +# On systems where rpath is supported ( all Unixoids ) the +# location of the installed Qwt library is compiled into the plugin, +# but on Windows it might be easier to have a self contained +# plugin to avoid any hassle with configuring the runtime +# environment of the designer/creator. +###################################################################### + +win32 { + QWT_CONFIG += QwtDesignerSelfContained +} ###################################################################### # If you want to auto build the examples, enable the line below # Otherwise you have to build them from the examples directory. ###################################################################### -#CONFIG += QwtExamples +#QWT_CONFIG += QwtExamples + +###################################################################### +# The playground is primarily intended for the Qwt development +# to explore and test new features. Nevertheless you might find +# ideas or code snippets that help for application development +# If you want to auto build the applications in playground, enable +# the line below. +# Otherwise you have to build them from the playground directory. +###################################################################### + +#QWT_CONFIG += QwtPlayground + +###################################################################### +# When Qt has been built as framework qmake wants +# to link frameworks instead of regular libs +###################################################################### + +macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) { + + QWT_CONFIG += QwtFramework +} + +###################################################################### +# Create and install pc files for pkg-config +# See http://www.freedesktop.org/wiki/Software/pkg-config/ +###################################################################### + +unix { + + #QWT_CONFIG += QwtPkgConfig +}