Fixed a number of small bugs, refactored

This commit is contained in:
2021-11-17 13:16:14 +13:00
parent 269373faa2
commit 5af930b4ea
5 changed files with 16 additions and 11 deletions
+3 -3
View File
@@ -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);
+5 -2
View File
@@ -6,7 +6,7 @@ namespace LASRead.LASFormat
{
/// <summary>
/// LAS Data Payloads are in the Point Data Record (PDR) format <br />
/// PDR 0-5 share the same basic substructure (which is inherited from this interface, <br />
/// PDR formats 0-5 share the same basic substructure (which is ultimately inherited from this interface) <br />
/// PDR 6-10 share a slightly different substructure (more flags)
/// </summary>
public interface IPointDataRecord
@@ -48,7 +48,10 @@ namespace LASRead.LASFormat
class PDR0 : IPointDataRecord
{
const int headerSize = 20;
/// <summary>
/// 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
/// </summary>
public int X { get; set; }
public int Y { get; set; }
public int Z { get; set; }
+2 -1
View File
@@ -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();
}
+3 -3
View File
@@ -9,9 +9,9 @@ namespace LASRead.LASFormat
public class RecordCollection : IEnumerable<Record>
{
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<Record> 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;