public void ReadMultiplePointsTest()
        {
            using (LasFileReader reader = new LasFileReader("file://" + _fixture.CurrentLasFilePath))
            {
                Assert.AreEqual((UInt64)0, reader.ReadedPointCount);
                Assert.False(reader.EndOfStream);

                IList <IGeometry> points = reader.Read(2);
                Assert.AreEqual(2, points.Count);
                Assert.AreEqual((UInt64)2, reader.ReadedPointCount);
                Assert.False(reader.EndOfStream);

                LasPointFormat7 point = points[0] as LasPointFormat7;
                Assert.NotNull(point);
                Assert.AreEqual((Double)0.50, point.X);
                Assert.AreEqual((Double)1.00, point.Y);
                Assert.AreEqual((Double)1.50, point.Z);
                Assert.AreEqual((UInt16)0, point.Intensity);
                Assert.AreEqual((Byte)1, point.ReturnNumber);
                Assert.AreEqual((Byte)2, point.TotalReturnNumber);
                Assert.True(point.IsSynthetic);
                Assert.True(point.IsKeyPoint);
                Assert.False(point.IsWithheld);
                Assert.False(point.IsOverlap);
                Assert.AreEqual((Byte)0, point.ScannerChannel);
                Assert.True(point.IsScanDirectionPositive);
                Assert.False(point.IsFlightLineEdge);
                Assert.AreEqual((Byte)1, point.Classification);
                Assert.AreEqual((Byte)0, point.UserData);
                Assert.AreEqual((Int16)0, point.ScanAngle);
                Assert.AreEqual((UInt16)0, point.PointSourceId);
                Assert.AreEqual((Double)0, point.GPSTime);
                Assert.AreEqual((UInt16)1, point.RedChannel);
                Assert.AreEqual((UInt16)2, point.GreenChannel);
                Assert.AreEqual((UInt16)3, point.BlueChannel);

                points = reader.ReadToEnd();
                Assert.AreEqual(3, points.Count);
                Assert.AreEqual((UInt64)5, reader.ReadedPointCount);
                Assert.True(reader.EndOfStream);

                point = points[2] as LasPointFormat7;
                Assert.NotNull(point);
                Assert.AreEqual((Double)4.50, point.X);
                Assert.AreEqual((Double)5.00, point.Y);
                Assert.AreEqual((Double)5.50, point.Z);
                Assert.AreEqual((UInt16)0, point.Intensity);
                Assert.AreEqual((Byte)1, point.ReturnNumber);
                Assert.AreEqual((Byte)1, point.TotalReturnNumber);
                Assert.True(point.IsSynthetic);
                Assert.False(point.IsKeyPoint);
                Assert.True(point.IsWithheld);
                Assert.True(point.IsOverlap);
                Assert.AreEqual((Byte)1, point.ScannerChannel);
                Assert.True(point.IsScanDirectionPositive);
                Assert.True(point.IsFlightLineEdge);
                Assert.AreEqual((Byte)5, point.Classification);
                Assert.AreEqual((Byte)0, point.UserData);
                Assert.AreEqual((Int16)0, point.ScanAngle);
                Assert.AreEqual((UInt16)0, point.PointSourceId);
                Assert.AreEqual((Double)0, point.GPSTime);
                Assert.AreEqual((UInt16)1, point.RedChannel);
                Assert.AreEqual((UInt16)2, point.GreenChannel);
                Assert.AreEqual((UInt16)3, point.BlueChannel);
            }
        }
        public void ReadLegacyPointTest()
        {
            using (LasFileReader reader = new LasFileReader("file://" + _fixture.LegacyLasFilePath))
            {
                Assert.AreEqual((UInt64)0, reader.ReadedPointCount);
                Assert.AreEqual((UInt64)5, reader.TotalPointCount);
                Assert.False(reader.EndOfStream);

                // Point 1.

                LasPointFormat0 point = reader.Read() as LasPointFormat0;
                Assert.AreEqual((UInt64)1, reader.ReadedPointCount);
                Assert.AreEqual((UInt64)5, reader.TotalPointCount);
                Assert.False(reader.EndOfStream);

                Assert.NotNull(point);
                Assert.AreEqual((Double)0.50, point.X);
                Assert.AreEqual((Double)1.00, point.Y);
                Assert.AreEqual((Double)1.50, point.Z);
                Assert.AreEqual((UInt16)0, point.Intensity);
                Assert.AreEqual((Byte)1, point.ReturnNumber);
                Assert.AreEqual((Byte)2, point.TotalReturnNumber);
                Assert.True(point.IsSynthetic);
                Assert.True(point.IsKeyPoint);
                Assert.False(point.IsWithheld);
                Assert.True(point.IsScanDirectionPositive);
                Assert.False(point.IsFlightLineEdge);
                Assert.AreEqual((Byte)1, point.Classification);
                Assert.AreEqual((Byte)0, point.UserData);
                Assert.AreEqual((Int16)0, point.ScanAngle);
                Assert.AreEqual((UInt16)0, point.PointSourceId);

                // Point 2.

                point = reader.Read() as LasPointFormat0;
                Assert.AreEqual((UInt64)2, reader.ReadedPointCount);
                Assert.False(reader.EndOfStream);

                Assert.NotNull(point);
                Assert.AreEqual((Double)1.50, point.X);
                Assert.AreEqual((Double)2.00, point.Y);
                Assert.AreEqual((Double)2.50, point.Z);
                Assert.AreEqual((UInt16)0, point.Intensity);
                Assert.AreEqual((Byte)2, point.ReturnNumber);
                Assert.AreEqual((Byte)2, point.TotalReturnNumber);
                Assert.True(point.IsSynthetic);
                Assert.False(point.IsKeyPoint);
                Assert.False(point.IsWithheld);
                Assert.True(point.IsScanDirectionPositive);
                Assert.False(point.IsFlightLineEdge);
                Assert.AreEqual((Byte)2, point.Classification);
                Assert.AreEqual((Byte)0, point.UserData);
                Assert.AreEqual((Int16)0, point.ScanAngle);
                Assert.AreEqual((UInt16)0, point.PointSourceId);

                reader.Read();
                Assert.AreEqual((UInt64)3, reader.ReadedPointCount);
                Assert.False(reader.EndOfStream);

                reader.Read();
                Assert.AreEqual((UInt64)4, reader.ReadedPointCount);
                Assert.False(reader.EndOfStream);

                // Point 5.

                point = reader.Read() as LasPointFormat0;
                Assert.AreEqual((UInt64)5, reader.ReadedPointCount);
                Assert.True(reader.EndOfStream);

                Assert.NotNull(point);
                Assert.AreEqual((Double)4.50, point.X);
                Assert.AreEqual((Double)5.00, point.Y);
                Assert.AreEqual((Double)5.50, point.Z);
                Assert.AreEqual((UInt16)0, point.Intensity);
                Assert.AreEqual((Byte)1, point.ReturnNumber);
                Assert.AreEqual((Byte)1, point.TotalReturnNumber);
                Assert.True(point.IsSynthetic);
                Assert.False(point.IsKeyPoint);
                Assert.True(point.IsWithheld);
                Assert.True(point.IsScanDirectionPositive);
                Assert.True(point.IsFlightLineEdge);
                Assert.AreEqual((Byte)5, point.Classification);
                Assert.AreEqual((Byte)0, point.UserData);
                Assert.AreEqual((Int16)0, point.ScanAngle);
                Assert.AreEqual((UInt16)0, point.PointSourceId);

                Boolean result = false;

                try
                {
                    reader.Read();
                }
                catch (InvalidDataException)
                {
                    result = true;
                }

                Assert.True(result);
            }
        }
        public void OpenFileNotSupportedPointVersionAndReadTest()
        {
            using (LasFileReader reader = new LasFileReader("file://" + _fixture.FutureLasFilePath))
            {
                LasPublicHeader header = reader.Header;

                Assert.AreEqual((UInt16)39, header.FileSourceId);
                Assert.AreEqual(GPSTimeType.Week, header.GPSTimeType);
                Assert.False(header.IsWavePacketStorageInternal);
                Assert.True(header.IsWavePacketStorageExternal);
                Assert.True(header.IsReturnNumberOriginSynthetical);
                Assert.AreEqual(CRSType.GeoTIFF, header.CRSType);
                Assert.AreEqual((UInt32)81, header.ProjectId1);
                Assert.AreEqual((UInt16)50, header.ProjectId2);
                Assert.AreEqual((UInt16)12, header.ProjectId3);
                Assert.AreEqual((UInt64)974, header.ProjectId4);
                Assert.AreEqual((Byte)1, header.VersionMajor);
                Assert.AreEqual((Byte)5, header.VersionMinor);
                Assert.AreEqual("OTHER", header.SystemIdentifier);
                Assert.AreEqual("LasFileReaderUnitTests", header.GeneratingSoftware);
                Assert.AreEqual((UInt16)286, header.FileCreationDay);
                Assert.AreEqual((UInt16)2020, header.FileCreationYear);
                Assert.AreEqual((UInt16)376, header.PublicHeaderSize);
                Assert.AreEqual((UInt32)376, header.PointDataOffset);
                Assert.AreEqual((UInt32)0, header.VariableLengthRecordCount);
                Assert.AreEqual((Byte)11, header.PointDataFormat);
                Assert.AreEqual((UInt16)37, header.PointDataLength);
                Assert.AreEqual((UInt32)0, header.LegacyPointCount);

                for (var i = 0; i < 5; i++)
                {
                    Assert.AreEqual((UInt32)0, header.LegacyPointCountPerReturn[i]);
                }

                Assert.AreEqual((Double)0.01, header.ScaleFactorX);
                Assert.AreEqual((Double)0.05, header.ScaleFactorY);
                Assert.AreEqual((Double)0.10, header.ScaleFactorZ);
                Assert.AreEqual((Double)(-0.50), header.OffsetX);
                Assert.AreEqual((Double)0.00, header.OffsetY);
                Assert.AreEqual((Double)0.50, header.OffsetZ);
                Assert.AreEqual((Double)100, header.MaxX);
                Assert.AreEqual((Double)0, header.MinX);
                Assert.AreEqual((Double)101, header.MaxY);
                Assert.AreEqual((Double)1, header.MinY);
                Assert.AreEqual((Double)102, header.MaxZ);
                Assert.AreEqual((Double)2, header.MinZ);
                Assert.AreEqual((UInt64)0, header.WavePacketRecordOffset);
                Assert.AreEqual((UInt64)0, header.ExtendedVariableLengthRecordOffset);
                Assert.AreEqual((UInt32)0, header.ExtendedVariableLengthRecordCount);
                Assert.AreEqual((UInt64)5, header.PointCount);
                Assert.AreEqual((UInt64)3, header.PointCountPerReturn[0]);
                Assert.AreEqual((UInt64)2, header.PointCountPerReturn[1]);

                for (var i = 2; i < 15; i++)
                {
                    Assert.AreEqual((UInt64)0, header.PointCountPerReturn[i]);
                }

                Boolean result = false;

                try
                {
                    reader.Read();
                }
                catch (InvalidDataException)
                {
                    result = true;
                }

                Assert.True(result);
            }
        }