Skip to content
Open
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
7 changes: 6 additions & 1 deletion src/MeshKernelNET/Api/PropertyType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public enum PropertyType
/// <summary>
/// The circumcenter of the mesh faces.
/// </summary>
FaceCircumcenter = 2
FaceCircumcenter = 2,

/// <summary>
/// The bounding box of the mesh faces.
/// </summary>
FaceBounds = 4
}
}
42 changes: 42 additions & 0 deletions test/MeshKernelNETTest/Api/MeshKernelApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2639,13 +2639,55 @@ public void Mesh2dGetPropertyFaceCircumcenterThroughApi()
}
}

[Test]
public void Mesh2dGetPropertyFaceBoundsThroughApi()
{
// Setup
using (var api = new MeshKernelApi())
using (DisposableMesh2D mesh = CreateMesh2D(4, 4, 100, 200))
{
var propertyValues = new DisposableGeometryList();
try
{
// Prepare
int id = api.AllocateState(0);
Assert.That(api.Mesh2dSet(id, mesh), Is.EqualTo(0));

// Execute
Assert.That(api.Mesh2dGetProperty(id, PropertyType.FaceBounds, LocationType.Faces, out propertyValues), Is.EqualTo(0));

// Assert
Assert.That(propertyValues.NumberOfCoordinates, Is.EqualTo(54));
Assert.That(propertyValues.XCoordinates[0], Is.EqualTo(0.0));
Assert.That(propertyValues.YCoordinates[0], Is.EqualTo(0.0));
Assert.That(propertyValues.XCoordinates[1], Is.EqualTo(100.0));
Assert.That(propertyValues.YCoordinates[1], Is.EqualTo(0.0));
Assert.That(propertyValues.XCoordinates[2], Is.EqualTo(100.0));
Assert.That(propertyValues.YCoordinates[2], Is.EqualTo(200.0));
Assert.That(propertyValues.XCoordinates[3], Is.EqualTo(0.0));
Assert.That(propertyValues.YCoordinates[3], Is.EqualTo(200.0));
Assert.That(propertyValues.XCoordinates[4], Is.EqualTo(-999.0));
Assert.That(propertyValues.YCoordinates[4], Is.EqualTo(-999.0));
Assert.That(propertyValues.XCoordinates[5], Is.EqualTo(-999.0));
Assert.That(propertyValues.YCoordinates[5], Is.EqualTo(-999.0));
}
finally
{
api.ClearState();
propertyValues.Dispose();
}
}
}

[Test]
[TestCase(PropertyType.Orthogonality, LocationType.Faces)]
[TestCase(PropertyType.Orthogonality, LocationType.Nodes)]
[TestCase(PropertyType.EdgeLength, LocationType.Faces)]
[TestCase(PropertyType.EdgeLength, LocationType.Nodes)]
[TestCase(PropertyType.FaceCircumcenter, LocationType.Nodes)]
[TestCase(PropertyType.FaceCircumcenter, LocationType.Edges)]
[TestCase(PropertyType.FaceBounds, LocationType.Edges)]
[TestCase(PropertyType.FaceBounds, LocationType.Nodes)]
public void Mesh2dGetPropertyWithInvalidLocationThroughApi(PropertyType propertyType, LocationType locationType)
{
// Setup
Expand Down