diff --git a/LASRead/LASFile.cs b/LASRead/LASFile.cs
index e29d2ed..1cf84ae 100644
--- a/LASRead/LASFile.cs
+++ b/LASRead/LASFile.cs
@@ -75,7 +75,7 @@ namespace LASFormat
VLRStart = Header.HeaderSize;
VLRHeader initial = new VLRHeader();
initial.ReadRecords(VLRStream);
- vlrCollection = new RecordCollection(VLRStream, VLRStart, Header.NumberVLRs, initial);
+ vlrCollection = new RecordCollection(ref VLRStream, VLRStart, Header.NumberVLRs, initial);
// Grab a starting PDR
PDRStart = Header.DataOffset;
@@ -103,7 +103,7 @@ namespace LASFormat
EVLRStream = GetOffsetStream(source, EVLRSize);
EVLRHeader evlrInitial = new EVLRHeader();
evlrInitial.ReadRecords(EVLRStream);
- evlrCollection = new RecordCollection(EVLRStream, EVLRStart, Header.NumberOfExtendedVLRs, evlrInitial);
+ evlrCollection = new RecordCollection(ref EVLRStream, EVLRStart, Header.NumberOfExtendedVLRs, evlrInitial);
// Finally, set the stream back to the starting position
source.Position = 0;
// TODO: Grab a starting Waveform
@@ -146,6 +146,7 @@ namespace LASFormat
source.Read(buffer, 0, remaining);
newStream.Write(buffer, 0, remaining);
}
+ newStream.Position = 0;
return newStream;
}
diff --git a/LASRead/LASFormat/FileHeader.cs b/LASRead/LASFormat/FileHeader.cs
index c92319b..6f47131 100644
--- a/LASRead/LASFormat/FileHeader.cs
+++ b/LASRead/LASFormat/FileHeader.cs
@@ -335,10 +335,10 @@ namespace LASRead.LASFormat
sb.Append("PointDataLength: " + PointDataRecordLength.ToString() + Environment.NewLine);
sb.Append("Legacy #PDRs: " + LegacyNumberOfPointRecords.ToString() + Environment.NewLine);
sb.Append("Legacy #PDR returns: ");
- foreach (uint legacyReturn in LegacyNumberOfPointByReturn)
+ for (int i = 0; i < LegacyNumberOfPointByReturn.Length; i++)
{
- sb.Append(legacyReturn);
- sb.Append(" ");
+ uint legacyReturn = LegacyNumberOfPointByReturn[i];
+ sb.Append($"{i+1}: {legacyReturn} ");
}
sb.Append(Environment.NewLine);
sb.Append("X Scale Factor: " + X_scaleFactor.ToString() + Environment.NewLine);
diff --git a/LASRead/LASFormat/PointDataRecord.cs b/LASRead/LASFormat/PointDataRecord.cs
index 2d1b860..305a310 100644
--- a/LASRead/LASFormat/PointDataRecord.cs
+++ b/LASRead/LASFormat/PointDataRecord.cs
@@ -6,7 +6,7 @@ namespace LASRead.LASFormat
{
///
/// LAS Data Payloads are in the Point Data Record (PDR) format
- /// PDR 0-5 share the same basic substructure (which is inherited from this interface,
+ /// PDR formats 0-5 share the same basic substructure (which is ultimately inherited from this interface)
/// PDR 6-10 share a slightly different substructure (more flags)
///
public interface IPointDataRecord
@@ -48,7 +48,10 @@ namespace LASRead.LASFormat
class PDR0 : IPointDataRecord
{
const int headerSize = 20;
-
+ ///
+ /// PDRs for the X,Y,Z are 4-byte integers. They are multiplied by the scale defined in the
+ /// header to determine the true (potentially non-integral) coordinate of the point
+ ///
public int X { get; set; }
public int Y { get; set; }
public int Z { get; set; }
diff --git a/LASRead/LASFormat/Record.cs b/LASRead/LASFormat/Record.cs
index ea2f83b..d656ab4 100644
--- a/LASRead/LASFormat/Record.cs
+++ b/LASRead/LASFormat/Record.cs
@@ -39,6 +39,7 @@ namespace LASRead.LASFormat
StringBuilder sb = new StringBuilder();
sb.Append(header.ToString() + Environment.NewLine);
sb.Append(string.Format("Binary Data @{0}, of length {1}{2}", position + header.HeaderLength, header.HeaderLength, Environment.NewLine));
+ sb.Append(header.ToString());
return sb.ToString();
}
}
@@ -140,7 +141,7 @@ namespace LASRead.LASFormat
sb.Append("Record ID: " + RecordID.ToString() + Environment.NewLine);
sb.Append("Record Length After Header: " + RecordID.ToString() + Environment.NewLine);
sb.Append("Description: " + new string(DataHelpers.ToCharArray(Description)) + Environment.NewLine);
- return base.ToString();
+ return sb.ToString();
}
diff --git a/LASRead/LASFormat/RecordCollection.cs b/LASRead/LASFormat/RecordCollection.cs
index 41a6c74..8f237e8 100644
--- a/LASRead/LASFormat/RecordCollection.cs
+++ b/LASRead/LASFormat/RecordCollection.cs
@@ -9,9 +9,9 @@ namespace LASRead.LASFormat
public class RecordCollection : IEnumerable
{
RecordEnumerator enumerator;
- public RecordCollection(Stream source, ulong startPosition, uint maxItems, IRecordPayloadHeader firstHeader)
+ public RecordCollection(ref Stream source, ulong startPosition, uint maxItems, IRecordPayloadHeader firstHeader)
{
- enumerator = new RecordEnumerator(source, startPosition, maxItems, firstHeader);
+ enumerator = new RecordEnumerator(ref source, startPosition, maxItems, firstHeader);
}
public IEnumerator GetEnumerator()
{
@@ -32,7 +32,7 @@ namespace LASRead.LASFormat
uint currentCount;
uint maxCount;
- public RecordEnumerator(Stream source, ulong startPosition, uint maxItems, IRecordPayloadHeader firstHeader)
+ public RecordEnumerator(ref Stream source, ulong startPosition, uint maxItems, IRecordPayloadHeader firstHeader)
{
dataSource = source;
streamStart = startPosition;