Skip to content

Commit

Permalink
[Aardvark.Data.E57] LangVersion 12; remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmaierhofer committed Jul 23, 2024
1 parent b0ed98c commit a6fb321
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
22 changes: 11 additions & 11 deletions src/Aardvark.Algodat.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ internal static void Test_Import_Regression()

var key = Path.GetFileName(filename);

var storePath = $@"W:\aardvark\stores_noparts\{key}";
var storePath = $@"T:\tmp_regression\{key}";
Directory.CreateDirectory(storePath);
using var storeRaw = new SimpleDiskStore(Path.Combine(storePath, "data.uds"));
var store = storeRaw.ToPointCloudStore();
Expand All @@ -1831,10 +1831,10 @@ internal static void Test_Import_Regression()
.WithKey(key)
.WithVerbose(true)
.WithMaxDegreeOfParallelism(0)
//.WithMinDist(0.0025)
//.WithNormalizePointDensityGlobal(true)
.WithMinDist(0)
.WithNormalizePointDensityGlobal(false)
.WithMinDist(0.005)
.WithNormalizePointDensityGlobal(true)
//.WithMinDist(0)
//.WithNormalizePointDensityGlobal(false)
//.WithProgressCallback(p => { Report.Line($"{p:0.00}"); })
//.WithEnabledPartIndices(false)
;
Expand Down Expand Up @@ -2763,13 +2763,13 @@ public static async Task Main(string[] _)
{
await Task.CompletedTask; // avoid warning if no async methods are called here ...

//Test_Import_Regression();
Test_Import_Regression();

await CreateStore(
@"W:\Datasets\Vgm\Data\2024-04-04_bugreport\Bestand.e57",
@"T:\tmp\issue72_Bestand.e57",
minDist: 0.005
);
//await CreateStore(
// @"W:\Datasets\Vgm\Data\2024-04-04_bugreport\Bestand.e57",
// @"T:\tmp\issue72_Bestand.e57",
// minDist: 0.005
// );

//{
// var chunks = E57.Chunks(@"W:\Datasets\Vgm\Data\2024-04-30_bugreport\F_240205.e57", ParseConfig.Default);
Expand Down
15 changes: 8 additions & 7 deletions src/Aardvark.Data.E57/ASTM_E57.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ public static class ASTM_E57
/// <summary>
/// Physical E57 file offset.
/// </summary>
public readonly struct E57PhysicalOffset
public readonly struct E57PhysicalOffset(long value)
{
public readonly long Value;
public E57PhysicalOffset(long value) => Value
= (value % 1024 < 1020) ? value : throw new ArgumentException($"E57PhysicalOffset must not point to checksum bytes. ({value}).");
public readonly long Value = (value % 1024 < 1020)
? value
: throw new ArgumentException($"E57PhysicalOffset must not point to checksum bytes. ({value}).")
;

public static E57PhysicalOffset operator +(E57PhysicalOffset a, E57PhysicalOffset b) => new(a.Value + b.Value);
public static E57LogicalOffset operator +(E57PhysicalOffset a, E57LogicalOffset b) => (E57LogicalOffset)a + b;
Expand All @@ -59,10 +60,10 @@ public E57PhysicalOffset(long value) => Value
/// <summary>
/// Logical E57 file offset.
/// </summary>
public readonly struct E57LogicalOffset
public readonly struct E57LogicalOffset(long value)
{
public readonly long Value;
public E57LogicalOffset(long value) { Value = value; }
public readonly long Value = value;

public static E57LogicalOffset operator +(E57LogicalOffset a, E57LogicalOffset b) => new(a.Value + b.Value);
public static E57LogicalOffset operator +(E57LogicalOffset a, int b) => new(a.Value + b);
public static explicit operator E57PhysicalOffset(E57LogicalOffset a) => new(a.Value + (a.Value / 1020 * 4));
Expand Down
2 changes: 2 additions & 0 deletions src/Aardvark.Data.E57/BitPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ You should have received a copy of the GNU Affero General Public License
using System;
using System.Runtime.CompilerServices;

#pragma warning disable IDE0130 // Namespace does not match folder structure

namespace Aardvark.Base
{
/// <summary></summary>
Expand Down
4 changes: 3 additions & 1 deletion src/Aardvark.Data.E57/ImportE57.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ You should have received a copy of the GNU Affero General Public License
using System.Xml.Linq;
using static Aardvark.Data.E57.ASTM_E57;

#pragma warning disable IDE0130 // Namespace does not match folder structure

namespace Aardvark.Data.Points.Import
{
/// <summary>
Expand All @@ -38,7 +40,7 @@ public static partial class E57

static E57()
{
E57Format = new PointCloudFileFormat("e57", new[] { ".e57" }, E57Info, Chunks);
E57Format = new PointCloudFileFormat("e57", [".e57"], E57Info, Chunks);
PointCloudFileFormat.Register(E57Format);
}

Expand Down
8 changes: 5 additions & 3 deletions src/Aardvark.Data.E57/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using System.Linq;
using PPS = Aardvark.Data.E57.PointPropertySemantics;

#pragma warning disable IDE0130 // Namespace does not match folder structure

namespace System.Runtime.CompilerServices
{
internal class IsExternalInit { }
Expand Down Expand Up @@ -86,7 +88,7 @@ internal interface IValueBuffer

internal class ValueBuffer<T> : IValueBuffer
{
private List<T> _value = new();
private List<T> _value = [];
public void AddRange(T[] xs) => _value.AddRange(xs);
public int Count => _value.Count;
public Array Consume(int n)
Expand All @@ -95,7 +97,7 @@ public Array Consume(int n)
T[] result;
if (n == _value.Count)
{
result = _value.ToArray();
result = [.. _value];
_value.Clear();
}
else
Expand All @@ -109,7 +111,7 @@ public Array Consume(int n)

internal class ValueBufferSet
{
private readonly Dictionary<PPS, IValueBuffer> _data = new();
private readonly Dictionary<PPS, IValueBuffer> _data = [];

public ValueBufferSet(IEnumerable<PPS> keys)
{
Expand Down

0 comments on commit a6fb321

Please sign in to comment.