Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
mlz
BornAgain
Commits
68ccc19e
Commit
68ccc19e
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
doing Plot1D mappers
parent
f19db0fb
No related branches found
No related tags found
2 merge requests
!963
GUI refactoring: rm mappers from specular and projection plots
,
!962
Draft: GUI refactoring: rm mappers from SpecularPlot
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Data/Data1DViewItem.cpp
+0
-7
0 additions, 7 deletions
GUI/Model/Data/Data1DViewItem.cpp
GUI/View/PlotComparison/Plot1D.cpp
+74
-18
74 additions, 18 deletions
GUI/View/PlotComparison/Plot1D.cpp
with
74 additions
and
25 deletions
GUI/Model/Data/Data1DViewItem.cpp
+
0
−
7
View file @
68ccc19e
...
...
@@ -37,13 +37,6 @@ Data1DViewItem::Data1DViewItem()
,
m_job_item
(
nullptr
)
{
registerTag
(
T_DATA_PROPERTIES
,
1
,
1
,
{
DataPropertyContainer
::
M_TYPE
});
mapper
()
->
setOnPropertyChange
([
this
](
const
QString
&
name
)
{
if
(
!
DataItem
::
isAxesUnitsPropertyName
(
name
))
return
;
setAxesRangeToData
();
GUI
::
Model
::
DataViewUtils
::
updateAxesTitle
(
this
);
});
}
//! set zoom range of x,y axes to axes of input data
...
...
This diff is collapsed.
Click to expand it.
GUI/View/PlotComparison/Plot1D.cpp
+
74
−
18
View file @
68ccc19e
...
...
@@ -17,6 +17,7 @@
#include
"GUI/Model/Data/DataItem.h"
#include
"GUI/Model/Data/DataProperties.h"
#include
"GUI/Model/Data/DataPropertyContainer.h"
#include
"GUI/Model/Data/DataViewUtils.h"
#include
"GUI/Model/Device/AxesItems.h"
#include
"GUI/View/PlotUtil/PlotConstants.h"
#include
"GUI/View/PlotUtil/PlotEventInfo.h"
...
...
@@ -116,40 +117,95 @@ void Plot1D::subscribeToItem()
initPlots
();
refreshPlotData
();
viewItem
()
->
mapper
()
->
setOnPropertyChange
(
[
this
](
const
QString
&
name
)
{
onPropertyChanged
(
name
);
},
this
);
viewItem
()
->
mapper
()
->
setOnChildPropertyChange
(
[
this
](
SessionItem
*
item
,
const
QString
name
)
{
if
(
dynamic_cast
<
BasicAxisItem
*>
(
item
))
modifyAxesProperties
(
item
->
itemName
(),
name
);
},
this
);
//#ifdef USE_MAPPERS
// viewItem()->mapper()->setOnPropertyChange(
// [this](const QString& name) {
// if (DataItem::isAxesUnitsPropertyName(name)) {
// viewItem()->setAxesRangeToData();
// GUI::Model::DataViewUtils::updateAxesTitle(viewItem());
// }
// onPropertyChanged(name);
// }, this);
// viewItem()->mapper()->setOnChildPropertyChange(
// [this](SessionItem* item, const QString name) {
// if (dynamic_cast<BasicAxisItem*>(item))
// modifyAxesProperties(item->itemName(), name);
// },
// this);
// std::for_each(m_graph_map.begin(), m_graph_map.end(), [caller = this](auto pair) {
// auto property_item = pair.first;
// property_item->dataItem()->mapper()->setOnValueChange(
// [caller]() { caller->refreshPlotData(); }, caller);
// });
//#else
// datafield
std
::
for_each
(
m_graph_map
.
begin
(),
m_graph_map
.
end
(),
[
caller
=
this
](
auto
pair
)
{
#ifdef USE_MAPPERS
auto
property_item
=
pair
.
first
;
property_item
->
dataItem
()
->
mapper
()
->
setOnValueChange
(
[
caller
]()
{
caller
->
refreshPlotData
();
},
caller
);
#else
DataItem
*
dataItem
=
pair
.
first
->
dataItem
();
connect
(
dataItem
,
&
DataItem
::
datafieldChanged
,
caller
,
[
caller
]()
{
caller
->
refreshPlotData
();
});
#endif
});
// units
connect
(
viewItem
(),
&
DataItem
::
axesUnitsReplotRequested
,
this
,
[
=
]()
{
viewItem
()
->
setAxesRangeToData
();
GUI
::
Model
::
DataViewUtils
::
updateAxesTitle
(
viewItem
());
setAxesRangeFromItem
(
viewItem
());
updateAllGraphs
();
replot
();
});
// x axis
connect
(
viewItem
()
->
xAxisItem
(),
&
BasicAxisItem
::
axisTitleChanged
,
this
,
[
=
]()
{
setAxesLabelsFromItem
(
viewItem
());
replot
();
});
connect
(
viewItem
()
->
xAxisItem
(),
&
BasicAxisItem
::
axisRangeChanged
,
this
,
[
=
]()
{
setAxesRangeConnected
(
false
);
m_custom_plot
->
xAxis
->
setRange
(
viewItem
()
->
getLowerX
(),
viewItem
()
->
getUpperX
());
setAxesRangeConnected
(
true
);
replot
();
});
// y axis
connect
(
viewItem
()
->
yAxisItem
(),
&
BasicAxisItem
::
axisTitleChanged
,
this
,
[
=
]()
{
setAxesLabelsFromItem
(
viewItem
());
replot
();
});
connect
(
viewItem
()
->
yAxisItem
(),
&
BasicAxisItem
::
axisRangeChanged
,
this
,
[
=
]()
{
setAxesRangeConnected
(
false
);
m_custom_plot
->
yAxis
->
setRange
(
viewItem
()
->
getLowerY
(),
viewItem
()
->
getUpperY
());
setAxesRangeConnected
(
true
);
replot
();
});
connect
(
viewItem
()
->
yAxisItem
(),
&
AmplitudeAxisItem
::
logScaleChanged
,
this
,
[
=
]()
{
setLog
(
viewItem
()
->
isLog
());
replot
();
});
//#endif
setConnected
(
true
);
}
void
Plot1D
::
unsubscribeFromItem
()
{
m_custom_plot
->
clearGraphs
();
std
::
for_each
(
m_graph_map
.
begin
(),
m_graph_map
.
end
(),
[
caller
=
this
](
auto
pair
)
{
#ifdef USE_MAPPERS
std
::
for_each
(
m_graph_map
.
begin
(),
m_graph_map
.
end
(),
[
caller
=
this
](
auto
pair
)
{
pair
.
first
->
dataItem
()
->
mapper
()
->
unsubscribe
(
caller
);
});
#else
// disconnect(specularItem(), nullptr, this, nullptr);
// disconnect(specularItem()->xAxisItem(), nullptr, this, nullptr);
// disconnect(specularItem()->yAxisItem(), nullptr, this, nullptr);
std
::
for_each
(
m_graph_map
.
begin
(),
m_graph_map
.
end
(),
[
caller
=
this
](
auto
pair
)
{
disconnect
(
pair
.
first
->
dataItem
(),
nullptr
,
caller
,
nullptr
);
#endif
});
#endif
m_graph_map
.
clear
();
setConnected
(
false
);
}
...
...
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