From 71a41400b37f87601c0f3ba88fd4082b2e86e0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81kos=20Halmai?= Date: Mon, 7 Aug 2023 20:37:20 +0200 Subject: [PATCH] Frame V13 support added for imagery. --- BitmapCompressionMode.cs | 2 +- Frame.cs | 2 ++ Properties/launchSettings.json | 2 +- SL3Reader.cs | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/BitmapCompressionMode.cs b/BitmapCompressionMode.cs index 5642388..da5cfde 100644 --- a/BitmapCompressionMode.cs +++ b/BitmapCompressionMode.cs @@ -8,5 +8,5 @@ internal enum BitmapCompressionMode : uint BI_BITFIELDS = 3, BI_JPEG = 4, BI_PNG = 5 - } + }; } \ No newline at end of file diff --git a/Frame.cs b/Frame.cs index 0b9f6d0..6de01b8 100644 --- a/Frame.cs +++ b/Frame.cs @@ -7,6 +7,8 @@ namespace SL3Reader { + // We might need a refactoring. Seemingly it is not a single frame, but one long header, + // and extra information panel and the data itself. [StructLayout(LayoutKind.Explicit, Size = ExtendedSizeV10)] [DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] public readonly struct Frame diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 133f87f..749fe40 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "SL3Reader": { "commandName": "Project", - "commandLineArgs": "\"C:\\Users\\halmaia\\Downloads\\Sonar_2023-08-06_12.43.36.sl3\" F:\\3D.csv -3dg" + "commandLineArgs": "\"C:\\Users\\halmaia\\Downloads\\Sonar_2023-08-06_12.43.36.sl3\" F:\\DS\\ -DS" } } } diff --git a/SL3Reader.cs b/SL3Reader.cs index 829eceb..6c12c97 100644 --- a/SL3Reader.cs +++ b/SL3Reader.cs @@ -275,7 +275,7 @@ public unsafe void ExportImagery(string path, SurveyType surveyType = SurveyType out Span fileBuffer, out Span pixelData); - byte* offset = ((Frame*)imageFrames[0])->FrameType is FrameType.Basic ? (byte*)Frame.BasicSize : (byte*)Frame.ExtendedSizeV10; + byte* offset = (byte*)((Frame*)imageFrames[0])->RelativeDataOffset; fixed (byte* pixelPtr = pixelData) for (int j = first, k = 0; j < final; j++) @@ -290,9 +290,9 @@ public unsafe void ExportImagery(string path, SurveyType surveyType = SurveyType // World file // TODO: Remove intermediate solution: - var firstStrip = AugmentedCoordinates[Frames.IndexOf(imageFrames[first])]; - var lastStrip = AugmentedCoordinates[Frames.IndexOf(imageFrames[final - 1])]; - var lastFrame = (Frame*)imageFrames[final - 1]; + GeoPoint firstStrip = AugmentedCoordinates[Frames.IndexOf(imageFrames[first])]; + GeoPoint lastStrip = AugmentedCoordinates[Frames.IndexOf(imageFrames[final - 1])]; + Frame* lastFrame = (Frame*)imageFrames[final - 1]; // TODO: Nem jó! double XSize = -(lastStrip.Distance - firstStrip.Distance) / (final - first);