Skip to content

Commit f99f728

Browse files
committed
fixing classification
1 parent 9950307 commit f99f728

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

MainWindow.xaml.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
268268
//Log.Write(istrue1 ? "1" : "0");
269269
//Log.Write(istrue2 ? "1" : "0");
270270

271-
if ((importSettings.useAutoOffset == true && importSettings.importMetadataOnly == false) || (importSettings.importIntensity == true && importSettings.importRGB == true && importSettings.packColors == true && importSettings.importMetadataOnly == false))
271+
if ((importSettings.useAutoOffset == true && importSettings.importMetadataOnly == false) || ((importSettings.importIntensity == true||importSettings.importClassification == true) && importSettings.importRGB == true && importSettings.packColors == true && importSettings.importMetadataOnly == false))
272272
{
273273
int iterations = importSettings.offsetMode == "min" ? importSettings.maxFiles : 1; // 1 for legacy mode
274274

@@ -767,7 +767,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
767767
// NOTE only works with formats that have bounds defined in header, otherwise need to loop whole file to get bounds?
768768

769769
// dont use these bounds, in this case
770-
if (importSettings.useAutoOffset == true || (importSettings.importIntensity == true && importSettings.importRGB == true && importSettings.packColors == true))
770+
if (importSettings.useAutoOffset == true || ((importSettings.importIntensity == true || importSettings.importClassification == true) && importSettings.importRGB == true && importSettings.packColors == true))
771771
{
772772
// TODO add manual offset here still?
773773
// we use global bounds or Y offset to fix negative Y
@@ -906,9 +906,8 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
906906
if (importSettings.importIntensity == true)
907907
{
908908
//intensity = taskReader.GetIntensity();
909-
909+
// works here
910910
intensity = taskReader.GetClassification();
911-
912911
//if (i < 20000) Log.Write("int: " + intensity);
913912

914913
// if no rgb, then replace RGB with intensity
@@ -924,12 +923,12 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
924923

925924
if (importSettings.importClassification == true)
926925
{
927-
//classification = taskReader.GetClassification();
928-
classification = taskReader.GetIntensity();
926+
classification = taskReader.GetClassification();
927+
//classification = taskReader.GetIntensity();
929928
//if (classification<0 || classification>1) Log.Write("****: " + classification.ToString());
930929

931930
//if (i < 20000) Log.Write("class: " + classification.ToString());
932-
931+
//classification = 0;
933932
//if (intensity.r < minInt)
934933
//{
935934
// minInt = intensity.r;

Tools/ArgParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ public static ImportSettings Parse(string[] args, string rootFolder, ILogger log
875875
//}
876876

877877
// must have at least one
878-
if (importSettings.importRGB == false && importSettings.importIntensity == false && importSettings.importClassification == false)
878+
if (importSettings.importRGB == false && (importSettings.importIntensity == false && importSettings.importClassification == false) && importSettings.importClassification == false)
879879
{
880880
importSettings.errors.Add("Must have -rgb OR -intensity OR -classification enabled");
881881
}

Writers/PCROOT.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ void IWriter.Close()
265265

266266
string commentRow = "# version" + sep + "gridsize" + sep + "pointcount" + sep + "boundsMinX" + sep + "boundsMinY" + sep + "boundsMinZ" + sep + "boundsMaxX" + sep + "boundsMaxY" + sep + "boundsMaxZ" + sep + "autoOffsetX" + sep + "autoOffsetY" + sep + "autoOffsetZ" + sep + "packMagicValue";
267267
if (importSettings.importRGB == true && importSettings.importIntensity == true) commentRow += sep + "intensity";
268+
if (importSettings.importRGB == true && importSettings.importClassification == true) commentRow += sep + "classification";
268269
if (addComments) tilerootdata.Insert(1, commentRow);
269270

270271
// add global header settings to first row
@@ -526,7 +527,8 @@ void IWriter.Save(int fileIndex)
526527
nodeTempIntensity = nodeIntensity[key];
527528
}
528529

529-
if (importSettings.importClassification == true)
530+
// TODO separate?
531+
if (importSettings.importRGB == true && importSettings.importClassification == true)
530532
{
531533
nodeTempClassification = nodeClassification[key];
532534
}
@@ -921,6 +923,7 @@ void IWriter.Save(int fileIndex)
921923
writerIntensity.Close();
922924
bsIntensity.Dispose();
923925
}
926+
924927
// TEST separate classification
925928
if (importSettings.importRGB == true && importSettings.importClassification == true)
926929
{

0 commit comments

Comments
 (0)