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
6af42fa8
Commit
6af42fa8
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
ResolutionFunctionItems: add r/w
parent
65942283
No related branches found
No related tags found
1 merge request
!1208
GUI: serialization refactoring part 7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Device/ResolutionFunctionItems.cpp
+27
-1
27 additions, 1 deletion
GUI/Model/Device/ResolutionFunctionItems.cpp
GUI/Model/Device/ResolutionFunctionItems.h
+5
-2
5 additions, 2 deletions
GUI/Model/Device/ResolutionFunctionItems.h
with
32 additions
and
3 deletions
GUI/Model/Device/ResolutionFunctionItems.cpp
+
27
−
1
View file @
6af42fa8
...
...
@@ -12,9 +12,10 @@
//
// ************************************************************************************************
#include
"GUI/Model/Device/ResolutionFunctionItems.h"
#include
"Device/Resolution/ResolutionFunction2DGaussian.h"
#include
"GUI/Model/Device/ResolutionFunctionItems.h"
#include
"GUI/Support/XML/Serialize.h"
#include
"GUI/Support/XML/UtilXML.h"
namespace
{
namespace
Tag
{
...
...
@@ -57,3 +58,28 @@ void ResolutionFunction2DGaussianItem::serialize(Streamer& s)
Serialize
::
rwProperty
(
s
,
Tag
::
SigmaX
,
m_sigmaX
);
Serialize
::
rwProperty
(
s
,
Tag
::
SigmaY
,
m_sigmaY
);
}
void
ResolutionFunction2DGaussianItem
::
writeTo
(
QXmlStreamWriter
*
w
)
const
{
XML
::
writeAttribute
(
w
,
XML
::
Attrib
::
version
,
uint
(
1
));
m_sigmaX
.
writeTo
(
w
,
Tag
::
SigmaX
);
m_sigmaY
.
writeTo
(
w
,
Tag
::
SigmaY
);
}
void
ResolutionFunction2DGaussianItem
::
readFrom
(
QXmlStreamReader
*
r
)
{
const
uint
version
=
XML
::
readUIntAttribute
(
r
,
XML
::
Attrib
::
version
);
Q_UNUSED
(
version
)
while
(
r
->
readNextStartElement
())
{
QString
tag
=
r
->
name
().
toString
();
if
(
tag
==
Tag
::
SigmaX
)
m_sigmaX
.
readFrom
(
r
,
tag
);
else
if
(
tag
==
Tag
::
SigmaY
)
m_sigmaY
.
readFrom
(
r
,
tag
);
else
r
->
skipCurrentElement
();
}
}
This diff is collapsed.
Click to expand it.
GUI/Model/Device/ResolutionFunctionItems.h
+
5
−
2
View file @
6af42fa8
...
...
@@ -31,7 +31,9 @@ public:
//! Set the unit of the distributed value
virtual
void
setUnit
(
const
std
::
variant
<
QString
,
Unit
>&
)
{}
virtual
void
serialize
(
Streamer
&
){};
virtual
void
serialize
(
Streamer
&
)
{}
virtual
void
writeTo
(
QXmlStreamWriter
*
)
const
{}
virtual
void
readFrom
(
QXmlStreamReader
*
)
{}
};
class
ResolutionFunctionNoneItem
:
public
ResolutionFunctionItem
{
...
...
@@ -48,6 +50,8 @@ public:
void
setUnit
(
const
std
::
variant
<
QString
,
Unit
>&
unit
)
override
;
void
serialize
(
Streamer
&
s
)
override
;
void
writeTo
(
QXmlStreamWriter
*
w
)
const
override
;
void
readFrom
(
QXmlStreamReader
*
r
)
override
;
DoubleProperty
&
sigmaX
()
{
return
m_sigmaX
;
}
const
DoubleProperty
&
sigmaX
()
const
{
return
m_sigmaX
;
}
...
...
@@ -57,7 +61,6 @@ public:
const
DoubleProperty
&
sigmaY
()
const
{
return
m_sigmaY
;
}
void
setSigmaY
(
double
v
)
{
m_sigmaY
.
setValue
(
v
);
}
protected
:
DoubleProperty
m_sigmaX
;
DoubleProperty
m_sigmaY
;
...
...
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