[Points] compilation fix or -> ||
- also some style fixes made by MSVC
This commit is contained in:
@@ -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<data3D.childCount(); ++child) {
|
||||
for (int child = 0; child < data3D.childCount(); ++child) {
|
||||
e57::StructureNode scan_data(data3D.get(child));
|
||||
e57::CompressedVectorNode cvn(scan_data.get("points"));
|
||||
e57::StructureNode prototype(cvn.prototype());
|
||||
@@ -1335,7 +1335,7 @@ void E57Reader::read(const std::string& filename)
|
||||
int64_t* state = new int64_t[buf_size];
|
||||
unsigned* rgb = new unsigned[buf_size * 3];
|
||||
int64_t* nil = new int64_t[buf_size];
|
||||
|
||||
|
||||
// check the channels which are needed
|
||||
unsigned* ptr_xyz = new unsigned[3];
|
||||
unsigned* ptr_rgb = new unsigned[3];
|
||||
@@ -1343,13 +1343,13 @@ void E57Reader::read(const std::string& filename)
|
||||
bool inv_state = false;
|
||||
unsigned cnt_xyz = 0;
|
||||
unsigned cnt_rgb = 0;
|
||||
std::vector<e57::SourceDestBuffer> sdb;
|
||||
for (int i=0; i<prototype.childCount(); ++i) {
|
||||
std::vector<e57::SourceDestBuffer> 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; i<count; ++i) {
|
||||
|
||||
while ((count = cvr.read())) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
filter = false;
|
||||
if (hasState) {
|
||||
if (state[i]!=0) { filter = true; }
|
||||
if (state[i] != 0) { filter = true; }
|
||||
}
|
||||
pt.x = xyz[ptr_xyz[0]*buf_size+i];
|
||||
pt.y = xyz[ptr_xyz[1]*buf_size+i];
|
||||
pt.z = xyz[ptr_xyz[2]*buf_size+i];
|
||||
if ((!filter) && (cnt_pts>0)) {
|
||||
if (Base::Distance(last,pt)<minDistance) {
|
||||
pt.x = xyz[ptr_xyz[0] * buf_size + i];
|
||||
pt.y = xyz[ptr_xyz[1] * buf_size + i];
|
||||
pt.z = xyz[ptr_xyz[2] * buf_size + i];
|
||||
if ((!filter) && (cnt_pts > 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<float>(rgb[ptr_rgb[0]*buf_size+i])/255.0f;
|
||||
c.g = static_cast<float>(rgb[ptr_rgb[1]*buf_size+i])/255.0f;
|
||||
c.b = static_cast<float>(rgb[ptr_rgb[2]*buf_size+i])/255.0f;
|
||||
c.r = static_cast<float>(rgb[ptr_rgb[0] * buf_size + i]) / 255.0f;
|
||||
c.g = static_cast<float>(rgb[ptr_rgb[1] * buf_size + i]) / 255.0f;
|
||||
c.b = static_cast<float>(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.");
|
||||
|
||||
Reference in New Issue
Block a user