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
496e521b
Commit
496e521b
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
restore instruments serialization
parent
4cce3df8
No related branches found
No related tags found
1 merge request
!1457
Restore instruments serialization (#512)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Device/InstrumentItems.cpp
+66
-28
66 additions, 28 deletions
GUI/Model/Device/InstrumentItems.cpp
GUI/Model/Device/InstrumentItems.h
+3
-0
3 additions, 0 deletions
GUI/Model/Device/InstrumentItems.h
with
69 additions
and
28 deletions
GUI/Model/Device/InstrumentItems.cpp
+
66
−
28
View file @
496e521b
...
...
@@ -323,7 +323,7 @@ std::unique_ptr<IBeamScan> ScanningFunctionality::createScan() const
return
result
;
}
void
ScanningFunctionality
::
writeScanTo
(
QXmlStreamWriter
*
w
)
const
void
ScanningFunctionality
::
writeScanTo
(
QXmlStreamWriter
*
w
)
const
{
XML
::
writeAttribute
(
w
,
XML
::
Attrib
::
version
,
uint
(
1
));
...
...
@@ -333,22 +333,22 @@ void ScanningFunctionality::writeScanTo(QXmlStreamWriter *w) const
w
->
writeEndElement
();
}
void
ScanningFunctionality
::
readScanFrom
(
QXmlStreamReader
*
r
)
void
ScanningFunctionality
::
readScanFrom
(
QXmlStreamReader
*
r
)
{
const
uint
version
=
XML
::
readUIntAttribute
(
r
,
XML
::
Attrib
::
version
);
Q_UNUSED
(
version
)
Q_UNUSED
(
version
)
while
(
r
->
readNextStartElement
())
{
QString
tag
=
r
->
name
().
toString
();
while
(
r
->
readNextStartElement
())
{
QString
tag
=
r
->
name
().
toString
();
// scan
if
(
tag
==
Tag
::
Scan
)
{
m_scanItem
->
readFrom
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// scan
if
(
tag
==
Tag
::
Scan
)
{
m_scanItem
->
readFrom
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
}
else
r
->
skipCurrentElement
();
}
}
else
r
->
skipCurrentElement
();
}
}
...
...
@@ -434,6 +434,44 @@ ISimulation* SpecularInstrumentItem::createSimulation(const MultiLayer& sample)
return
new
SpecularSimulation
(
*
createScan
(),
sample
);
}
void
SpecularInstrumentItem
::
writeTo
(
QXmlStreamWriter
*
w
)
const
{
XML
::
writeAttribute
(
w
,
XML
::
Attrib
::
version
,
uint
(
1
));
// instrument parameters from base class
w
->
writeStartElement
(
Tag
::
BaseData
);
InstrumentItem
::
writeTo
(
w
);
w
->
writeEndElement
();
// scan parameters from base class
w
->
writeStartElement
(
Tag
::
ScanParameters
);
ScanningFunctionality
::
writeScanTo
(
w
);
w
->
writeEndElement
();
}
void
SpecularInstrumentItem
::
readFrom
(
QXmlStreamReader
*
r
)
{
const
uint
version
=
XML
::
readUIntAttribute
(
r
,
XML
::
Attrib
::
version
);
Q_UNUSED
(
version
)
while
(
r
->
readNextStartElement
())
{
QString
tag
=
r
->
name
().
toString
();
// instrument parameters from base class
if
(
tag
==
Tag
::
BaseData
)
{
InstrumentItem
::
readFrom
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// scan parameters from base class
}
else
if
(
tag
==
Tag
::
ScanParameters
)
{
ScanningFunctionality
::
readScanFrom
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
}
else
r
->
skipCurrentElement
();
}
}
// ************************************************************************************************
// class DepthprobeInstrumentItem
// ************************************************************************************************
...
...
@@ -495,14 +533,14 @@ void DepthprobeInstrumentItem::writeTo(QXmlStreamWriter* w) const
{
XML
::
writeAttribute
(
w
,
XML
::
Attrib
::
version
,
uint
(
1
));
// parameters from base class
//
instrument
parameters from base class
w
->
writeStartElement
(
Tag
::
BaseData
);
InstrumentItem
::
writeTo
(
w
);
w
->
writeEndElement
();
// scan
w
->
writeStartElement
(
Tag
::
Scan
);
s
can
Item
()
->
writeTo
(
w
);
// scan
parameters from base class
w
->
writeStartElement
(
Tag
::
Scan
Parameters
);
S
can
ningFunctionality
::
write
Scan
To
(
w
);
w
->
writeEndElement
();
// z axis
...
...
@@ -519,14 +557,14 @@ void DepthprobeInstrumentItem::readFrom(QXmlStreamReader* r)
while
(
r
->
readNextStartElement
())
{
QString
tag
=
r
->
name
().
toString
();
// parameters from base class
//
instrument
parameters from base class
if
(
tag
==
Tag
::
BaseData
)
{
InstrumentItem
::
readFrom
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// scan
}
else
if
(
tag
==
Tag
::
Scan
)
{
s
can
Item
()
->
read
From
(
r
);
// scan
parameters from base class
}
else
if
(
tag
==
Tag
::
Scan
Parameters
)
{
S
can
ningFunctionality
::
readScan
From
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// z axis
...
...
@@ -594,14 +632,14 @@ void OffspecInstrumentItem::writeTo(QXmlStreamWriter* w) const
{
XML
::
writeAttribute
(
w
,
XML
::
Attrib
::
version
,
uint
(
1
));
// parameters from base class
//
instrument
parameters from base class
w
->
writeStartElement
(
Tag
::
BaseData
);
InstrumentItem
::
writeTo
(
w
);
w
->
writeEndElement
();
// scan
w
->
writeStartElement
(
Tag
::
Scan
);
s
can
Item
()
->
writeTo
(
w
);
// scan
parameters from base class
w
->
writeStartElement
(
Tag
::
Scan
Parameters
);
S
can
ningFunctionality
::
write
Scan
To
(
w
);
w
->
writeEndElement
();
}
...
...
@@ -613,14 +651,14 @@ void OffspecInstrumentItem::readFrom(QXmlStreamReader* r)
while
(
r
->
readNextStartElement
())
{
QString
tag
=
r
->
name
().
toString
();
// parameters from base class
//
instrument
parameters from base class
if
(
tag
==
Tag
::
BaseData
)
{
InstrumentItem
::
readFrom
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
// scan
}
else
if
(
tag
==
Tag
::
Scan
)
{
s
can
Item
()
->
read
From
(
r
);
// scan
parameters from base class
}
else
if
(
tag
==
Tag
::
Scan
Parameters
)
{
S
can
ningFunctionality
::
readScan
From
(
r
);
XML
::
gotoEndElementOfTag
(
r
,
tag
);
}
else
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Device/InstrumentItems.h
+
3
−
0
View file @
496e521b
...
...
@@ -165,6 +165,9 @@ public:
bool
alignedWith
(
const
RealItem
*
item
)
const
override
;
const
ICoordSystem
*
createCoordSystem
()
const
override
;
ISimulation
*
createSimulation
(
const
MultiLayer
&
sample
)
const
override
;
void
writeTo
(
QXmlStreamWriter
*
w
)
const
override
;
void
readFrom
(
QXmlStreamReader
*
r
)
override
;
};
...
...
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