Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mlz
BornAgain
Commits
7129e900
Commit
7129e900
authored
Jun 10, 2022
by
Mikhail Svechnikov
Committed by
Mikhail Svechnikov
Jun 13, 2022
Browse files
gradient change works
parent
d5e41ac8
Changes
13
Hide whitespace changes
Inline
Side-by-side
GUI/Model/Data/DataItem.cpp
View file @
7129e900
...
...
@@ -104,14 +104,9 @@ void DataItem::setAxesUnits(const ComboProperty& units)
setItemValue
(
P_AXES_UNITS
,
units
.
variant
());
}
SessionItem
*
DataItem
::
getAxesUnitsItem
()
const
{
return
getItem
(
P_AXES_UNITS
);
}
SelectionDescriptor
<
QString
>
DataItem
::
axesUnits
()
const
{
return
SelectionDescriptor
<
QString
>
(
get
AxesUnitsItem
(
));
return
SelectionDescriptor
<
QString
>
(
get
Item
(
P_AXES_UNITS
));
}
bool
DataItem
::
isAxesUnitsPropertyName
(
const
QString
&
name
)
...
...
GUI/Model/Data/DataItem.h
View file @
7129e900
...
...
@@ -61,8 +61,6 @@ public:
QString
selectedCoords
()
const
;
void
setAxesUnits
(
const
ComboProperty
&
units
);
SessionItem
*
getAxesUnitsItem
()
const
;
void
createAxesUnitsDescriptor
();
SelectionDescriptor
<
QString
>
axesUnits
()
const
;
static
bool
isAxesUnitsPropertyName
(
const
QString
&
name
);
static
void
updateAxesUnits
(
SessionItem
*
item
,
const
QString
&
name
,
...
...
@@ -82,7 +80,7 @@ signals:
void
rawDataVectorChanged
(
const
std
::
vector
<
double
>&
data
);
void
fileNameChanged
(
const
QString
&
filename
);
void
axesUnitsChanged
();
void
r
eplotRequested
();
void
axesUnitsR
eplotRequested
();
protected:
explicit
DataItem
(
const
QString
&
modelType
);
...
...
GUI/Model/Data/IntensityDataItem.cpp
View file @
7129e900
...
...
@@ -161,7 +161,6 @@ ComboProperty IntensityDataItem::getGradient() const
void
IntensityDataItem
::
setGradient
(
const
ComboProperty
&
gradient
)
{
setItemValue
(
P_GRADIENT
,
gradient
.
variant
());
emit
gradientChanged
(
gradient
);
}
SelectionDescriptor
<
QString
>
IntensityDataItem
::
gradient
()
const
...
...
@@ -329,7 +328,7 @@ void IntensityDataItem::setLogz(bool logz)
void
IntensityDataItem
::
setInterpolated
(
bool
interp
)
{
setItemValue
(
P_IS_INTERPOLATED
,
interp
);
emit
interpolationChanged
(
interp
);
emit
interpolationChanged
();
}
//! Sets zoom range of X,Y axes, if it was not yet defined.
...
...
GUI/Model/Data/IntensityDataItem.h
View file @
7129e900
...
...
@@ -122,7 +122,7 @@ public:
static
bool
isZaxisPropertyName
(
const
QString
&
name
);
signals:
void
gradientChanged
(
const
ComboProperty
&
gradient
);
void
gradientChanged
();
void
zAxisLockChanged
(
bool
isLocked
);
void
xAxisTitleChanged
(
const
QString
&
title
);
void
yAxisTitleChanged
(
const
QString
&
title
);
...
...
@@ -134,7 +134,7 @@ signals:
void
zAxisLowerChanged
(
double
value
);
void
zAxisUpperChanged
(
double
value
);
void
zLogChanged
(
bool
isLog
);
void
interpolationChanged
(
bool
isInterpolated
);
void
interpolationChanged
();
public
slots
:
void
setLowerX
(
double
value
);
...
...
GUI/Model/Job/JobItem.cpp
View file @
7129e900
...
...
@@ -290,16 +290,26 @@ RealDataItem* JobItem::realDataItem()
RealDataItem
*
JobItem
::
copyRealDataIntoJob
(
const
RealDataItem
*
real_data
)
{
qInfo
()
<<
"copyRealDataIntoJob"
<<
endl
;
// create diffDataItem together with realDataItem
if
(
!
diffDataItem
())
{
if
(
real_data
->
isIntensityData
())
model
()
->
insertItem
<
IntensityDataItem
>
(
this
,
-
1
,
T_DIFF
);
else
else
if
(
real_data
->
isSpecularData
())
model
()
->
insertItem
<
SpecularDataItem
>
(
this
,
-
1
,
T_DIFF
);
qInfo
()
<<
"JobItem::diff inserted in copy"
<<
endl
;
}
else
ASSERT
(
0
)
return
model
()
->
copyItem
(
real_data
,
this
,
T_REALDATA
);
// immediately create coordinate system and axes units
if
(
instrumentItem
())
{
GUI
::
Model
::
JobItemUtils
::
setIntensityItemCoords
(
diffDataItem
(),
instrumentItem
());
diffDataItem
()
->
updateCoords
(
instrumentItem
());
}
}
RealDataItem
*
realDataCopy
=
model
()
->
copyItem
(
real_data
,
this
,
T_REALDATA
);
if
(
!
isSpecularJob
())
{
realDataCopy
->
intensityDataItem
()
->
setGradient
(
intensityDataItem
()
->
getGradient
());
}
return
realDataCopy
;
}
RealDataItem
*
JobItem
::
createRealDataItem
()
...
...
GUI/Model/Job/JobItem.h
View file @
7129e900
...
...
@@ -171,13 +171,6 @@ T* JobItem::setDataType()
{
static_assert
(
std
::
is_base_of
<
DataItem
,
T
>::
value
,
"Class must be derived from DataItem"
);
qInfo
()
<<
"JobItem::setDataType"
<<
endl
;
// if(realDataItem() && !diffDataItem())
// {
// model()->insertItem<T>(this, -1, T_DIFF);
// qInfo() << "JobItem::diff inserted" << endl;
// }
return
model
()
->
insertItem
<
T
>
(
this
,
-
1
,
T_OUTPUT
);
}
...
...
GUI/View/Plot2D/IntensityDataCanvas.cpp
View file @
7129e900
...
...
@@ -175,32 +175,32 @@ void IntensityDataCanvas::initRotation()
void
IntensityDataCanvas
::
onPropertyChanged
(
const
QString
&
name
)
{
if
(
IntensityDataItem
::
isGradientPropertyName
(
name
))
{
QSettings
settings
;
settings
.
setValue
(
SettingsKeyGradient
,
intensityDataItem
()
->
getGradientValue
());
}
else
if
(
IntensityDataItem
::
isInterpolatedPropertyName
(
name
))
{
QSettings
settings
;
settings
.
setValue
(
SettingsKeyInterpolation
,
intensityDataItem
()
->
isInterpolated
());
}
//
if (IntensityDataItem::isGradientPropertyName(name)) {
//
QSettings settings;
//
settings.setValue(SettingsKeyGradient, intensityDataItem()->getGradientValue());
//
} else if (IntensityDataItem::isInterpolatedPropertyName(name)) {
//
QSettings settings;
//
settings.setValue(SettingsKeyInterpolation, intensityDataItem()->isInterpolated());
//
}
}
//! Apply persistent settings (gradient, interpolation) to IntensityDataItem.
void
IntensityDataCanvas
::
applyPersistentSettings
()
{
QSettings
settings
;
if
(
settings
.
contains
(
SettingsKeyGradient
))
{
ComboProperty
combo
=
intensityDataItem
()
->
getGradient
();
QString
persistentGradient
=
settings
.
value
(
SettingsKeyGradient
).
toString
();
if
(
combo
.
getValue
()
!=
persistentGradient
)
{
combo
.
setValue
(
persistentGradient
);
intensityDataItem
()
->
setGradient
(
combo
);
}
}
if
(
settings
.
contains
(
SettingsKeyInterpolation
))
{
bool
value
=
settings
.
value
(
SettingsKeyInterpolation
).
toBool
();
intensityDataItem
()
->
setInterpolated
(
value
);
}
//
QSettings settings;
//
if (settings.contains(SettingsKeyGradient)) {
//
ComboProperty combo = intensityDataItem()->getGradient();
//
QString persistentGradient = settings.value(SettingsKeyGradient).toString();
//
if (combo.getValue() != persistentGradient) {
//
combo.setValue(persistentGradient);
//
intensityDataItem()->setGradient(combo);
//
}
//
}
//
if (settings.contains(SettingsKeyInterpolation)) {
//
bool value = settings.value(SettingsKeyInterpolation).toBool();
//
intensityDataItem()->setInterpolated(value);
//
}
}
GUI/View/Plot2D/IntensityDataWidget.cpp
View file @
7129e900
...
...
@@ -55,14 +55,16 @@ IntensityDataWidget::IntensityDataWidget(QWidget* parent)
void
IntensityDataWidget
::
setItem
(
SessionItem
*
job_Item
)
{
SessionItemWidget
::
setItem
(
job_Item
);
SessionItemWidget
::
setItem
(
job_Item
);
// now we can access to jobItem()
// now we can access to JobItem
m_intensityCanvas
->
setItem
(
intensityDataItem
());
#ifdef USE_MAPPERS
m_propertyWidget
->
setItem
({
intensityDataItem
()});
#else
qInfo
()
<<
intensityDataItem
()
<<
realIntensityDataItem
()
<<
diffIntensityDataItem
()
<<
endl
;
qInfo
()
<<
endl
<<
"simu"
<<
intensityDataItem
()
<<
endl
<<
"real"
<<
realIntensityDataItem
()
<<
endl
<<
"diff"
<<
diffIntensityDataItem
()
<<
endl
;
m_propertyWidget
->
setItem
({
intensityDataItem
(),
realIntensityDataItem
(),
diffIntensityDataItem
()});
...
...
GUI/View/PlotComparison/FitComparisonController.cpp
View file @
7129e900
...
...
@@ -135,7 +135,6 @@ void DiffItemController::setItem(JobItem* job_item)
{
ASSERT
(
job_item
);
ASSERT
(
job_item
->
diffDataItem
());
qInfo
()
<<
"diffDataItem asserted"
<<
endl
;
if
(
m_current_item
)
unsubscribe
();
...
...
GUI/View/PlotComparison/FitComparisonWidget.cpp
View file @
7129e900
...
...
@@ -106,7 +106,10 @@ void FitComparisonWidget::subscribeToItem()
#ifdef USE_MAPPERS
m_propertyWidget
->
setItem
({
simulatedDataItem
()});
#else
qInfo
()
<<
simulatedDataItem
()
<<
realDataItem
()
<<
diffItem
()
<<
endl
;
qInfo
()
<<
endl
<<
"simu"
<<
simulatedDataItem
()
<<
endl
<<
"real"
<<
realDataItem
()
<<
endl
<<
"diff"
<<
diffItem
()
<<
endl
;
m_propertyWidget
->
setItem
({
simulatedDataItem
(),
realDataItem
(),
diffItem
()});
#endif
}
...
...
GUI/View/PlotUtil/ColorMap.cpp
View file @
7129e900
...
...
@@ -221,14 +221,14 @@ void ColorMap::subscribeToItem()
intensityItem
()
->
mapper
()
->
setOnValueChange
([
this
]()
{
onIntensityModified
();
},
this
);
#else
connect
(
intensityItem
(),
&
IntensityDataItem
::
replotRequested
,
this
,
[
=
]()
{
setAxesRangeConnected
(
false
);
m_customPlot
->
xAxis
->
setRange
(
GUI
::
View
::
RangeUtils
::
itemZoomX
(
intensityItem
()));
m_customPlot
->
yAxis
->
setRange
(
GUI
::
View
::
RangeUtils
::
itemZoomY
(
intensityItem
()));
setAxesRangeConnected
(
true
);
connect
(
intensityItem
(),
&
IntensityDataItem
::
axesUnitsReplotRequested
,
this
,
[
=
]()
{
setAxesRangeFromItem
(
intensityItem
());
setDataFromItem
(
intensityItem
());
setAxesZoomFromItem
(
intensityItem
());
setAxesLabelsFromItem
(
intensityItem
());
replot
();
});
connect
(
intensityItem
(),
&
IntensityDataItem
::
gradientChanged
,
this
,
[
=
]()
{
m_colorMap
->
setGradient
(
GUI
::
View
::
RangeUtils
::
itemGradient
(
intensityItem
()));
replot
();
});
#endif
...
...
GUI/View/PlotUtil/IntensityDataPropertyWidget.cpp
View file @
7129e900
...
...
@@ -80,8 +80,10 @@ void IntensityDataPropertyWidget::setItem(QVector<IntensityDataItem*> itemsVec)
m_mainLayout
->
addRow
(
"Color scheme:"
,
createComboBox
(
first_item
->
gradient
(),
[
=
](
int
newIndex
){
for
(
IntensityDataItem
*
item
:
m_items_vec
)
if
(
item
)
if
(
item
)
{
item
->
gradient
().
setCurrentIndex
(
newIndex
);
emit
item
->
gradientChanged
();
}
}));
m_mainLayout
->
addRow
(
createCheckBox
(
"Interpolate"
,
...
...
@@ -151,7 +153,7 @@ void IntensityDataPropertyWidget::setItem(QVector<IntensityDataItem*> itemsVec)
item
->
blockSignals
(
true
);
item
->
updateCoords
(
jobItem
()
->
instrumentItem
());
item
->
blockSignals
(
false
);
emit
item
->
r
eplotRequested
();
emit
item
->
axesUnitsR
eplotRequested
();
}
});
}
...
...
GUI/View/Projection/ProjectionsEditor.cpp
View file @
7129e900
...
...
@@ -64,8 +64,19 @@ void ProjectionsEditor::setContext(SessionModel* model, const QModelIndex& shape
delete
m_selectionModel
;
m_selectionModel
=
new
QItemSelectionModel
(
model
,
this
);
//#ifdef USE_MAPPERS
m_propertyPanel
->
setItem
({
intensityItem
});
//#else
// qInfo() << endl
// << "simu" << intensityDataItem() << endl
// << "real" << realIntensityDataItem() << endl
// << "diff" << diffIntensityDataItem() << endl;
// m_propertyPanel->setItem({intensityDataItem(),
// realIntensityDataItem(),
// diffIntensityDataItem()});
//#endif
m_projectionsCanvas
->
setSelectionModel
(
m_selectionModel
);
m_projectionsCanvas
->
setContext
(
model
,
shapeContainerIndex
,
intensityItem
);
m_projectionsWidget
->
setItem
(
intensityItem
);
...
...
Write
Preview
Supports
Markdown
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