Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Marc SCHWEITZER
sight
Commits
000a0acc
Commit
000a0acc
authored
Mar 17, 2015
by
Pascal Monnier
Browse files
Fixed deepCopy of the ModelSeries and updated test for modelSeries.
--HG-- branch : fw4spl_0.10.1
parent
e02a59ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
SrcLib/core/fwMedData/src/fwMedData/ModelSeries.cpp
View file @
000a0acc
...
...
@@ -8,6 +8,7 @@
#include
<fwData/Image.hpp>
#include
<fwData/registry/macros.hpp>
#include
<fwData/Exception.hpp>
#include
<fwData/Reconstruction.hpp>
#include
"fwMedData/ModelSeries.hpp"
...
...
@@ -50,7 +51,11 @@ void ModelSeries::cachedDeepCopy(const ::fwData::Object::csptr &_source, DeepCop
this
->::
fwMedData
::
Series
::
cachedDeepCopy
(
_source
,
cache
);
m_attrReconstructionDB
=
other
->
m_attrReconstructionDB
;
m_attrReconstructionDB
.
clear
();
for
(
const
::
fwData
::
Reconstruction
::
sptr
&
rec
:
other
->
m_attrReconstructionDB
)
{
m_attrReconstructionDB
.
push_back
(
::
fwData
::
Object
::
copy
(
rec
,
cache
));
}
}
//------------------------------------------------------------------------------
...
...
SrcLib/core/fwMedData/test/tu/include/ModelSeriesTest.hpp
View file @
000a0acc
...
...
@@ -18,6 +18,8 @@ class ModelSeriesTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE
(
ModelSeriesTest
);
CPPUNIT_TEST
(
modelTest
);
CPPUNIT_TEST
(
deepCopyTest
);
CPPUNIT_TEST
(
shallowCopyTest
);
CPPUNIT_TEST_SUITE_END
();
public:
...
...
@@ -26,6 +28,8 @@ public:
void
tearDown
();
void
modelTest
();
void
deepCopyTest
();
void
shallowCopyTest
();
private:
ModelSeries
::
sptr
m_series
;
...
...
SrcLib/core/fwMedData/test/tu/src/ModelSeriesTest.cpp
View file @
000a0acc
...
...
@@ -73,5 +73,58 @@ void ModelSeriesTest::modelTest()
//------------------------------------------------------------------------------
void
ModelSeriesTest
::
deepCopyTest
()
{
CPPUNIT_ASSERT
(
m_series
);
::
fwData
::
Reconstruction
::
sptr
rec1
=
::
fwData
::
Reconstruction
::
New
();
::
fwData
::
Mesh
::
sptr
mesh1
=
::
fwData
::
Mesh
::
New
();
::
fwTest
::
generator
::
Mesh
::
generateQuadMesh
(
mesh1
);
rec1
->
setMesh
(
mesh1
);
ModelSeries
::
ReconstructionVectorType
recs
;
recs
.
push_back
(
rec1
);
m_series
->
setReconstructionDB
(
recs
);
::
fwMedData
::
ModelSeries
::
sptr
secondSeries
=
::
fwMedData
::
ModelSeries
::
New
();
secondSeries
->
deepCopy
(
m_series
);
CPPUNIT_ASSERT_EQUAL
(
1
,
(
int
)
m_series
->
getReconstructionDB
().
size
());
CPPUNIT_ASSERT_EQUAL
(
1
,
(
int
)
secondSeries
->
getReconstructionDB
().
size
());
CPPUNIT_ASSERT
(
m_series
->
getReconstructionDB
()[
0
]
!=
secondSeries
->
getReconstructionDB
()[
0
]);
}
//------------------------------------------------------------------------------
void
ModelSeriesTest
::
shallowCopyTest
()
{
CPPUNIT_ASSERT
(
m_series
);
::
fwData
::
Reconstruction
::
sptr
rec1
=
::
fwData
::
Reconstruction
::
New
();
::
fwData
::
Mesh
::
sptr
mesh1
=
::
fwData
::
Mesh
::
New
();
::
fwTest
::
generator
::
Mesh
::
generateQuadMesh
(
mesh1
);
rec1
->
setMesh
(
mesh1
);
ModelSeries
::
ReconstructionVectorType
recs
;
recs
.
push_back
(
rec1
);
m_series
->
setReconstructionDB
(
recs
);
::
fwMedData
::
ModelSeries
::
sptr
secondSeries
=
::
fwMedData
::
ModelSeries
::
New
();
secondSeries
->
shallowCopy
(
m_series
);
CPPUNIT_ASSERT
(
m_series
->
getReconstructionDB
()[
0
]
==
secondSeries
->
getReconstructionDB
()[
0
]);
CPPUNIT_ASSERT_EQUAL
(
m_series
->
getReconstructionDB
()[
0
],
secondSeries
->
getReconstructionDB
()[
0
]);
CPPUNIT_ASSERT_EQUAL
(
recs
[
0
],
m_series
->
getReconstructionDB
()[
0
]);
CPPUNIT_ASSERT_EQUAL
(
recs
[
0
],
secondSeries
->
getReconstructionDB
()[
0
]);
CPPUNIT_ASSERT_EQUAL
(
1
,
(
int
)
m_series
->
getReconstructionDB
().
size
());
CPPUNIT_ASSERT_EQUAL
(
1
,
(
int
)
secondSeries
->
getReconstructionDB
().
size
());
}
//------------------------------------------------------------------------------
}
//namespace ut
}
//namespace fwMedData
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment