Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
einsteinathome
pulsatingscience
Commits
f1b2a390
Commit
f1b2a390
authored
Feb 03, 2009
by
Oliver Bock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to show orbital planes permanently (not only during interaction)
parent
06da55db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
5 deletions
+61
-5
src/pulsaranimationwidget.cpp
src/pulsaranimationwidget.cpp
+10
-1
src/pulsaranimationwidget.h
src/pulsaranimationwidget.h
+3
-0
src/pulsatingscience.cpp
src/pulsatingscience.cpp
+31
-3
src/pulsatingscience.h
src/pulsatingscience.h
+4
-0
src/pulsatingscience.ui
src/pulsatingscience.ui
+13
-1
No files found.
src/pulsaranimationwidget.cpp
View file @
f1b2a390
...
...
@@ -64,8 +64,10 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_pulsarMass
=
1.4
f
;
m_companionMass
=
1.4
f
;
m_showOrbits
=
false
;
m_showRotationAxes
=
false
;
m_cameraInteraction
=
false
;
m_mouseLastX
=
0
;
m_mouseLastY
=
0
;
m_mouseAngleH
=
90.0
f
;
...
...
@@ -305,7 +307,7 @@ void PulsarAnimationWidget::paintGL()
glPopMatrix
();
// draw orbital planes
if
(
m_cameraInteraction
)
{
if
(
m_cameraInteraction
||
m_showOrbits
)
{
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT_AND_DIFFUSE
,
translucent
);
static
float
sizeOffset
=
0.25
f
;
...
...
@@ -375,6 +377,13 @@ void PulsarAnimationWidget::updateFrame()
emit
pulsarAnimationStep
(
m_pulsarRotationDelta
);
}
void
PulsarAnimationWidget
::
showOrbits
(
bool
enabled
)
{
m_showOrbits
=
enabled
;
updateGL
();
}
void
PulsarAnimationWidget
::
showRotationAxes
(
bool
enabled
)
{
m_showRotationAxes
=
enabled
;
...
...
src/pulsaranimationwidget.h
View file @
f1b2a390
...
...
@@ -53,6 +53,7 @@ public slots:
void
updateFrame
();
void
showOrbits
(
bool
enabled
);
void
showRotationAxes
(
bool
enabled
);
signals:
...
...
@@ -107,8 +108,10 @@ private:
int
m_pulsarSpinAxisInclination
;
int
m_pulsarMagneticAxisInclination
;
bool
m_showOrbits
;
bool
m_showRotationAxes
;
bool
m_cameraInteraction
;
int
m_mouseLastX
;
int
m_mouseLastY
;
int
m_mouseAngleH
;
...
...
src/pulsatingscience.cpp
View file @
f1b2a390
...
...
@@ -30,6 +30,7 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
ui
.
menuView
->
addAction
(
animControl
);
// inital status (based on GUI)
m_permanentOrbits
=
ui
.
actionPermanent_orbits
->
isChecked
();
m_rotationAxesVisible
=
ui
.
actionRotationAxes
->
isChecked
();
m_menuBarVisible
=
ui
.
actionMenu_bar
->
isChecked
();
m_statusBarVisible
=
ui
.
actionStatus_bar
->
isChecked
();
...
...
@@ -43,6 +44,8 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
m_pauseShortcut
->
setEnabled
(
false
);
m_stopShortcut
=
new
QShortcut
(
ui
.
actionStop
->
shortcut
(),
this
);
m_stopShortcut
->
setEnabled
(
false
);
m_permanentOrbitsShortcut
=
new
QShortcut
(
ui
.
actionPermanent_orbits
->
shortcut
(),
this
);
m_permanentOrbitsShortcut
->
setEnabled
(
false
);
m_rotationAxesShortcut
=
new
QShortcut
(
ui
.
actionRotationAxes
->
shortcut
(),
this
);
m_rotationAxesShortcut
->
setEnabled
(
false
);
m_menuBarShortcut
=
new
QShortcut
(
ui
.
actionMenu_bar
->
shortcut
(),
this
);
...
...
@@ -50,8 +53,7 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
m_fullscreenShortcut
=
new
QShortcut
(
ui
.
actionFullscreen
->
shortcut
(),
this
);
m_fullscreenShortcut
->
setEnabled
(
false
);
// TODO: register all remaining shortcuts, too (to use them while menu is hidden!)
// establish object communications
connect
(
ui
.
actionRun
,
SIGNAL
(
activated
()),
ui
.
pulsarGlWidget
,
SLOT
(
runAnimation
()));
...
...
@@ -61,6 +63,9 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect
(
ui
.
actionStop
,
SIGNAL
(
activated
()),
ui
.
pulsarGlWidget
,
SLOT
(
stopAnimation
()));
connect
(
ui
.
actionPermanent_orbits
,
SIGNAL
(
toggled
(
bool
)),
ui
.
pulsarGlWidget
,
SLOT
(
showOrbits
(
bool
)));
connect
(
ui
.
actionRotationAxes
,
SIGNAL
(
toggled
(
bool
)),
ui
.
pulsarGlWidget
,
SLOT
(
showRotationAxes
(
bool
)));
...
...
@@ -76,7 +81,6 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect
(
ui
.
pulsarGlWidget
,
SIGNAL
(
pulseProfileUpdated
(
const
QVector
<
float
>&
)),
ui
.
pulseScopeWidget
,
SLOT
(
drawCurve
(
const
QVector
<
float
>&
)));
// initialize animation parameters (using GUI settings)
on_sliderPulsarSemiMajorAxis_valueChanged
(
ui
.
sliderPulsarSemiMajorAxis
->
value
());
...
...
@@ -105,6 +109,11 @@ PulsatingScience::~PulsatingScience()
delete
m_stopShortcut
;
}
if
(
m_permanentOrbitsShortcut
)
{
m_permanentOrbitsShortcut
->
disconnect
();
delete
m_permanentOrbitsShortcut
;
}
if
(
m_rotationAxesShortcut
)
{
m_rotationAxesShortcut
->
disconnect
();
delete
m_rotationAxesShortcut
;
...
...
@@ -204,6 +213,21 @@ void PulsatingScience::on_sliderPulsarSemiMajorAxis_valueChanged(int value)
ui
.
lcdPulsarSemiMajorAxis
->
setStyleSheet
(
"color: black"
);
}
void
PulsatingScience
::
permanentOrbitsToggled
()
{
if
(
m_permanentOrbits
)
{
on_actionPermanent_orbits_toggled
(
false
);
ui
.
actionPermanent_orbits
->
setChecked
(
false
);
}
else
{
on_actionPermanent_orbits_toggled
(
true
);
ui
.
actionPermanent_orbits
->
setChecked
(
true
);
}
}
void
PulsatingScience
::
on_actionPermanent_orbits_toggled
(
bool
checked
)
{
m_permanentOrbits
=
checked
;
}
void
PulsatingScience
::
rotationAxesToggled
()
{
if
(
m_rotationAxesVisible
)
{
on_actionRotationAxes_toggled
(
false
);
...
...
@@ -245,6 +269,8 @@ void PulsatingScience::on_actionMenu_bar_toggled(bool checked)
m_pauseShortcut
->
setEnabled
(
false
);
m_stopShortcut
->
disconnect
();
m_stopShortcut
->
setEnabled
(
false
);
m_permanentOrbitsShortcut
->
disconnect
();
m_permanentOrbitsShortcut
->
setEnabled
(
false
);
m_rotationAxesShortcut
->
disconnect
();
m_rotationAxesShortcut
->
setEnabled
(
false
);
m_fullscreenShortcut
->
disconnect
();
...
...
@@ -263,6 +289,8 @@ void PulsatingScience::on_actionMenu_bar_toggled(bool checked)
connect
(
m_pauseShortcut
,
SIGNAL
(
activated
()),
ui
.
pulsarGlWidget
,
SLOT
(
pauseAnimation
()));
m_stopShortcut
->
setEnabled
(
true
);
connect
(
m_stopShortcut
,
SIGNAL
(
activated
()),
ui
.
pulsarGlWidget
,
SLOT
(
stopAnimation
()));
m_permanentOrbitsShortcut
->
setEnabled
(
true
);
connect
(
m_permanentOrbitsShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
permanentOrbitsToggled
()));
m_rotationAxesShortcut
->
setEnabled
(
true
);
connect
(
m_rotationAxesShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
rotationAxesToggled
()));
m_fullscreenShortcut
->
setEnabled
(
true
);
...
...
src/pulsatingscience.h
View file @
f1b2a390
...
...
@@ -49,6 +49,8 @@ public slots:
void
on_sliderPulsarMagneticAxisInclination_valueChanged
(
int
value
);
void
on_sliderPulsarSemiMajorAxis_valueChanged
(
int
value
);
void
permanentOrbitsToggled
();
void
on_actionPermanent_orbits_toggled
(
bool
checked
);
void
rotationAxesToggled
();
void
on_actionRotationAxes_toggled
(
bool
checked
);
void
fullscreenToggled
();
...
...
@@ -69,10 +71,12 @@ private:
QShortcut
*
m_runShortcut
;
QShortcut
*
m_pauseShortcut
;
QShortcut
*
m_stopShortcut
;
QShortcut
*
m_permanentOrbitsShortcut
;
QShortcut
*
m_rotationAxesShortcut
;
QShortcut
*
m_menuBarShortcut
;
QShortcut
*
m_fullscreenShortcut
;
bool
m_permanentOrbits
;
bool
m_rotationAxesVisible
;
bool
m_menuBarVisible
;
bool
m_statusBarVisible
;
...
...
src/pulsatingscience.ui
View file @
f1b2a390
...
...
@@ -478,6 +478,7 @@
<property name="title" >
<string>&View</string>
</property>
<addaction name="actionPermanent_orbits" />
<addaction name="actionRotationAxes" />
<addaction name="separator" />
<addaction name="actionFullscreen" />
...
...
@@ -652,7 +653,7 @@
<bool>true</bool>
</property>
<property name="text" >
<string>Rotation
A
xes</string>
<string>Rotation
a
xes</string>
</property>
<property name="shortcut" >
<string>Alt+R</string>
...
...
@@ -669,6 +670,17 @@
<string>Alt+F</string>
</property>
</action>
<action name="actionPermanent_orbits" >
<property name="checkable" >
<bool>true</bool>
</property>
<property name="text" >
<string>Orbital planes</string>
</property>
<property name="shortcut" >
<string>Alt+O</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment