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 ReadPointTest() { using (LasFileReader reader = new LasFileReader("file://" + _fixture.CurrentLasFilePath)) { Assert.AreEqual((UInt64)0, reader.ReadedPointCount); Assert.AreEqual((UInt64)5, reader.TotalPointCount); Assert.False(reader.EndOfStream); // Point 1. LasPointFormat7 point = reader.Read() as LasPointFormat7; 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.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); // Point 2. point = reader.Read() as LasPointFormat7; 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.False(point.IsOverlap); Assert.AreEqual((Byte)0, point.ScannerChannel); 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); Assert.AreEqual((Double)0, point.GPSTime); Assert.AreEqual((UInt16)10, point.RedChannel); Assert.AreEqual((UInt16)20, point.GreenChannel); Assert.AreEqual((UInt16)30, point.BlueChannel); 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 LasPointFormat7; 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.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); Boolean result = false; try { reader.Read(); } catch (InvalidDataException) { result = true; } Assert.True(result); } }