Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usage of STJ for .net 8 #168

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
Expand All @@ -29,9 +29,10 @@
<PackageVersion Include="SimpleExec" Version="12.0.0" />
<PackageVersion Include="Speckle.Objects" Version="3.1.0-dev.109" />
<PackageVersion Include="System.Threading.Channels" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="5.0.0" />
<GlobalPackageReference Include="PolySharp" Version="1.14.1" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="GitVersion.MsBuild" Version="5.12.0" />
<GlobalPackageReference Include="Speckle.InterfaceGenerator" Version="0.9.6" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions src/Speckle.Objects/GIS/GisPointFeature.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Geometry;
using Speckle.Sdk.Models;

Expand All @@ -9,7 +8,8 @@ public class GisPointFeature : Base, IGisFeature, IDisplayValue<List<Point>>
{
public required Base attributes { get; set; }

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<Point> geometry
{
get => displayValue;
Expand Down
4 changes: 2 additions & 2 deletions src/Speckle.Objects/GIS/GisPolylineFeature.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Geometry;
using Speckle.Sdk.Models;

Expand All @@ -9,7 +8,8 @@ public class GisPolylineFeature : Base, IGisFeature, IDisplayValue<List<Polyline
{
public required Base attributes { get; set; }

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<Polyline> geometry
{
get => displayValue;
Expand Down
17 changes: 12 additions & 5 deletions src/Speckle.Objects/Geometry/Arc.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Other;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Common;
Expand Down Expand Up @@ -42,19 +41,25 @@ public class Arc : Base, IHasBoundingBox, ICurve, ITransformable<Arc>
/// <summary>
/// OBSOLETE - This is just here for backwards compatibility.
/// </summary>
[JsonIgnore, Obsolete("start angle should be calculated from arc startpoint and plane if needed", true)]
[Obsolete("start angle should be calculated from arc startpoint and plane if needed", true)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public double? startAngle { get; set; }

/// <summary>
/// OBSOLETE - This is just here for backwards compatibility.
/// </summary>
[JsonIgnore, Obsolete("end angle should be calculated from arc endpoint and plane if needed", true)]
[Obsolete("end angle should be calculated from arc endpoint and plane if needed", true)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public double? endAngle { get; set; }

/// <summary>
/// OBSOLETE - This is just here for backwards compatibility.
/// </summary>
[JsonIgnore, Obsolete("Refer to measure instead", true)]
[Obsolete("Refer to measure instead", true)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public double angleRadians { get; set; }

/// <summary>
Expand All @@ -81,7 +86,9 @@ public class Arc : Base, IHasBoundingBox, ICurve, ITransformable<Arc>
/// <summary>
/// OBSOLETE - This is just here for backwards compatibility.
/// </summary>
[JsonIgnore, Obsolete("Area property does not belong on an arc", true)]
[Obsolete("Area property does not belong on an arc", true)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public double area { get; set; }

/// <inheritdoc/>
Expand Down
9 changes: 6 additions & 3 deletions src/Speckle.Objects/Geometry/Box.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Common;
using Speckle.Sdk.Models;
Expand All @@ -11,7 +10,9 @@ namespace Speckle.Objects.Geometry;
[SpeckleType("Objects.Geometry.Box")]
public class Box : Base, IHasVolume, IHasArea, IHasBoundingBox
{
[JsonIgnore, Obsolete("Use plane property instead", true)]
[Obsolete("Use plane property instead", true)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public Plane basePlane
{
get => plane;
Expand Down Expand Up @@ -49,7 +50,9 @@ public Plane basePlane
/// <inheritdoc/>
public double area => 2 * (xSize.Length * ySize.Length + xSize.Length * zSize.Length + ySize.Length * zSize.Length);

[JsonIgnore, Obsolete("Boxs should not have a bounding box", true)]
[Obsolete("Boxs should not have a bounding box", true)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public Box? bbox { get; }

/// <inheritdoc/>
Expand Down
33 changes: 24 additions & 9 deletions src/Speckle.Objects/Geometry/Brep.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Runtime.Serialization;
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Other;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Common;
Expand All @@ -25,7 +24,9 @@ public class Brep : Base, IHasArea, IHasVolume, IHasBoundingBox, ITransformable<
/// <summary>
/// Gets or sets the list of surfaces in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<Surface> Surfaces { get; set; }

/// <summary>
Expand Down Expand Up @@ -68,7 +69,9 @@ public List<double> SurfacesValue
/// <summary>
/// Gets or sets the list of 3-dimensional curves in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<ICurve> Curve3D { get; set; }

/// <summary>
Expand All @@ -93,7 +96,9 @@ public List<double> Curve3DValues
/// <summary>
/// Gets or sets the list of 2-dimensional UV curves in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<ICurve> Curve2D { get; set; }

/// <summary>
Expand All @@ -118,7 +123,9 @@ public List<double> Curve2DValues
/// <summary>
/// Gets or sets the list of vertices in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<Point> Vertices { get; set; }

/// <summary>
Expand Down Expand Up @@ -158,7 +165,9 @@ public List<double> VerticesValue
/// <summary>
/// Gets or sets the list of edges in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<BrepEdge> Edges { get; set; }

/// <summary>
Expand Down Expand Up @@ -232,7 +241,9 @@ public List<double?> EdgesValue
/// <summary>
/// Gets or sets the list of closed UV loops in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<BrepLoop> Loops { get; set; }

/// <summary>
Expand Down Expand Up @@ -288,7 +299,9 @@ public List<int> LoopsValue
/// <summary>
/// Gets or sets the list of UV trim segments for each surface in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<BrepTrim> Trims { get; set; }

/// <summary>
Expand Down Expand Up @@ -354,7 +367,9 @@ public List<int> TrimsValue
/// <summary>
/// Gets or sets the list of faces in this <see cref="Brep"/> instance.
/// </summary>
[JsonIgnore]

[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required List<BrepFace> Faces { get; set; }

/// <summary>
Expand Down
16 changes: 10 additions & 6 deletions src/Speckle.Objects/Geometry/BrepEdge.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Models;

Expand All @@ -10,7 +9,8 @@ namespace Speckle.Objects.Geometry;
[SpeckleType("Objects.Geometry.BrepEdge")]
public class BrepEdge : Base
{
[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required Brep Brep { get; set; }

public required int Curve3dIndex { get; set; }
Expand All @@ -22,15 +22,19 @@ public class BrepEdge : Base

public required Interval Domain { get; set; }

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public Point StartVertex => Brep.Vertices[StartIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public Point EndVertex => Brep.Vertices[EndIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public IEnumerable<BrepTrim> Trims => TrimIndices.Select(i => Brep.Trims[i]);

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public ICurve Curve => Brep.Curve3D[Curve3dIndex];
}
13 changes: 8 additions & 5 deletions src/Speckle.Objects/Geometry/BrepFace.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Sdk.Models;

namespace Speckle.Objects.Geometry;
Expand All @@ -9,20 +8,24 @@ namespace Speckle.Objects.Geometry;
[SpeckleType("Objects.Geometry.BrepFace")]
public class BrepFace : Base
{
[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required Brep Brep { get; set; }

public required int SurfaceIndex { get; set; }
public required List<int> LoopIndices { get; set; }
public required int OuterLoopIndex { get; set; }
public required bool OrientationReversed { get; set; }

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public BrepLoop OuterLoop => Brep.Loops[OuterLoopIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public Surface Surface => Brep.Surfaces[SurfaceIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public List<BrepLoop> Loops => LoopIndices.Select(i => Brep.Loops[i]).ToList();
}
10 changes: 6 additions & 4 deletions src/Speckle.Objects/Geometry/BrepLoop.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Sdk.Models;

namespace Speckle.Objects.Geometry;
Expand All @@ -9,16 +8,19 @@ namespace Speckle.Objects.Geometry;
[SpeckleType("Objects.Geometry.BrepLoop")]
public class BrepLoop : Base
{
[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required Brep Brep { get; set; }

public required int FaceIndex { get; set; }
public required List<int> TrimIndices { get; set; }
public required BrepLoopType Type { get; set; }

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public BrepFace Face => Brep.Faces[FaceIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public List<BrepTrim> Trims => TrimIndices.Select(i => Brep.Trims[i]).ToList();
}
16 changes: 10 additions & 6 deletions src/Speckle.Objects/Geometry/BrepTrim.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Primitive;
using Speckle.Sdk.Models;

Expand All @@ -10,7 +9,8 @@ namespace Speckle.Objects.Geometry;
[SpeckleType("Objects.Geometry.BrepTrim")]
public class BrepTrim : Base
{
[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public required Brep Brep { get; set; }
public required int EdgeIndex { get; set; }
public required int StartIndex { get; set; }
Expand All @@ -24,15 +24,19 @@ public class BrepTrim : Base

public required Interval Domain { get; set; }

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public BrepFace Face => Brep.Faces[FaceIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public BrepLoop Loop => Brep.Loops[LoopIndex];

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public BrepEdge? Edge => EdgeIndex != -1 ? Brep.Edges[EdgeIndex] : null;

[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public ICurve Curve2d => Brep.Curve2D[CurveIndex];
}
6 changes: 4 additions & 2 deletions src/Speckle.Objects/Geometry/ControlPoint.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Speckle.Newtonsoft.Json;
using Speckle.Objects.Other;
using Speckle.Sdk.Models;

Expand All @@ -23,7 +22,10 @@ public ControlPoint(double x, double y, double z, double w, string units, string
/// OBSOLETE - This is just here for backwards compatibility.
/// </summary>
[
JsonProperty(NullValueHandling = NullValueHandling.Ignore),
Speckle.Newtonsoft.Json.JsonProperty(NullValueHandling = Speckle.Newtonsoft.Json.NullValueHandling.Ignore),
System.Text.Json.Serialization.JsonIgnore(
Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull
),
Obsolete("Access coordinates using XYZ and weight fields", true)
]
private new List<double> value
Expand Down
Loading
Loading