Commit 59705e02 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added actual preset switching

* Use preset source location
* Use preset source orientation (iota/psi)
* Update 3D rendering and plots
* Use preset source name (for window title)

TODO: verify all source locations
parent 1844d864
......@@ -79,6 +79,8 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_VirgoAngle = 0;
m_KAGRAAngle = 0;
m_LIAngle = 0;
m_sourceLongitude = 0.0;
m_sourceLatitude = 0.0;
m_sourceIota = 0.0;
m_sourceInclination = 0;
......@@ -448,8 +450,8 @@ void PulsarAnimationWidget::paintGL()
// draw source
glPushMatrix();
{
glRotatef(41.093, 0.0, 1.0, 0.0);
glRotatef(-(-23.3844), 1.0, 0.0, 0.0);
glRotatef(m_sourceLongitude, 0.0, 1.0, 0.0);
glRotatef(-(m_sourceLatitude), 1.0, 0.0, 0.0);
glTranslatef(0.0, 0.0, m_earthRadius + 2.0);
......@@ -699,6 +701,22 @@ void PulsarAnimationWidget::setLIAngle(const int degrees)
updateGL();
}
void PulsarAnimationWidget::setSourceLatitude(double sourceLatitude)
{
m_sourceLatitude = sourceLatitude;
updatePulseProfile();
updateGL();
}
void PulsarAnimationWidget::setSourceLongitude(double sourceLongitude)
{
m_sourceLongitude = sourceLongitude;
updatePulseProfile();
updateGL();
}
void PulsarAnimationWidget::setSourceIota(const int degrees)
{
m_sourceIota = degrees;
......@@ -753,6 +771,9 @@ void PulsarAnimationWidget::updatePulseProfile()
// and CW when viewed from above. So I have adjusted this code to
// be consistent with LAL, and inserted a factor of -1 in my code.
// Bruce
in.longitude = m_sourceLongitude;
in.lattitude = m_sourceLatitude;
in.iota = m_sourceIota;
in.psi = m_sourceInclination;
in.orientation[0] = m_LLOAngle;
in.orientation[1] = m_LHOAngle;
......
......@@ -57,6 +57,8 @@ public:
void setVirgoAngle(const int degrees);
void setKAGRAAngle(const int degrees);
void setLIAngle(const int degrees);
void setSourceLongitude(double sourceLongitude);
void setSourceLatitude(double sourceLatitude);
void setSourceIota(const int degrees);
void setSourceInclination(const int degrees);
void getCameraPosition(double& cameraAngleH, double& cameraAngleV, double& cameraZoom);
......@@ -107,6 +109,8 @@ private:
double m_VirgoAngle;
double m_KAGRAAngle;
double m_LIAngle;
double m_sourceLongitude;
double m_sourceLatitude;
double m_sourceIota;
double m_sourceInclination;
......
......@@ -20,11 +20,12 @@
#include "pulsatingscience.h"
#include "plotdata.h"
#include "preseteditor.h"
#include <QSettings>
#include "lib/antenna_lib.h"
#include <QSettings>
#include <QDateTime>
#ifdef __APPLE__
#include "/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h"
......@@ -153,7 +154,28 @@ void PulsatingScience::on_cmbSource_currentIndexChanged(int index)
ui.lblSource->setText(m_presets->preset(index).getDescription());
// TODO: change source
// change source
QDateTime date = QDateTime::fromString(m_presets->preset(index).getTime(),"yyyy-MM-dd hh:mm:ss");
date.setTimeSpec(Qt::UTC);
long long int epoch = date.toSecsSinceEpoch();
double rightAscension = m_presets->preset(index).getRightAscension().toDouble();
double declination = m_presets->preset(index).getDeclination().toDouble();
double longitude;
double latitude;
epoch_RA_DEC_to_Latt_Long(epoch, rightAscension, declination, &latitude, &longitude);
ui.pulsarGlWidget->setSourceLongitude(longitude);
ui.pulsarGlWidget->setSourceLatitude(latitude);
int iota = m_presets->preset(index).getIota().toInt();
int psi = m_presets->preset(index).getPsi().toInt();
ui.sliderSourceIota->setValue(iota);
ui.sliderSourceInclination->setValue(psi);
QString title("%1 - Max Planck Institute for Gravitational Physics Hannover");
title = title.arg(m_presets->preset(index).getName());
ui.centralwidget->window()->setWindowTitle(title);
}
void PulsatingScience::on_chkLHO_clicked(bool checked)
......
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>GW170817 - Max Planck Institute for Gravitational Physics Hannover</string>
<string>Max Planck Institute for Gravitational Physics Hannover</string>
</property>
<property name="windowIcon">
<iconset resource="pulsatingscience.qrc">
......
Supports Markdown
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