Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
mag-core
Commits
92980904
Commit
92980904
authored
Dec 05, 2019
by
Tobias WEBER
Browse files
continued with moldyn tool
parent
44b7c110
Changes
2
Show whitespace changes
Inline
Side-by-side
tools/moldyn/moldyn.cpp
View file @
92980904
...
...
@@ -8,6 +8,7 @@
#include "moldyn.h"
#include <QtWidgets/QApplication>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QMessageBox>
...
...
@@ -34,6 +35,13 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
this
->
setStatusBar
(
m_status
);
QWidget
*
pMainPanel
=
new
QWidget
();
auto
pMainGrid
=
new
QGridLayout
(
pMainPanel
);
pMainGrid
->
setSpacing
(
2
);
pMainGrid
->
setContentsMargins
(
4
,
4
,
4
,
4
);
this
->
setCentralWidget
(
pMainPanel
);
// menu bar
{
m_menu
=
new
QMenuBar
(
this
);
...
...
@@ -80,7 +88,21 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
connect
(
m_plot
,
&
GlPlot
::
MouseDown
,
this
,
&
MolDynDlg
::
PlotMouseDown
);
connect
(
m_plot
,
&
GlPlot
::
MouseUp
,
this
,
&
MolDynDlg
::
PlotMouseUp
);
this
->
setCentralWidget
(
m_plot
);
//this->setCentralWidget(m_plot);
pMainGrid
->
addWidget
(
m_plot
,
0
,
0
,
1
,
1
);
}
// controls
{
m_slider
=
new
QSlider
(
Qt
::
Horizontal
,
this
);
m_slider
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Minimum
});
m_slider
->
setMinimum
(
0
);
m_slider
->
setTracking
(
1
);
connect
(
m_slider
,
&
QSlider
::
valueChanged
,
this
,
&
MolDynDlg
::
SliderValueChanged
);
pMainGrid
->
addWidget
(
m_slider
,
1
,
0
,
1
,
1
);
}
...
...
@@ -136,9 +158,13 @@ void MolDynDlg::Load()
if
(
!
m_mol
.
LoadFile
(
filename
.
toStdString
(),
100
))
{
QMessageBox
::
critical
(
this
,
"Molecular Dynamics"
,
"Error loading file."
);
return
;
}
m_slider
->
setMaximum
(
m_mol
.
GetFrameCount
());
// atom colors
std
::
vector
<
t_vec
>
cols
=
{
m
::
create
<
t_vec
>
({
1
,
0
,
0
}),
...
...
@@ -149,6 +175,7 @@ void MolDynDlg::Load()
m
::
create
<
t_vec
>
({
0
,
0
,
0
}),
};
// add atoms to 3d view
if
(
m_mol
.
GetFrameCount
())
{
const
auto
&
frame
=
m_mol
.
GetFrame
(
0
);
...
...
@@ -235,6 +262,12 @@ void MolDynDlg::PlotMouseUp(bool left, bool mid, bool right)
void
MolDynDlg
::
SliderValueChanged
(
int
val
)
{
}
// ----------------------------------------------------------------------------
void
MolDynDlg
::
AfterGLInitialisation
()
{
...
...
tools/moldyn/moldyn.h
View file @
92980904
...
...
@@ -12,6 +12,7 @@
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QSlider>
#include <QtCore/QSettings>
#include <vector>
...
...
@@ -39,6 +40,7 @@ protected:
QSettings
*
m_sett
=
nullptr
;
QMenuBar
*
m_menu
=
nullptr
;
QStatusBar
*
m_status
=
nullptr
;
QSlider
*
m_slider
=
nullptr
;
GlPlot
*
m_plot
=
nullptr
;
std
::
size_t
m_sphere
=
0
;
...
...
@@ -57,6 +59,8 @@ protected:
void
PickerIntersection
(
const
t_vec3_gl
*
pos
,
std
::
size_t
objIdx
,
const
t_vec3_gl
*
posSphere
);
void
AfterGLInitialisation
();
void
SliderValueChanged
(
int
val
);
virtual
void
closeEvent
(
QCloseEvent
*
evt
)
override
;
private:
...
...
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