|
|
5681d98 |
--- CloudCompare-2.9.1/libs/qCC_io/ShpFilter.cpp 2017-11-03 12:30:42.000000000 +0100
|
|
|
5681d98 |
+++ ./ShpFilter.cpp 2018-02-23 14:19:46.837624000 +0100
|
|
|
5681d98 |
@@ -72,6 +72,34 @@
|
|
|
5681d98 |
SHP_MULTI_PATCH = 31
|
|
|
5681d98 |
};
|
|
|
5681d98 |
|
|
|
5681d98 |
+//DGM: by default qToLittleEndian and qFromLittleEndian only works for integer types!
|
|
|
5681d98 |
+double swapD(double in)
|
|
|
5681d98 |
+{
|
|
|
5681d98 |
+ //! Change the endianness (see https://stackoverflow.com/questions/41012414/convert-double-value-from-little-endian-to-big-endian)
|
|
|
5681d98 |
+ std::array<char, sizeof(double)> p;
|
|
|
5681d98 |
+ memcpy(&p[0], &in, sizeof(double));
|
|
|
5681d98 |
+ std::reverse(p.begin(), p.end());
|
|
|
5681d98 |
+ memcpy(&in, &p[0], sizeof(double));
|
|
|
5681d98 |
+ return in;
|
|
|
5681d98 |
+}
|
|
|
5681d98 |
+
|
|
|
5681d98 |
+double qFromLittleEndianD(double in)
|
|
|
5681d98 |
+{
|
|
|
5681d98 |
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
|
|
5681d98 |
+ return swapD(in);
|
|
|
5681d98 |
+#endif
|
|
|
5681d98 |
+ return in;
|
|
|
5681d98 |
+}
|
|
|
5681d98 |
+
|
|
|
5681d98 |
+double qToLittleEndianD(double in)
|
|
|
5681d98 |
+{
|
|
|
5681d98 |
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
|
|
5681d98 |
+ return swapD(in);
|
|
|
5681d98 |
+#endif
|
|
|
5681d98 |
+ return in;
|
|
|
5681d98 |
+}
|
|
|
5681d98 |
+
|
|
|
5681d98 |
+
|
|
|
5681d98 |
//! Shape File Save dialog
|
|
|
5681d98 |
class SaveSHPFileDialog : public QDialog, public Ui::SaveSHPFileDlg
|
|
|
5681d98 |
{
|
|
|
5681d98 |
@@ -271,10 +299,10 @@
|
|
|
5681d98 |
{
|
|
|
5681d98 |
//The Bounding Box for the PolyLine stored in the order Xmin, Ymin, Xmax, Ymax
|
|
|
5681d98 |
//DGM: ignored
|
|
|
5681d98 |
- //double xMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
- //double xMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+ 8));
|
|
|
5681d98 |
- //double yMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+16));
|
|
|
5681d98 |
- //double yMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+24));
|
|
|
5681d98 |
+ //double xMin = qFromLittleEndianD(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
+ //double xMax = qFromLittleEndianD(*reinterpret_cast<double*>(header+ 8));
|
|
|
5681d98 |
+ //double yMin = qFromLittleEndianD(*reinterpret_cast<double*>(header+16));
|
|
|
5681d98 |
+ //double yMax = qFromLittleEndianD(*reinterpret_cast<double*>(header+24));
|
|
|
5681d98 |
}
|
|
|
5681d98 |
|
|
|
5681d98 |
//Byte 32: NumParts (The number of parts in the PolyLine)
|
|
|
5681d98 |
@@ -321,8 +349,8 @@
|
|
|
5681d98 |
//check for errors
|
|
|
5681d98 |
if (file.error() != QFile::NoError)
|
|
|
5681d98 |
return CC_FERR_READING;
|
|
|
5681d98 |
- double x = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
- double y = qFromLittleEndian<double>(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
+ double x = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double y = qFromLittleEndianD(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
points[i].x = static_cast<PointCoordinateType>(x + PShift.x);
|
|
|
5681d98 |
points[i].y = static_cast<PointCoordinateType>(y + PShift.y);
|
|
|
5681d98 |
points[i].z = 0;
|
|
|
5681d98 |
@@ -337,8 +365,8 @@
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(header, 16);
|
|
|
5681d98 |
//DGM: ignored
|
|
|
5681d98 |
- //double zMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
- //double zMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+8));
|
|
|
5681d98 |
+ //double zMin = qFromLittleEndianD(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
+ //double zMax = qFromLittleEndianD(*reinterpret_cast<double*>(header+8));
|
|
|
5681d98 |
}
|
|
|
5681d98 |
|
|
|
5681d98 |
//Z coordinates (an array of length NumPoints)
|
|
|
5681d98 |
@@ -349,7 +377,7 @@
|
|
|
5681d98 |
//check for errors
|
|
|
5681d98 |
if (file.error() != QFile::NoError)
|
|
|
5681d98 |
return CC_FERR_READING;
|
|
|
5681d98 |
- double z = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double z = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
points[i].z = static_cast<PointCoordinateType>(z + PShift.z);
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -365,8 +393,8 @@
|
|
|
5681d98 |
//check for errors
|
|
|
5681d98 |
if (file.error() != QFile::NoError)
|
|
|
5681d98 |
return CC_FERR_READING;
|
|
|
5681d98 |
- double mMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
- double mMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
+ double mMin = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double mMax = qFromLittleEndianD(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
|
|
|
5681d98 |
if (mMin != ESRI_NO_DATA && mMax != ESRI_NO_DATA)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
@@ -391,7 +419,7 @@
|
|
|
5681d98 |
//check for errors
|
|
|
5681d98 |
if (file.error() != QFile::NoError)
|
|
|
5681d98 |
return CC_FERR_READING;
|
|
|
5681d98 |
- double m = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double m = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
scalarValues[i] = (m == ESRI_NO_DATA ? NAN_VALUE : static_cast<ScalarType>(m));
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -509,10 +537,10 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//Byte 4: Box
|
|
|
5681d98 |
{
|
|
|
5681d98 |
- double xMin = qToLittleEndian<double>(bbMing.u[X]);
|
|
|
5681d98 |
- double xMax = qToLittleEndian<double>(bbMaxg.u[X]);
|
|
|
5681d98 |
- double yMin = qToLittleEndian<double>(bbMing.u[Y]);
|
|
|
5681d98 |
- double yMax = qToLittleEndian<double>(bbMaxg.u[Y]);
|
|
|
5681d98 |
+ double xMin = qToLittleEndianD(bbMing.u[X]);
|
|
|
5681d98 |
+ double xMax = qToLittleEndianD(bbMaxg.u[X]);
|
|
|
5681d98 |
+ double yMin = qToLittleEndianD(bbMing.u[Y]);
|
|
|
5681d98 |
+ double yMax = qToLittleEndianD(bbMaxg.u[Y]);
|
|
|
5681d98 |
//The Bounding Box for the PolyLine stored in the order Xmin, Ymin, Xmax, Ymax
|
|
|
5681d98 |
/*Byte 4*/file.write((const char*)&xMin, 8);
|
|
|
5681d98 |
/*Byte 12*/file.write((const char*)&yMin, 8);
|
|
|
5681d98 |
@@ -595,8 +623,8 @@
|
|
|
5681d98 |
const CCVector3* P = vertices->getPoint(ii % realNumPoints); //warning: handle loop if polyline is closed
|
|
|
5681d98 |
CCVector3d Pg = poly->toGlobal3d(*P);
|
|
|
5681d98 |
|
|
|
5681d98 |
- double x = qToLittleEndian<double>(Pg.u[X]);
|
|
|
5681d98 |
- double y = qToLittleEndian<double>(Pg.u[Y]);
|
|
|
5681d98 |
+ double x = qToLittleEndianD(Pg.u[X]);
|
|
|
5681d98 |
+ double y = qToLittleEndianD(Pg.u[Y]);
|
|
|
5681d98 |
/*Byte 0*/file.write((const char*)&x, 8);
|
|
|
5681d98 |
/*Byte 8*/file.write((const char*)&y, 8);
|
|
|
5681d98 |
bytesWritten += 16;
|
|
|
5681d98 |
@@ -608,8 +636,8 @@
|
|
|
5681d98 |
{
|
|
|
5681d98 |
//Z boundaries
|
|
|
5681d98 |
{
|
|
|
5681d98 |
- double zMin = qToLittleEndian<double>(bbMing.u[Z]);
|
|
|
5681d98 |
- double zMax = qToLittleEndian<double>(bbMaxg.u[Z]);
|
|
|
5681d98 |
+ double zMin = qToLittleEndianD(bbMing.u[Z]);
|
|
|
5681d98 |
+ double zMax = qToLittleEndianD(bbMaxg.u[Z]);
|
|
|
5681d98 |
file.write((const char*)&zMin, 8);
|
|
|
5681d98 |
file.write((const char*)&zMax, 8);
|
|
|
5681d98 |
bytesWritten += 16;
|
|
|
5681d98 |
@@ -622,7 +650,7 @@
|
|
|
5681d98 |
int32_t ii = (inverseOrder ? numPoints - 1 - i : i);
|
|
|
5681d98 |
const CCVector3* P = vertices->getPoint(ii % realNumPoints); //warning: handle loop if polyline is closed
|
|
|
5681d98 |
CCVector3d Pg = poly->toGlobal3d(*P);
|
|
|
5681d98 |
- double z = qToLittleEndian<double>(Pg.u[Z]);
|
|
|
5681d98 |
+ double z = qToLittleEndianD(Pg.u[Z]);
|
|
|
5681d98 |
file.write((const char*)&z, 8);
|
|
|
5681d98 |
bytesWritten += 8;
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -651,8 +679,8 @@
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
- mMin = qToLittleEndian<double>(mMin);
|
|
|
5681d98 |
- mMax = qToLittleEndian<double>(mMax);
|
|
|
5681d98 |
+ mMin = qToLittleEndianD(mMin);
|
|
|
5681d98 |
+ mMax = qToLittleEndianD(mMax);
|
|
|
5681d98 |
file.write((const char*)&mMin, 8);
|
|
|
5681d98 |
file.write((const char*)&mMax, 8);
|
|
|
5681d98 |
bytesWritten += 16;
|
|
|
5681d98 |
@@ -660,13 +688,13 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//M values (for each part - just one here)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
- double scalar = qToLittleEndian<double>(ESRI_NO_DATA);
|
|
|
5681d98 |
+ double scalar = qToLittleEndianD(ESRI_NO_DATA);
|
|
|
5681d98 |
for (int32_t i = 0; i < numPoints; ++i)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
if (hasSF)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
scalar = static_cast<double>(vertices->getPointScalarValue(i % realNumPoints)); //warning: handle loop if polyline is closed
|
|
|
5681d98 |
- scalar = qToLittleEndian<double>(scalar);
|
|
|
5681d98 |
+ scalar = qToLittleEndianD(scalar);
|
|
|
5681d98 |
}
|
|
|
5681d98 |
file.write((const char*)&scalar, 8);
|
|
|
5681d98 |
bytesWritten += 8;
|
|
|
5681d98 |
@@ -686,10 +714,10 @@
|
|
|
5681d98 |
{
|
|
|
5681d98 |
//The Bounding Box for the Cloud stored in the order Xmin, Ymin, Xmax, Ymax
|
|
|
5681d98 |
//DGM: ignored
|
|
|
5681d98 |
- //double xMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
- //double xMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+ 8));
|
|
|
5681d98 |
- //double yMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+16));
|
|
|
5681d98 |
- //double yMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+24));
|
|
|
5681d98 |
+ //double xMin = qFromLittleEndianD(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
+ //double xMax = qFromLittleEndianD(*reinterpret_cast<double*>(header+ 8));
|
|
|
5681d98 |
+ //double yMin = qFromLittleEndianD(*reinterpret_cast<double*>(header+16));
|
|
|
5681d98 |
+ //double yMax = qFromLittleEndianD(*reinterpret_cast<double*>(header+24));
|
|
|
5681d98 |
}
|
|
|
5681d98 |
|
|
|
5681d98 |
//Byte 32: NumPoints (The total number of points)
|
|
|
5681d98 |
@@ -708,8 +736,8 @@
|
|
|
5681d98 |
for (int32_t i = 0; i < numPoints; ++i)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(header, 16);
|
|
|
5681d98 |
- double x = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
- double y = qFromLittleEndian<double>(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
+ double x = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double y = qFromLittleEndianD(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
CCVector3 P(static_cast<PointCoordinateType>(x + PShift.x),
|
|
|
5681d98 |
static_cast<PointCoordinateType>(y + PShift.y),
|
|
|
5681d98 |
0);
|
|
|
5681d98 |
@@ -724,8 +752,8 @@
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(header, 16);
|
|
|
5681d98 |
//DGM: ignored
|
|
|
5681d98 |
- //double zMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
- //double zMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header+8));
|
|
|
5681d98 |
+ //double zMin = qFromLittleEndianD(*reinterpret_cast<double*>(header ));
|
|
|
5681d98 |
+ //double zMax = qFromLittleEndianD(*reinterpret_cast<double*>(header+8));
|
|
|
5681d98 |
}
|
|
|
5681d98 |
|
|
|
5681d98 |
//Z coordinates (an array of length NumPoints)
|
|
|
5681d98 |
@@ -733,7 +761,7 @@
|
|
|
5681d98 |
for (int32_t i = 0; i < numPoints; ++i)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(header, 8);
|
|
|
5681d98 |
- double z = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double z = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
const CCVector3* P = cloud->getPoint(i);
|
|
|
5681d98 |
const_cast<CCVector3*>(P)->z = static_cast<PointCoordinateType>(z + PShift.z);
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -749,8 +777,8 @@
|
|
|
5681d98 |
ccScalarField* sf = 0;
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(header, 16);
|
|
|
5681d98 |
- double mMin = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
- double mMax = qFromLittleEndian<double>(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
+ double mMin = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double mMax = qFromLittleEndianD(*reinterpret_cast<double*>(header + 8));
|
|
|
5681d98 |
|
|
|
5681d98 |
if (mMin != ESRI_NO_DATA && mMax != ESRI_NO_DATA)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
@@ -770,7 +798,7 @@
|
|
|
5681d98 |
for (int32_t i = 0; i < numPoints; ++i)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(header, 8);
|
|
|
5681d98 |
- double m = qFromLittleEndian<double>(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
+ double m = qFromLittleEndianD(*reinterpret_cast<double*>(header));
|
|
|
5681d98 |
ScalarType s = m == ESRI_NO_DATA ? NAN_VALUE : static_cast<ScalarType>(m);
|
|
|
5681d98 |
sf->addElement(s);
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -809,10 +837,10 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//Byte 4: Box
|
|
|
5681d98 |
{
|
|
|
5681d98 |
- double xMin = qToLittleEndian<double>(bbMing.x);
|
|
|
5681d98 |
- double xMax = qToLittleEndian<double>(bbMaxg.x);
|
|
|
5681d98 |
- double yMin = qToLittleEndian<double>(bbMing.y);
|
|
|
5681d98 |
- double yMax = qToLittleEndian<double>(bbMaxg.y);
|
|
|
5681d98 |
+ double xMin = qToLittleEndianD(bbMing.x);
|
|
|
5681d98 |
+ double xMax = qToLittleEndianD(bbMaxg.x);
|
|
|
5681d98 |
+ double yMin = qToLittleEndianD(bbMing.y);
|
|
|
5681d98 |
+ double yMax = qToLittleEndianD(bbMaxg.y);
|
|
|
5681d98 |
//The Bounding Box for the Cloud stored in the order Xmin, Ymin, Xmax, Ymax
|
|
|
5681d98 |
/*Byte 4*/file.write((const char*)&xMin, 8);
|
|
|
5681d98 |
/*Byte 12*/file.write((const char*)&yMin, 8);
|
|
|
5681d98 |
@@ -836,8 +864,8 @@
|
|
|
5681d98 |
const CCVector3* P = cloud->getPoint(i);
|
|
|
5681d98 |
CCVector3d Pg = cloud->toGlobal3d(*P);
|
|
|
5681d98 |
|
|
|
5681d98 |
- double x = qToLittleEndian<double>(Pg.x);
|
|
|
5681d98 |
- double y = qToLittleEndian<double>(Pg.y);
|
|
|
5681d98 |
+ double x = qToLittleEndianD(Pg.x);
|
|
|
5681d98 |
+ double y = qToLittleEndianD(Pg.y);
|
|
|
5681d98 |
/*Byte 0*/file.write((const char*)&x, 8);
|
|
|
5681d98 |
/*Byte 8*/file.write((const char*)&y, 8);
|
|
|
5681d98 |
bytesWritten += 16;
|
|
|
5681d98 |
@@ -846,8 +874,8 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//Z boundaries
|
|
|
5681d98 |
{
|
|
|
5681d98 |
- double zMin = qToLittleEndian<double>(bbMing.z);
|
|
|
5681d98 |
- double zMax = qToLittleEndian<double>(bbMaxg.z);
|
|
|
5681d98 |
+ double zMin = qToLittleEndianD(bbMing.z);
|
|
|
5681d98 |
+ double zMax = qToLittleEndianD(bbMaxg.z);
|
|
|
5681d98 |
file.write((const char*)&zMin, 8);
|
|
|
5681d98 |
file.write((const char*)&zMax, 8);
|
|
|
5681d98 |
bytesWritten += 16;
|
|
|
5681d98 |
@@ -859,7 +887,7 @@
|
|
|
5681d98 |
{
|
|
|
5681d98 |
const CCVector3* P = cloud->getPoint(i);
|
|
|
5681d98 |
CCVector3d Pg = cloud->toGlobal3d(*P);
|
|
|
5681d98 |
- double z = qToLittleEndian<double>(Pg.z);
|
|
|
5681d98 |
+ double z = qToLittleEndianD(Pg.z);
|
|
|
5681d98 |
file.write((const char*)&z, 8);
|
|
|
5681d98 |
bytesWritten += 8;
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -888,8 +916,8 @@
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
- mMin = qToLittleEndian<double>(mMin);
|
|
|
5681d98 |
- mMax = qToLittleEndian<double>(mMax);
|
|
|
5681d98 |
+ mMin = qToLittleEndianD(mMin);
|
|
|
5681d98 |
+ mMax = qToLittleEndianD(mMax);
|
|
|
5681d98 |
file.write((const char*)&mMin, 8);
|
|
|
5681d98 |
file.write((const char*)&mMax, 8);
|
|
|
5681d98 |
bytesWritten += 16;
|
|
|
5681d98 |
@@ -897,13 +925,13 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//M values
|
|
|
5681d98 |
{
|
|
|
5681d98 |
- double scalar = qToLittleEndian<double>(ESRI_NO_DATA);
|
|
|
5681d98 |
+ double scalar = qToLittleEndianD(ESRI_NO_DATA);
|
|
|
5681d98 |
for (int32_t i = 0; i < numPoints; ++i)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
if (hasSF)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
scalar = static_cast<double>(cloud->getPointScalarValue(i));
|
|
|
5681d98 |
- scalar = qToLittleEndian<double>(scalar);
|
|
|
5681d98 |
+ scalar = qToLittleEndianD(scalar);
|
|
|
5681d98 |
}
|
|
|
5681d98 |
file.write((const char*)&scalar, 8);
|
|
|
5681d98 |
bytesWritten += 8;
|
|
|
5681d98 |
@@ -918,8 +946,8 @@
|
|
|
5681d98 |
char buffer[16];
|
|
|
5681d98 |
file.read(buffer, 16);
|
|
|
5681d98 |
|
|
|
5681d98 |
- double x = qFromLittleEndian<double>(*reinterpret_cast<double*>(buffer));
|
|
|
5681d98 |
- double y = qFromLittleEndian<double>(*reinterpret_cast<double*>(buffer + 8));
|
|
|
5681d98 |
+ double x = qFromLittleEndianD(*reinterpret_cast<double*>(buffer));
|
|
|
5681d98 |
+ double y = qFromLittleEndianD(*reinterpret_cast<double*>(buffer + 8));
|
|
|
5681d98 |
CCVector3 P(static_cast<PointCoordinateType>(x + PShift.x),
|
|
|
5681d98 |
static_cast<PointCoordinateType>(y + PShift.y),
|
|
|
5681d98 |
0);
|
|
|
5681d98 |
@@ -930,7 +958,7 @@
|
|
|
5681d98 |
//Z coordinate
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(buffer, 8);
|
|
|
5681d98 |
- double z = qFromLittleEndian<double>(*reinterpret_cast<double*>(buffer));
|
|
|
5681d98 |
+ double z = qFromLittleEndianD(*reinterpret_cast<double*>(buffer));
|
|
|
5681d98 |
P.z = static_cast<PointCoordinateType>(z + PShift.z);
|
|
|
5681d98 |
}
|
|
|
5681d98 |
}
|
|
|
5681d98 |
@@ -957,7 +985,7 @@
|
|
|
5681d98 |
//Measure
|
|
|
5681d98 |
{
|
|
|
5681d98 |
file.read(buffer, 8);
|
|
|
5681d98 |
- double m = qFromLittleEndian<double>(*reinterpret_cast<double*>(buffer));
|
|
|
5681d98 |
+ double m = qFromLittleEndianD(*reinterpret_cast<double*>(buffer));
|
|
|
5681d98 |
if (m != ESRI_NO_DATA)
|
|
|
5681d98 |
{
|
|
|
5681d98 |
s = static_cast<ScalarType>(m);
|
|
|
5681d98 |
@@ -1144,10 +1172,10 @@
|
|
|
5681d98 |
_header += 4;
|
|
|
5681d98 |
|
|
|
5681d98 |
//X and Y bounaries
|
|
|
5681d98 |
- double xMin = qToLittleEndian<double>(bbMinCorner.u[X]);
|
|
|
5681d98 |
- double xMax = qToLittleEndian<double>(bbMaxCorner.u[X]);
|
|
|
5681d98 |
- double yMin = qToLittleEndian<double>(bbMinCorner.u[Y]);
|
|
|
5681d98 |
- double yMax = qToLittleEndian<double>(bbMaxCorner.u[Y]);
|
|
|
5681d98 |
+ double xMin = qToLittleEndianD(bbMinCorner.u[X]);
|
|
|
5681d98 |
+ double xMax = qToLittleEndianD(bbMaxCorner.u[X]);
|
|
|
5681d98 |
+ double yMin = qToLittleEndianD(bbMinCorner.u[Y]);
|
|
|
5681d98 |
+ double yMax = qToLittleEndianD(bbMaxCorner.u[Y]);
|
|
|
5681d98 |
//Byte 36: box X min
|
|
|
5681d98 |
memcpy(_header, (const char*)&xMin, 8);
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
@@ -1163,8 +1191,8 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//Z bounaries
|
|
|
5681d98 |
//Unused, with value 0.0, if not Measured or Z type
|
|
|
5681d98 |
- double zMin = outputShapeType < SHP_POINT_Z ? 0.0 : qToLittleEndian<double>(bbMinCorner.u[Z]);
|
|
|
5681d98 |
- double zMax = outputShapeType < SHP_POINT_Z ? 0.0 : qToLittleEndian<double>(bbMaxCorner.u[Z]);
|
|
|
5681d98 |
+ double zMin = outputShapeType < SHP_POINT_Z ? 0.0 : qToLittleEndianD(bbMinCorner.u[Z]);
|
|
|
5681d98 |
+ double zMax = outputShapeType < SHP_POINT_Z ? 0.0 : qToLittleEndianD(bbMaxCorner.u[Z]);
|
|
|
5681d98 |
//Byte 68: box Z min
|
|
|
5681d98 |
memcpy(_header, (const char*)&zMin, 8);
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
@@ -1447,25 +1475,25 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//X and Y bounaries
|
|
|
5681d98 |
//Byte 36: box X min
|
|
|
5681d98 |
- double xMin = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ double xMin = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
//Byte 44: box Y min
|
|
|
5681d98 |
- double yMin = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ double yMin = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
//Byte 52: box X max
|
|
|
5681d98 |
- //double xMax = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ //double xMax = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
//Byte 60: box Y max
|
|
|
5681d98 |
- //double yMax = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ //double yMax = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
|
|
|
5681d98 |
//Z bounaries
|
|
|
5681d98 |
//Unused, with value 0.0, if not Measured or Z type
|
|
|
5681d98 |
//Byte 68: box Z min
|
|
|
5681d98 |
- double zMin = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ double zMin = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
//Byte 76: box Z max
|
|
|
5681d98 |
- //double zMax = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ //double zMax = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
|
|
|
5681d98 |
if (std::isnan(zMin))
|
|
|
5681d98 |
@@ -1482,10 +1510,10 @@
|
|
|
5681d98 |
|
|
|
5681d98 |
//M bounaries (M = measures)
|
|
|
5681d98 |
//Byte 84: M min
|
|
|
5681d98 |
- //double mMin = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ //double mMin = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
//Byte 92: M max
|
|
|
5681d98 |
- //double mMax = qFromLittleEndian<double>(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
+ //double mMax = qFromLittleEndianD(*reinterpret_cast<const double*>(_header));
|
|
|
5681d98 |
_header += 8;
|
|
|
5681d98 |
}
|
|
|
5681d98 |
assert(fileLength >= 100);
|