|
|
/*------------------------------------------------------------------------------
|
|
|
-- This file is a part of the QLop Software
|
|
|
-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
|
|
|
--
|
|
|
-- This program is free software; you can redistribute it and/or modify
|
|
|
-- it under the terms of the GNU General Public License as published by
|
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
|
|
-- (at your option) any later version.
|
|
|
--
|
|
|
-- This program is distributed in the hope that it will be useful,
|
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-- GNU General Public License for more details.
|
|
|
--
|
|
|
-- You should have received a copy of the GNU General Public License
|
|
|
-- along with this program; if not, write to the Free Software
|
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
-------------------------------------------------------------------------------*/
|
|
|
/*-- Author : Alexis Jeandet
|
|
|
-- Mail : alexis.jeandet@member.fsf.org
|
|
|
----------------------------------------------------------------------------*/
|
|
|
/*
|
|
|
* This code is mainly a copy of QCustomPlot's QCPGraph class
|
|
|
*/
|
|
|
#ifndef QCUSTOMPLOTVECT_H
|
|
|
#define QCUSTOMPLOTVECT_H
|
|
|
|
|
|
#include <QWidget>
|
|
|
#include <qcustomplot.h>
|
|
|
|
|
|
class QCPGraphVect : public QCPGraph
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
public:
|
|
|
explicit QCPGraphVect(QCPAxis *keyAxis, QCPAxis *valueAxis);
|
|
|
~QCPGraphVect();
|
|
|
QVector<QCPData> *data() const { return mData; }
|
|
|
void setData(QVector<QCPData> *data);
|
|
|
QVector<QCPData>* getVisibleData();
|
|
|
protected:
|
|
|
QVector<QCPData>* mData;
|
|
|
virtual void draw(QCPPainter *painter);
|
|
|
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
|
|
|
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const;
|
|
|
void getPreparedData(QVector<QCPData> *lineData, QVector<QCPData> *scatterData) const;
|
|
|
void getVisibleDataBounds(QVector<QCPData>::const_iterator &lower, QVector<QCPData>::const_iterator &upper) const;
|
|
|
int countDataInBounds(const QVector<QCPData>::const_iterator &lower, const QVector<QCPData>::const_iterator &upper, int maxCount) const;
|
|
|
|
|
|
void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *scatterData) const;
|
|
|
void getLinePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;
|
|
|
};
|
|
|
|
|
|
class QCustomPlotVect : public QCustomPlot
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
public:
|
|
|
QCustomPlotVect(QWidget *parent = 0);
|
|
|
~QCustomPlotVect();
|
|
|
QCPGraphVect *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0);
|
|
|
protected:
|
|
|
};
|
|
|
|
|
|
#endif // QCUSTOMPLOTVECT_H
|
|
|
|