Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
in20tools_old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias WEBER
in20tools_old
Commits
720936d0
Commit
720936d0
authored
6 years ago
by
Tobias WEBER
Browse files
Options
Downloads
Patches
Plain Diff
continued with structure factor tool
parent
6f8e22f7
Branches
Branches containing commit
Tags
4.3.28
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/structfact/structfact.cpp
+93
-18
93 additions, 18 deletions
tools/structfact/structfact.cpp
tools/structfact/structfact.h
+6
-0
6 additions, 0 deletions
tools/structfact/structfact.h
with
99 additions
and
18 deletions
tools/structfact/structfact.cpp
+
93
−
18
View file @
720936d0
...
...
@@ -60,13 +60,33 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
setSizeGripEnabled
(
true
);
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
GeneralFont
));
{
// plot widget
m_dlgPlot
=
new
QDialog
(
this
);
m_dlgPlot
->
setWindowTitle
(
"3D View"
);
if
(
m_sett
&&
m_sett
->
contains
(
"geo_3dview"
))
m_dlgPlot
->
restoreGeometry
(
m_sett
->
value
(
"geo_3dview"
).
toByteArray
());
m_dlgPlot
->
show
();
m_plot
=
std
::
make_shared
<
GlPlot
>
(
this
);
m_plot
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
});
auto
grid
=
new
QGridLayout
(
m_dlgPlot
);
grid
->
setSpacing
(
2
);
grid
->
setContentsMargins
(
4
,
4
,
4
,
4
);
grid
->
addWidget
(
m_plot
.
get
(),
0
,
0
,
1
,
1
);
connect
(
m_plot
.
get
(),
&
GlPlot
::
AfterGLInitialisation
,
this
,
&
StructFactDlg
::
AfterGLInitialisation
);
connect
(
m_plot
->
GetImpl
(),
&
GlPlot_impl
::
PickerIntersection
,
this
,
&
StructFactDlg
::
PickerIntersection
);
connect
(
m_plot
.
get
(),
&
GlPlot
::
MouseDown
,
this
,
&
StructFactDlg
::
PlotMouseDown
);
connect
(
m_plot
.
get
(),
&
GlPlot
::
MouseUp
,
this
,
&
StructFactDlg
::
PlotMouseUp
);
}
auto
tabs
=
new
QTabWidget
(
this
);
{
m_nucleipanel
=
new
QWidget
(
this
);
m_plot
=
std
::
make_shared
<
GlPlot
>
(
m_nucleipanel
);
m_nuclei
=
new
QTableWidget
(
m_nucleipanel
);
m_nuclei
->
setShowGrid
(
true
);
m_nuclei
->
setSortingEnabled
(
true
);
...
...
@@ -86,12 +106,12 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
m_nuclei
->
setHorizontalHeaderItem
(
COL_Y
,
new
QTableWidgetItem
{
"y (frac.)"
});
m_nuclei
->
setHorizontalHeaderItem
(
COL_Z
,
new
QTableWidgetItem
{
"z (frac.)"
});
m_nuclei
->
setColumnWidth
(
COL_NAME
,
10
0
);
m_nuclei
->
setColumnWidth
(
COL_SCATLEN_RE
,
7
5
);
m_nuclei
->
setColumnWidth
(
COL_SCATLEN_IM
,
7
5
);
m_nuclei
->
setColumnWidth
(
COL_X
,
7
5
);
m_nuclei
->
setColumnWidth
(
COL_Y
,
7
5
);
m_nuclei
->
setColumnWidth
(
COL_Z
,
7
5
);
m_nuclei
->
setColumnWidth
(
COL_NAME
,
9
0
);
m_nuclei
->
setColumnWidth
(
COL_SCATLEN_RE
,
6
5
);
m_nuclei
->
setColumnWidth
(
COL_SCATLEN_IM
,
6
5
);
m_nuclei
->
setColumnWidth
(
COL_X
,
6
5
);
m_nuclei
->
setColumnWidth
(
COL_Y
,
6
5
);
m_nuclei
->
setColumnWidth
(
COL_Z
,
6
5
);
QToolButton
*
pTabBtnAdd
=
new
QToolButton
(
m_nucleipanel
);
QToolButton
*
pTabBtnDel
=
new
QToolButton
(
m_nucleipanel
);
...
...
@@ -99,8 +119,8 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
QToolButton
*
pTabBtnDown
=
new
QToolButton
(
m_nucleipanel
);
QToolButton
*
pTabBtnLoad
=
new
QToolButton
(
m_nucleipanel
);
QToolButton
*
pTabBtnSave
=
new
QToolButton
(
m_nucleipanel
);
QToolButton
*
pTabBtn3DView
=
new
QToolButton
(
m_nucleipanel
);
m_plot
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
});
m_nuclei
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
});
pTabBtnAdd
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
});
pTabBtnDel
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
});
...
...
@@ -108,6 +128,7 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
pTabBtnDown
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
});
pTabBtnLoad
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
});
pTabBtnSave
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
});
pTabBtn3DView
->
setSizePolicy
(
QSizePolicy
{
QSizePolicy
::
Expanding
,
QSizePolicy
::
Fixed
});
pTabBtnAdd
->
setText
(
"Add Nucleus"
);
pTabBtnDel
->
setText
(
"Delete Nuclei"
);
...
...
@@ -115,6 +136,7 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
pTabBtnDown
->
setText
(
"Move Nuclei Down"
);
pTabBtnLoad
->
setText
(
"Load..."
);
pTabBtnSave
->
setText
(
"Save..."
);
pTabBtn3DView
->
setText
(
"3D View..."
);
m_editA
=
new
QLineEdit
(
"5"
,
m_nucleipanel
);
...
...
@@ -129,20 +151,21 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
pTabGrid
->
setSpacing
(
2
);
pTabGrid
->
setContentsMargins
(
4
,
4
,
4
,
4
);
int
y
=
0
;
pTabGrid
->
addWidget
(
m_plot
.
get
(),
y
,
0
,
1
,
4
);
pTabGrid
->
addWidget
(
m_nuclei
,
++
y
,
0
,
1
,
4
);
//
pTabGrid->addWidget(m_plot.get(), y,0,1,4);
pTabGrid
->
addWidget
(
m_nuclei
,
y
,
0
,
1
,
4
);
pTabGrid
->
addWidget
(
pTabBtnAdd
,
++
y
,
0
,
1
,
1
);
pTabGrid
->
addWidget
(
pTabBtnDel
,
y
,
1
,
1
,
1
);
pTabGrid
->
addWidget
(
pTabBtnUp
,
y
,
2
,
1
,
1
);
pTabGrid
->
addWidget
(
pTabBtnDown
,
y
,
3
,
1
,
1
);
pTabGrid
->
addWidget
(
pTabBtnLoad
,
++
y
,
0
,
1
,
1
);
pTabGrid
->
addWidget
(
pTabBtnSave
,
y
,
1
,
1
,
1
);
pTabGrid
->
addWidget
(
pTabBtn3DView
,
y
,
3
,
1
,
1
);
auto
sep1
=
new
QFrame
(
m_nucleipanel
);
sep1
->
setFrameStyle
(
QFrame
::
HLine
);
pTabGrid
->
addWidget
(
sep1
,
++
y
,
0
,
1
,
4
);
pTabGrid
->
addWidget
(
new
QLabel
(
"Lattice (A):"
),
5
,
0
,
1
,
1
);
pTabGrid
->
addWidget
(
m_editA
,
++
y
,
1
,
1
,
1
);
pTabGrid
->
addWidget
(
new
QLabel
(
"Lattice (A):"
),
++
y
,
0
,
1
,
1
);
pTabGrid
->
addWidget
(
m_editA
,
y
,
1
,
1
,
1
);
pTabGrid
->
addWidget
(
m_editB
,
y
,
2
,
1
,
1
);
pTabGrid
->
addWidget
(
m_editC
,
y
,
3
,
1
,
1
);
pTabGrid
->
addWidget
(
new
QLabel
(
"Angles (deg):"
),
++
y
,
0
,
1
,
1
);
...
...
@@ -167,19 +190,27 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
// signals
connect
(
pTabBtnAdd
,
&
QToolButton
::
clicked
,
this
,
[
this
]()
{
this
->
AddTabItem
(
-
1
);
});
connect
(
pTabBtnAdd
,
&
QToolButton
::
clicked
,
this
,
[
this
]()
{
this
->
AddTabItem
(
-
1
);
});
connect
(
pTabBtnDel
,
&
QToolButton
::
clicked
,
this
,
&
StructFactDlg
::
DelTabItem
);
connect
(
pTabBtnUp
,
&
QToolButton
::
clicked
,
this
,
&
StructFactDlg
::
MoveTabItemUp
);
connect
(
pTabBtnDown
,
&
QToolButton
::
clicked
,
this
,
&
StructFactDlg
::
MoveTabItemDown
);
connect
(
pTabBtnLoad
,
&
QToolButton
::
clicked
,
this
,
&
StructFactDlg
::
Load
);
connect
(
pTabBtnSave
,
&
QToolButton
::
clicked
,
this
,
&
StructFactDlg
::
Save
);
connect
(
pTabBtn3DView
,
&
QToolButton
::
clicked
,
this
,
[
this
]()
{
this
->
m_dlgPlot
->
show
();
this
->
m_dlgPlot
->
raise
();
this
->
m_dlgPlot
->
focusWidget
();
});
connect
(
m_nuclei
,
&
QTableWidget
::
currentCellChanged
,
this
,
&
StructFactDlg
::
TableCurCellChanged
);
connect
(
m_nuclei
,
&
QTableWidget
::
entered
,
this
,
&
StructFactDlg
::
TableCellEntered
);
connect
(
m_nuclei
,
&
QTableWidget
::
itemChanged
,
this
,
&
StructFactDlg
::
TableItemChanged
);
connect
(
m_nuclei
,
&
QTableWidget
::
customContextMenuRequested
,
this
,
&
StructFactDlg
::
ShowTableContextMenu
);
connect
(
m_plot
.
get
(),
&
GlPlot
::
AfterGLInitialisation
,
this
,
&
StructFactDlg
::
AfterGLInitialisation
);
tabs
->
addTab
(
m_nucleipanel
,
"Nuclei"
);
}
...
...
@@ -746,6 +777,46 @@ void StructFactDlg::Calc()
}
/**
* mouse hovers over 3d object
*/
void
StructFactDlg
::
PickerIntersection
(
const
t_vec3_gl
*
pos
,
std
::
size_t
objIdx
,
const
t_vec3_gl
*
posSphere
)
{
if
(
pos
)
m_curPickedObj
=
long
(
objIdx
);
else
m_curPickedObj
=
-
1
;
}
/**
* mouse button pressed
*/
void
StructFactDlg
::
PlotMouseDown
(
bool
left
,
bool
mid
,
bool
right
)
{
if
(
left
&&
m_curPickedObj
>
0
)
{
// find corresponding nucleus in table
for
(
int
row
=
0
;
row
<
m_nuclei
->
rowCount
();
++
row
)
{
if
(
std
::
size_t
obj
=
m_nuclei
->
item
(
row
,
COL_NAME
)
->
data
(
Qt
::
UserRole
).
toUInt
();
long
(
obj
)
==
m_curPickedObj
)
{
m_nuclei
->
setCurrentCell
(
row
,
0
);
break
;
}
}
}
}
/**
* mouse button released
*/
void
StructFactDlg
::
PlotMouseUp
(
bool
left
,
bool
mid
,
bool
right
)
{
}
void
StructFactDlg
::
AfterGLInitialisation
()
{
m_sphere
=
m_plot
->
GetImpl
()
->
AddSphere
(
0.1
,
0.
,
0.
,
0.
,
1.
,
0.
,
0.
,
1.
);
...
...
@@ -764,7 +835,11 @@ void StructFactDlg::AfterGLInitialisation()
void
StructFactDlg
::
closeEvent
(
QCloseEvent
*
evt
)
{
if
(
m_sett
)
m_sett
->
setValue
(
"geo"
,
saveGeometry
());
if
(
m_sett
)
{
m_sett
->
setValue
(
"geo"
,
saveGeometry
());
m_sett
->
setValue
(
"geo_3dview"
,
m_dlgPlot
->
saveGeometry
());
}
}
// ----------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
tools/structfact/structfact.h
+
6
−
0
View file @
720936d0
...
...
@@ -75,6 +75,7 @@ public:
protected:
QSettings
*
m_sett
=
nullptr
;
QDialog
*
m_dlgPlot
=
nullptr
;
std
::
shared_ptr
<
GlPlot
>
m_plot
;
std
::
size_t
m_sphere
=
0
;
QLabel
*
m_labelGlInfos
[
4
]
=
{
nullptr
,
nullptr
,
nullptr
,
nullptr
};
...
...
@@ -113,6 +114,9 @@ protected:
std
::
vector
<
NuclPos
>
GetNuclei
()
const
;
void
Calc
();
void
PlotMouseDown
(
bool
left
,
bool
mid
,
bool
right
);
void
PlotMouseUp
(
bool
left
,
bool
mid
,
bool
right
);
void
PickerIntersection
(
const
t_vec3_gl
*
pos
,
std
::
size_t
objIdx
,
const
t_vec3_gl
*
posSphere
);
void
AfterGLInitialisation
();
virtual
void
closeEvent
(
QCloseEvent
*
evt
)
override
;
...
...
@@ -121,6 +125,8 @@ private:
int
m_iCursorRow
=
-
1
;
bool
m_ignoreChanges
=
1
;
long
m_curPickedObj
=
-
1
;
private
:
std
::
vector
<
int
>
GetSelectedRows
(
bool
sort_reversed
=
false
)
const
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment