Skip to content

Commit

Permalink
Frame V13 support added for imagery.
Browse files Browse the repository at this point in the history
  • Loading branch information
halmaia committed Aug 7, 2023
1 parent 7129a6a commit 71a4140
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion BitmapCompressionMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ internal enum BitmapCompressionMode : uint
BI_BITFIELDS = 3,
BI_JPEG = 4,
BI_PNG = 5
}
};
}
2 changes: 2 additions & 0 deletions Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
8 changes: 4 additions & 4 deletions SL3Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public unsafe void ExportImagery(string path, SurveyType surveyType = SurveyType
out Span<byte> fileBuffer,
out Span<byte> 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++)
Expand All @@ -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);
Expand Down

0 comments on commit 71a4140

Please sign in to comment.