diff --git a/include/E57SimpleData.h b/include/E57SimpleData.h index 7d40204..69763b7 100644 --- a/include/E57SimpleData.h +++ b/include/E57SimpleData.h @@ -438,9 +438,8 @@ namespace e57 PointGroupingSchemes pointGroupingSchemes; //!< The defined schemes that group points in different ways PointStandardizedFieldsAvailable pointFields; //!< The active fields used in the WritePoints function. - //! Total size of the compressed vector of PointRecord structures referring to the binary data that actually - //! stores the point data - int64_t pointsSize = 0; + //! The number of points in the Data3D. + int64_t pointCount = 0; }; //! @brief Stores pointers to user-provided buffers diff --git a/src/E57SimpleData.cpp b/src/E57SimpleData.cpp index 20a6ce0..0c5bc6f 100644 --- a/src/E57SimpleData.cpp +++ b/src/E57SimpleData.cpp @@ -31,11 +31,11 @@ namespace e57 template Data3DPointsData_t::Data3DPointsData_t( Data3D &data3D ) : _selfAllocated( true ) { - const auto cSize = data3D.pointsSize; + const auto cPointCount = data3D.pointCount; - if ( cSize < 1 ) + if ( cPointCount < 1 ) { - throw E57_EXCEPTION2( E57_ERROR_VALUE_OUT_OF_BOUNDS, "pointsSize=" + toString( cSize ) + " minimum=1" ); + throw E57_EXCEPTION2( E57_ERROR_VALUE_OUT_OF_BOUNDS, "pointCount=" + toString( cPointCount ) + " minimum=1" ); } // We need to adjust min/max for floats. @@ -51,117 +51,117 @@ namespace e57 if ( data3D.pointFields.cartesianXField ) { - cartesianX = new COORDTYPE[cSize]; + cartesianX = new COORDTYPE[cPointCount]; } if ( data3D.pointFields.cartesianYField ) { - cartesianY = new COORDTYPE[cSize]; + cartesianY = new COORDTYPE[cPointCount]; } if ( data3D.pointFields.cartesianZField ) { - cartesianZ = new COORDTYPE[cSize]; + cartesianZ = new COORDTYPE[cPointCount]; } if ( data3D.pointFields.cartesianInvalidStateField ) { - cartesianInvalidState = new int8_t[cSize]; + cartesianInvalidState = new int8_t[cPointCount]; } if ( data3D.pointFields.intensityField ) { - intensity = new float[cSize]; + intensity = new float[cPointCount]; } if ( data3D.pointFields.isIntensityInvalidField ) { - isIntensityInvalid = new int8_t[cSize]; + isIntensityInvalid = new int8_t[cPointCount]; } if ( data3D.pointFields.colorRedField ) { - colorRed = new uint8_t[cSize]; + colorRed = new uint8_t[cPointCount]; } if ( data3D.pointFields.colorGreenField ) { - colorGreen = new uint8_t[cSize]; + colorGreen = new uint8_t[cPointCount]; } if ( data3D.pointFields.colorBlueField ) { - colorBlue = new uint8_t[cSize]; + colorBlue = new uint8_t[cPointCount]; } if ( data3D.pointFields.isColorInvalidField ) { - isColorInvalid = new int8_t[cSize]; + isColorInvalid = new int8_t[cPointCount]; } if ( data3D.pointFields.sphericalRangeField ) { - sphericalRange = new COORDTYPE[cSize]; + sphericalRange = new COORDTYPE[cPointCount]; } if ( data3D.pointFields.sphericalAzimuthField ) { - sphericalAzimuth = new COORDTYPE[cSize]; + sphericalAzimuth = new COORDTYPE[cPointCount]; } if ( data3D.pointFields.sphericalElevationField ) { - sphericalElevation = new COORDTYPE[cSize]; + sphericalElevation = new COORDTYPE[cPointCount]; } if ( data3D.pointFields.sphericalInvalidStateField ) { - sphericalInvalidState = new int8_t[cSize]; + sphericalInvalidState = new int8_t[cPointCount]; } if ( data3D.pointFields.rowIndexField ) { - rowIndex = new int32_t[cSize]; + rowIndex = new int32_t[cPointCount]; } if ( data3D.pointFields.columnIndexField ) { - columnIndex = new int32_t[cSize]; + columnIndex = new int32_t[cPointCount]; } if ( data3D.pointFields.returnIndexField ) { - returnIndex = new int8_t[cSize]; + returnIndex = new int8_t[cPointCount]; } if ( data3D.pointFields.returnCountField ) { - returnCount = new int8_t[cSize]; + returnCount = new int8_t[cPointCount]; } if ( data3D.pointFields.timeStampField ) { - timeStamp = new double[cSize]; + timeStamp = new double[cPointCount]; } if ( data3D.pointFields.isTimeStampInvalidField ) { - isTimeStampInvalid = new int8_t[cSize]; + isTimeStampInvalid = new int8_t[cPointCount]; } if ( data3D.pointFields.normalXField ) { - normalX = new float[cSize]; + normalX = new float[cPointCount]; } if ( data3D.pointFields.normalYField ) { - normalY = new float[cSize]; + normalY = new float[cPointCount]; } if ( data3D.pointFields.normalZField ) { - normalZ = new float[cSize]; + normalZ = new float[cPointCount]; } } diff --git a/src/ReaderImpl.cpp b/src/ReaderImpl.cpp index 04127a9..c2461a7 100644 --- a/src/ReaderImpl.cpp +++ b/src/ReaderImpl.cpp @@ -597,7 +597,7 @@ namespace e57 const StructureNode proto( points.prototype() ); data3DHeader.guid = StringNode( scan.get( "guid" ) ).value(); - data3DHeader.pointsSize = points.childCount(); + data3DHeader.pointCount = points.childCount(); if ( scan.isDefined( "name" ) ) { diff --git a/src/WriterImpl.cpp b/src/WriterImpl.cpp index cfd0a10..5148c03 100644 --- a/src/WriterImpl.cpp +++ b/src/WriterImpl.cpp @@ -686,11 +686,11 @@ namespace e57 // "/data3D/0/pointGroupingSchemes/groupingByLine/groups/0/idElementValue" const int64_t groupsSize = data3DHeader.pointGroupingSchemes.groupingByLine.groupsSize; const int64_t countSize = data3DHeader.pointGroupingSchemes.groupingByLine.pointCountSize; - const int64_t pointsSize = data3DHeader.pointsSize; + const int64_t pointsCount = data3DHeader.pointCount; StructureNode lineGroupProto( imf_ ); - lineGroupProto.set( "startPointIndex", IntegerNode( imf_, 0, 0, pointsSize - 1 ) ); + lineGroupProto.set( "startPointIndex", IntegerNode( imf_, 0, 0, pointsCount - 1 ) ); lineGroupProto.set( "idElementValue", IntegerNode( imf_, 0, 0, groupsSize - 1 ) ); lineGroupProto.set( "pointCount", IntegerNode( imf_, 0, 0, countSize ) ); diff --git a/test/src/test_SimpleData.cpp b/test/src/test_SimpleData.cpp index 7a9cc6d..c852a0f 100644 --- a/test/src/test_SimpleData.cpp +++ b/test/src/test_SimpleData.cpp @@ -18,7 +18,7 @@ TEST( SimpleDataHeader, HeaderMinMaxFloat ) { e57::Data3D dataHeader; - dataHeader.pointsSize = 1; + dataHeader.pointCount = 1; EXPECT_EQ( dataHeader.pointFields.pointRangeMinimum, e57::E57_DOUBLE_MIN ); EXPECT_EQ( dataHeader.pointFields.pointRangeMaximum, e57::E57_DOUBLE_MAX ); @@ -42,7 +42,7 @@ TEST( SimpleDataHeader, HeaderMinMaxDouble ) { e57::Data3D dataHeader; - dataHeader.pointsSize = 1; + dataHeader.pointCount = 1; EXPECT_EQ( dataHeader.pointFields.pointRangeMinimum, e57::E57_DOUBLE_MIN ); EXPECT_EQ( dataHeader.pointFields.pointRangeMaximum, e57::E57_DOUBLE_MAX ); diff --git a/test/src/test_SimpleReader.cpp b/test/src/test_SimpleReader.cpp index 4f3511a..663f0e9 100644 --- a/test/src/test_SimpleReader.cpp +++ b/test/src/test_SimpleReader.cpp @@ -86,10 +86,10 @@ TEST( SimpleReaderData, ColouredCubeFloat ) e57::Data3D data3DHeader; ASSERT_TRUE( reader->ReadData3D( 0, data3DHeader ) ); - ASSERT_EQ( data3DHeader.pointsSize, 7'680 ); + ASSERT_EQ( data3DHeader.pointCount, 7'680 ); EXPECT_EQ( data3DHeader.guid, "Coloured Cube Float Scan Header GUID" ); - const uint64_t cNumPoints = data3DHeader.pointsSize; + const uint64_t cNumPoints = data3DHeader.pointCount; e57::Data3DPointsData pointsData( data3DHeader ); @@ -123,10 +123,10 @@ TEST( SimpleReaderData, ColouredCubeFloatToDouble ) e57::Data3D data3DHeader; ASSERT_TRUE( reader->ReadData3D( 0, data3DHeader ) ); - ASSERT_EQ( data3DHeader.pointsSize, 7'680 ); + ASSERT_EQ( data3DHeader.pointCount, 7'680 ); EXPECT_EQ( data3DHeader.guid, "Coloured Cube Float Scan Header GUID" ); - const uint64_t cNumPoints = data3DHeader.pointsSize; + const uint64_t cNumPoints = data3DHeader.pointCount; e57::Data3DPointsData_d pointsData( data3DHeader ); @@ -160,10 +160,10 @@ TEST( SimpleReaderData, BunnyDouble ) e57::Data3D data3DHeader; ASSERT_TRUE( reader->ReadData3D( 0, data3DHeader ) ); - ASSERT_EQ( data3DHeader.pointsSize, 30'571 ); + ASSERT_EQ( data3DHeader.pointCount, 30'571 ); EXPECT_EQ( data3DHeader.guid, "{9CA24C38-C93E-40E8-A366-F49977C7E3EB}" ); - const uint64_t cNumPoints = data3DHeader.pointsSize; + const uint64_t cNumPoints = data3DHeader.pointCount; e57::Data3DPointsData pointsData( data3DHeader ); @@ -197,10 +197,10 @@ TEST( SimpleReaderData, BunnyInt32 ) e57::Data3D data3DHeader; ASSERT_TRUE( reader->ReadData3D( 0, data3DHeader ) ); - EXPECT_EQ( data3DHeader.pointsSize, 30'571 ); + EXPECT_EQ( data3DHeader.pointCount, 30'571 ); EXPECT_EQ( data3DHeader.guid, "{9CA24C38-C93E-40E8-A366-F49977C7E3EB}" ); - const uint64_t cNumPoints = data3DHeader.pointsSize; + const uint64_t cNumPoints = data3DHeader.pointCount; e57::Data3DPointsData pointsData( data3DHeader ); diff --git a/test/src/test_SimpleWriter.cpp b/test/src/test_SimpleWriter.cpp index a44dff6..f7b9094 100644 --- a/test/src/test_SimpleWriter.cpp +++ b/test/src/test_SimpleWriter.cpp @@ -160,7 +160,7 @@ TEST( SimpleWriter, ColouredCubeDouble ) e57::Data3D header; header.guid = "Coloured Cube Double Scan Header GUID"; header.description = "libE57Format test: cube of coloured points using doubles"; - header.pointsSize = cNumPoints; + header.pointCount = cNumPoints; // setting this to < 0.0 indicates we want to write doubles header.pointFields.pointRangeScaledInteger = -1.0; @@ -220,7 +220,7 @@ TEST( SimpleWriter, ColouredCubeFloat ) e57::Data3D header; header.guid = "Coloured Cube Float Scan Header GUID"; header.description = "libE57Format test: cube of coloured points using floats"; - header.pointsSize = cNumPoints; + header.pointCount = cNumPoints; setUsingColouredCartesianPoints( header ); @@ -283,7 +283,7 @@ TEST( SimpleWriter, ColouredCubeScaledInt ) e57::Data3D header; header.guid = "Cube Scaled Int Scan Header GUID"; header.description = "libE57Format test: cube of coloured points using scaled integers"; - header.pointsSize = cNumPoints; + header.pointCount = cNumPoints; // setting this to > 0.0 indicates we want to write scaled ints and to use this as the scale header.pointFields.pointRangeScaledInteger = 0.001; @@ -337,7 +337,7 @@ TEST( SimpleWriter, MultipleScans ) constexpr int cNumPoints = 8; e57::Data3D header; - header.pointsSize = cNumPoints; + header.pointCount = cNumPoints; header.pointFields.cartesianXField = true; header.pointFields.cartesianYField = true; header.pointFields.cartesianZField = true; @@ -411,7 +411,7 @@ TEST( SimpleWriter, CartesianPoints ) e57::Data3D header; header.guid = "Cartesian Points Header GUID"; - header.pointsSize = cNumPoints; + header.pointCount = cNumPoints; header.pointFields.cartesianXField = true; header.pointFields.cartesianYField = true; header.pointFields.cartesianZField = true; @@ -449,7 +449,7 @@ TEST( SimpleWriter, ColouredCartesianPoints ) e57::Data3D header; header.guid = "Coloured Cartesian Points Header GUID"; - header.pointsSize = cNumPoints; + header.pointCount = cNumPoints; setUsingColouredCartesianPoints( header );