##// END OF EJS Templates
Added Python Console and some Wrappers....
Added Python Console and some Wrappers. More code cleaning, WIP.

File last commit:

r5:92e4585e8fab default
r5:92e4585e8fab default
Show More
cassinitools.cpp
116 lines | 3.0 KiB | text/x-c | CppLexer
#include "cassinitools.h"
#include <qlopplots.h>
#include <QPen>
CassiniTools* CassiniTools::_self=NULL;
QDockWidget* CassiniTools::m_gui=NULL;
CassiniToolsGUI* CassiniTools::m_CassiniToolsGUI=NULL;
CassiniDataFile* CassiniTools::m_dataFile=NULL;
Qt::GlobalColor QLopColours[]= {Qt::black,
Qt::red,
Qt::blue,
Qt::green,
Qt::darkGreen,
Qt::cyan,
Qt::darkRed,
Qt::gray,
Qt::yellow,
Qt::darkBlue,
Qt::darkCyan,
Qt::magenta,
Qt::darkMagenta,
Qt::darkYellow,
Qt::darkGray,
Qt::lightGray};
int QLopColoursCount=16;
#define _INIT() if(Q_UNLIKELY(_self==NULL)){init();}
CassiniTools::CassiniTools(bool noGUI,QObject *parent) : QLopService(parent)
{
m_dataFile = new CassiniDataFile();
connect(m_dataFile,SIGNAL(dataReady(QLopDataList)),this,SLOT(dataReady(QLopDataList)));
m_serviceName="CassiniTools";
m_noGui=noGUI;
}
CassiniTools::~CassiniTools()
{
delete m_dataFile;
delete m_CassiniToolsGUI;
delete m_gui;
}
void CassiniTools::init(bool noGUI, QObject *parent)
{
if(Q_UNLIKELY(_self==NULL))
{
_self=new CassiniTools(noGUI,parent);
}
}
CassiniTools *CassiniTools::self()
{
_INIT();
return _self;
}
void CassiniTools::decodeFGMData(const QString &file)
{
_INIT();
m_dataFile->parseFile(file);
}
void CassiniTools::plotFile(const QString &File)
{
if(!m_dataFile->isRunning())
{
m_dataFile->parseFile(File);
QLopPlots::getPlot()->setTitle(File);
}
}
void CassiniTools::plot_TAB_File(const QString &fileName)
{
}
QDockWidget *CassiniTools::getGUI()
{
if(!m_noGui && (m_gui==NULL))
{
m_gui=new QDockWidget("Cassini Tools");
m_CassiniToolsGUI = new CassiniToolsGUI();
m_gui->setWidget(m_CassiniToolsGUI);
m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
}
return m_gui;
}
const QString &CassiniTools::serviceName()
{
_INIT();
return m_serviceName;
}
void CassiniTools::dataReady(QLopDataList data)
{
QLopPlots::getPlot()->removeAllGraphs();
for(int i=0;i<data.count();i++)
{
QLopPlots::getPlot()->addGraph();
QLopPlots::getPlot()->setAdaptativeSampling(i,true);
QLopPlots::getPlot()->setUseFastVector(i,true);
QPen pen = QLopPlots::getPlot()->getGraphPen(i);
pen.setColor(QLopColours[i%QLopColoursCount]);
QLopPlots::getPlot()->setGraphPen(i,pen);
QLopPlots::getPlot()->setGraphName(i,data.at(i)->name+"("+data.at(i)->unit+")");
QLopPlots::getPlot()->setGraphData(i,data.at(i)->data,false);
}
QLopPlots::getPlot()->rescaleAxis();
QLopPlots::getPlot()->replot();
}