##// END OF EJS Templates
Spec file ready for rpm packaging....
Spec file ready for rpm packaging. Added automaic name generation for cassini toolbox/export function. Started QLopDataBase viewer.

File last commit:

r11:f1a4e3a7ca04 default
r13:c0cb4ee23d25 default
Show More
SocExplorerPlot.cpp
715 lines | 20.6 KiB | text/x-c | CppLexer
/ src / SocExplorerPlot.cpp
First init
r0 /*------------------------------------------------------------------------------
-- 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
----------------------------------------------------------------------------*/
#include "SocExplorerPlot.h"
Added Python Console and some Wrappers....
r5 #include <QSvgGenerator>
#include <qcpdocumentobject.h>
#include <QPdfWriter>
#include <QPrinter>
First init
r0
SocExplorerPlot::SocExplorerPlot(QWidget *parent) :
added missing GPL headers...
r11 QWidget(parent), mRubberBand(new QRubberBand(QRubberBand::Rectangle, this))
First init
r0 {
added missing GPL headers...
r11 this->m_plot = new QCustomPlotVect(this);
this->m_plot->setInteractions(QCP::iRangeDrag | QCP::iSelectAxes |
QCP::iSelectLegend | QCP::iSelectPlottables);
this->m_plot->axisRect()->setRangeDrag(Qt::Horizontal|Qt::Vertical);
this->m_plot->axisRect()->setRangeZoom(Qt::Horizontal|Qt::Vertical);
this->m_mainlayout = new QGridLayout(this);
this->setLayout(this->m_mainlayout);
this->m_mainlayout->addWidget(this->m_plot);
this->setMinimumSize(400,300);
this->setFocusPolicy(Qt::WheelFocus);
this->m_plot->setAttribute(Qt::WA_TransparentForMouseEvents);
this->ctrl_hold = false;
this->shift_hold = false;
this->mouse_hold = false;
this->m_plot->setNoAntialiasingOnDrag(true);
this->show();
this->m_plot->legend->setVisible(true);
First init
r0 }
added zoom box.
r2 SocExplorerPlot::~SocExplorerPlot()
{
added missing GPL headers...
r11 delete mRubberBand;
added zoom box.
r2 }
First init
r0 void SocExplorerPlot::show()
{
added missing GPL headers...
r11 QWidget::show();
First init
r0 }
void SocExplorerPlot::replot()
{
Added Python Console and some Wrappers....
r5 this->m_plot->replot();
}
void SocExplorerPlot::exportToSVG(const QString &fileName)
{
QSvgGenerator printer;
printer.setFileName(fileName);
QCPPainter qcpPainter;
qcpPainter.begin(&printer);
m_plot->toPainter(&qcpPainter, m_plot->width(), m_plot->height());
qcpPainter.end();
}
void SocExplorerPlot::exportToPDF(const QString &fileName)
{
A lot of refactoring:...
r6 QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName(fileName);
printer.setFullPage(true);
QCPPainter qcpPainter;
qcpPainter.begin(&printer);
m_plot->toPainter(&qcpPainter, printer.width(), printer.height());
qcpPainter.end();
First init
r0 }
Removed hack from QCustomPlot, moved to QCustomPlotVect class.
r7 void SocExplorerPlot::addAction(SocExplorerPlotActions *action)
{
this->m_actions.append(action);
QWidget::addAction((QAction*)action);
}
QVector<QCPData> *SocExplorerPlot::getVisibleData(int graphIndex)
{
plot view export works on cassini fgm data.
r8 QVector<QCPData> *visibleData=((QCPGraphVect*)m_plot->graph(graphIndex))->getVisibleData();
return visibleData;
Removed hack from QCustomPlot, moved to QCustomPlotVect class.
r7 }
First init
r0 void SocExplorerPlot::setTitle(QString title)
{
added missing GPL headers...
r11 Q_UNUSED(title)
//this->m_plot->setTitle(title);
/*!
First init
r0 @todo Function borcken fixe this!
*/
added quick fileName generation for data export, and fixed wrong date reading...
r10 this->m_Title = title;
A lot of refactoring:...
r6 emit titleChanged(title);
this->repaint();
First init
r0 }
added quick fileName generation for data export, and fixed wrong date reading...
r10 const QString &SocExplorerPlot::title()
{
return m_Title;
}
First init
r0 void SocExplorerPlot::setXaxisLabel(QString label)
{
added missing GPL headers...
r11 this->m_plot->xAxis->setLabel(label);
Added preliminary version of FFT and removed memory leak.
r9 this->repaint();
}
void SocExplorerPlot::setXaxisLog()
{
this->m_plot->xAxis->setScaleType(QCPAxis::stLogarithmic);
First init
r0 }
void SocExplorerPlot::setYaxisLabel(QString label)
{
added missing GPL headers...
r11 this->m_plot->yAxis->setLabel(label);
Added preliminary version of FFT and removed memory leak.
r9 this->repaint();
}
void SocExplorerPlot::setYaxisLog()
{
this->m_plot->yAxis->setScaleType(QCPAxis::stLogarithmic);
First init
r0 }
void SocExplorerPlot::setXaxisRange(double lower, double upper)
{
added missing GPL headers...
r11 this->m_plot->xAxis->setRange(lower,upper);
First init
r0 }
void SocExplorerPlot::setYaxisRange(double lower, double upper)
{
added missing GPL headers...
r11 this->m_plot->yAxis->setRange(lower,upper);
First init
r0 }
void SocExplorerPlot::rescaleAxis()
{
added missing GPL headers...
r11 this->m_plot->rescaleAxes();
this->m_plot->replot();
First init
r0 }
void SocExplorerPlot::setLegendFont(QFont font)
{
added missing GPL headers...
r11 this->m_plot->legend->setFont(font);
this->repaint();
First init
r0 }
void SocExplorerPlot::setLegendSelectedFont(QFont font)
{
added missing GPL headers...
r11 this->m_plot->legend->setSelectedFont(font);
this->repaint();
First init
r0 }
void SocExplorerPlot::setAdaptativeSampling(int graphIndex, bool enable)
{
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setAdaptiveSampling(enable);
First init
r0 }
Changed QCustomPlot data from QMap to QVector....
r3 void SocExplorerPlot::setUseFastVector(int graphIndex, bool enable)
{
Removed hack from QCustomPlot, moved to QCustomPlotVect class.
r7 // TODO deprecated
added missing GPL headers...
r11 // this->m_plot->graph(graphIndex)->setUseFastVectors(enable);
Changed QCustomPlot data from QMap to QVector....
r3 }
First init
r0 int SocExplorerPlot::addGraph()
{
added missing GPL headers...
r11 this->m_plot->addGraph();
return this->m_plot->graphCount() -1;
First init
r0 }
bool SocExplorerPlot::removeGraph(int graphIndex)
{
Removed hack from QCustomPlot, moved to QCustomPlotVect class.
r7 return this->m_plot->removeGraph(graphIndex);
}
int SocExplorerPlot::graphCount()
{
return m_plot->graphCount();
First init
r0 }
void SocExplorerPlot::removeAllGraphs()
{
added missing GPL headers...
r11 int graphCount=this->m_plot->graphCount();
for(int i=0;i<graphCount;i++)
First init
r0 {
added missing GPL headers...
r11 this->m_plot->removeGraph(0);
First init
r0 }
}
void SocExplorerPlot::setGraphName(int graphIndex,QString name)
{
added missing GPL headers...
r11 if(graphIndex<this->m_plot->graphCount())
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setName(name);
}
added quick fileName generation for data export, and fixed wrong date reading...
r10 }
const QString &SocExplorerPlot::graphName(int graphIndex)
{
if(graphIndex<this->m_plot->graphCount())
{
return this->m_plot->graph(graphIndex)->name();
First init
r0 }
added quick fileName generation for data export, and fixed wrong date reading...
r10 return "";
First init
r0 }
void SocExplorerPlot::setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y)
{
added missing GPL headers...
r11 if((graphIndex<this->m_plot->graphCount()) && (x.count()==y.count()) && (x.at(0).type()==QVariant::Double))
First init
r0 {
added missing GPL headers...
r11 QVector<double> _x(x.count()), _y(y.count());
for(int i=0;i<x.count();i++)
First init
r0 {
added missing GPL headers...
r11 /*_x[i] = x.at(i).value<double>();
First init
r0 _y[i] = y.at(i).value<double>();*/
added missing GPL headers...
r11 _x[i] = x.at(i).toDouble();
_y[i] = y.at(i).toDouble();
First init
r0 }
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setData(_x,_y);
First init
r0 }
added missing GPL headers...
r11 else
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 if((graphIndex<this->m_plot->graphCount()) && (x.count()==y.count()) && (x.at(0).type()==QVariant::DateTime))
First init
r0 {
added missing GPL headers...
r11 QVector<double> _x(x.count()), _y(y.count());
for(int i=0;i<x.count();i++)
First init
r0 {
added missing GPL headers...
r11 /*_x[i] = x.at(i).value<double>();
First init
r0 _y[i] = y.at(i).value<double>();*/
added missing GPL headers...
r11 _x[i] = x.at(i).toDateTime().toMSecsSinceEpoch();
_y[i] = y.at(i).toDouble();
First init
r0 }
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setData(_x,_y);
this->m_plot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
this->m_plot->xAxis->setDateTimeFormat("hh:mm:ss.zzz");
First init
r0
}
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 this->m_plot->replot();
First init
r0 }
void SocExplorerPlot::setGraphData(int graphIndex, QCPDataMap *data, bool copy, bool replot)
{
added missing GPL headers...
r11 if((graphIndex<this->m_plot->graphCount()))// && (x.at(0).type()==QVariant::Double))
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setData(data,copy);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 if(replot)
this->m_plot->replot();
First init
r0 }
Changed QCustomPlot data from QMap to QVector....
r3 void SocExplorerPlot::setGraphData(int graphIndex,QVector<QCPData> *data, bool replot)
{
added missing GPL headers...
r11 if((graphIndex<this->m_plot->graphCount()))// && (x.at(0).type()==QVariant::Double))
Changed QCustomPlot data from QMap to QVector....
r3 {
added missing GPL headers...
r11 ((QCPGraphVect*)this->m_plot->graph(graphIndex))->setData(data);
Changed QCustomPlot data from QMap to QVector....
r3 }
added missing GPL headers...
r11 if(replot)
this->m_plot->replot();
Changed QCustomPlot data from QMap to QVector....
r3 }
First init
r0 void SocExplorerPlot::addGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y)
{
added missing GPL headers...
r11 if((graphIndex<this->m_plot->graphCount()) && (x.count()==y.count()))// && (x.at(0).type()==QVariant::Double))
First init
r0 {
added missing GPL headers...
r11 QVector<double> _x(x.count()), _y(y.count());
for(int i=0;i<x.count();i++)
First init
r0 {
added missing GPL headers...
r11 /*_x[i] = x.at(i).value<double>();
First init
r0 _y[i] = y.at(i).value<double>();*/
added missing GPL headers...
r11 _x[i] = x.at(i).toDouble();
_y[i] = y.at(i).toDouble();
First init
r0 }
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->addData(_x,_y);
First init
r0 }
added missing GPL headers...
r11 this->m_plot->replot();
First init
r0 }
void SocExplorerPlot::addGraphData(int graphIndex, QVariant x, QVariant y)
{
added missing GPL headers...
r11 if(graphIndex<this->m_plot->graphCount())// && (x.at(0).type()==QVariant::Double))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->addData(x.toDouble(),y.toDouble());
First init
r0 }
added missing GPL headers...
r11 this->m_plot->replot();
First init
r0 }
void SocExplorerPlot::setGraphPen(int graphIndex,QPen pen)
{
added missing GPL headers...
r11 if(graphIndex<this->m_plot->graphCount())
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setPen(pen);
First init
r0 }
}
QPen SocExplorerPlot::getGraphPen(int graphIndex)
{
added missing GPL headers...
r11 if(graphIndex<this->m_plot->graphCount())
First init
r0 {
added missing GPL headers...
r11 return this->m_plot->graph(graphIndex)->pen();
First init
r0 }
added missing GPL headers...
r11 return this->m_plot->graph()->pen();
First init
r0 }
void SocExplorerPlot::setGraphLineStyle(int graphIndex,QString lineStyle)
{
added missing GPL headers...
r11 if(graphIndex<this->m_plot->graphCount())
First init
r0 {
added missing GPL headers...
r11 if(!lineStyle.compare("none"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsNone);
return;
First init
r0 }
added missing GPL headers...
r11 if(!lineStyle.compare("line"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsLine);
return;
First init
r0 }
added missing GPL headers...
r11 if(!lineStyle.compare("stepleft"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepLeft);
return;
First init
r0 }
added missing GPL headers...
r11 if(!lineStyle.compare("stepright"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepRight);
return;
First init
r0 }
added missing GPL headers...
r11 if(!lineStyle.compare("stepcenter"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepCenter);
return;
First init
r0 }
added missing GPL headers...
r11 if(!lineStyle.compare("impulse"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsImpulse);
return;
First init
r0 }
}
}
void SocExplorerPlot::setGraphScatterStyle(int graphIndex,QString scatterStyle)
{
added missing GPL headers...
r11 if(graphIndex<this->m_plot->graphCount())
First init
r0 {
added missing GPL headers...
r11 if(!scatterStyle.compare("none"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssNone);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("dot"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDot);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("cross"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCross);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("plus"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlus);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("circle"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCircle);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("disc"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDisc);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("square"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssSquare);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("diamond"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDiamond);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("star"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssStar);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("triangle"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssTriangle);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("invertedtriangle"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssTriangleInverted);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("crosssquare"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCrossSquare);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("plussquare"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlusSquare);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("crosscircle"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCrossCircle);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("pluscircle"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlusCircle);
return;
First init
r0 }
added missing GPL headers...
r11 if(!scatterStyle.compare("peace"))
First init
r0 {
added missing GPL headers...
r11 this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPeace);
return;
First init
r0 }
Drag and drop implemented, improved plot interactions.
r1 }
First init
r0 }
void SocExplorerPlot::setXaxisTickLabelType(QCPAxis::LabelType type)
{
added missing GPL headers...
r11 this->m_plot->xAxis->setTickLabelType(type);
First init
r0 }
void SocExplorerPlot::setXaxisDateTimeFormat(const QString &format)
{
added missing GPL headers...
r11 this->m_plot->xAxis->setDateTimeFormat(format);
First init
r0 }
void SocExplorerPlot::keyPressEvent(QKeyEvent * event)
{
added missing GPL headers...
r11 switch(event->key())
First init
r0 {
case Qt::Key_Control:
added missing GPL headers...
r11 this->ctrl_hold = true;
setCursor(Qt::CrossCursor);
break;
First init
r0 case Qt::Key_Shift:
added missing GPL headers...
r11 this->shift_hold = true;
break;
First init
r0 case Qt::Key_M:
added missing GPL headers...
r11 this->rescaleAxis();
break;
Drag and drop implemented, improved plot interactions.
r1 case Qt::Key_Left:
added missing GPL headers...
r11 if(!ctrl_hold)
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 move(-0.1,Qt::Horizontal);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 else
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 zoom(2,this->width()/2,Qt::Horizontal);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 break;
Drag and drop implemented, improved plot interactions.
r1 case Qt::Key_Right:
added missing GPL headers...
r11 if(!ctrl_hold)
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 move(0.1,Qt::Horizontal);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 else
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 zoom(0.5,this->width()/2,Qt::Horizontal);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 break;
Drag and drop implemented, improved plot interactions.
r1 case Qt::Key_Up:
added missing GPL headers...
r11 if(!ctrl_hold)
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 move(0.1,Qt::Vertical);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 else
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 zoom(0.5,this->height()/2,Qt::Vertical);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 break;
Drag and drop implemented, improved plot interactions.
r1 case Qt::Key_Down:
added missing GPL headers...
r11 if(!ctrl_hold)
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 move(-0.1,Qt::Vertical);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 else
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 zoom(2,this->height()/2,Qt::Vertical);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 break;
First init
r0 default:
added missing GPL headers...
r11 QWidget::keyPressEvent(event);
break;
First init
r0 }
}
void SocExplorerPlot::keyReleaseEvent(QKeyEvent * event)
{
added missing GPL headers...
r11 switch(event->key())
First init
r0 {
case Qt::Key_Control:
added missing GPL headers...
r11 event->accept();
this->ctrl_hold = false;
break;
First init
r0 case Qt::Key_Shift:
added missing GPL headers...
r11 event->accept();
this->shift_hold = false;
break;
First init
r0 default:
added missing GPL headers...
r11 QWidget::keyReleaseEvent(event);
break;
First init
r0 }
added missing GPL headers...
r11 setCursor(Qt::ArrowCursor);
First init
r0 }
void SocExplorerPlot::wheelEvent(QWheelEvent * event)
{
added missing GPL headers...
r11 double factor;
double wheelSteps = event->delta()/120.0; // a single step delta is +/-120 usually
if(ctrl_hold)
First init
r0 {
added missing GPL headers...
r11 if (event->orientation()==Qt::Vertical)//mRangeZoom.testFlag(Qt::Vertical))
First init
r0 {
added missing GPL headers...
r11 setCursor(Qt::SizeVerCursor);
factor = pow(this->m_plot->axisRect()->rangeZoomFactor(Qt::Vertical), wheelSteps);
zoom(factor,event->pos().y(),Qt::Vertical);
First init
r0 }
added missing GPL headers...
r11 QWidget::wheelEvent(event);
return;
First init
r0 }
added missing GPL headers...
r11 if(shift_hold)
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 if (event->orientation()==Qt::Vertical)//mRangeZoom.testFlag(Qt::Vertical))
Drag and drop implemented, improved plot interactions.
r1 {
added missing GPL headers...
r11 setCursor(Qt::SizeHorCursor);
factor = pow(this->m_plot->axisRect()->rangeZoomFactor(Qt::Horizontal), wheelSteps);
zoom(factor,event->pos().x(),Qt::Horizontal);
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 QWidget::wheelEvent(event);
return;
Drag and drop implemented, improved plot interactions.
r1 }
added missing GPL headers...
r11 move(wheelSteps,Qt::Horizontal);
QWidget::wheelEvent(event);
First init
r0 }
void SocExplorerPlot::mousePressEvent(QMouseEvent *event)
{
added missing GPL headers...
r11 if(event->button()==Qt::LeftButton)
First init
r0 {
added missing GPL headers...
r11 if(ctrl_hold)
added zoom box.
r2 {
added missing GPL headers...
r11 setCursor(Qt::CrossCursor);
mOrigin = event->pos();
mRubberBand->setGeometry(QRect(mOrigin, QSize()));
mRubberBand->show();
added zoom box.
r2 }
added missing GPL headers...
r11 else
added zoom box.
r2 {
added missing GPL headers...
r11 setCursor(Qt::ClosedHandCursor);
mDragStart = event->pos();
this->mouse_hold = true;
DragStartHorzRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal)->range();
DragStartVertRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical)->range();
added zoom box.
r2 }
First init
r0 }
added missing GPL headers...
r11 QWidget::mousePressEvent(event);
First init
r0 }
void SocExplorerPlot::mouseReleaseEvent(QMouseEvent *event)
{
added missing GPL headers...
r11 if(event->button()==Qt::LeftButton)
First init
r0 {
added missing GPL headers...
r11 this->mouse_hold = false;
First init
r0 }
added missing GPL headers...
r11 if (mRubberBand->isVisible())
added zoom box.
r2 {
added missing GPL headers...
r11 const QRect & zoomRect = mRubberBand->geometry();
int xp1, yp1, xp2, yp2;
zoomRect.getCoords(&xp1, &yp1, &xp2, &yp2);
double x1 = this->m_plot->xAxis->pixelToCoord(xp1);
double x2 = this->m_plot->xAxis->pixelToCoord(xp2);
double y1 = this->m_plot->yAxis->pixelToCoord(yp1);
double y2 = this->m_plot->yAxis->pixelToCoord(yp2);
added zoom box.
r2
added missing GPL headers...
r11 this->m_plot->xAxis->setRange(x1, x2);
this->m_plot->yAxis->setRange(y1, y2);
added zoom box.
r2
added missing GPL headers...
r11 mRubberBand->hide();
this->m_plot->replot();
added zoom box.
r2 }
added missing GPL headers...
r11 setCursor(Qt::ArrowCursor);
QWidget::mouseReleaseEvent(event);
Drag and drop implemented, improved plot interactions.
r1 }
void SocExplorerPlot::zoom(double factor, int center, Qt::Orientation orientation)
{
added missing GPL headers...
r11 QCPAxis* axis = this->m_plot->axisRect()->rangeZoomAxis(orientation);
axis->scaleRange(factor, axis->pixelToCoord(center));
this->m_plot->replot();
First init
r0 }
Drag and drop implemented, improved plot interactions.
r1 void SocExplorerPlot::move(double factor, Qt::Orientation orientation)
{
added missing GPL headers...
r11 QCPAxis* axis = this->m_plot->axisRect()->rangeDragAxis(orientation);
// double rg = (axis->range().upper - axis->range().lower)*(factor);
// axis->setRange(axis->range().lower+(rg), axis->range().upper+(rg));
double rg =0.0;
DragStartHorzRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal)->range();
DragStartVertRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical)->range();
if(this->m_plot->xAxis->scaleType() == QCPAxis::stLinear)
{
rg = (axis->range().upper - axis->range().lower)*(factor/10);
axis->setRange(axis->range().lower+(rg), axis->range().upper+(rg));
}
else if(this->m_plot->xAxis->scaleType() == QCPAxis::stLogarithmic)
{
// rg = (axis->range().upper / axis->range().lower)*(factor/100);
int start,stop;
double diff;
if(factor>0.0)
{
stop =this->width()*factor/10;
start = 2*this->width()*factor/10;
}
if(factor<0.0)
{
factor*=-1.0;
start =this->width()*factor/10;
stop = 2*this->width()*factor/10;
}
diff = axis->pixelToCoord(start) / axis->pixelToCoord(stop);
axis->setRange(this->m_plot->axisRect()->rangeDragAxis(orientation)->range().lower*diff, this->m_plot->axisRect()->rangeDragAxis(orientation)->range().upper*diff);
}
this->m_plot->replot();
Drag and drop implemented, improved plot interactions.
r1 }
First init
r0 void SocExplorerPlot::mouseMoveEvent(QMouseEvent *event)
{
added missing GPL headers...
r11 if(mouse_hold)
First init
r0 {
added missing GPL headers...
r11 QCPAxis* Haxis = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal);
QCPAxis* Vaxis = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical);
// double diff = rangeDragHorzAxis->pixelToCoord(mDragStart.x()) / rangeDragHorzAxis->pixelToCoord(event->pos().x());
// rangeDragHorzAxis->setRange(mDragStartHorzRange.lower*diff, mDragStartHorzRange.upper*diff);
double diff=0;
if(this->m_plot->xAxis->scaleType() == QCPAxis::stLinear)
{
diff = Haxis->pixelToCoord(mDragStart.x()) - Haxis->pixelToCoord(event->pos().x());
Haxis->setRange(DragStartHorzRange.lower+diff, DragStartHorzRange.upper+diff);
}
else if(this->m_plot->xAxis->scaleType() == QCPAxis::stLogarithmic)
{
diff = Haxis->pixelToCoord(mDragStart.x()) / Haxis->pixelToCoord(event->pos().x());
Haxis->setRange(DragStartHorzRange.lower*diff, DragStartHorzRange.upper*diff);
}
if(this->m_plot->yAxis->scaleType() == QCPAxis::stLinear)
{
diff = Vaxis->pixelToCoord(mDragStart.y()) - Vaxis->pixelToCoord(event->pos().y());
Vaxis->setRange(DragStartVertRange.lower+diff, DragStartVertRange.upper+diff);
}
else if(this->m_plot->yAxis->scaleType() == QCPAxis::stLogarithmic)
{
diff = Vaxis->pixelToCoord(mDragStart.y()) / Vaxis->pixelToCoord(event->pos().y());
Vaxis->setRange(DragStartVertRange.lower*diff, DragStartVertRange.upper*diff);
}
this->m_plot->replot();
First init
r0 }
added missing GPL headers...
r11 if (mRubberBand->isVisible())
added zoom box.
r2 {
added missing GPL headers...
r11 mRubberBand->setGeometry(QRect(mOrigin, event->pos()).normalized());
added zoom box.
r2 }
added missing GPL headers...
r11 QWidget::mouseMoveEvent(event);
First init
r0 }