From c84821a138b3b1c3cd904298336301eb50c96fb6 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Mon, 16 Oct 2023 14:21:24 +0200 Subject: [PATCH 1/9] qwt updated --- .../Qt-Advanced-Docking/src/DockOverlay.cpp | 4 +- 3rdparty/qwt/src/qwt_abstract_scale_draw.cpp | 5 +- 3rdparty/qwt/src/qwt_date_scale_engine.cpp | 6 +- 3rdparty/qwt/src/qwt_global.h | 4 +- 3rdparty/qwt/src/qwt_picker.cpp | 41 +++-- 3rdparty/qwt/src/qwt_picker.h | 1 + 3rdparty/qwt/src/qwt_plot_curve.cpp | 139 +++++++++++++++- 3rdparty/qwt/src/qwt_plot_curve.h | 5 + 3rdparty/qwt/src/qwt_plot_opengl_canvas.cpp | 49 ++++-- 3rdparty/qwt/src/qwt_plot_opengl_canvas.h | 4 +- 3rdparty/qwt/src/qwt_point_data.h | 10 +- 3rdparty/qwt/src/qwt_series_data.cpp | 153 ------------------ 3rdparty/qwt/src/qwt_series_data.h | 79 +++------ 13 files changed, 248 insertions(+), 252 deletions(-) diff --git a/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp b/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp index f23a83458..384b5d068 100644 --- a/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp +++ b/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp @@ -806,10 +806,10 @@ void CDockOverlayCross::setIconColors(const QString& Colors) {"Arrow", CDockOverlayCross::ArrowColor}, {"Shadow", CDockOverlayCross::ShadowColor}}; - auto ColorList = Colors.split(' ', QString::SkipEmptyParts); + auto ColorList = Colors.split(' ', Qt::SkipEmptyParts); for (const auto& ColorListEntry : ColorList) { - auto ComponentColor = ColorListEntry.split('=', QString::SkipEmptyParts); + auto ComponentColor = ColorListEntry.split('=', Qt::SkipEmptyParts); int Component = ColorCompenentStringMap.value(ComponentColor[0], -1); if (Component < 0) { diff --git a/3rdparty/qwt/src/qwt_abstract_scale_draw.cpp b/3rdparty/qwt/src/qwt_abstract_scale_draw.cpp index abbcb91a0..8398b5816 100644 --- a/3rdparty/qwt/src/qwt_abstract_scale_draw.cpp +++ b/3rdparty/qwt/src/qwt_abstract_scale_draw.cpp @@ -374,7 +374,10 @@ double QwtAbstractScaleDraw::maxTickLength() const */ QwtText QwtAbstractScaleDraw::label( double value ) const { - return QLocale().toString( value ); + auto str = QLocale().toString( value, 'f', 6 ); + str.remove( QRegExp("0+$") ); // Remove any number of trailing 0's + str.remove( QRegExp("\\.$") ); // If the last character is just a '.' then remove it + return str; } /*! diff --git a/3rdparty/qwt/src/qwt_date_scale_engine.cpp b/3rdparty/qwt/src/qwt_date_scale_engine.cpp index 40aab4184..11acfcfc5 100644 --- a/3rdparty/qwt/src/qwt_date_scale_engine.cpp +++ b/3rdparty/qwt/src/qwt_date_scale_engine.cpp @@ -51,7 +51,11 @@ static double qwtIntervalWidth( const QDateTime& minDate, { case QwtDate::Millisecond: { - return minDate.msecsTo( maxDate ); + const double secsTo = minDate.secsTo( maxDate ); + const double msecs = maxDate.time().msec() - + minDate.time().msec(); + + return secsTo * 1000 + msecs; } case QwtDate::Second: { diff --git a/3rdparty/qwt/src/qwt_global.h b/3rdparty/qwt/src/qwt_global.h index c27a83ff0..aaf8ce0c9 100644 --- a/3rdparty/qwt/src/qwt_global.h +++ b/3rdparty/qwt/src/qwt_global.h @@ -14,8 +14,8 @@ // QWT_VERSION is (major << 16) + (minor << 8) + patch. -#define QWT_VERSION 0x060201 -#define QWT_VERSION_STR "6.2.1" +#define QWT_VERSION 0x060300 +#define QWT_VERSION_STR "6.3.0" #if defined( _MSC_VER ) /* MSVC Compiler */ /* template-class specialization 'identifier' is already instantiated */ diff --git a/3rdparty/qwt/src/qwt_picker.cpp b/3rdparty/qwt/src/qwt_picker.cpp index d55602c6a..000e0e403 100644 --- a/3rdparty/qwt/src/qwt_picker.cpp +++ b/3rdparty/qwt/src/qwt_picker.cpp @@ -825,9 +825,26 @@ QRect QwtPicker::trackerRect( const QFont& font ) const return QRect(); const QSizeF textSize = text.textSize( font ); - QRect textRect( 0, 0, qwtCeil( textSize.width() ), qwtCeil( textSize.height() ) ); + const int w = qwtCeil( textSize.width() ); + const int h = qwtCeil( textSize.height() ); + + return trackerRect( QSize( w, h ) ); +} + +/*! + Calculate the geometry of the tracker that is needed to display + information of a specific size at the tracker position + + \param size Size + \return Bounding rectangle of the tracker + + \sa trackerPosition() + */ +QRect QwtPicker::trackerRect( const QSize& size ) const +{ const QPoint& pos = m_data->trackerPosition; + QRect infoRect( 0, 0, size.width(), size.height() ); int alignment = 0; if ( isActive() && m_data->pickedPoints.count() > 1 @@ -840,13 +857,15 @@ QRect QwtPicker::trackerRect( const QFont& font ) const alignment |= ( pos.y() > last.y() ) ? Qt::AlignBottom : Qt::AlignTop; } else + { alignment = Qt::AlignTop | Qt::AlignRight; + } const int margin = 5; int x = pos.x(); if ( alignment & Qt::AlignLeft ) - x -= textRect.width() + margin; + x -= infoRect.width() + margin; else if ( alignment & Qt::AlignRight ) x += margin; @@ -854,21 +873,21 @@ QRect QwtPicker::trackerRect( const QFont& font ) const if ( alignment & Qt::AlignBottom ) y += margin; else if ( alignment & Qt::AlignTop ) - y -= textRect.height() + margin; + y -= infoRect.height() + margin; - textRect.moveTopLeft( QPoint( x, y ) ); + infoRect.moveTopLeft( QPoint( x, y ) ); const QRect pickRect = pickArea().boundingRect().toRect(); - int right = qMin( textRect.right(), pickRect.right() - margin ); - int bottom = qMin( textRect.bottom(), pickRect.bottom() - margin ); - textRect.moveBottomRight( QPoint( right, bottom ) ); + int right = qMin( infoRect.right(), pickRect.right() - margin ); + int bottom = qMin( infoRect.bottom(), pickRect.bottom() - margin ); + infoRect.moveBottomRight( QPoint( right, bottom ) ); - int left = qMax( textRect.left(), pickRect.left() + margin ); - int top = qMax( textRect.top(), pickRect.top() + margin ); - textRect.moveTopLeft( QPoint( left, top ) ); + int left = qMax( infoRect.left(), pickRect.left() + margin ); + int top = qMax( infoRect.top(), pickRect.top() + margin ); + infoRect.moveTopLeft( QPoint( left, top ) ); - return textRect; + return infoRect; } /*! diff --git a/3rdparty/qwt/src/qwt_picker.h b/3rdparty/qwt/src/qwt_picker.h index 84e67f94f..3af10124f 100644 --- a/3rdparty/qwt/src/qwt_picker.h +++ b/3rdparty/qwt/src/qwt_picker.h @@ -325,6 +325,7 @@ class QWT_EXPORT QwtPicker : public QObject, public QwtEventPattern const QwtWidgetOverlay* trackerOverlay() const; const QPolygon& pickedPoints() const; + QRect trackerRect( const QSize& ) const; private: void init( QWidget*, RubberBand rubberBand, DisplayMode trackerMode ); diff --git a/3rdparty/qwt/src/qwt_plot_curve.cpp b/3rdparty/qwt/src/qwt_plot_curve.cpp index 2aa7551b0..e7ee06632 100644 --- a/3rdparty/qwt/src/qwt_plot_curve.cpp +++ b/3rdparty/qwt/src/qwt_plot_curve.cpp @@ -453,6 +453,22 @@ void QwtPlotCurve::drawCurve( QPainter* painter, int style, case Dots: drawDots( painter, xMap, yMap, canvasRect, from, to ); break; + case LinesAndDots: { + if (testCurveAttribute(Fitted)) { + from = 0; + to = dataSize() - 1; + } + drawLines(painter, xMap, yMap, canvasRect, from, to); + + QPen prev_pen = painter->pen(); + QPen new_pen = prev_pen; + new_pen.setWidth(prev_pen.width() * 3); + + painter->setPen(new_pen); + drawDots(painter, xMap, yMap, canvasRect, from, to); + painter->setPen(prev_pen); + } break; + case NoCurve: default: break; @@ -1044,7 +1060,7 @@ double QwtPlotCurve::baseline() const \param pos Position, where to look for the closest curve point \param dist If dist != NULL, closestPoint() returns the distance between - the position and the closest curve point + the position and the closest curve point in paint device coordinates \return Index of the closest curve point, or -1 if none can be found ( f.e when the curve has no points ) \note closestPoint() implements a dumb algorithm, that iterates @@ -1089,6 +1105,127 @@ int QwtPlotCurve::closestPoint( const QPointF& pos, double* dist ) const return index; } +/*! + Find the curve point with the smallest coordinate larger than a specific value + The coordinates have to be monotonic in direction of the orientation. + + \param orientation Qt::Horizontal corresponds to x, Qt::Vertical to y coordinates + \param value x or y coordinate, depending on the orientation + + \return Index of the curve point with the smalles coordinate above value + or -1 if there is none. + + \note The implementation uses a binary search algorithm and requires the + points being ordered in direction of the orientation. + + \sa qwtUpperSampleIndex() + */ +int QwtPlotCurve::adjacentPoint( Qt::Orientation orientation, qreal value ) const +{ + const QwtSeriesData< QPointF >* data = this->data(); + if ( data == nullptr ) + return -1; + + if ( orientation == Qt::Horizontal ) + { + struct compareX + { + inline bool operator()( const double x, const QPointF& pos ) const + { + return ( x < pos.x() ); + } + }; + + return qwtUpperSampleIndex< QPointF >( *data, value, compareX() ); + } + else + { + struct compareY + { + inline bool operator()( const double y, const QPointF& pos ) const + { + return ( y < pos.y() ); + } + }; + + return qwtUpperSampleIndex< QPointF >( *data, value, compareY() ); + } + + return -1; +} + +/*! + Calculate a fictive curve point by interpolating between the adjacent + points. The curve points have to be monotonic in direction of the orientation. + + \param orientation For Qt::Horizontal value is a x coordinate and a y coordinate + is returned. For Qt::Vertical value is a x coordinate + \param value x or y coordinate, depending on the orientation + + \return Interpolated coordinate or qQNaN() if value is outside the bounding + rectangle of the curve + + \note The implementation uses a binary search algorithm and requires the + points being ordered in direction of the orientation. + + \sa adjacentPoint() + */ +qreal QwtPlotCurve::interpolatedValueAt( Qt::Orientation orientation, double value ) const +{ + const QRectF br = boundingRect(); + if ( br.width() <= 0.0 ) + return qQNaN(); + + double v; + + if ( orientation == Qt::Horizontal ) + { + if ( value < br.left() || value > br.right() ) + return qQNaN(); + + const int index = adjacentPoint( orientation, value ); + + if ( index == -1 ) + { + const QPointF last = sample( dataSize() - 1 ); + + if ( value != last.x() ) + return qQNaN(); + + v = last.y(); + } + else + { + const QLineF line( sample( index - 1 ), sample( index ) ); + v = line.pointAt( ( value - line.p1().x() ) / line.dx() ).y(); + } + } + else + { + if ( value < br.top() || value > br.bottom() ) + return qQNaN(); + + const int index = adjacentPoint( orientation, value ); + + if ( index == -1 ) + { + const QPointF last = sample( dataSize() - 1 ); + + if ( value != last.y() ) + return qQNaN(); + + v = last.x(); + } + else + { + const QLineF line( sample( index - 1 ), sample( index ) ); + v = line.pointAt( ( value - line.p1().y() ) / line.dy() ).x(); + } + } + + return v; +} + /*! \return Icon representing the curve on the legend diff --git a/3rdparty/qwt/src/qwt_plot_curve.h b/3rdparty/qwt/src/qwt_plot_curve.h index d9e472832..c55f4d013 100644 --- a/3rdparty/qwt/src/qwt_plot_curve.h +++ b/3rdparty/qwt/src/qwt_plot_curve.h @@ -97,6 +97,8 @@ class QWT_EXPORT QwtPlotCurve */ Dots, + LinesAndDots, + /*! Styles >= QwtPlotCurve::UserCurve are reserved for derived classes of QwtPlotCurve that overload drawCurve() with @@ -271,6 +273,9 @@ class QWT_EXPORT QwtPlotCurve void setSamples( QwtSeriesData< QPointF >* ); virtual int closestPoint( const QPointF& pos, double* dist = NULL ) const; + virtual int adjacentPoint( Qt::Orientation orientation, qreal value ) const; + + qreal interpolatedValueAt( Qt::Orientation, double ) const; double minXValue() const; double maxXValue() const; diff --git a/3rdparty/qwt/src/qwt_plot_opengl_canvas.cpp b/3rdparty/qwt/src/qwt_plot_opengl_canvas.cpp index 1c63f4d3a..d022af04a 100644 --- a/3rdparty/qwt/src/qwt_plot_opengl_canvas.cpp +++ b/3rdparty/qwt/src/qwt_plot_opengl_canvas.cpp @@ -21,7 +21,8 @@ class QwtPlotOpenGLCanvas::PrivateData { public: PrivateData() - : isPolished( false ) + : numFBOSamples( -1 ) + , isPolished( false ) , fboDirty( true ) , fbo( NULL ) { @@ -32,7 +33,7 @@ class QwtPlotOpenGLCanvas::PrivateData delete fbo; } - int numSamples; + int numFBOSamples; bool isPolished; bool fboDirty; @@ -49,33 +50,36 @@ QwtPlotOpenGLCanvas::QwtPlotOpenGLCanvas( QwtPlot* plot ) : QOpenGLWidget( plot ) , QwtPlotAbstractGLCanvas( this ) { - QSurfaceFormat fmt = format(); - fmt.setSamples( 4 ); - - init( fmt ); + init(); } /*! \brief Constructor - \param format OpenGL surface format + \param int Number of samples, see QSurfaceFormat::samples() \param plot Parent plot widget \sa QwtPlot::setCanvas() */ -QwtPlotOpenGLCanvas::QwtPlotOpenGLCanvas( - const QSurfaceFormat& format, QwtPlot* plot ) +QwtPlotOpenGLCanvas::QwtPlotOpenGLCanvas( int numSamples, QwtPlot* plot ) : QOpenGLWidget( plot ) , QwtPlotAbstractGLCanvas( this ) { - init( format ); + if ( numSamples < -1 ) + numSamples = -1; + + QSurfaceFormat fmt = format(); + if ( numSamples != fmt.samples() ) + { + fmt.setSamples( numSamples ); + setFormat( fmt ); + } + + init(); } -void QwtPlotOpenGLCanvas::init( const QSurfaceFormat& format ) +void QwtPlotOpenGLCanvas::init() { m_data = new PrivateData; - m_data->numSamples = format.samples(); - - setFormat( format ); #if 1 setAttribute( Qt::WA_OpaquePaintEvent, true ); @@ -111,6 +115,19 @@ void QwtPlotOpenGLCanvas::paintEvent( QPaintEvent* event ) */ bool QwtPlotOpenGLCanvas::event( QEvent* event ) { + if ( event->type() == QEvent::Resize ) + { + if ( m_data->numFBOSamples < 0 ) + { + /* + QOpenGLWidget always uses a FBO and sets the number of samples for + the FBO not for the widget itself. So format().samples() does not + return the correct value after the first QEvent::Resize. + */ + m_data->numFBOSamples = qMax( format().samples(), 0 ); + } + } + const bool ok = QOpenGLWidget::event( event ); if ( event->type() == QEvent::PolishRequest ) @@ -214,9 +231,11 @@ void QwtPlotOpenGLCanvas::paintGL() if ( m_data->fbo == NULL ) { QOpenGLFramebufferObjectFormat fboFormat; - fboFormat.setSamples( m_data->numSamples ); fboFormat.setAttachment( QOpenGLFramebufferObject::CombinedDepthStencil ); + if ( m_data->numFBOSamples > 0 ) + fboFormat.setSamples( m_data->numFBOSamples ); + m_data->fbo = new QOpenGLFramebufferObject( fboSize, fboFormat ); m_data->fboDirty = true; } diff --git a/3rdparty/qwt/src/qwt_plot_opengl_canvas.h b/3rdparty/qwt/src/qwt_plot_opengl_canvas.h index a89bbb0db..32f3f8c6d 100644 --- a/3rdparty/qwt/src/qwt_plot_opengl_canvas.h +++ b/3rdparty/qwt/src/qwt_plot_opengl_canvas.h @@ -46,7 +46,7 @@ class QWT_EXPORT QwtPlotOpenGLCanvas : public QOpenGLWidget, public QwtPlotAbstr public: explicit QwtPlotOpenGLCanvas( QwtPlot* = NULL ); - explicit QwtPlotOpenGLCanvas( const QSurfaceFormat&, QwtPlot* = NULL); + explicit QwtPlotOpenGLCanvas( int samples, QwtPlot* = NULL); virtual ~QwtPlotOpenGLCanvas(); Q_INVOKABLE virtual void invalidateBackingStore() QWT_OVERRIDE; @@ -65,7 +65,7 @@ class QWT_EXPORT QwtPlotOpenGLCanvas : public QOpenGLWidget, public QwtPlotAbstr virtual void resizeGL( int width, int height ) QWT_OVERRIDE; private: - void init( const QSurfaceFormat& ); + void init(); virtual void clearBackingStore() QWT_OVERRIDE; class PrivateData; diff --git a/3rdparty/qwt/src/qwt_point_data.h b/3rdparty/qwt/src/qwt_point_data.h index cfda18dbf..8105c400d 100644 --- a/3rdparty/qwt/src/qwt_point_data.h +++ b/3rdparty/qwt/src/qwt_point_data.h @@ -19,7 +19,7 @@ \brief Interface for iterating over two QVector objects. */ template< typename T > -class QwtPointArrayData : public QwtPointSeriesData +class QwtPointArrayData : public QwtSeriesData< QPointF > { public: QwtPointArrayData( const QVector< T >& x, const QVector< T >& y ); @@ -40,7 +40,7 @@ class QwtPointArrayData : public QwtPointSeriesData \brief Data class containing two pointers to memory blocks of T. */ template< typename T > -class QwtCPointerData : public QwtPointSeriesData +class QwtCPointerData : public QwtSeriesData< QPointF > { public: QwtCPointerData( const T* x, const T* y, size_t size ); @@ -64,7 +64,7 @@ class QwtCPointerData : public QwtPointSeriesData interpreted as x coordinate. */ template< typename T > -class QwtValuePointData : public QwtPointSeriesData +class QwtValuePointData : public QwtSeriesData< QPointF > { public: QwtValuePointData( const QVector< T >& y ); @@ -86,7 +86,7 @@ class QwtValuePointData : public QwtPointSeriesData interpreted as x coordinate. */ template< typename T > -class QwtCPointerValueData : public QwtPointSeriesData +class QwtCPointerValueData : public QwtSeriesData< QPointF > { public: QwtCPointerValueData( const T* y, size_t size ); @@ -154,7 +154,7 @@ class QwtCPointerValueData : public QwtPointSeriesData } \endcode */ -class QWT_EXPORT QwtSyntheticPointData : public QwtPointSeriesData +class QWT_EXPORT QwtSyntheticPointData : public QwtSeriesData< QPointF > { public: QwtSyntheticPointData( size_t size, diff --git a/3rdparty/qwt/src/qwt_series_data.cpp b/3rdparty/qwt/src/qwt_series_data.cpp index 0efc97ef2..b727b8ec0 100644 --- a/3rdparty/qwt/src/qwt_series_data.cpp +++ b/3rdparty/qwt/src/qwt_series_data.cpp @@ -242,156 +242,3 @@ QRectF qwtBoundingRect( { return qwtBoundingRectT< QwtVectorFieldSample >( series, from, to ); } - -/*! - Constructor - \param samples Samples - */ -QwtPointSeriesData::QwtPointSeriesData( const QVector< QPointF >& samples ) - : QwtArraySeriesData< QPointF >( samples ) -{ -} - -/*! - \brief Calculate the bounding rectangle - - The bounding rectangle is calculated once by iterating over all - points and is stored for all following requests. - - \return Bounding rectangle - */ -QRectF QwtPointSeriesData::boundingRect() const -{ - if ( cachedBoundingRect.width() < 0.0 ) - cachedBoundingRect = qwtBoundingRect( *this ); - - return cachedBoundingRect; -} - -/*! - Constructor - \param samples Samples - */ -QwtPoint3DSeriesData::QwtPoint3DSeriesData( - const QVector< QwtPoint3D >& samples ) - : QwtArraySeriesData< QwtPoint3D >( samples ) -{ -} - -/*! - \brief Calculate the bounding rectangle - - The bounding rectangle is calculated once by iterating over all - points and is stored for all following requests. - - \return Bounding rectangle - */ -QRectF QwtPoint3DSeriesData::boundingRect() const -{ - if ( cachedBoundingRect.width() < 0.0 ) - cachedBoundingRect = qwtBoundingRect( *this ); - - return cachedBoundingRect; -} - -/*! - Constructor - \param samples Samples - */ -QwtIntervalSeriesData::QwtIntervalSeriesData( - const QVector< QwtIntervalSample >& samples ) - : QwtArraySeriesData< QwtIntervalSample >( samples ) -{ -} - -/*! - \brief Calculate the bounding rectangle - - The bounding rectangle is calculated once by iterating over all - points and is stored for all following requests. - - \return Bounding rectangle - */ -QRectF QwtIntervalSeriesData::boundingRect() const -{ - if ( cachedBoundingRect.width() < 0.0 ) - cachedBoundingRect = qwtBoundingRect( *this ); - - return cachedBoundingRect; -} - -/*! - Constructor - \param samples Samples - */ -QwtVectorFieldData::QwtVectorFieldData( - const QVector< QwtVectorFieldSample >& samples ) - : QwtArraySeriesData< QwtVectorFieldSample >( samples ) -{ -} - -/*! - \brief Calculate the bounding rectangle - - The bounding rectangle is calculated once by iterating over all - points and is stored for all following requests. - - \return Bounding rectangle - */ -QRectF QwtVectorFieldData::boundingRect() const -{ - if ( cachedBoundingRect.width() < 0.0 ) - cachedBoundingRect = qwtBoundingRect( *this ); - - return cachedBoundingRect; -} - -/*! - Constructor - \param samples Samples - */ -QwtSetSeriesData::QwtSetSeriesData( const QVector< QwtSetSample >& samples ) - : QwtArraySeriesData< QwtSetSample >( samples ) -{ -} - -/*! - \brief Calculate the bounding rectangle - - The bounding rectangle is calculated once by iterating over all - points and is stored for all following requests. - - \return Bounding rectangle - */ -QRectF QwtSetSeriesData::boundingRect() const -{ - if ( cachedBoundingRect.width() < 0.0 ) - cachedBoundingRect = qwtBoundingRect( *this ); - - return cachedBoundingRect; -} - -/*! - Constructor - \param samples Samples - */ -QwtTradingChartData::QwtTradingChartData( const QVector< QwtOHLCSample >& samples ) - : QwtArraySeriesData< QwtOHLCSample >( samples ) -{ -} - -/*! - \brief Calculate the bounding rectangle - - The bounding rectangle is calculated once by iterating over all - points and is stored for all following requests. - - \return Bounding rectangle - */ -QRectF QwtTradingChartData::boundingRect() const -{ - if ( cachedBoundingRect.width() < 0.0 ) - cachedBoundingRect = qwtBoundingRect( *this ); - - return cachedBoundingRect; -} diff --git a/3rdparty/qwt/src/qwt_series_data.h b/3rdparty/qwt/src/qwt_series_data.h index f0d65a80e..d6d534cea 100644 --- a/3rdparty/qwt/src/qwt_series_data.h +++ b/3rdparty/qwt/src/qwt_series_data.h @@ -67,6 +67,12 @@ class QwtSeriesData */ virtual T sample( size_t i ) const = 0; +#else + // Needed for generating the python bindings, but not for using them ! + virtual size_t size() const { return 0; } + virtual T sample( size_t i ) const { return T(); } +#endif + /*! Calculate the bounding rect of all samples @@ -75,18 +81,17 @@ class QwtSeriesData qwtBoundingRect(...) offers slow implementations iterating over the samples. For large sets it is recommended to implement - something faster f.e. by caching the bounding rectangle. + something faster. \return Bounding rectangle */ - virtual QRectF boundingRect() const = 0; + virtual QRectF boundingRect() const + { + if ( cachedBoundingRect.width() < 0.0 ) + cachedBoundingRect = qwtBoundingRect( *this ); -#else - // Needed for generating the python bindings, but not for using them ! - virtual size_t size() const { return 0; } - virtual T sample( size_t i ) const { return T(); } - virtual QRectF boundingRect() const { return cachedBoundingRect; } -#endif + return cachedBoundingRect; + } /*! Set a the "rect of interest" @@ -206,66 +211,22 @@ T QwtArraySeriesData< T >::sample( size_t i ) const } //! Interface for iterating over an array of points -class QWT_EXPORT QwtPointSeriesData : public QwtArraySeriesData< QPointF > -{ - public: - QwtPointSeriesData( - const QVector< QPointF >& = QVector< QPointF >( ) ); - - virtual QRectF boundingRect() const QWT_OVERRIDE; -}; +typedef QwtArraySeriesData< QPointF > QwtPointSeriesData; //! Interface for iterating over an array of 3D points -class QWT_EXPORT QwtPoint3DSeriesData : public QwtArraySeriesData< QwtPoint3D > -{ - public: - QwtPoint3DSeriesData( - const QVector< QwtPoint3D >& = QVector< QwtPoint3D >( ) ); - - virtual QRectF boundingRect() const QWT_OVERRIDE; -}; +typedef QwtArraySeriesData< QwtPoint3D > QwtPoint3DSeriesData; //! Interface for iterating over an array of intervals -class QWT_EXPORT QwtIntervalSeriesData : public QwtArraySeriesData< QwtIntervalSample > -{ - public: - QwtIntervalSeriesData( - const QVector< QwtIntervalSample >& = QVector< QwtIntervalSample >( ) ); - - virtual QRectF boundingRect() const QWT_OVERRIDE; -}; +typedef QwtArraySeriesData< QwtIntervalSample > QwtIntervalSeriesData; //! Interface for iterating over an array of samples -class QWT_EXPORT QwtSetSeriesData : public QwtArraySeriesData< QwtSetSample > -{ - public: - QwtSetSeriesData( - const QVector< QwtSetSample >& = QVector< QwtSetSample >( ) ); - - virtual QRectF boundingRect() const QWT_OVERRIDE; -}; +typedef QwtArraySeriesData< QwtSetSample > QwtSetSeriesData; //! Interface for iterating over an array of vector field samples -class QWT_EXPORT QwtVectorFieldData : public QwtArraySeriesData< QwtVectorFieldSample > -{ - public: - QwtVectorFieldData( - const QVector< QwtVectorFieldSample >& = QVector< QwtVectorFieldSample >( ) ); - - virtual QRectF boundingRect() const QWT_OVERRIDE; -}; +typedef QwtArraySeriesData< QwtVectorFieldSample > QwtVectorFieldData; -/*! - Interface for iterating over an array of OHLC samples - */ -class QWT_EXPORT QwtTradingChartData : public QwtArraySeriesData< QwtOHLCSample > -{ - public: - QwtTradingChartData( - const QVector< QwtOHLCSample >& = QVector< QwtOHLCSample >( ) ); - - virtual QRectF boundingRect() const QWT_OVERRIDE; -}; +//! Interface for iterating over an array of OHLC samples +typedef QwtArraySeriesData< QwtOHLCSample > QwtTradingChartData; QWT_EXPORT QRectF qwtBoundingRect( const QwtSeriesData< QPointF >&, int from = 0, int to = -1 ); From 4ba24c591a9a84fbfb6c0329b787d73f98a2b23b Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Mon, 16 Oct 2023 14:21:38 +0200 Subject: [PATCH 2/9] fix some warnings --- plotjuggler_app/curvelist_panel.cpp | 2 +- plotjuggler_app/curvetree_view.cpp | 6 +++--- plotjuggler_app/main.cpp | 2 +- plotjuggler_app/mainwindow.cpp | 10 +++++----- plotjuggler_app/plot_docker.cpp | 2 +- plotjuggler_app/transforms/function_editor.cpp | 2 +- plotjuggler_app/tree_completer.h | 2 +- plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plotjuggler_app/curvelist_panel.cpp b/plotjuggler_app/curvelist_panel.cpp index 9abf72e9d..445e91d66 100644 --- a/plotjuggler_app/curvelist_panel.cpp +++ b/plotjuggler_app/curvelist_panel.cpp @@ -407,7 +407,7 @@ QString StringifyArray(QString str) QString CurveListPanel::getTreeName(QString name) { - auto parts = name.split('/', QString::SplitBehavior::SkipEmptyParts); + auto parts = name.split('/', Qt::SkipEmptyParts); QString out; for (int i = 0; i < parts.size(); i++) diff --git a/plotjuggler_app/curvetree_view.cpp b/plotjuggler_app/curvetree_view.cpp index eb367080f..1bf4f38b5 100644 --- a/plotjuggler_app/curvetree_view.cpp +++ b/plotjuggler_app/curvetree_view.cpp @@ -85,7 +85,7 @@ void CurveTreeView::addItem(const QString& group_name, const QString& tree_name, QStringList parts; if (use_separator) { - parts = tree_name.split('/', QString::SplitBehavior::SkipEmptyParts); + parts = tree_name.split('/', Qt::SkipEmptyParts); } else { @@ -99,7 +99,7 @@ void CurveTreeView::addItem(const QString& group_name, const QString& tree_name, bool prefix_is_group = tree_name.startsWith(group_name); bool hasGroup = !group_name.isEmpty(); - auto group_parts = group_name.split('/', QString::SplitBehavior::SkipEmptyParts); + auto group_parts = group_name.split('/', Qt::SkipEmptyParts); if (hasGroup && !prefix_is_group) { @@ -213,7 +213,7 @@ bool CurveTreeView::applyVisibilityFilter(const QString& search_string) bool updated = false; _hidden_count = 0; - QStringList spaced_items = search_string.split(' ', QString::SkipEmptyParts); + QStringList spaced_items = search_string.split(' ', Qt::SkipEmptyParts); auto hideFunc = [&](QTreeWidgetItem* item) { QString name = item->data(0, Qt::UserRole).toString(); diff --git a/plotjuggler_app/main.cpp b/plotjuggler_app/main.cpp index 13e3dfd11..b13fda7b1 100644 --- a/plotjuggler_app/main.cpp +++ b/plotjuggler_app/main.cpp @@ -132,7 +132,7 @@ std::vector MergeArguments(const std::vector& args) { #ifdef PJ_DEFAULT_ARGS auto default_cmdline_args = - QString(PJ_DEFAULT_ARGS).split(" ", QString::SkipEmptyParts); + QString(PJ_DEFAULT_ARGS).split(" ", Qt::SkipEmptyParts); std::vector new_args; new_args.push_back(args.front()); diff --git a/plotjuggler_app/mainwindow.cpp b/plotjuggler_app/mainwindow.cpp index 46e22fa09..aacc103ee 100644 --- a/plotjuggler_app/mainwindow.cpp +++ b/plotjuggler_app/mainwindow.cpp @@ -93,7 +93,7 @@ MainWindow::MainWindow(const QCommandLineParser& commandline_parser, QWidget* pa if (commandline_parser.isSet("enabled_plugins")) { _enabled_plugins = - commandline_parser.value("enabled_plugins").split(";", QString::SkipEmptyParts); + commandline_parser.value("enabled_plugins").split(";", Qt::SkipEmptyParts); // Treat the command-line parameter '--enabled_plugins *' to mean all plugings are // enabled if ((_enabled_plugins.size() == 1) && (_enabled_plugins.contains("*"))) @@ -104,7 +104,7 @@ MainWindow::MainWindow(const QCommandLineParser& commandline_parser, QWidget* pa if (commandline_parser.isSet("disabled_plugins")) { _disabled_plugins = - commandline_parser.value("disabled_plugins").split(";", QString::SkipEmptyParts); + commandline_parser.value("disabled_plugins").split(";", Qt::SkipEmptyParts); } _curvelist_widget = new CurveListPanel(_mapped_plot_data, _transform_functions, this); @@ -240,7 +240,7 @@ MainWindow::MainWindow(const QCommandLineParser& commandline_parser, QWidget* pa //------------ Load plugins ------------- auto plugin_extra_folders = - commandline_parser.value("plugin_folders").split(";", QString::SkipEmptyParts); + commandline_parser.value("plugin_folders").split(";", Qt::SkipEmptyParts); _default_streamer = commandline_parser.value("start_streamer"); @@ -2065,7 +2065,7 @@ bool MainWindow::loadLayoutFromFile(QString filename) QDomElement datasources_elem = datafile_elem.firstChildElement("selected_" "datasources"); QString topics_list = datasources_elem.attribute("value"); - info.selected_datasources = topics_list.split(";", QString::SkipEmptyParts); + info.selected_datasources = topics_list.split(";", Qt::SkipEmptyParts); auto plugin_elem = datafile_elem.firstChildElement("plugin"); info.plugin_config.appendChild(info.plugin_config.importNode(plugin_elem, true)); @@ -3184,7 +3184,7 @@ void MainWindow::on_pushButtonSaveLayout_clicked() if (file.open(QIODevice::WriteOnly)) { QTextStream stream(&file); - stream << doc.toString() << endl; + stream << doc.toString() << Qt::endl; } } diff --git a/plotjuggler_app/plot_docker.cpp b/plotjuggler_app/plot_docker.cpp index 17f8af225..fa87b8043 100644 --- a/plotjuggler_app/plot_docker.cpp +++ b/plotjuggler_app/plot_docker.cpp @@ -169,7 +169,7 @@ void PlotDocker::restoreSplitter(QDomElement elem, DockWidget* widget) (orientation == Qt::Horizontal) ? widgets[i]->width() : widgets[i]->height(); } - auto sizes_str = elem.attribute("sizes").splitRef(";", QString::SkipEmptyParts); + auto sizes_str = elem.attribute("sizes").splitRef(";", Qt::SkipEmptyParts); QList sizes; for (int i = 0; i < splitter_count; i++) diff --git a/plotjuggler_app/transforms/function_editor.cpp b/plotjuggler_app/transforms/function_editor.cpp index d05716373..8557a6798 100644 --- a/plotjuggler_app/transforms/function_editor.cpp +++ b/plotjuggler_app/transforms/function_editor.cpp @@ -918,7 +918,7 @@ void FunctionEditorWidget::onLineEditTab2FilterChanged() } else { - QStringList spaced_items = filter_text.split(' ', QString::SkipEmptyParts); + QStringList spaced_items = filter_text.split(' ', Qt::SkipEmptyParts); for (const auto& [name, plotdata] : _plot_map_data.numeric) { bool show = true; diff --git a/plotjuggler_app/tree_completer.h b/plotjuggler_app/tree_completer.h index c2c1f6925..78328da1b 100644 --- a/plotjuggler_app/tree_completer.h +++ b/plotjuggler_app/tree_completer.h @@ -72,7 +72,7 @@ class TreeModel : public QAbstractItemModel { } void addToTree(const QString& name, int reference_row) { - auto parts = name.split('/', QString::SplitBehavior::SkipEmptyParts); + auto parts = name.split('/', Qt::SkipEmptyParts); if (parts.size() == 0) { return; } diff --git a/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp b/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp index ab0a17417..621ad79c8 100644 --- a/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp +++ b/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp @@ -110,7 +110,7 @@ static int processInputLog(const string& logpath, if (verbose) { if (lastPrintPercent != 100 && !interrupted) cout << "\r" << "Percent Complete: 100" << flush; - cout << endl; + cout << Qt::endl; } if (interrupted) progress_dialog.cancel(); From 513e2aa8e786af4a20d75e443d733ceb7273eddd Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Mon, 16 Oct 2023 14:30:40 +0200 Subject: [PATCH 3/9] Ci updated --- .github/workflows/ros1.yaml | 1 - .github/workflows/ros2.yaml | 2 -- 2 files changed, 3 deletions(-) diff --git a/.github/workflows/ros1.yaml b/.github/workflows/ros1.yaml index d783f61a9..6a3aa5cc3 100644 --- a/.github/workflows/ros1.yaml +++ b/.github/workflows/ros1.yaml @@ -7,7 +7,6 @@ jobs: strategy: matrix: env: - - {ROS_DISTRO: melodic, ROS_REPO: main} - {ROS_DISTRO: noetic, ROS_REPO: main} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/ros2.yaml b/.github/workflows/ros2.yaml index de3e7c6dd..be0786d07 100644 --- a/.github/workflows/ros2.yaml +++ b/.github/workflows/ros2.yaml @@ -7,8 +7,6 @@ jobs: strategy: matrix: env: - - {ROS_DISTRO: foxy, ROS_REPO: main} - - {ROS_DISTRO: galactic, ROS_REPO: main} - {ROS_DISTRO: humble, ROS_REPO: main} - {ROS_DISTRO: rolling, ROS_REPO: main} runs-on: ubuntu-latest From 621af92fce9ef5f290873997c9adf45d360bc612 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Thu, 19 Oct 2023 12:56:38 +0200 Subject: [PATCH 4/9] Revert "fix some warnings" This reverts commit 4ba24c591a9a84fbfb6c0329b787d73f98a2b23b. --- plotjuggler_app/curvelist_panel.cpp | 2 +- plotjuggler_app/curvetree_view.cpp | 6 +++--- plotjuggler_app/main.cpp | 2 +- plotjuggler_app/mainwindow.cpp | 10 +++++----- plotjuggler_app/plot_docker.cpp | 2 +- plotjuggler_app/transforms/function_editor.cpp | 2 +- plotjuggler_app/tree_completer.h | 2 +- plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plotjuggler_app/curvelist_panel.cpp b/plotjuggler_app/curvelist_panel.cpp index 445e91d66..9abf72e9d 100644 --- a/plotjuggler_app/curvelist_panel.cpp +++ b/plotjuggler_app/curvelist_panel.cpp @@ -407,7 +407,7 @@ QString StringifyArray(QString str) QString CurveListPanel::getTreeName(QString name) { - auto parts = name.split('/', Qt::SkipEmptyParts); + auto parts = name.split('/', QString::SplitBehavior::SkipEmptyParts); QString out; for (int i = 0; i < parts.size(); i++) diff --git a/plotjuggler_app/curvetree_view.cpp b/plotjuggler_app/curvetree_view.cpp index 1bf4f38b5..eb367080f 100644 --- a/plotjuggler_app/curvetree_view.cpp +++ b/plotjuggler_app/curvetree_view.cpp @@ -85,7 +85,7 @@ void CurveTreeView::addItem(const QString& group_name, const QString& tree_name, QStringList parts; if (use_separator) { - parts = tree_name.split('/', Qt::SkipEmptyParts); + parts = tree_name.split('/', QString::SplitBehavior::SkipEmptyParts); } else { @@ -99,7 +99,7 @@ void CurveTreeView::addItem(const QString& group_name, const QString& tree_name, bool prefix_is_group = tree_name.startsWith(group_name); bool hasGroup = !group_name.isEmpty(); - auto group_parts = group_name.split('/', Qt::SkipEmptyParts); + auto group_parts = group_name.split('/', QString::SplitBehavior::SkipEmptyParts); if (hasGroup && !prefix_is_group) { @@ -213,7 +213,7 @@ bool CurveTreeView::applyVisibilityFilter(const QString& search_string) bool updated = false; _hidden_count = 0; - QStringList spaced_items = search_string.split(' ', Qt::SkipEmptyParts); + QStringList spaced_items = search_string.split(' ', QString::SkipEmptyParts); auto hideFunc = [&](QTreeWidgetItem* item) { QString name = item->data(0, Qt::UserRole).toString(); diff --git a/plotjuggler_app/main.cpp b/plotjuggler_app/main.cpp index b13fda7b1..13e3dfd11 100644 --- a/plotjuggler_app/main.cpp +++ b/plotjuggler_app/main.cpp @@ -132,7 +132,7 @@ std::vector MergeArguments(const std::vector& args) { #ifdef PJ_DEFAULT_ARGS auto default_cmdline_args = - QString(PJ_DEFAULT_ARGS).split(" ", Qt::SkipEmptyParts); + QString(PJ_DEFAULT_ARGS).split(" ", QString::SkipEmptyParts); std::vector new_args; new_args.push_back(args.front()); diff --git a/plotjuggler_app/mainwindow.cpp b/plotjuggler_app/mainwindow.cpp index aacc103ee..46e22fa09 100644 --- a/plotjuggler_app/mainwindow.cpp +++ b/plotjuggler_app/mainwindow.cpp @@ -93,7 +93,7 @@ MainWindow::MainWindow(const QCommandLineParser& commandline_parser, QWidget* pa if (commandline_parser.isSet("enabled_plugins")) { _enabled_plugins = - commandline_parser.value("enabled_plugins").split(";", Qt::SkipEmptyParts); + commandline_parser.value("enabled_plugins").split(";", QString::SkipEmptyParts); // Treat the command-line parameter '--enabled_plugins *' to mean all plugings are // enabled if ((_enabled_plugins.size() == 1) && (_enabled_plugins.contains("*"))) @@ -104,7 +104,7 @@ MainWindow::MainWindow(const QCommandLineParser& commandline_parser, QWidget* pa if (commandline_parser.isSet("disabled_plugins")) { _disabled_plugins = - commandline_parser.value("disabled_plugins").split(";", Qt::SkipEmptyParts); + commandline_parser.value("disabled_plugins").split(";", QString::SkipEmptyParts); } _curvelist_widget = new CurveListPanel(_mapped_plot_data, _transform_functions, this); @@ -240,7 +240,7 @@ MainWindow::MainWindow(const QCommandLineParser& commandline_parser, QWidget* pa //------------ Load plugins ------------- auto plugin_extra_folders = - commandline_parser.value("plugin_folders").split(";", Qt::SkipEmptyParts); + commandline_parser.value("plugin_folders").split(";", QString::SkipEmptyParts); _default_streamer = commandline_parser.value("start_streamer"); @@ -2065,7 +2065,7 @@ bool MainWindow::loadLayoutFromFile(QString filename) QDomElement datasources_elem = datafile_elem.firstChildElement("selected_" "datasources"); QString topics_list = datasources_elem.attribute("value"); - info.selected_datasources = topics_list.split(";", Qt::SkipEmptyParts); + info.selected_datasources = topics_list.split(";", QString::SkipEmptyParts); auto plugin_elem = datafile_elem.firstChildElement("plugin"); info.plugin_config.appendChild(info.plugin_config.importNode(plugin_elem, true)); @@ -3184,7 +3184,7 @@ void MainWindow::on_pushButtonSaveLayout_clicked() if (file.open(QIODevice::WriteOnly)) { QTextStream stream(&file); - stream << doc.toString() << Qt::endl; + stream << doc.toString() << endl; } } diff --git a/plotjuggler_app/plot_docker.cpp b/plotjuggler_app/plot_docker.cpp index fa87b8043..17f8af225 100644 --- a/plotjuggler_app/plot_docker.cpp +++ b/plotjuggler_app/plot_docker.cpp @@ -169,7 +169,7 @@ void PlotDocker::restoreSplitter(QDomElement elem, DockWidget* widget) (orientation == Qt::Horizontal) ? widgets[i]->width() : widgets[i]->height(); } - auto sizes_str = elem.attribute("sizes").splitRef(";", Qt::SkipEmptyParts); + auto sizes_str = elem.attribute("sizes").splitRef(";", QString::SkipEmptyParts); QList sizes; for (int i = 0; i < splitter_count; i++) diff --git a/plotjuggler_app/transforms/function_editor.cpp b/plotjuggler_app/transforms/function_editor.cpp index 8557a6798..d05716373 100644 --- a/plotjuggler_app/transforms/function_editor.cpp +++ b/plotjuggler_app/transforms/function_editor.cpp @@ -918,7 +918,7 @@ void FunctionEditorWidget::onLineEditTab2FilterChanged() } else { - QStringList spaced_items = filter_text.split(' ', Qt::SkipEmptyParts); + QStringList spaced_items = filter_text.split(' ', QString::SkipEmptyParts); for (const auto& [name, plotdata] : _plot_map_data.numeric) { bool show = true; diff --git a/plotjuggler_app/tree_completer.h b/plotjuggler_app/tree_completer.h index 78328da1b..c2c1f6925 100644 --- a/plotjuggler_app/tree_completer.h +++ b/plotjuggler_app/tree_completer.h @@ -72,7 +72,7 @@ class TreeModel : public QAbstractItemModel { } void addToTree(const QString& name, int reference_row) { - auto parts = name.split('/', Qt::SkipEmptyParts); + auto parts = name.split('/', QString::SplitBehavior::SkipEmptyParts); if (parts.size() == 0) { return; } diff --git a/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp b/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp index 621ad79c8..ab0a17417 100644 --- a/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp +++ b/plotjuggler_plugins/PluginsZcm/dataload_zcm.cpp @@ -110,7 +110,7 @@ static int processInputLog(const string& logpath, if (verbose) { if (lastPrintPercent != 100 && !interrupted) cout << "\r" << "Percent Complete: 100" << flush; - cout << Qt::endl; + cout << endl; } if (interrupted) progress_dialog.cancel(); From 583cc2182f58f5c9cb6a530abd6522f3742aecbb Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Thu, 19 Oct 2023 13:30:04 +0200 Subject: [PATCH 5/9] revert --- 3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp b/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp index 384b5d068..644ae2c27 100644 --- a/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp +++ b/3rdparty/Qt-Advanced-Docking/src/DockOverlay.cpp @@ -806,10 +806,10 @@ void CDockOverlayCross::setIconColors(const QString& Colors) {"Arrow", CDockOverlayCross::ArrowColor}, {"Shadow", CDockOverlayCross::ShadowColor}}; - auto ColorList = Colors.split(' ', Qt::SkipEmptyParts); + auto ColorList = Colors.split(' ', QString::SkipEmptyParts); for (const auto& ColorListEntry : ColorList) { - auto ComponentColor = ColorListEntry.split('=', Qt::SkipEmptyParts); + auto ComponentColor = ColorListEntry.split('=', QString::SkipEmptyParts); int Component = ColorCompenentStringMap.value(ComponentColor[0], -1); if (Component < 0) { From 587ecbdc0c11cb4b4c55bf5bb3395387d61421d5 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Sun, 12 Nov 2023 14:23:04 +0100 Subject: [PATCH 6/9] data_tamer updated --- .../ParserDataTamer/datatamer_parser.cpp | 130 +++++++++++------- 1 file changed, 78 insertions(+), 52 deletions(-) diff --git a/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp b/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp index f84cf1073..c8c488d9a 100644 --- a/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp +++ b/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp @@ -10,6 +10,10 @@ namespace DataTamer { enum class ValueType { + BOOL, + BYTE, + CHAR, + UINT8, UINT16, UINT32, @@ -28,20 +32,39 @@ enum class ValueType ValueType FromStr(std::string const& str) { - static std::unordered_map names = { - { "UINT8", ValueType::UINT8 }, - { "UINT16", ValueType::UINT16 }, - { "UINT32", ValueType::UINT32 }, - { "UINT64", ValueType::UINT64 }, + static std::unordered_map names = + { + { "UINT8", ValueType::UINT8 }, + { "uint8", ValueType::UINT8 }, - { "INT8", ValueType::INT8 }, - { "INT16", ValueType::INT16 }, - { "INT32", ValueType::INT32 }, - { "INT64", ValueType::INT64 }, + { "UINT16", ValueType::UINT16 }, + { "uint16", ValueType::UINT8 }, - { "FLOAT", ValueType::FLOAT }, - { "DOUBLE", ValueType::DOUBLE } - }; + { "UINT32", ValueType::UINT32 }, + { "uint32", ValueType::UINT32 }, + + { "UINT64", ValueType::UINT64 }, + { "uint64", ValueType::UINT64 }, + + { "INT8", ValueType::INT8 }, + { "int8", ValueType::INT8 }, + { "INT16", ValueType::INT16 }, + { "int16", ValueType::INT16 }, + { "INT32", ValueType::INT32 }, + { "int32", ValueType::INT32 }, + { "INT64", ValueType::INT64 }, + { "int64", ValueType::INT64 }, + + { "FLOAT", ValueType::FLOAT }, + { "float32", ValueType::FLOAT }, + { "DOUBLE", ValueType::DOUBLE }, + { "float64", ValueType::DOUBLE }, + + { "bool", ValueType::BOOL }, + { "byte", ValueType::BYTE }, + { "char", ValueType::CHAR } + + }; auto const it = names.find(str); return it == names.end() ? ValueType::OTHER : it->second; } @@ -61,7 +84,7 @@ class DataTamerParser: public MessageParser { public: DataTamerParser(const std::string &topic_name, - const std::string &/*type_name*/, + const std::string &type_name, const std::string &schema, PJ::PlotDataMapRef &data): MessageParser(topic_name, data), @@ -93,12 +116,12 @@ class DataTamerParser: public MessageParser std::memcpy(enable_vector.data(), msg_ptr + offset, flags_size); offset += flags_size; - const uint32_t remaining_bytes = Deserialize(msg_ptr, offset); +// const uint32_t remaining_bytes = Deserialize(msg_ptr, offset); - if(remaining_bytes + offset != serialized_msg.size()) - { - throw std::runtime_error("DataTamerParser: corrupted size"); - } +// if(remaining_bytes + offset != serialized_msg.size()) +// { +// throw std::runtime_error("DataTamerParser: corrupted size"); +// } for(size_t i=0; i(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::UINT16: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::UINT32: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::UINT64: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - - case DataTamer::ValueType::INT8: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::INT16: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::INT32: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::INT64: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - - case DataTamer::ValueType::FLOAT: - val = static_cast(Deserialize(msg_ptr, offset)); - break; - case DataTamer::ValueType::DOUBLE: - val = Deserialize(msg_ptr, offset); - break; - default: - break; + case DataTamer::ValueType::BOOL: + case DataTamer::ValueType::BYTE: + case DataTamer::ValueType::UINT8: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::UINT16: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::UINT32: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::UINT64: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + + case DataTamer::ValueType::CHAR: + case DataTamer::ValueType::INT8: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::INT16: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::INT32: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::INT64: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + + case DataTamer::ValueType::FLOAT: + val = static_cast(Deserialize(msg_ptr, offset)); + break; + case DataTamer::ValueType::DOUBLE: + val = Deserialize(msg_ptr, offset); + break; + default: + break; } auto& ts = timeseries_[i]; if(!ts.plot_data) From 28f080a5f2a663ac1fef6161f05e02c22060e37f Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Sun, 12 Nov 2023 14:30:19 +0100 Subject: [PATCH 7/9] prepare release --- CHANGELOG.rst | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- README.md | 2 +- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 24e7a657a..34c1c7ee2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,68 @@ Changelog for package plotjuggler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Forthcoming +----------- +* data_tamer updated + This reverts commit 4ba24c591a9a84fbfb6c0329b787d73f98a2b23b. +* CI updated +* qwt updated +* Merge pull request `#869 `_ from zdavkeos/step_interpolation + Add "Steps" when drawing curves +* Merge pull request `#870 `_ from MirkoFerrati/patch-3 + Fix missing '22' in the new snap core22 workflow +* Fix missing '22' in the new snap core22 workflow +* Merge pull request `#849 `_ from MirkoFerrati/mirko/core22_snap + update to core22, remove ros1, enable humble instead of foxy +* Add "Steps" when drawing curves +* Remove deprecated messages from foxy +* Skip git security check for git owner inside the snap container +* Adapt to new snapcraft syntax for core22, sort stage-packages +* swap default snap with core22 snap for ros humble +* duplicate the snap github action to publish new humble track +* add snap for core22, remove ros1, enable humble +* Merge pull request `#853 `_ from MirkoFerrati/mirko/fix_snap + remove deprecated msg from snapcraft +* Merge pull request `#846 `_ from locusrobotics/fix-catkin-build + Use a more reliable method to select buildtool +* fix +* MCAP loader is not faster for large files +* fix parsers names +* extend the Toolbox plugin interface +* mcap updated +* remove deprecated msg from snapcraft +* Use a more reliable method to select buildtool +* Merge pull request `#843 `_ from faisal-shah/date-time-format-urls + Add link to QDate format string +* Add 'tab' as a separator in the CSV loader +* Add link to QDate format string + A link to QTime format string was there, but not QDate +* Merge pull request `#840 `_ from jbendes/zcm-improvements + Zcm improvements +* Moved away from std function for speed +* Fixed loading of selected channels from layout +* Merge pull request `#827 `_ from jbendes/zcm + Added zcm streaming support +* Merge pull request `#834 `_ from rinnaz/fix-protobuf-parser-leak + Fix memory leak in protobuf parser +* Made transport text box wider +* Looking for zcm in alternate directory first +* A bit more stable +* Serializing and deserializing dataloader for zcm in layout +* fix: memory leak in protobuf parser +* Reverted change +* Changed to ZCM_DEFAULT_URL +* ZCM refactored +* ZCM works, with single type file +* Cleaner loading dialogs +* Added progress dialog +* Added channel selection +* Added data loading from files +* A bit of simplification and bug fix +* Added zcm streaming support +* Add missing cstdint include +* Contributors: Davide Faconti, Faisal Shah, Jonathan Bendes, Mirko Ferrati, Paul Bovbel, Rinat Nazarov, Zach Davis, joajfreitas + 3.7.0 (2023-05-19) ------------------ * Handle protobuf maps (`#824 `_) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02d382c27..8e540b617 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10.2) -PROJECT(plotjuggler LANGUAGES C CXX VERSION 3.7.1) +PROJECT(plotjuggler LANGUAGES C CXX VERSION 3.8.0) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/README.md b/README.md index 8b7181b2b..0af659b08 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ **Gold Sponsor**: [Greenzie](https://www.greenzie.com/) -# PlotJuggler 3.7 +# PlotJuggler 3.8 PlotJuggler is a tool to visualize time series that is **fast**, **powerful** and **intuitive**. From ddf25ba18be107041423c087ad50ee888995b92c Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Sun, 12 Nov 2023 14:30:40 +0100 Subject: [PATCH 8/9] 3.8.0 --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 34c1c7ee2..bfa98cd40 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog for package plotjuggler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Forthcoming ------------ +3.8.0 (2023-11-12) +------------------ * data_tamer updated This reverts commit 4ba24c591a9a84fbfb6c0329b787d73f98a2b23b. * CI updated diff --git a/package.xml b/package.xml index 0e62b4197..6ceab35d7 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ plotjuggler - 3.7.1 + 3.8.0 PlotJuggler: juggle with data Davide Faconti From 0764a6125cc2607f85d9985f26718fcaee738473 Mon Sep 17 00:00:00 2001 From: Davide Faconti Date: Mon, 13 Nov 2023 12:00:47 +0100 Subject: [PATCH 9/9] updated data_tamer --- .../ParserDataTamer/datatamer_parser.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp b/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp index c8c488d9a..8ff9165c5 100644 --- a/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp +++ b/plotjuggler_plugins/ParserDataTamer/datatamer_parser.cpp @@ -110,18 +110,21 @@ class DataTamerParser: public MessageParser const auto* msg_ptr = serialized_msg.data(); uint32_t flags_size = Deserialize(msg_ptr, offset); + if(offset + flags_size > serialized_msg.size()) + { + throw std::runtime_error("DataTamerParser: corrupted size"); + } thread_local std::vector enable_vector; enable_vector.resize(flags_size); std::memcpy(enable_vector.data(), msg_ptr + offset, flags_size); offset += flags_size; -// const uint32_t remaining_bytes = Deserialize(msg_ptr, offset); - -// if(remaining_bytes + offset != serialized_msg.size()) -// { -// throw std::runtime_error("DataTamerParser: corrupted size"); -// } + uint32_t payload_size = Deserialize(msg_ptr, offset); + if(offset + payload_size != serialized_msg.size()) + { + throw std::runtime_error("DataTamerParser: corrupted size"); + } for(size_t i=0; i