24
24
using System . Reflection ;
25
25
using System . Globalization ;
26
26
using System . Windows . Media ;
27
+ using PointCloudConverter . Structs . Metadata ;
27
28
28
29
namespace PointCloudConverter
29
30
{
30
31
public partial class MainWindow : Window
31
32
{
32
- static readonly string version = "03 .04.2025" ;
33
+ static readonly string version = "04 .04.2025" ;
33
34
static readonly string appname = "PointCloud Converter - " + version ;
34
35
static readonly string rootFolder = AppDomain . CurrentDomain . BaseDirectory ;
35
36
@@ -54,7 +55,7 @@ public partial class MainWindow : Window
54
55
public static MainWindow mainWindowStatic ;
55
56
bool isInitialiazing = true ;
56
57
57
- static List < LasHeader > lasHeaders = new List < LasHeader > ( ) ;
58
+ static JobMetadata jobMetadata = new JobMetadata ( ) ;
58
59
59
60
// progress bar data
60
61
static int progressPoint = 0 ;
@@ -70,10 +71,6 @@ public partial class MainWindow : Window
70
71
private readonly float cellSize = 0.5f ;
71
72
private static ConcurrentDictionary < ( int , int , int ) , byte > occupiedCells = new ( ) ;
72
73
73
- // classification stats
74
- static byte minClass = 255 ;
75
- static byte maxClass = 0 ;
76
-
77
74
// plugins
78
75
string externalFileFormats = "" ;
79
76
@@ -202,10 +199,6 @@ private async void Main()
202
199
// get elapsed time using time
203
200
var startTime = DateTime . Now ;
204
201
205
- // classification minmax
206
- minClass = 255 ;
207
- maxClass = 0 ;
208
-
209
202
// if have files, process them
210
203
if ( importSettings . errors . Count == 0 )
211
204
{
@@ -343,7 +336,15 @@ private static async Task ProcessAllFiles(object workerParamsObject)
343
336
importSettings . offsetZ = lowestZ ;
344
337
} // if useAutoOffset
345
338
346
- lasHeaders . Clear ( ) ;
339
+
340
+ //lasHeaders.Clear();
341
+ jobMetadata . Job = new Job
342
+ {
343
+ ConverterVersion = version ,
344
+ ImportSettings = importSettings ,
345
+ StartTime = DateTime . Now
346
+ } ;
347
+ jobMetadata . lasHeaders . Clear ( ) ;
347
348
progressFile = 0 ;
348
349
349
350
//for (int i = 0, len = importSettings.maxFiles; i < len; i++)
@@ -505,7 +506,11 @@ private static async Task ProcessAllFiles(object workerParamsObject)
505
506
StringEscapeHandling = StringEscapeHandling . Default // This prevents escaping of characters and write the WKT string properly
506
507
} ;
507
508
508
- string jsonMeta = JsonConvert . SerializeObject ( lasHeaders , settings ) ;
509
+ // add job date
510
+ jobMetadata . Job . EndTime = DateTime . Now ;
511
+ jobMetadata . Job . Elapsed = jobMetadata . Job . EndTime - jobMetadata . Job . StartTime ;
512
+
513
+ string jsonMeta = JsonConvert . SerializeObject ( jobMetadata , settings ) ;
509
514
510
515
// var jsonMeta = JsonSerializer.Serialize(lasHeaders, new JsonSerializerOptions() { WriteIndented = true });
511
516
//Log.Write("MetaData: " + jsonMeta);
@@ -666,8 +671,8 @@ static void ProgressTick(object sender, EventArgs e)
666
671
progressBar . Maximum = maxValue ;
667
672
progressBar . Value = currentValue ;
668
673
progressBar . Foreground = ( ( currentValue + 1 >= maxValue ) ? Brushes . Lime : Brushes . Red ) ; //+1 hack fix
669
- //progressBar.ToolTip = $"Thread {index} - {currentValue} / {maxValue}"; // not visible, because modal dialog
670
- //Log.Write("ProgressTick: " + index + " " + currentValue + " / " + maxValue);
674
+ //progressBar.ToolTip = $"Thread {index} - {currentValue} / {maxValue}"; // not visible, because modal dialog
675
+ //Log.Write("ProgressTick: " + index + " " + currentValue + " / " + maxValue);
671
676
672
677
// print json progress
673
678
if ( progressInfo . UseJsonLog ) // TODO now same bool value is for each progressinfo..
@@ -686,12 +691,12 @@ static void ProgressTick(object sender, EventArgs e)
686
691
}
687
692
} // foreach progressinfo
688
693
} // lock
689
- //}
690
- //else // finished ?
691
- //{
692
- // Log.Write("*************** ProgressTick: progressTotalPoints is 0, finishing..");
693
- // mainWindowStatic.progressBarFiles.Value = 0;
694
- // mainWindowStatic.lblStatus.Content = "";
694
+ //}
695
+ //else // finished ?
696
+ //{
697
+ // Log.Write("*************** ProgressTick: progressTotalPoints is 0, finishing..");
698
+ // mainWindowStatic.progressBarFiles.Value = 0;
699
+ // mainWindowStatic.lblStatus.Content = "";
695
700
696
701
// foreach (UIElement element in mainWindowStatic.ProgressBarsContainer.Children)
697
702
// {
@@ -960,10 +965,6 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
960
965
{
961
966
classification = taskReader . GetClassification ( ) ;
962
967
963
- // get min and max
964
- if ( classification < minClass ) minClass = classification ;
965
- if ( classification > maxClass ) maxClass = classification ;
966
-
967
968
//classification = (byte)255;
968
969
969
970
//if (classification<0 || classification>1) Log.Write("****: " + classification.ToString());
@@ -1034,11 +1035,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
1034
1035
if ( importSettings . importMetadata == true )
1035
1036
{
1036
1037
var metaData = taskReader . GetMetaData ( importSettings , fileIndex ) ;
1037
- // NOTE now its added to every file..
1038
- metaData . ConverterVersion = version ;
1039
- metaData . MinClassification = minClass ;
1040
- metaData . MaxClassification = maxClass ;
1041
- lasHeaders . Add ( metaData ) ;
1038
+ jobMetadata . lasHeaders . Add ( metaData ) ;
1042
1039
}
1043
1040
1044
1041
} // if importMetadataOnly == false ^
@@ -1049,7 +1046,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
1049
1046
var metaData = taskReader . GetMetaData ( importSettings , fileIndex ) ;
1050
1047
// NOTE now its added to every file..
1051
1048
metaData . ConverterVersion = version ;
1052
- lasHeaders . Add ( metaData ) ;
1049
+ jobMetadata . lasHeaders . Add ( metaData ) ;
1053
1050
}
1054
1051
}
1055
1052
0 commit comments