implement a direct way to set single or double precision when writing/reading properties using floating point numbers

This commit is contained in:
wmayer
2018-10-23 19:38:03 +02:00
parent 8392914f50
commit f004858fe5
3 changed files with 16 additions and 6 deletions

View File

@@ -418,7 +418,7 @@ void PropertyVectorList::SaveDocFile (Base::Writer &writer) const
Base::OutputStream str(writer.Stream());
uint32_t uCt = (uint32_t)getSize();
str << uCt;
if (writer.getFileVersion() > 0) {
if (!isSinglePrecision()) {
for (std::vector<Base::Vector3d>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
str << it->x << it->y << it->z;
}
@@ -439,7 +439,7 @@ void PropertyVectorList::RestoreDocFile(Base::Reader &reader)
uint32_t uCt=0;
str >> uCt;
std::vector<Base::Vector3d> values(uCt);
if (reader.getFileVersion() > 0) {
if (!isSinglePrecision()) {
for (std::vector<Base::Vector3d>::iterator it = values.begin(); it != values.end(); ++it) {
str >> it->x >> it->y >> it->z;
}
@@ -917,7 +917,7 @@ void PropertyPlacementList::SaveDocFile (Base::Writer &writer) const
Base::OutputStream str(writer.Stream());
uint32_t uCt = (uint32_t)getSize();
str << uCt;
if (writer.getFileVersion() > 0) {
if (!isSinglePrecision()) {
for (std::vector<Base::Placement>::const_iterator it = _lValueList.begin(); it != _lValueList.end(); ++it) {
str << it->getPosition().x << it->getPosition().y << it->getPosition().z
<< it->getRotation()[0] << it->getRotation()[1] << it->getRotation()[2] << it->getRotation()[3] ;
@@ -943,7 +943,7 @@ void PropertyPlacementList::RestoreDocFile(Base::Reader &reader)
uint32_t uCt=0;
str >> uCt;
std::vector<Base::Placement> values(uCt);
if (reader.getFileVersion() > 0) {
if (!isSinglePrecision()) {
for (std::vector<Base::Placement>::iterator it = values.begin(); it != values.end(); ++it) {
Base::Vector3d pos;
double q0, q1, q2, q3;