Skip to content

Commit 8f9f586

Browse files
committed
cleanup pcroot, changed: Dont write .pcroot file, if not tiles (for example, if had used read metadata only)
1 parent 0566187 commit 8f9f586

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

Writers/PCROOT.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void AddPoint(float x, float y, float z, double time, bool addTime)
145145
TotalPoints++;
146146
if (addTime) TimeSum += time;
147147
}
148-
}
148+
} // struct TileStats
149149

150150
public PCROOT(int? _taskID)
151151
{
@@ -159,9 +159,7 @@ public PCROOT(int? _taskID)
159159
public void Dispose()
160160
{
161161
Dispose(true);
162-
GC.Collect();
163-
GC.WaitForPendingFinalizers();
164-
GC.Collect();
162+
GC.SuppressFinalize(this);
165163
}
166164

167165
protected virtual void Dispose(bool disposing)
@@ -550,7 +548,15 @@ void IWriter.Close()
550548
"maxX" + sep + "maxY" + sep + "maxZ" + sep + "cellX" + sep + "cellY" + sep + "cellZ" + sep +
551549
"averageTimeStamp" + sep + "overlapRatio");
552550

553-
File.WriteAllLines(outputFileRoot, tilerootdata.ToArray());
551+
if (nodeBounds.Count > 0)
552+
{
553+
File.WriteAllLines(outputFileRoot, tilerootdata.ToArray());
554+
}
555+
else
556+
{
557+
Log.Write("No point data processed or found");
558+
}
559+
554560

555561
Log.Write("Done saving v3 : " + outputFileRoot);
556562

@@ -565,8 +571,12 @@ void IWriter.Close()
565571

566572
nodeBounds.Clear();
567573
localBounds.Init();
568-
569574
nodeBoundsBag.Clear();
575+
576+
skippedNodesCounter = 0;
577+
skippedPointsCounter = 0;
578+
GlobalBounds.Reset();
579+
nodeBoundsBag = new ConcurrentBag<PointCloudTile>();
570580
} // Close()
571581

572582
void IWriter.Cleanup(int fileIndex)
@@ -783,11 +793,8 @@ private void EnsureCapacity(int want)
783793
y = Grow(y, newCap);
784794
z = Grow(z, newCap);
785795

786-
r = Grow(r, newCap);
787-
g = Grow(g, newCap);
788-
b = Grow(b, newCap);
789-
790-
if (s.importRGB) { r = Grow(r, newCap); g = Grow(g, newCap); b = Grow(b, newCap); }
796+
// RGB always allocated if intensity or classification value is imported alone
797+
if (s.importRGB || (s.importRGB == false && (s.importIntensity || s.importClassification))) { r = Grow(r, newCap); g = Grow(g, newCap); b = Grow(b, newCap); }
791798
if (s.importIntensity) intensity = Grow(intensity, newCap);
792799
if (s.importClassification) classification = Grow(classification, newCap);
793800
if (s.averageTimestamp) time = Grow(time, newCap);

0 commit comments

Comments
 (0)