diff --git a/src/Mod/Points/App/PointsAlgos.cpp b/src/Mod/Points/App/PointsAlgos.cpp index c73f5c1dff..12cc9c97fa 100644 --- a/src/Mod/Points/App/PointsAlgos.cpp +++ b/src/Mod/Points/App/PointsAlgos.cpp @@ -1307,9 +1307,9 @@ void PcdReader::readBinary(bool transpose, E57Reader::E57Reader(const bool& Color, const bool& State, const float& Distance) { - useColor = Color; - checkState = State; - minDistance = Distance; + useColor = Color; + checkState = State; + minDistance = Distance; } E57Reader::~E57Reader() @@ -1324,7 +1324,7 @@ void E57Reader::read(const std::string& filename) e57::StructureNode root = imfi.root(); if (root.isDefined("data3D")) { e57::VectorNode data3D(root.get("data3D")); - for (int child=0; child sdb; - for (int i=0; i sdb; + for (int i = 0; i < prototype.childCount(); ++i) { e57::Node n(prototype.get(i)); - if ((n.type()== e57::E57_FLOAT) or (n.type()== e57::E57_SCALED_INTEGER)) { - if (n.elementName()=="cartesianX") { + if ((n.type() == e57::E57_FLOAT) || (n.type() == e57::E57_SCALED_INTEGER)) { + if (n.elementName() == "cartesianX") { ptr_xyz[0] = cnt_xyz++; - sdb.push_back( + sdb.push_back( e57::SourceDestBuffer( imfi , n.elementName() @@ -1360,7 +1360,7 @@ void E57Reader::read(const std::string& filename) ) ); } - else if (n.elementName()=="cartesianY") { + else if (n.elementName() == "cartesianY") { ptr_xyz[1] = cnt_xyz++; sdb.push_back( e57::SourceDestBuffer( @@ -1373,136 +1373,136 @@ void E57Reader::read(const std::string& filename) ) ); } - else if (n.elementName()=="cartesianZ") { + else if (n.elementName() == "cartesianZ") { ptr_xyz[2] = cnt_xyz++; sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() - , &(xyz[2*buf_size]) + , n.elementName() + , &(xyz[2 * buf_size]) , buf_size , true , true - ) - ); + ) + ); } - else if (n.elementName()=="intensity") { + else if (n.elementName() == "intensity") { inty = true; sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() + , n.elementName() , &(intensity[0]) , buf_size , true , true - ) - ); + ) + ); } else { - sdb.push_back( + sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() + , n.elementName() , &(nil[0]) , buf_size , true , true - ) - ); + ) + ); } - + } - else if (n.type()== e57::E57_INTEGER) { - if (n.elementName()=="colorRed") { + else if (n.type() == e57::E57_INTEGER) { + if (n.elementName() == "colorRed") { ptr_rgb[0] = cnt_rgb++; sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() + , n.elementName() , &(rgb[0]) , buf_size , true , true - ) - ); + ) + ); } - else if (n.elementName()=="colorGreen") { + else if (n.elementName() == "colorGreen") { ptr_rgb[1] = cnt_rgb++; sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() + , n.elementName() , &(rgb[buf_size]) , buf_size , true , true - ) - ); + ) + ); } - else if (n.elementName()=="colorBlue") { + else if (n.elementName() == "colorBlue") { ptr_rgb[2] = cnt_rgb++; sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() - , &(rgb[2*buf_size]) + , n.elementName() + , &(rgb[2 * buf_size]) , buf_size , true , true - ) - ); + ) + ); } - else if (n.elementName()=="cartesianInvalidState") { + else if (n.elementName() == "cartesianInvalidState") { inv_state = true; sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() + , n.elementName() , &(state[0]) , buf_size , true , true - ) - ); + ) + ); } else { sdb.push_back( e57::SourceDestBuffer( imfi - , n.elementName() + , n.elementName() , &(nil[0]) , buf_size , true , true - ) - ); + ) + ); } } } - + // read the data - - if (cnt_xyz==3) { + + if (cnt_xyz == 3) { unsigned count; - unsigned cnt_pts=0; + unsigned cnt_pts = 0; Base::Vector3d pt, last; e57::CompressedVectorReader cvr(cvn.reader(sdb)); - bool hasColor = (cnt_rgb==3) && useColor; + bool hasColor = (cnt_rgb == 3) && useColor; bool hasState = inv_state && checkState; bool filter = false; - - while((count = cvr.read())) { - for (size_t i=0; i0)) { - if (Base::Distance(last,pt) 0)) { + if (Base::Distance(last, pt) < minDistance) { filter = true; } } @@ -1512,15 +1512,15 @@ void E57Reader::read(const std::string& filename) last = pt; if (hasColor) { App::Color c; - c.r = static_cast(rgb[ptr_rgb[0]*buf_size+i])/255.0f; - c.g = static_cast(rgb[ptr_rgb[1]*buf_size+i])/255.0f; - c.b = static_cast(rgb[ptr_rgb[2]*buf_size+i])/255.0f; + c.r = static_cast(rgb[ptr_rgb[0] * buf_size + i]) / 255.0f; + c.g = static_cast(rgb[ptr_rgb[1] * buf_size + i]) / 255.0f; + c.b = static_cast(rgb[ptr_rgb[2] * buf_size + i]) / 255.0f; if (inty) { c.a = intensity[i]; } colors.push_back(c); - } + } } - } - } + } + } } else { Base::Console().Error("Missing channels xyz.");