Commit efbbe3b5 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added mock-up curves for the three IFOs

parent 01f66fe5
......@@ -26,7 +26,8 @@ QT += core \
webkit
HEADERS += src/pulsaranimationwidget.h \
src/pulsescopewidget.h \
src/pulsatingscience.h
src/pulsatingscience.h \
src/common.h
SOURCES += src/pulsaranimationwidget.cpp \
src/pulsescopewidget.cpp \
src/pulsatingscience.cpp \
......
#ifndef COMMON_H
#define COMMON_H
#define PERIODS 2
#endif // COMMON_H
......@@ -24,8 +24,9 @@ const double PulsarAnimationWidget::deg2rad = PI/180.0;
PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
QGLWidget(QGLFormat(QGL::AlphaChannel | QGL::SampleBuffers), parent),
m_pulseProfile(360, 0.0)
m_curveLHO(360*PERIODS, 0.0),
m_curveLLO(360*PERIODS, 0.0),
m_curveVirgo(360*PERIODS, 0.0)
{
QString msgThis = tr("3D animation");
if(!format().directRendering()) {
......@@ -571,10 +572,12 @@ void PulsarAnimationWidget::resetCameraPosition(const double angleH, const doubl
void PulsarAnimationWidget::updatePulseProfile()
{
for(int x = 0; x < 360; ++x) {
m_pulseProfile[x] = 0;
for(int x = 0; x < 360*PERIODS; ++x) {
m_curveLHO[x] = sin(x * deg2rad);
m_curveLLO[x] = cos(x * deg2rad);
m_curveVirgo[x] = 0;
}
// propagate new profile
emit pulseProfileUpdated(m_pulseProfile);
emit pulseProfileUpdated(m_curveLHO, m_curveLLO, m_curveVirgo);
}
......@@ -34,8 +34,9 @@
#include <GL/glu.h>
#endif
#define PI 3.14159265
#include "common.h"
#define PI 3.14159265
class PulsarAnimationWidget : public QGLWidget
{
......@@ -54,7 +55,7 @@ public:
void resetCameraPosition(const double angleH, const double angleV, const double zoom);
signals:
void pulseProfileUpdated(const QVector<double>& data);
void pulseProfileUpdated(const QVector<double>& dataLHO, const QVector<double>& dataLLO, const QVector<double>& dataVirgo);
private:
void initializeGL();
......@@ -102,7 +103,9 @@ private:
double m_cameraPosY;
double m_cameraPosZ;
QVector<double> m_pulseProfile;
QVector<double> m_curveLHO;
QVector<double> m_curveLLO;
QVector<double> m_curveVirgo;
static const double deg2rad;
};
......
......@@ -58,8 +58,8 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
m_hiddenShortcut = new QShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_D), this);
// establish object communications
connect(ui.pulsarGlWidget, SIGNAL(pulseProfileUpdated(const QVector<double>&)),
ui.pulseScopeWidget, SLOT(plot(const QVector<double>&)), Qt::DirectConnection);
connect(ui.pulsarGlWidget, SIGNAL(pulseProfileUpdated(const QVector<double>&, const QVector<double>&, const QVector<double>&)),
ui.pulseScopeWidget, SLOT(plot(const QVector<double>&, const QVector<double>&, const QVector<double>&)), Qt::DirectConnection);
connect(m_hiddenShortcut, SIGNAL(activated()),
this, SLOT(toggleHiddenDemoMode()));
......
......@@ -49,17 +49,21 @@ PulseScopeWidget::PulseScopeWidget(QWidget *parent) : QGraphicsView(parent),
qWarning() << msg.arg(msgThis);
}
m_scopeSizeH = 360.0;
m_scopeSizeH = 360.0 * PERIODS;
m_scopeSizeV = 2.0;
m_path = NULL;
m_pathLHO = NULL;
m_pathLLO = NULL;
m_pathVirgo = NULL;
m_marker = m_scene.addLine(0.0, 0.0, 0.0, m_scopeSizeV);
m_marker->setZValue(1);
setScene(&m_scene);
m_data.fill(0.0, qRound(m_scopeSizeH));
drawCurve(m_path, m_data, "black");
drawCurve(m_pathLHO, m_data, "black");
drawCurve(m_pathLLO, m_data, "black");
drawCurve(m_pathVirgo, m_data, "black");
}
PulseScopeWidget::~PulseScopeWidget()
......@@ -74,9 +78,11 @@ void PulseScopeWidget::resizeEvent(QResizeEvent *event)
fitInView(m_scene.itemsBoundingRect(), Qt::IgnoreAspectRatio);
}
void PulseScopeWidget::plot(const QVector<double>& vector)
void PulseScopeWidget::plot(const QVector<double>& dataLHO, const QVector<double>& dataLLO, const QVector<double>& dataVirgo)
{
drawCurve(m_path, vector, "yellow");
drawCurve(m_pathLHO, dataLHO, "blue");
drawCurve(m_pathLLO, dataLLO, "red");
drawCurve(m_pathVirgo, dataVirgo, "green");
}
void PulseScopeWidget::drawCurve(QGraphicsPathItem* path, const QVector<double>& vector, QString color)
......
......@@ -30,6 +30,7 @@
#include <QGraphicsLineItem>
#include <QDebug>
#include "common.h"
class PulseScopeWidget : public QGraphicsView
{
......@@ -42,14 +43,16 @@ public:
void resizeEvent(QResizeEvent *event);
public slots:
void plot(const QVector<double>& vector);
void plot(const QVector<double>& dataLHO, const QVector<double>& dataLLO, const QVector<double>& dataVirgo);
private:
void drawCurve(QGraphicsPathItem* path, const QVector<double>& vector, QString color);
QGraphicsScene m_scene;
QVector<double> m_data;
QGraphicsPathItem *m_path;
QGraphicsPathItem *m_pathLHO;
QGraphicsPathItem *m_pathLLO;
QGraphicsPathItem *m_pathVirgo;
QGraphicsLineItem *m_marker;
double m_scopeSizeH;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment