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
c66a5b01
Commit
c66a5b01
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
RealItem: store pointer to InstrumentModel
parent
df75f686
No related branches found
No related tags found
1 merge request
!1360
GUI: serialize only selected index for "ComboProperty"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Data/RealItem.cpp
+17
-2
17 additions, 2 deletions
GUI/Model/Data/RealItem.cpp
GUI/Model/Data/RealItem.h
+4
-0
4 additions, 0 deletions
GUI/Model/Data/RealItem.h
GUI/Model/Project/ProjectDocument.cpp
+1
-0
1 addition, 0 deletions
GUI/Model/Project/ProjectDocument.cpp
with
22 additions
and
2 deletions
GUI/Model/Data/RealItem.cpp
+
17
−
2
View file @
c66a5b01
...
...
@@ -19,6 +19,7 @@
#include
"GUI/Model/Data/ProjectionItems.h"
#include
"GUI/Model/Data/SpecularDataItem.h"
#include
"GUI/Model/Device/InstrumentItems.h"
#include
"GUI/Model/Device/InstrumentModel.h"
#include
"GUI/Model/Device/MaskItems.h"
#include
"GUI/Support/IO/AbstractDataLoader1D.h"
#include
"GUI/Support/IO/DataLoaders1D.h"
...
...
@@ -234,6 +235,11 @@ void RealItem::unlinkFromInstrument()
updateToInstrument
(
nullptr
);
}
void
RealItem
::
setInstrumentModel
(
InstrumentModel
*
instrumentModel
)
{
m_instrumentModel
=
instrumentModel
;
}
bool
RealItem
::
hasImportErrors
()
const
{
return
(
dataLoader
()
!=
nullptr
)
?
dataLoader
()
->
numErrors
()
>
0
:
false
;
...
...
@@ -447,13 +453,21 @@ QString RealItem::readFrom(QXmlStreamReader* r, const QString& projectDir,
}
else
if
(
tag
==
Tag
::
Data
)
{
QString
type
;
XML
::
readAttribute
(
r
,
XML
::
Attrib
::
type
,
&
type
);
initFromType
(
type
)
->
readFrom
(
r
);
initFromType
(
type
);
// if we have linked instrument, try to create axes units list
if
(
!
m_instrumentId
.
isEmpty
()
&&
m_instrumentModel
)
// read 'm_instrumentId' before
if
(
auto
*
instrument
=
m_instrumentModel
->
findInstrumentItemById
(
m_instrumentId
))
GUI
::
Model
::
JobItemUtils
::
setDataItemCoords
(
m_dataItem
.
get
(),
instrument
);
m_dataItem
->
readFrom
(
r
);
dataError
=
m_dataItem
->
loadDatafield
(
messageService
,
projectDir
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// native data
}
else
if
(
tag
==
Tag
::
NativeData
)
{
initNativeData
()
->
readFrom
(
r
);
// requires initialized m_dataItem
// TODO: do we need to create coordinates here?
initNativeData
()
->
readFrom
(
r
);
// read 'm_dataItem' before
nativeDataError
=
m_nativeDataItem
->
loadDatafield
(
messageService
,
projectDir
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
...
...
@@ -479,6 +493,7 @@ QString RealItem::readFrom(QXmlStreamReader* r, const QString& projectDir,
void
RealItem
::
copyTo
(
RealItem
*
const
realdata_dst
)
const
{
realdata_dst
->
setInstrumentModel
(
m_instrumentModel
);
GUI
::
Util
::
copyContents
(
this
,
realdata_dst
);
if
(
m_dataItem
)
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Data/RealItem.h
+
4
−
0
View file @
c66a5b01
...
...
@@ -21,6 +21,7 @@
class
Datafield
;
class
ImportDataInfo
;
class
InstrumentItem
;
class
InstrumentModel
;
class
IntensityDataItem
;
class
MaskContainerItem
;
class
MessageService
;
...
...
@@ -85,6 +86,8 @@ public:
void
linkToInstrument
(
const
InstrumentItem
*
instrument
);
void
unlinkFromInstrument
();
void
setInstrumentModel
(
InstrumentModel
*
instrumentModel
);
// loader
bool
hasImportErrors
()
const
;
...
...
@@ -135,6 +138,7 @@ private:
QString
m_name
;
QString
m_nativeDataUnits
=
"nbins"
;
QString
m_presentationType
;
InstrumentModel
*
m_instrumentModel
=
nullptr
;
// DataItem can be `IntensityDataItem` and `SpecularDataItem` (default `IntensityDataItem`).
std
::
unique_ptr
<
DataItem
>
m_dataItem
;
// TODO: Can be replaced by std::variant
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Project/ProjectDocument.cpp
+
1
−
0
View file @
c66a5b01
...
...
@@ -367,6 +367,7 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
// real model
}
else
if
(
tag
==
Tag
::
RealModel
)
{
// 'm_instrumentModel' should be read before
m_realModel
.
readFrom
(
&
r
,
projectDir
,
&
messageService
);
XML
::
gotoEndElementOfTag
(
&
r
,
tag
);
...
...
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