mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-13 12:42:20 +00:00
Revert "Qwt 6 support"
The patch that was applied was missing a number of critical changes
and needs to be recreated and retested. The majority of qwt was not
uplifted and remained at Qwt 5.
This reverts commit e97aac7919.
This commit is contained in:
56
qwt/qwt.prf
56
qwt/qwt.prf
@@ -1,44 +1,34 @@
|
||||
################################################################
|
||||
# -*- mode: sh -*- ################################################
|
||||
# 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
|
||||
################################################################
|
||||
###################################################################
|
||||
|
||||
include ( ./qwtconfig.pri )
|
||||
QwtBuild = dll
|
||||
QwtVersion = 5.2.0
|
||||
|
||||
contains(QWT_CONFIG, QwtDll) {
|
||||
unix {
|
||||
QwtBase = /usr/local/qwt-$${QwtVersion}-svn
|
||||
LIBS += -L$${QwtBase}/lib -lqwt
|
||||
}
|
||||
win32 {
|
||||
QwtBase = C:/Qwt-$${QwtVersion}-svn
|
||||
|
||||
DEFINES *= QWT_DLL
|
||||
contains(QwtBuild, dll) {
|
||||
DEFINES += QWT_DLL
|
||||
|
||||
msvc:LIBS += $${QwtBase}/lib/qwt5.lib
|
||||
msvc.net:LIBS += $${QwtBase}/lib/qwt5.lib
|
||||
msvc2005:LIBS += $${QwtBase}/lib/qwt5.lib
|
||||
} else {
|
||||
win32-msvc:LIBS += $${QwtBase}/lib/qwt.lib
|
||||
win32-msvc.net:LIBS += $${QwtBase}/lib/qwt.lib
|
||||
win32-msvc2005:LIBS += $${QwtBase}/lib/qwt.lib
|
||||
}
|
||||
g++:LIBS += -L$${QwtBase}/lib -lqwt
|
||||
}
|
||||
|
||||
contains(QWT_CONFIG, QwtSvg) {
|
||||
|
||||
QT *= svg
|
||||
}
|
||||
else {
|
||||
|
||||
DEFINES *= QWT_NO_SVG
|
||||
}
|
||||
|
||||
contains(QWT_CONFIG, QwtFramework) {
|
||||
|
||||
INCLUDEPATH *= $${QWT_INSTALL_LIBS}/qwt.framework/Headers
|
||||
LIBS *= -F$${QWT_INSTALL_LIBS}
|
||||
}
|
||||
else {
|
||||
|
||||
INCLUDEPATH *= $${QWT_INSTALL_HEADERS}
|
||||
LIBS *= -L$${QWT_INSTALL_LIBS}
|
||||
}
|
||||
|
||||
INCLUDEPATH_QWT = $${INCLUDEPATH}
|
||||
qtAddLibrary(qwt)
|
||||
|
||||
# we don't want qtAddLibrary to expand the
|
||||
# include path, with directories, that might
|
||||
# conflict with other installations of qwt
|
||||
|
||||
INCLUDEPATH = $${INCLUDEPATH_QWT}
|
||||
INCLUDEPATH += $${QwtBase}/include
|
||||
|
||||
20
qwt/qwt.pro
20
qwt/qwt.pro
@@ -1,30 +1,24 @@
|
||||
################################################################
|
||||
# -*- mode: sh -*- ###########################
|
||||
# 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
|
||||
################################################################
|
||||
##############################################
|
||||
|
||||
include( qwtconfig.pri )
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
textengines
|
||||
|
||||
#contains(QWT_CONFIG, QwtDesigner ) {
|
||||
# SUBDIRS += designer
|
||||
#}
|
||||
|
||||
contains(QWT_CONFIG, QwtExamples ) {
|
||||
SUBDIRS += examples
|
||||
contains(CONFIG, QwtDesigner ) {
|
||||
SUBDIRS += designer
|
||||
}
|
||||
|
||||
qwtspec.files = qwtconfig.pri qwt.prf
|
||||
qwtspec.path = $${QWT_INSTALL_FEATURES}
|
||||
|
||||
INSTALLS += qwtspec
|
||||
contains(CONFIG, QwtExamples ) {
|
||||
SUBDIRS += examples
|
||||
}
|
||||
|
||||
2047
qwt/qwt.pro.user
2047
qwt/qwt.pro.user
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
||||
################################################################
|
||||
# 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
|
||||
################################################################
|
||||
|
||||
######################################################################
|
||||
# qmake internal options
|
||||
######################################################################
|
||||
|
||||
CONFIG += qt
|
||||
CONFIG += warn_on
|
||||
CONFIG += no_keywords
|
||||
CONFIG += silent
|
||||
|
||||
######################################################################
|
||||
# release/debug mode
|
||||
######################################################################
|
||||
|
||||
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 += debug_and_release
|
||||
CONFIG += build_all
|
||||
}
|
||||
else {
|
||||
|
||||
# CONFIG += release
|
||||
CONFIG += debug
|
||||
|
||||
VER_MAJ = $${QWT_VER_MAJ}
|
||||
VER_MIN = $${QWT_VER_MIN}
|
||||
VER_PAT = $${QWT_VER_PAT}
|
||||
VERSION = $${QWT_VERSION}
|
||||
}
|
||||
|
||||
linux-g++ {
|
||||
# CONFIG += separate_debug_info
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# paths for building qwt
|
||||
######################################################################
|
||||
|
||||
MOC_DIR = moc
|
||||
RCC_DIR = resources
|
||||
!debug_and_release {
|
||||
OBJECTS_DIR = obj
|
||||
}
|
||||
|
||||
unix {
|
||||
|
||||
exists( $${QMAKE_LIBDIR_QT}/libqwt.* ) {
|
||||
|
||||
# On some Linux distributions the Qwt libraries are installed
|
||||
# in the same directory as the Qt libraries. Unfortunately
|
||||
# qmake always adds QMAKE_LIBDIR_QT at the beginning of the
|
||||
# linker path, so that the installed libraries will be
|
||||
# used instead of the local ones.
|
||||
|
||||
error( "local build will conflict with $${QMAKE_LIBDIR_QT}/libqwt.*" )
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* QwtPolar Widget Library
|
||||
* Copyright (C) 2008 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
|
||||
*****************************************************************************/
|
||||
|
||||
#include "qwt_point_polar.h"
|
||||
#include "qwt_math.h"
|
||||
|
||||
#if QT_VERSION < 0x040601
|
||||
#define qAtan2(y, x) ::atan2(y, x)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Convert and assign values from a point in Cartesian coordinates
|
||||
|
||||
\param p Point in Cartesian coordinates
|
||||
\sa setPoint(), toPoint()
|
||||
*/
|
||||
QwtPointPolar::QwtPointPolar( const QPointF &p )
|
||||
{
|
||||
d_radius = qSqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
|
||||
d_azimuth = qAtan2( p.y(), p.x() );
|
||||
}
|
||||
|
||||
/*!
|
||||
Convert and assign values from a point in Cartesian coordinates
|
||||
\param p Point in Cartesian coordinates
|
||||
*/
|
||||
void QwtPointPolar::setPoint( const QPointF &p )
|
||||
{
|
||||
d_radius = qSqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
|
||||
d_azimuth = qAtan2( p.y(), p.x() );
|
||||
}
|
||||
|
||||
/*!
|
||||
Convert and return values in Cartesian coordinates
|
||||
|
||||
\note Invalid or null points will be returned as QPointF(0.0, 0.0)
|
||||
\sa isValid(), isNull()
|
||||
*/
|
||||
QPointF QwtPointPolar::toPoint() const
|
||||
{
|
||||
if ( d_radius <= 0.0 )
|
||||
return QPointF( 0.0, 0.0 );
|
||||
|
||||
const double x = d_radius * qCos( d_azimuth );
|
||||
const double y = d_radius * qSin( d_azimuth );
|
||||
|
||||
return QPointF( x, y );
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if point1 is equal to point2; otherwise returns false.
|
||||
|
||||
Two points are equal to each other if radius and
|
||||
azimuth-coordinates are the same. Points are not equal, when
|
||||
the azimuth differs, but other.azimuth() == azimuth() % (2 * PI).
|
||||
|
||||
\sa normalized()
|
||||
*/
|
||||
bool QwtPointPolar::operator==( const QwtPointPolar &other ) const
|
||||
{
|
||||
return d_radius == other.d_radius && d_azimuth == other.d_azimuth;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if point1 is not equal to point2; otherwise returns false.
|
||||
|
||||
Two points are equal to each other if radius and
|
||||
azimuth-coordinates are the same. Points are not equal, when
|
||||
the azimuth differs, but other.azimuth() == azimuth() % (2 * PI).
|
||||
|
||||
\sa normalized()
|
||||
*/
|
||||
bool QwtPointPolar::operator!=( const QwtPointPolar &other ) const
|
||||
{
|
||||
return d_radius != other.d_radius || d_azimuth != other.d_azimuth;
|
||||
}
|
||||
|
||||
/*!
|
||||
Normalize radius and azimuth
|
||||
|
||||
When the radius is < 0.0 it is set to 0.0. The azimuth is
|
||||
a value >= 0.0 and < 2 * M_PI.
|
||||
*/
|
||||
QwtPointPolar QwtPointPolar::normalized() const
|
||||
{
|
||||
const double radius = qMax( d_radius, 0.0 );
|
||||
|
||||
double azimuth = d_azimuth;
|
||||
if ( azimuth < -2.0 * M_PI || azimuth >= 2 * M_PI )
|
||||
azimuth = ::fmod( d_azimuth, 2 * M_PI );
|
||||
|
||||
if ( azimuth < 0.0 )
|
||||
azimuth += 2 * M_PI;
|
||||
|
||||
return QwtPointPolar( azimuth, radius );
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
||||
QDebug operator<<( QDebug debug, const QwtPointPolar &point )
|
||||
{
|
||||
debug.nospace() << "QwtPointPolar("
|
||||
<< point.azimuth() << "," << point.radius() << ")";
|
||||
|
||||
return debug.space();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,195 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
/*! \file */
|
||||
#ifndef _QWT_POINT_POLAR_H_
|
||||
#define _QWT_POINT_POLAR_H_ 1
|
||||
|
||||
#include "qwt_global.h"
|
||||
#include "qwt_math.h"
|
||||
#include <qpoint.h>
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
#include <qdebug.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief A point in polar coordinates
|
||||
|
||||
In polar coordinates a point is determined by an angle and a distance.
|
||||
See http://en.wikipedia.org/wiki/Polar_coordinate_system
|
||||
*/
|
||||
|
||||
class QWT_EXPORT QwtPointPolar
|
||||
{
|
||||
public:
|
||||
QwtPointPolar();
|
||||
QwtPointPolar( double azimuth, double radius );
|
||||
QwtPointPolar( const QwtPointPolar & );
|
||||
QwtPointPolar( const QPointF & );
|
||||
|
||||
void setPoint( const QPointF & );
|
||||
QPointF toPoint() const;
|
||||
|
||||
bool isValid() const;
|
||||
bool isNull() const;
|
||||
|
||||
double radius() const;
|
||||
double azimuth() const;
|
||||
|
||||
double &rRadius();
|
||||
double &rAzimuth();
|
||||
|
||||
void setRadius( double );
|
||||
void setAzimuth( double );
|
||||
|
||||
bool operator==( const QwtPointPolar & ) const;
|
||||
bool operator!=( const QwtPointPolar & ) const;
|
||||
|
||||
QwtPointPolar normalized() const;
|
||||
|
||||
private:
|
||||
double d_azimuth;
|
||||
double d_radius;
|
||||
};
|
||||
|
||||
/*!
|
||||
Constructs a null point, with a radius and azimuth set to 0.0.
|
||||
\sa QPointF::isNull
|
||||
*/
|
||||
inline QwtPointPolar::QwtPointPolar():
|
||||
d_azimuth( 0.0 ),
|
||||
d_radius( 0.0 )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a point with coordinates specified by radius and azimuth.
|
||||
|
||||
\param azimuth Azimuth
|
||||
\param radius Radius
|
||||
*/
|
||||
inline QwtPointPolar::QwtPointPolar( double azimuth, double radius ):
|
||||
d_azimuth( azimuth ),
|
||||
d_radius( radius )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a point using the values of the point specified.
|
||||
\param other Other point
|
||||
*/
|
||||
inline QwtPointPolar::QwtPointPolar( const QwtPointPolar &other ):
|
||||
d_azimuth( other.d_azimuth ),
|
||||
d_radius( other.d_radius )
|
||||
{
|
||||
}
|
||||
|
||||
//! Returns true if radius() >= 0.0
|
||||
inline bool QwtPointPolar::isValid() const
|
||||
{
|
||||
return d_radius >= 0.0;
|
||||
}
|
||||
|
||||
//! Returns true if radius() >= 0.0
|
||||
inline bool QwtPointPolar::isNull() const
|
||||
{
|
||||
return d_radius == 0.0;
|
||||
}
|
||||
|
||||
//! Returns the radius.
|
||||
inline double QwtPointPolar::radius() const
|
||||
{
|
||||
return d_radius;
|
||||
}
|
||||
|
||||
//! Returns the azimuth.
|
||||
inline double QwtPointPolar::azimuth() const
|
||||
{
|
||||
return d_azimuth;
|
||||
}
|
||||
|
||||
//! Returns the radius.
|
||||
inline double &QwtPointPolar::rRadius()
|
||||
{
|
||||
return d_radius;
|
||||
}
|
||||
|
||||
//! Returns the azimuth.
|
||||
inline double &QwtPointPolar::rAzimuth()
|
||||
{
|
||||
return d_azimuth;
|
||||
}
|
||||
|
||||
//! Sets the radius to radius.
|
||||
inline void QwtPointPolar::setRadius( double radius )
|
||||
{
|
||||
d_radius = radius;
|
||||
}
|
||||
|
||||
//! Sets the atimuth to atimuth.
|
||||
inline void QwtPointPolar::setAzimuth( double azimuth )
|
||||
{
|
||||
d_azimuth = azimuth;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QWT_EXPORT QDebug operator<<( QDebug, const QwtPointPolar & );
|
||||
#endif
|
||||
|
||||
inline QPoint qwtPolar2Pos( const QPoint &pole,
|
||||
double radius, double angle )
|
||||
{
|
||||
const double x = pole.x() + radius * qCos( angle );
|
||||
const double y = pole.y() - radius * qSin( angle );
|
||||
|
||||
return QPoint( qRound( x ), qRound( y ) );
|
||||
}
|
||||
|
||||
inline QPoint qwtDegree2Pos( const QPoint &pole,
|
||||
double radius, double angle )
|
||||
{
|
||||
return qwtPolar2Pos( pole, radius, angle / 180.0 * M_PI );
|
||||
}
|
||||
|
||||
inline QPointF qwtPolar2Pos( const QPointF &pole,
|
||||
double radius, double angle )
|
||||
{
|
||||
const double x = pole.x() + radius * qCos( angle );
|
||||
const double y = pole.y() - radius * qSin( angle );
|
||||
|
||||
return QPointF( x, y);
|
||||
}
|
||||
|
||||
inline QPointF qwtDegree2Pos( const QPointF &pole,
|
||||
double radius, double angle )
|
||||
{
|
||||
return qwtPolar2Pos( pole, radius, angle / 180.0 * M_PI );
|
||||
}
|
||||
|
||||
inline QPointF qwtFastPolar2Pos( const QPointF &pole,
|
||||
double radius, double angle )
|
||||
{
|
||||
#if QT_VERSION < 0x040601
|
||||
const double x = pole.x() + radius * ::cos( angle );
|
||||
const double y = pole.y() - radius * ::sin( angle );
|
||||
#else
|
||||
const double x = pole.x() + radius * qFastCos( angle );
|
||||
const double y = pole.y() - radius * qFastSin( angle );
|
||||
#endif
|
||||
|
||||
return QPointF( x, y);
|
||||
}
|
||||
|
||||
inline QPointF qwtFastDegree2Pos( const QPointF &pole,
|
||||
double radius, double angle )
|
||||
{
|
||||
return qwtFastPolar2Pos( pole, radius, angle / 180.0 * M_PI );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,106 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
#include "qwt_sampling_thread.h"
|
||||
#include "qwt_system_clock.h"
|
||||
|
||||
class QwtSamplingThread::PrivateData
|
||||
{
|
||||
public:
|
||||
QwtSystemClock clock;
|
||||
|
||||
double interval;
|
||||
bool isStopped;
|
||||
};
|
||||
|
||||
|
||||
//! Constructor
|
||||
QwtSamplingThread::QwtSamplingThread( QObject *parent ):
|
||||
QThread( parent )
|
||||
{
|
||||
d_data = new PrivateData;
|
||||
d_data->interval = 1000; // 1 second
|
||||
d_data->isStopped = true;
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
QwtSamplingThread::~QwtSamplingThread()
|
||||
{
|
||||
delete d_data;
|
||||
}
|
||||
|
||||
/*!
|
||||
Change the interval (in ms), when sample() is called.
|
||||
The default interval is 1000.0 ( = 1s )
|
||||
|
||||
\param interval Interval
|
||||
\sa interval()
|
||||
*/
|
||||
void QwtSamplingThread::setInterval( double interval )
|
||||
{
|
||||
if ( interval < 0.0 )
|
||||
interval = 0.0;
|
||||
|
||||
d_data->interval = interval;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return Interval (in ms), between 2 calls of sample()
|
||||
\sa setInterval()
|
||||
*/
|
||||
double QwtSamplingThread::interval() const
|
||||
{
|
||||
return d_data->interval;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return Time (in ms) since the thread was started
|
||||
\sa QThread::start(), run()
|
||||
*/
|
||||
double QwtSamplingThread::elapsed() const
|
||||
{
|
||||
if ( d_data->isStopped )
|
||||
return 0.0;
|
||||
|
||||
return d_data->clock.elapsed();
|
||||
}
|
||||
|
||||
/*!
|
||||
Terminate the collecting thread
|
||||
\sa QThread::start(), run()
|
||||
*/
|
||||
void QwtSamplingThread::stop()
|
||||
{
|
||||
d_data->isStopped = true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Loop collecting samples started from QThread::start()
|
||||
\sa stop()
|
||||
*/
|
||||
void QwtSamplingThread::run()
|
||||
{
|
||||
d_data->clock.start();
|
||||
d_data->isStopped = false;
|
||||
|
||||
while ( !d_data->isStopped )
|
||||
{
|
||||
const double elapsed = d_data->clock.elapsed();
|
||||
sample( elapsed / 1000.0 );
|
||||
|
||||
if ( d_data->interval > 0.0 )
|
||||
{
|
||||
const double msecs =
|
||||
d_data->interval - ( d_data->clock.elapsed() - elapsed );
|
||||
|
||||
if ( msecs > 0.0 )
|
||||
usleep( qRound( 1000.0 * msecs ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef _QWT_SAMPLING_THREAD_H_
|
||||
#define _QWT_SAMPLING_THREAD_H_
|
||||
|
||||
#include "qwt_global.h"
|
||||
#include <qthread.h>
|
||||
|
||||
/*!
|
||||
\brief A thread collecting samples at regular intervals.
|
||||
|
||||
Contiounous signals are converted into a discrete signal by
|
||||
collecting samples at regular intervals. A discrete signal
|
||||
can be displayed by a QwtPlotSeriesItem on a QwtPlot widget.
|
||||
|
||||
QwtSamplingThread starts a thread calling perodically sample(),
|
||||
to collect and store ( or emit ) a single sample.
|
||||
|
||||
\sa QwtPlotCurve, QwtPlotSeriesItem
|
||||
*/
|
||||
class QWT_EXPORT QwtSamplingThread: public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual ~QwtSamplingThread();
|
||||
|
||||
double interval() const;
|
||||
double elapsed() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setInterval( double interval );
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
explicit QwtSamplingThread( QObject *parent = NULL );
|
||||
|
||||
virtual void run();
|
||||
|
||||
/*!
|
||||
Collect a sample
|
||||
|
||||
\param elapsed Time since the thread was started in miliseconds
|
||||
*/
|
||||
virtual void sample( double elapsed ) = 0;
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
PrivateData *d_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,586 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
#include "qwt_series_data.h"
|
||||
#include "qwt_math.h"
|
||||
|
||||
static inline QRectF qwtBoundingRect( const QPointF &sample )
|
||||
{
|
||||
return QRectF( sample.x(), sample.y(), 0.0, 0.0 );
|
||||
}
|
||||
|
||||
static inline QRectF qwtBoundingRect( const QwtPoint3D &sample )
|
||||
{
|
||||
return QRectF( sample.x(), sample.y(), 0.0, 0.0 );
|
||||
}
|
||||
|
||||
static inline QRectF qwtBoundingRect( const QwtPointPolar &sample )
|
||||
{
|
||||
return QRectF( sample.azimuth(), sample.radius(), 0.0, 0.0 );
|
||||
}
|
||||
|
||||
static inline QRectF qwtBoundingRect( const QwtIntervalSample &sample )
|
||||
{
|
||||
return QRectF( sample.interval.minValue(), sample.value,
|
||||
sample.interval.maxValue() - sample.interval.minValue(), 0.0 );
|
||||
}
|
||||
|
||||
static inline QRectF qwtBoundingRect( const QwtSetSample &sample )
|
||||
{
|
||||
double minX = sample.set[0];
|
||||
double maxX = sample.set[0];
|
||||
|
||||
for ( int i = 1; i < ( int )sample.set.size(); i++ )
|
||||
{
|
||||
if ( sample.set[i] < minX )
|
||||
minX = sample.set[i];
|
||||
if ( sample.set[i] > maxX )
|
||||
maxX = sample.set[i];
|
||||
}
|
||||
|
||||
double minY = sample.value;
|
||||
double maxY = sample.value;
|
||||
|
||||
return QRectF( minX, minY, maxX - minX, maxY - minY );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect of a series subset
|
||||
|
||||
Slow implementation, that iterates over the series.
|
||||
|
||||
\param series Series
|
||||
\param from Index of the first sample, <= 0 means from the beginning
|
||||
\param to Index of the last sample, < 0 means to the end
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
QRectF qwtBoundingRectT(
|
||||
const QwtSeriesData<T>& series, int from, int to )
|
||||
{
|
||||
QRectF boundingRect( 1.0, 1.0, -2.0, -2.0 ); // invalid;
|
||||
|
||||
if ( from < 0 )
|
||||
from = 0;
|
||||
|
||||
if ( to < 0 )
|
||||
to = series.size() - 1;
|
||||
|
||||
if ( to < from )
|
||||
return boundingRect;
|
||||
|
||||
int i;
|
||||
for ( i = from; i <= to; i++ )
|
||||
{
|
||||
const QRectF rect = qwtBoundingRect( series.sample( i ) );
|
||||
if ( rect.width() >= 0.0 && rect.height() >= 0.0 )
|
||||
{
|
||||
boundingRect = rect;
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( ; i <= to; i++ )
|
||||
{
|
||||
const QRectF rect = qwtBoundingRect( series.sample( i ) );
|
||||
if ( rect.width() >= 0.0 && rect.height() >= 0.0 )
|
||||
{
|
||||
boundingRect.setLeft( qMin( boundingRect.left(), rect.left() ) );
|
||||
boundingRect.setRight( qMax( boundingRect.right(), rect.right() ) );
|
||||
boundingRect.setTop( qMin( boundingRect.top(), rect.top() ) );
|
||||
boundingRect.setBottom( qMax( boundingRect.bottom(), rect.bottom() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return boundingRect;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect of a series subset
|
||||
|
||||
Slow implementation, that iterates over the series.
|
||||
|
||||
\param series Series
|
||||
\param from Index of the first sample, <= 0 means from the beginning
|
||||
\param to Index of the last sample, < 0 means to the end
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QPointF> &series, int from, int to )
|
||||
{
|
||||
return qwtBoundingRectT<QPointF>( series, from, to );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect of a series subset
|
||||
|
||||
Slow implementation, that iterates over the series.
|
||||
|
||||
\param series Series
|
||||
\param from Index of the first sample, <= 0 means from the beginning
|
||||
\param to Index of the last sample, < 0 means to the end
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtPoint3D> &series, int from, int to )
|
||||
{
|
||||
return qwtBoundingRectT<QwtPoint3D>( series, from, to );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect of a series subset
|
||||
|
||||
The horizontal coordinates represent the azimuth, the
|
||||
vertical coordinates the radius.
|
||||
|
||||
Slow implementation, that iterates over the series.
|
||||
|
||||
\param series Series
|
||||
\param from Index of the first sample, <= 0 means from the beginning
|
||||
\param to Index of the last sample, < 0 means to the end
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtPointPolar> &series, int from, int to )
|
||||
{
|
||||
return qwtBoundingRectT<QwtPointPolar>( series, from, to );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect of a series subset
|
||||
|
||||
Slow implementation, that iterates over the series.
|
||||
|
||||
\param series Series
|
||||
\param from Index of the first sample, <= 0 means from the beginning
|
||||
\param to Index of the last sample, < 0 means to the end
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtIntervalSample>& series, int from, int to )
|
||||
{
|
||||
return qwtBoundingRectT<QwtIntervalSample>( series, from, to );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect of a series subset
|
||||
|
||||
Slow implementation, that iterates over the series.
|
||||
|
||||
\param series Series
|
||||
\param from Index of the first sample, <= 0 means from the beginning
|
||||
\param to Index of the last sample, < 0 means to the end
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtSetSample>& series, int from, int to )
|
||||
{
|
||||
return qwtBoundingRectT<QwtSetSample>( series, from, to );
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
\param samples Samples
|
||||
*/
|
||||
QwtPointSeriesData::QwtPointSeriesData(
|
||||
const QVector<QPointF> &samples ):
|
||||
QwtArraySeriesData<QPointF>( samples )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
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 ( d_boundingRect.width() < 0.0 )
|
||||
d_boundingRect = qwtBoundingRect( *this );
|
||||
|
||||
return d_boundingRect;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
\param samples Samples
|
||||
*/
|
||||
QwtPoint3DSeriesData::QwtPoint3DSeriesData(
|
||||
const QVector<QwtPoint3D> &samples ):
|
||||
QwtArraySeriesData<QwtPoint3D>( samples )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
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 ( d_boundingRect.width() < 0.0 )
|
||||
d_boundingRect = qwtBoundingRect( *this );
|
||||
|
||||
return d_boundingRect;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
\param samples Samples
|
||||
*/
|
||||
QwtIntervalSeriesData::QwtIntervalSeriesData(
|
||||
const QVector<QwtIntervalSample> &samples ):
|
||||
QwtArraySeriesData<QwtIntervalSample>( samples )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
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 ( d_boundingRect.width() < 0.0 )
|
||||
d_boundingRect = qwtBoundingRect( *this );
|
||||
|
||||
return d_boundingRect;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
\param samples Samples
|
||||
*/
|
||||
QwtSetSeriesData::QwtSetSeriesData(
|
||||
const QVector<QwtSetSample> &samples ):
|
||||
QwtArraySeriesData<QwtSetSample>( samples )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
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 ( d_boundingRect.width() < 0.0 )
|
||||
d_boundingRect = qwtBoundingRect( *this );
|
||||
|
||||
return d_boundingRect;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
|
||||
\param x Array of x values
|
||||
\param y Array of y values
|
||||
|
||||
\sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
|
||||
*/
|
||||
QwtPointArrayData::QwtPointArrayData(
|
||||
const QVector<double> &x, const QVector<double> &y ):
|
||||
d_x( x ),
|
||||
d_y( y )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
|
||||
\param x Array of x values
|
||||
\param y Array of y values
|
||||
\param size Size of the x and y arrays
|
||||
\sa QwtPlotCurve::setData(), QwtPlotCurve::setSamples()
|
||||
*/
|
||||
QwtPointArrayData::QwtPointArrayData( const double *x,
|
||||
const double *y, size_t size )
|
||||
{
|
||||
d_x.resize( size );
|
||||
qMemCopy( d_x.data(), x, size * sizeof( double ) );
|
||||
|
||||
d_y.resize( size );
|
||||
qMemCopy( d_y.data(), y, size * sizeof( double ) );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
The bounding rectangle is calculated once by iterating over all
|
||||
points and is stored for all following requests.
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF QwtPointArrayData::boundingRect() const
|
||||
{
|
||||
if ( d_boundingRect.width() < 0 )
|
||||
d_boundingRect = qwtBoundingRect( *this );
|
||||
|
||||
return d_boundingRect;
|
||||
}
|
||||
|
||||
//! \return Size of the data set
|
||||
size_t QwtPointArrayData::size() const
|
||||
{
|
||||
return qMin( d_x.size(), d_y.size() );
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the sample at position i
|
||||
|
||||
\param i Index
|
||||
\return Sample at position i
|
||||
*/
|
||||
QPointF QwtPointArrayData::sample( size_t i ) const
|
||||
{
|
||||
return QPointF( d_x[int( i )], d_y[int( i )] );
|
||||
}
|
||||
|
||||
//! \return Array of the x-values
|
||||
const QVector<double> &QwtPointArrayData::xData() const
|
||||
{
|
||||
return d_x;
|
||||
}
|
||||
|
||||
//! \return Array of the y-values
|
||||
const QVector<double> &QwtPointArrayData::yData() const
|
||||
{
|
||||
return d_y;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
|
||||
\param x Array of x values
|
||||
\param y Array of y values
|
||||
\param size Size of the x and y arrays
|
||||
|
||||
\warning The programmer must assure that the memory blocks referenced
|
||||
by the pointers remain valid during the lifetime of the
|
||||
QwtPlotCPointer object.
|
||||
|
||||
\sa QwtPlotCurve::setData(), QwtPlotCurve::setRawSamples()
|
||||
*/
|
||||
QwtCPointerData::QwtCPointerData(
|
||||
const double *x, const double *y, size_t size ):
|
||||
d_x( x ),
|
||||
d_y( y ),
|
||||
d_size( size )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
The bounding rectangle is calculated once by iterating over all
|
||||
points and is stored for all following requests.
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF QwtCPointerData::boundingRect() const
|
||||
{
|
||||
if ( d_boundingRect.width() < 0 )
|
||||
d_boundingRect = qwtBoundingRect( *this );
|
||||
|
||||
return d_boundingRect;
|
||||
}
|
||||
|
||||
//! \return Size of the data set
|
||||
size_t QwtCPointerData::size() const
|
||||
{
|
||||
return d_size;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the sample at position i
|
||||
|
||||
\param i Index
|
||||
\return Sample at position i
|
||||
*/
|
||||
QPointF QwtCPointerData::sample( size_t i ) const
|
||||
{
|
||||
return QPointF( d_x[int( i )], d_y[int( i )] );
|
||||
}
|
||||
|
||||
//! \return Array of the x-values
|
||||
const double *QwtCPointerData::xData() const
|
||||
{
|
||||
return d_x;
|
||||
}
|
||||
|
||||
//! \return Array of the y-values
|
||||
const double *QwtCPointerData::yData() const
|
||||
{
|
||||
return d_y;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
|
||||
\param size Number of points
|
||||
\param interval Bounding interval for the points
|
||||
|
||||
\sa setInterval(), setSize()
|
||||
*/
|
||||
QwtSyntheticPointData::QwtSyntheticPointData(
|
||||
size_t size, const QwtInterval &interval ):
|
||||
d_size( size ),
|
||||
d_interval( interval )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Change the number of points
|
||||
|
||||
\param size Number of points
|
||||
\sa size(), setInterval()
|
||||
*/
|
||||
void QwtSyntheticPointData::setSize( size_t size )
|
||||
{
|
||||
d_size = size;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return Number of points
|
||||
\sa setSize(), interval()
|
||||
*/
|
||||
size_t QwtSyntheticPointData::size() const
|
||||
{
|
||||
return d_size;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the bounding interval
|
||||
|
||||
\param interval Interval
|
||||
\sa interval(), setSize()
|
||||
*/
|
||||
void QwtSyntheticPointData::setInterval( const QwtInterval &interval )
|
||||
{
|
||||
d_interval = interval.normalized();
|
||||
}
|
||||
|
||||
/*!
|
||||
\return Bounding interval
|
||||
\sa setInterval(), size()
|
||||
*/
|
||||
QwtInterval QwtSyntheticPointData::interval() const
|
||||
{
|
||||
return d_interval;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set a the "rect of interest"
|
||||
|
||||
QwtPlotSeriesItem defines the current area of the plot canvas
|
||||
as "rect of interest" ( QwtPlotSeriesItem::updateScaleDiv() ).
|
||||
|
||||
If interval().isValid() == false the x values are calculated
|
||||
in the interval rect.left() -> rect.right().
|
||||
|
||||
\sa rectOfInterest()
|
||||
*/
|
||||
void QwtSyntheticPointData::setRectOfInterest( const QRectF &rect )
|
||||
{
|
||||
d_rectOfInterest = rect;
|
||||
d_intervalOfInterest = QwtInterval(
|
||||
rect.left(), rect.right() ).normalized();
|
||||
}
|
||||
|
||||
/*!
|
||||
\return "rect of interest"
|
||||
\sa setRectOfInterest()
|
||||
*/
|
||||
QRectF QwtSyntheticPointData::rectOfInterest() const
|
||||
{
|
||||
return d_rectOfInterest;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Calculate the bounding rect
|
||||
|
||||
This implementation iterates over all points, what could often
|
||||
be implemented much faster using the characteristics of the series.
|
||||
When there are many points it is recommended to overload and
|
||||
reimplement this method using the characteristics of the series
|
||||
( if possible ).
|
||||
|
||||
\return Bounding rectangle
|
||||
*/
|
||||
QRectF QwtSyntheticPointData::boundingRect() const
|
||||
{
|
||||
if ( d_size == 0 ||
|
||||
!( d_interval.isValid() || d_intervalOfInterest.isValid() ) )
|
||||
{
|
||||
return QRectF(1.0, 1.0, -2.0, -2.0); // something invalid
|
||||
}
|
||||
|
||||
return qwtBoundingRect( *this );
|
||||
}
|
||||
|
||||
/*!
|
||||
Calculate the point from an index
|
||||
|
||||
\param index Index
|
||||
\return QPointF(x(index), y(x(index)));
|
||||
|
||||
\warning For invalid indices ( index < 0 || index >= size() )
|
||||
(0, 0) is returned.
|
||||
*/
|
||||
QPointF QwtSyntheticPointData::sample( size_t index ) const
|
||||
{
|
||||
if ( index >= d_size )
|
||||
return QPointF( 0, 0 );
|
||||
|
||||
const double xValue = x( index );
|
||||
const double yValue = y( xValue );
|
||||
|
||||
return QPointF( xValue, yValue );
|
||||
}
|
||||
|
||||
/*!
|
||||
Calculate a x-value from an index
|
||||
|
||||
x values are calculated by deviding an interval into
|
||||
equidistant steps. If !interval().isValid() the
|
||||
interval is calculated from the "rect of interest".
|
||||
|
||||
\sa interval(), rectOfInterest(), y()
|
||||
*/
|
||||
double QwtSyntheticPointData::x( uint index ) const
|
||||
{
|
||||
const QwtInterval &interval = d_interval.isValid() ?
|
||||
d_interval : d_intervalOfInterest;
|
||||
|
||||
if ( !interval.isValid() || d_size == 0 || index >= d_size )
|
||||
return 0.0;
|
||||
|
||||
const double dx = interval.width() / d_size;
|
||||
return interval.minValue() + index * dx;
|
||||
}
|
||||
@@ -1,442 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QWT_SERIES_DATA_H
|
||||
#define QWT_SERIES_DATA_H 1
|
||||
|
||||
#include "qwt_global.h"
|
||||
#include "qwt_interval.h"
|
||||
#include "qwt_point_3d.h"
|
||||
#include "qwt_point_polar.h"
|
||||
#include <qvector.h>
|
||||
#include <qrect.h>
|
||||
|
||||
//! \brief A sample of the types (x1-x2, y) or (x, y1-y2)
|
||||
class QWT_EXPORT QwtIntervalSample
|
||||
{
|
||||
public:
|
||||
QwtIntervalSample();
|
||||
QwtIntervalSample( double, const QwtInterval & );
|
||||
QwtIntervalSample( double value, double min, double max );
|
||||
|
||||
bool operator==( const QwtIntervalSample & ) const;
|
||||
bool operator!=( const QwtIntervalSample & ) const;
|
||||
|
||||
//! Value
|
||||
double value;
|
||||
|
||||
//! Interval
|
||||
QwtInterval interval;
|
||||
};
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
The value is set to 0.0, the interval is invalid
|
||||
*/
|
||||
inline QwtIntervalSample::QwtIntervalSample():
|
||||
value( 0.0 )
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructor
|
||||
inline QwtIntervalSample::QwtIntervalSample(
|
||||
double v, const QwtInterval &intv ):
|
||||
value( v ),
|
||||
interval( intv )
|
||||
{
|
||||
}
|
||||
|
||||
//! Constructor
|
||||
inline QwtIntervalSample::QwtIntervalSample(
|
||||
double v, double min, double max ):
|
||||
value( v ),
|
||||
interval( min, max )
|
||||
{
|
||||
}
|
||||
|
||||
//! Compare operator
|
||||
inline bool QwtIntervalSample::operator==(
|
||||
const QwtIntervalSample &other ) const
|
||||
{
|
||||
return value == other.value && interval == other.interval;
|
||||
}
|
||||
|
||||
//! Compare operator
|
||||
inline bool QwtIntervalSample::operator!=(
|
||||
const QwtIntervalSample &other ) const
|
||||
{
|
||||
return !( *this == other );
|
||||
}
|
||||
|
||||
//! \brief A sample of the types (x1...xn, y) or (x, y1..yn)
|
||||
class QWT_EXPORT QwtSetSample
|
||||
{
|
||||
public:
|
||||
QwtSetSample();
|
||||
bool operator==( const QwtSetSample &other ) const;
|
||||
bool operator!=( const QwtSetSample &other ) const;
|
||||
|
||||
//! value
|
||||
double value;
|
||||
|
||||
//! Vector of values associated to value
|
||||
QVector<double> set;
|
||||
};
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
The value is set to 0.0
|
||||
*/
|
||||
inline QwtSetSample::QwtSetSample():
|
||||
value( 0.0 )
|
||||
{
|
||||
}
|
||||
|
||||
//! Compare operator
|
||||
inline bool QwtSetSample::operator==( const QwtSetSample &other ) const
|
||||
{
|
||||
return value == other.value && set == other.set;
|
||||
}
|
||||
|
||||
//! Compare operator
|
||||
inline bool QwtSetSample::operator!=( const QwtSetSample &other ) const
|
||||
{
|
||||
return !( *this == other );
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Abstract interface for iterating over samples
|
||||
|
||||
Qwt offers several implementations of the QwtSeriesData API,
|
||||
but in situations, where data of an application specific format
|
||||
needs to be displayed, without having to copy it, it is recommended
|
||||
to implement an individual data access.
|
||||
*/
|
||||
template <typename T>
|
||||
class QwtSeriesData
|
||||
{
|
||||
public:
|
||||
QwtSeriesData();
|
||||
virtual ~QwtSeriesData();
|
||||
|
||||
//! \return Number of samples
|
||||
virtual size_t size() const = 0;
|
||||
|
||||
/*!
|
||||
Return a sample
|
||||
\param i Index
|
||||
\return Sample at position i
|
||||
*/
|
||||
virtual T sample( size_t i ) const = 0;
|
||||
|
||||
/*!
|
||||
Calculate the bounding rect of all samples
|
||||
|
||||
The bounding rect is necessary for autoscaling and can be used
|
||||
for a couple of painting optimizations.
|
||||
|
||||
qwtBoundingRect(...) offers slow implementations iterating
|
||||
over the samples. For large sets it is recommended to implement
|
||||
something faster f.e. by caching the bounding rect.
|
||||
*/
|
||||
virtual QRectF boundingRect() const = 0;
|
||||
|
||||
virtual void setRectOfInterest( const QRectF & );
|
||||
|
||||
protected:
|
||||
//! Can be used to cache a calculated bounding rectangle
|
||||
mutable QRectF d_boundingRect;
|
||||
|
||||
private:
|
||||
QwtSeriesData<T> &operator=( const QwtSeriesData<T> & );
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
template <typename T>
|
||||
QwtSeriesData<T>::QwtSeriesData():
|
||||
d_boundingRect( 0.0, 0.0, -1.0, -1.0 )
|
||||
{
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
template <typename T>
|
||||
QwtSeriesData<T>::~QwtSeriesData()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Set a the "rect of interest"
|
||||
|
||||
QwtPlotSeriesItem defines the current area of the plot canvas
|
||||
as "rect of interest" ( QwtPlotSeriesItem::updateScaleDiv() ).
|
||||
It can be used to implement different levels of details.
|
||||
|
||||
The default implementation does nothing.
|
||||
*/
|
||||
template <typename T>
|
||||
void QwtSeriesData<T>::setRectOfInterest( const QRectF & )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Template class for data, that is organized as QVector
|
||||
|
||||
QVector uses implicit data sharing and can be
|
||||
passed around as argument efficiently.
|
||||
*/
|
||||
template <typename T>
|
||||
class QwtArraySeriesData: public QwtSeriesData<T>
|
||||
{
|
||||
public:
|
||||
QwtArraySeriesData();
|
||||
QwtArraySeriesData( const QVector<T> & );
|
||||
|
||||
void setSamples( const QVector<T> & );
|
||||
const QVector<T> samples() const;
|
||||
|
||||
virtual size_t size() const;
|
||||
virtual T sample( size_t ) const;
|
||||
|
||||
protected:
|
||||
//! Vector of samples
|
||||
QVector<T> d_samples;
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
template <typename T>
|
||||
QwtArraySeriesData<T>::QwtArraySeriesData()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
\param samples Array of samples
|
||||
*/
|
||||
template <typename T>
|
||||
QwtArraySeriesData<T>::QwtArraySeriesData( const QVector<T> &samples ):
|
||||
d_samples( samples )
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Assign an array of samples
|
||||
\param samples Array of samples
|
||||
*/
|
||||
template <typename T>
|
||||
void QwtArraySeriesData<T>::setSamples( const QVector<T> &samples )
|
||||
{
|
||||
QwtSeriesData<T>::d_boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
|
||||
d_samples = samples;
|
||||
}
|
||||
|
||||
//! \return Array of samples
|
||||
template <typename T>
|
||||
const QVector<T> QwtArraySeriesData<T>::samples() const
|
||||
{
|
||||
return d_samples;
|
||||
}
|
||||
|
||||
//! \return Number of samples
|
||||
template <typename T>
|
||||
size_t QwtArraySeriesData<T>::size() const
|
||||
{
|
||||
return d_samples.size();
|
||||
}
|
||||
|
||||
/*!
|
||||
Return a sample
|
||||
\param i Index
|
||||
\return Sample at position i
|
||||
*/
|
||||
template <typename T>
|
||||
T QwtArraySeriesData<T>::sample( size_t i ) const
|
||||
{
|
||||
return d_samples[i];
|
||||
}
|
||||
|
||||
//! 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;
|
||||
};
|
||||
|
||||
//! 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;
|
||||
};
|
||||
|
||||
//! 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;
|
||||
};
|
||||
|
||||
//! 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;
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Interface for iterating over two QVector<double> objects.
|
||||
*/
|
||||
class QWT_EXPORT QwtPointArrayData: public QwtSeriesData<QPointF>
|
||||
{
|
||||
public:
|
||||
QwtPointArrayData( const QVector<double> &x, const QVector<double> &y );
|
||||
QwtPointArrayData( const double *x, const double *y, size_t size );
|
||||
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
virtual size_t size() const;
|
||||
virtual QPointF sample( size_t i ) const;
|
||||
|
||||
const QVector<double> &xData() const;
|
||||
const QVector<double> &yData() const;
|
||||
|
||||
private:
|
||||
QVector<double> d_x;
|
||||
QVector<double> d_y;
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Data class containing two pointers to memory blocks of doubles.
|
||||
*/
|
||||
class QWT_EXPORT QwtCPointerData: public QwtSeriesData<QPointF>
|
||||
{
|
||||
public:
|
||||
QwtCPointerData( const double *x, const double *y, size_t size );
|
||||
|
||||
virtual QRectF boundingRect() const;
|
||||
virtual size_t size() const;
|
||||
virtual QPointF sample( size_t i ) const;
|
||||
|
||||
const double *xData() const;
|
||||
const double *yData() const;
|
||||
|
||||
private:
|
||||
const double *d_x;
|
||||
const double *d_y;
|
||||
size_t d_size;
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Synthetic point data
|
||||
|
||||
QwtSyntheticPointData provides a fixed number of points for an interval.
|
||||
The points are calculated in equidistant steps in x-direction.
|
||||
|
||||
If the interval is invalid, the points are calculated for
|
||||
the "rect of interest", what normally is the displayed area on the
|
||||
plot canvas. In this mode you get different levels of detail, when
|
||||
zooming in/out.
|
||||
|
||||
\par Example
|
||||
|
||||
The following example shows how to implement a sinus curve.
|
||||
|
||||
\verbatim
|
||||
#include <cmath>
|
||||
#include <qwt_series_data.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
class SinusData: public QwtSyntheticPointData
|
||||
{
|
||||
public:
|
||||
SinusData():
|
||||
QwtSyntheticPointData(100)
|
||||
{
|
||||
}
|
||||
virtual double y(double x) const
|
||||
{
|
||||
return qSin(x);
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QwtPlot plot;
|
||||
plot.setAxisScale(QwtPlot::xBottom, 0.0, 10.0);
|
||||
plot.setAxisScale(QwtPlot::yLeft, -1.0, 1.0);
|
||||
|
||||
QwtPlotCurve *curve = new QwtPlotCurve("y = sin(x)");
|
||||
curve->setData(SinusData());
|
||||
curve->attach(&plot);
|
||||
|
||||
plot.show();
|
||||
return a.exec();
|
||||
}
|
||||
\endverbatim
|
||||
*/
|
||||
class QWT_EXPORT QwtSyntheticPointData: public QwtSeriesData<QPointF>
|
||||
{
|
||||
public:
|
||||
QwtSyntheticPointData( size_t size,
|
||||
const QwtInterval & = QwtInterval() );
|
||||
|
||||
void setSize( size_t size );
|
||||
size_t size() const;
|
||||
|
||||
void setInterval( const QwtInterval& );
|
||||
QwtInterval interval() const;
|
||||
|
||||
virtual QRectF boundingRect() const;
|
||||
virtual QPointF sample( size_t i ) const;
|
||||
|
||||
/*!
|
||||
Calculate a y value for a x value
|
||||
|
||||
\param x x value
|
||||
\return Corresponding y value
|
||||
*/
|
||||
virtual double y( double x ) const = 0;
|
||||
virtual double x( uint index ) const;
|
||||
|
||||
virtual void setRectOfInterest( const QRectF & );
|
||||
QRectF rectOfInterest() const;
|
||||
|
||||
private:
|
||||
size_t d_size;
|
||||
QwtInterval d_interval;
|
||||
QRectF d_rectOfInterest;
|
||||
QwtInterval d_intervalOfInterest;
|
||||
};
|
||||
|
||||
QWT_EXPORT QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QPointF> &, int from = 0, int to = -1 );
|
||||
QWT_EXPORT QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtPoint3D> &, int from = 0, int to = -1 );
|
||||
QWT_EXPORT QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtPointPolar> &, int from = 0, int to = -1 );
|
||||
QWT_EXPORT QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtIntervalSample> &, int from = 0, int to = -1 );
|
||||
QWT_EXPORT QRectF qwtBoundingRect(
|
||||
const QwtSeriesData<QwtSetSample> &, int from = 0, int to = -1 );
|
||||
|
||||
#endif
|
||||
@@ -1,364 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
#include "qwt_system_clock.h"
|
||||
#include <qdatetime.h>
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <stdint.h>
|
||||
#include <mach/mach_time.h>
|
||||
#define QWT_HIGH_RESOLUTION_CLOCK
|
||||
#elif defined(_POSIX_TIMERS)
|
||||
#include <time.h>
|
||||
#define QWT_HIGH_RESOLUTION_CLOCK
|
||||
#elif defined(Q_OS_WIN)
|
||||
#define QWT_HIGH_RESOLUTION_CLOCK
|
||||
#include <qt_windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
|
||||
class QwtHighResolutionClock
|
||||
{
|
||||
public:
|
||||
QwtHighResolutionClock();
|
||||
|
||||
void start();
|
||||
double restart();
|
||||
double elapsed() const;
|
||||
|
||||
bool isNull() const;
|
||||
|
||||
static double precision();
|
||||
|
||||
private:
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
static double msecsTo( uint64_t, uint64_t );
|
||||
|
||||
uint64_t d_timeStamp;
|
||||
#elif defined(_POSIX_TIMERS)
|
||||
|
||||
static double msecsTo( const struct timespec &,
|
||||
const struct timespec & );
|
||||
|
||||
static bool isMonotonic();
|
||||
|
||||
struct timespec d_timeStamp;
|
||||
clockid_t d_clockId;
|
||||
|
||||
#elif defined(Q_OS_WIN)
|
||||
|
||||
LARGE_INTEGER d_startTicks;
|
||||
LARGE_INTEGER d_ticksPerSecond;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
QwtHighResolutionClock::QwtHighResolutionClock():
|
||||
d_timeStamp( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::precision()
|
||||
{
|
||||
return 1e-6;
|
||||
}
|
||||
|
||||
void QwtHighResolutionClock::start()
|
||||
{
|
||||
d_timeStamp = mach_absolute_time();
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::restart()
|
||||
{
|
||||
const uint64_t timeStamp = mach_absolute_time();
|
||||
const double elapsed = msecsTo( d_timeStamp, timeStamp );
|
||||
d_timeStamp = timeStamp;
|
||||
|
||||
return elapsed;
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::elapsed() const
|
||||
{
|
||||
return msecsTo( d_timeStamp, mach_absolute_time() );
|
||||
}
|
||||
|
||||
bool QwtHighResolutionClock::isNull() const
|
||||
{
|
||||
return d_timeStamp == 0;
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::msecsTo(
|
||||
uint64_t from, uint64_t to )
|
||||
{
|
||||
const uint64_t difference = to - from;
|
||||
|
||||
static double conversion = 0.0;
|
||||
if ( conversion == 0.0 )
|
||||
{
|
||||
mach_timebase_info_data_t info;
|
||||
kern_return_t err = mach_timebase_info( &info );
|
||||
|
||||
//Convert the timebase into ms
|
||||
if ( err == 0 )
|
||||
conversion = 1e-6 * ( double ) info.numer / ( double ) info.denom;
|
||||
}
|
||||
|
||||
return conversion * ( double ) difference;
|
||||
}
|
||||
|
||||
#elif defined(_POSIX_TIMERS)
|
||||
|
||||
QwtHighResolutionClock::QwtHighResolutionClock()
|
||||
{
|
||||
d_clockId = isMonotonic() ? CLOCK_MONOTONIC : CLOCK_REALTIME;
|
||||
d_timeStamp.tv_sec = d_timeStamp.tv_nsec = 0;
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::precision()
|
||||
{
|
||||
struct timespec resolution;
|
||||
|
||||
int clockId = isMonotonic() ? CLOCK_MONOTONIC : CLOCK_REALTIME;
|
||||
::clock_getres( clockId, &resolution );
|
||||
|
||||
return resolution.tv_nsec / 1e3;
|
||||
}
|
||||
|
||||
inline bool QwtHighResolutionClock::isNull() const
|
||||
{
|
||||
return d_timeStamp.tv_sec <= 0 && d_timeStamp.tv_nsec <= 0;
|
||||
}
|
||||
|
||||
inline void QwtHighResolutionClock::start()
|
||||
{
|
||||
::clock_gettime( d_clockId, &d_timeStamp );
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::restart()
|
||||
{
|
||||
struct timespec timeStamp;
|
||||
::clock_gettime( d_clockId, &timeStamp );
|
||||
|
||||
const double elapsed = msecsTo( d_timeStamp, timeStamp );
|
||||
|
||||
d_timeStamp = timeStamp;
|
||||
return elapsed;
|
||||
}
|
||||
|
||||
inline double QwtHighResolutionClock::elapsed() const
|
||||
{
|
||||
struct timespec timeStamp;
|
||||
::clock_gettime( d_clockId, &timeStamp );
|
||||
|
||||
return msecsTo( d_timeStamp, timeStamp );
|
||||
}
|
||||
|
||||
inline double QwtHighResolutionClock::msecsTo(
|
||||
const struct timespec &t1, const struct timespec &t2 )
|
||||
{
|
||||
return ( t2.tv_sec - t1.tv_sec ) * 1e3
|
||||
+ ( t2.tv_nsec - t1.tv_nsec ) * 1e-6;
|
||||
}
|
||||
|
||||
bool QwtHighResolutionClock::isMonotonic()
|
||||
{
|
||||
// code copied from qcore_unix.cpp
|
||||
|
||||
#if (_POSIX_MONOTONIC_CLOCK-0 > 0)
|
||||
return true;
|
||||
#else
|
||||
static int returnValue = 0;
|
||||
|
||||
if ( returnValue == 0 )
|
||||
{
|
||||
#if (_POSIX_MONOTONIC_CLOCK-0 < 0) || !defined(_SC_MONOTONIC_CLOCK)
|
||||
returnValue = -1;
|
||||
#elif (_POSIX_MONOTONIC_CLOCK == 0)
|
||||
// detect if the system support monotonic timers
|
||||
const long x = sysconf( _SC_MONOTONIC_CLOCK );
|
||||
returnValue = ( x >= 200112L ) ? 1 : -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
return returnValue != -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(Q_OS_WIN)
|
||||
|
||||
QwtHighResolutionClock::QwtHighResolutionClock()
|
||||
{
|
||||
d_startTicks.QuadPart = 0;
|
||||
QueryPerformanceFrequency( &d_ticksPerSecond );
|
||||
}
|
||||
|
||||
double QwtHighResolutionClock::precision()
|
||||
{
|
||||
LARGE_INTEGER ticks;
|
||||
if ( QueryPerformanceFrequency( &ticks ) && ticks.QuadPart > 0 )
|
||||
return 1e3 / ticks.QuadPart;
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
inline bool QwtHighResolutionClock::isNull() const
|
||||
{
|
||||
return d_startTicks.QuadPart <= 0;
|
||||
}
|
||||
|
||||
inline void QwtHighResolutionClock::start()
|
||||
{
|
||||
QueryPerformanceCounter( &d_startTicks );
|
||||
}
|
||||
|
||||
inline double QwtHighResolutionClock::restart()
|
||||
{
|
||||
LARGE_INTEGER ticks;
|
||||
QueryPerformanceCounter( &ticks );
|
||||
|
||||
const double dt = ticks.QuadPart - d_startTicks.QuadPart;
|
||||
d_startTicks = ticks;
|
||||
|
||||
return dt / d_ticksPerSecond.QuadPart * 1e3;
|
||||
}
|
||||
|
||||
inline double QwtHighResolutionClock::elapsed() const
|
||||
{
|
||||
LARGE_INTEGER ticks;
|
||||
QueryPerformanceCounter( &ticks );
|
||||
|
||||
const double dt = ticks.QuadPart - d_startTicks.QuadPart;
|
||||
return dt / d_ticksPerSecond.QuadPart * 1e3;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // QWT_HIGH_RESOLUTION_CLOCK
|
||||
|
||||
class QwtSystemClock::PrivateData
|
||||
{
|
||||
public:
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
QwtHighResolutionClock *clock;
|
||||
#endif
|
||||
QTime time;
|
||||
};
|
||||
|
||||
//! Constructs a null clock object.
|
||||
QwtSystemClock::QwtSystemClock()
|
||||
{
|
||||
d_data = new PrivateData;
|
||||
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
d_data->clock = NULL;
|
||||
if ( QwtHighResolutionClock::precision() > 0.0 )
|
||||
d_data->clock = new QwtHighResolutionClock;
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
QwtSystemClock::~QwtSystemClock()
|
||||
{
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
delete d_data->clock;
|
||||
#endif
|
||||
delete d_data;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return true if the clock has never been started.
|
||||
*/
|
||||
bool QwtSystemClock::isNull() const
|
||||
{
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
if ( d_data->clock )
|
||||
return d_data->clock->isNull();
|
||||
#endif
|
||||
|
||||
return d_data->time.isNull();
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the start time to the current time.
|
||||
*/
|
||||
void QwtSystemClock::start()
|
||||
{
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
if ( d_data->clock )
|
||||
{
|
||||
d_data->clock->start();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
d_data->time.start();
|
||||
}
|
||||
|
||||
/*!
|
||||
The start time to the current time and
|
||||
return the time, that is elapsed since the
|
||||
previous start time.
|
||||
*/
|
||||
double QwtSystemClock::restart()
|
||||
{
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
if ( d_data->clock )
|
||||
return d_data->clock->restart();
|
||||
#endif
|
||||
|
||||
return d_data->time.restart();
|
||||
}
|
||||
|
||||
/*!
|
||||
\return Number of milliseconds that have elapsed since the last time
|
||||
start() or restart() was called or 0.0 for null clocks.
|
||||
*/
|
||||
double QwtSystemClock::elapsed() const
|
||||
{
|
||||
double elapsed = 0.0;
|
||||
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
if ( d_data->clock )
|
||||
{
|
||||
if ( !d_data->clock->isNull() )
|
||||
elapsed = d_data->clock->elapsed();
|
||||
|
||||
return elapsed;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !d_data->time.isNull() )
|
||||
elapsed = d_data->time.elapsed();
|
||||
|
||||
return elapsed;
|
||||
}
|
||||
|
||||
/*!
|
||||
\return Accuracy of the system clock in milliseconds.
|
||||
*/
|
||||
double QwtSystemClock::precision()
|
||||
{
|
||||
static double prec = 0.0;
|
||||
if ( prec <= 0.0 )
|
||||
{
|
||||
#if defined(QWT_HIGH_RESOLUTION_CLOCK)
|
||||
prec = QwtHighResolutionClock::precision();
|
||||
#endif
|
||||
if ( prec <= 0.0 )
|
||||
prec = 1.0; // QTime offers 1 ms
|
||||
}
|
||||
|
||||
return prec;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||||
* 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
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QWT_SYSTEM_CLOCK_H
|
||||
#define QWT_SYSTEM_CLOCK_H
|
||||
|
||||
#include "qwt_global.h"
|
||||
|
||||
/*!
|
||||
\brief QwtSystemClock provides high resolution clock time functions.
|
||||
|
||||
Sometimes the resolution offered by QTime ( millisecond ) is not accurate
|
||||
enough for implementing time measurements ( f.e. sampling ).
|
||||
QwtSystemClock offers a subset of the QTime functionality using higher
|
||||
resolution timers ( if possible ).
|
||||
|
||||
Precision and time intervals are multiples of milliseconds (ms).
|
||||
|
||||
\note The implementation uses high-resolution performance counter on Windows,
|
||||
mach_absolute_time() on the Mac or POSIX timers on other systems.
|
||||
If none is available it falls back on QTimer.
|
||||
*/
|
||||
|
||||
class QWT_EXPORT QwtSystemClock
|
||||
{
|
||||
public:
|
||||
QwtSystemClock();
|
||||
virtual ~QwtSystemClock();
|
||||
|
||||
bool isNull() const;
|
||||
|
||||
void start();
|
||||
double restart();
|
||||
double elapsed() const;
|
||||
|
||||
static double precision();
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
PrivateData *d_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
qwt_mml_document.h/qwt_mml_document.cpp have been stripped down from
|
||||
"MML Widget" package of the solutions package, that is distributed under
|
||||
the following licenses:
|
||||
|
||||
-----------------------------------------------------------------
|
||||
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
All rights reserved.
|
||||
Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
|
||||
Commercial Usage
|
||||
Licensees holding valid Qt Commercial licenses may use this file in
|
||||
accordance with the Qt Solutions Commercial License Agreement provided
|
||||
with the Software or, alternatively, in accordance with the terms
|
||||
contained in a written agreement between you and Nokia.
|
||||
|
||||
GNU Lesser General Public License Usage
|
||||
Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
General Public License version 2.1 as published by the Free Software
|
||||
Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
packaging of this file. Please review the following information to
|
||||
ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
|
||||
In addition, as a special exception, Nokia gives you certain
|
||||
additional rights. These rights are described in the Nokia Qt LGPL
|
||||
Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
|
||||
package.
|
||||
|
||||
GNU General Public License Usage
|
||||
Alternatively, this file may be used under the terms of the GNU
|
||||
General Public License version 3.0 as published by the Free Software
|
||||
Foundation and appearing in the file LICENSE.GPL included in the
|
||||
packaging of this file. Please review the following information to
|
||||
ensure the GNU General Public License version 3.0 requirements will be
|
||||
met: http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
Please note Third Party Software included with Qt Solutions may impose
|
||||
additional restrictions and it is the user's responsibility to ensure
|
||||
that they have met the licensing requirements of the GPL, LGPL, or Qt
|
||||
Solutions Commercial license and the relevant license of the Third
|
||||
Party Software they are using.
|
||||
|
||||
If you are unsure which license is appropriate for your use, please
|
||||
contact Nokia at qt-info@nokia.com.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
#ifndef _QWT_MML_DOCUMENT_H_
|
||||
#define _QWT_MML_DOCUMENT_H_ 1
|
||||
|
||||
#include <qwt_global.h>
|
||||
#include <QString>
|
||||
|
||||
class QPainter;
|
||||
class QPoint;
|
||||
|
||||
class QwtMmlDocument;
|
||||
|
||||
class QWT_EXPORT QwtMathMLDocument
|
||||
{
|
||||
public:
|
||||
enum MmlFont
|
||||
{
|
||||
NormalFont,
|
||||
FrakturFont,
|
||||
SansSerifFont,
|
||||
ScriptFont,
|
||||
MonospaceFont,
|
||||
DoublestruckFont
|
||||
};
|
||||
|
||||
QwtMathMLDocument();
|
||||
~QwtMathMLDocument();
|
||||
|
||||
void clear();
|
||||
|
||||
bool setContent( QString text, QString *errorMsg = 0,
|
||||
int *errorLine = 0, int *errorColumn = 0 );
|
||||
void paint( QPainter *p, const QPoint &pos ) const;
|
||||
QSize size() const;
|
||||
|
||||
QString fontName( MmlFont type ) const;
|
||||
void setFontName( MmlFont type, const QString &name );
|
||||
|
||||
int baseFontPointSize() const;
|
||||
void setBaseFontPointSize( int size );
|
||||
|
||||
private:
|
||||
QwtMmlDocument *m_doc;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,37 +0,0 @@
|
||||
################################################################
|
||||
# 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
|
||||
################################################################
|
||||
|
||||
include ( ./qwtconfig.pri )
|
||||
|
||||
contains(QWT_CONFIG, QwtDll) {
|
||||
|
||||
DEFINES *= QWT_DLL
|
||||
}
|
||||
|
||||
QT *= xml
|
||||
|
||||
contains(QWT_CONFIG, QwtFramework) {
|
||||
|
||||
INCLUDEPATH *= $${QWT_INSTALL_LIBS}/qwtmathml.framework/Headers
|
||||
LIBS *= -F$${QWT_INSTALL_LIBS}
|
||||
}
|
||||
else {
|
||||
|
||||
INCLUDEPATH *= $${QWT_INSTALL_HEADERS}
|
||||
LIBS *= -L$${QWT_INSTALL_LIBS}
|
||||
}
|
||||
|
||||
INCLUDEPATH_QWTMATHML = $${INCLUDEPATH}
|
||||
qtAddLibrary(qwtmathml)
|
||||
|
||||
# we don't want qtAddLibrary to expand the
|
||||
# include path, with directories, that might
|
||||
# conflict with other installations of qwt
|
||||
|
||||
INCLUDEPATH = $${INCLUDEPATH_QWTMATHML}
|
||||
Reference in New Issue
Block a user