Skip to content
Merged
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
35 changes: 19 additions & 16 deletions src/MeshKernelNET/Api/IMeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace MeshKernelNET.Api
{
/// <summary>
/// Provides an API for mesh generation, manipulation, and analysis operations via the MeshKernel library.
/// </summary>
public interface IMeshKernelApi : IDisposable
{
/// <summary>
Expand Down Expand Up @@ -642,19 +645,19 @@ int CurvilinearSmoothingDirectional(int meshKernelId,
/// </summary>
/// <param name="meshKernelId">The ID of the mesh state</param>
/// <param name="land">The land boundary</param>
/// <param name="sectionControlPoint1x">Start point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint1y">Start point y-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2x">End point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2y">End point y-coordinate for the boundary section</param>
/// <param name="sectionControlPoint1X">Start point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint1Y">Start point y-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2X">End point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2Y">End point y-coordinate for the boundary section</param>
/// <param name="regionControlPointX">X-coordinate of the region-defining point; if equal to double missing value, use the default region</param>
/// <param name="regionControlPointY">Y-coordinate of the region-defining point; if equal to double missing value, use the default region</param>
/// <returns>Error code</returns>
int CurvilinearSnapToLandBoundary(int meshKernelId,
DisposableGeometryList land,
double sectionControlPoint1x,
double sectionControlPoint1y,
double sectionControlPoint2x,
double sectionControlPoint2y,
double sectionControlPoint1X,
double sectionControlPoint1Y,
double sectionControlPoint2X,
double sectionControlPoint2Y,
double regionControlPointX,
double regionControlPointY);

Expand All @@ -663,19 +666,19 @@ int CurvilinearSnapToLandBoundary(int meshKernelId,
/// </summary>
/// <param name="meshKernelId">The ID of the mesh state</param>
/// <param name="spline">The land boundary</param>
/// <param name="sectionControlPoint1x">Start point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint1y">Start point y-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2x">End point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2y">End point y-coordinate for the boundary section</param>
/// <param name="sectionControlPoint1X">Start point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint1Y">Start point y-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2X">End point x-coordinate for the boundary section</param>
/// <param name="sectionControlPoint2Y">End point y-coordinate for the boundary section</param>
/// <param name="regionControlPointX">X-coordinate of the region-defining point; if equal to double missing value, use the default region</param>
/// <param name="regionControlPointY">Y-coordinate of the region-defining point; if equal to double missing value, use the default region</param>
/// <returns>Error code</returns>
int CurvilinearSnapToSpline(int meshKernelId,
DisposableGeometryList spline,
double sectionControlPoint1x,
double sectionControlPoint1y,
double sectionControlPoint2x,
double sectionControlPoint2y,
double sectionControlPoint1X,
double sectionControlPoint1Y,
double sectionControlPoint2X,
double sectionControlPoint2Y,
double regionControlPointX,
double regionControlPointY);

Expand Down
47 changes: 23 additions & 24 deletions src/MeshKernelNET/Api/MeshKernelApi.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using MeshKernelNET.Helpers;
using MeshKernelNET.Native;

namespace MeshKernelNET.Api
{
[ExcludeFromCodeCoverage]
// Excluded because it is tested through the MeshKernelApiRemote
// DotCover on the build server does not work correctly with remoting
/// <summary>
/// Provides an API for mesh generation, manipulation, and analysis operations via the MeshKernel library.
/// </summary>
public sealed class MeshKernelApi : IMeshKernelApi
{
/// <inheritdoc/>
Expand Down Expand Up @@ -175,14 +174,14 @@ public int CurvilinearConvertToMesh2D(int meshKernelId)

public int CurvilinearDeleteExterior(int meshKernelId, BoundingBox boundingBox)
{
BoundingBoxNative boundingBoxNative = boundingBox.ToBoundingBoxNative();
var boundingBoxNative = boundingBox.ToBoundingBoxNative();
return MeshKernelDll.CurvilinearDeleteExterior(meshKernelId, ref boundingBoxNative);
}

public int CurvilinearDeleteInterior(int meshKernelId,
BoundingBox boundingBox)
{
BoundingBoxNative boundingBoxNative = boundingBox.ToBoundingBoxNative();
var boundingBoxNative = boundingBox.ToBoundingBoxNative();
return MeshKernelDll.CurvilinearDeleteInterior(meshKernelId, ref boundingBoxNative);
}

Expand Down Expand Up @@ -228,7 +227,7 @@ public int CurvilinearGridGetData(int meshKernelId, out DisposableCurvilinearGri

public int CurvilinearGetBoundariesAsPolygons(int meshKernelId, int lowerLeftN, int lowerLeftM, int upperRightN, int upperRightM, out DisposableGeometryList boundaryPolygons)
{
int numberOfPolygonNodes = 0;
var numberOfPolygonNodes = 0;
boundaryPolygons = new DisposableGeometryList();
int exitCode = MeshKernelDll.CurvilinearCountGetBoundariesAsPolygons(meshKernelId,
lowerLeftN,
Expand Down Expand Up @@ -612,40 +611,40 @@ public int CurvilinearSmoothingDirectional(int meshKernelId,

public int CurvilinearSnapToLandBoundary(int meshKernelId,
DisposableGeometryList land,
double sectionControlPoint1x,
double sectionControlPoint1y,
double sectionControlPoint2x,
double sectionControlPoint2y,
double sectionControlPoint1X,
double sectionControlPoint1Y,
double sectionControlPoint2X,
double sectionControlPoint2Y,
double regionControlPointX,
double regionControlPointY)
{
var geometryListNative = land.CreateNativeObject();
return MeshKernelDll.CurvilinearSnapToLandBoundary(meshKernelId,
ref geometryListNative,
sectionControlPoint1x,
sectionControlPoint1y,
sectionControlPoint2x,
sectionControlPoint2y,
sectionControlPoint1X,
sectionControlPoint1Y,
sectionControlPoint2X,
sectionControlPoint2Y,
regionControlPointX,
regionControlPointY);
}

public int CurvilinearSnapToSpline(int meshKernelId,
DisposableGeometryList spline,
double sectionControlPoint1x,
double sectionControlPoint1y,
double sectionControlPoint2x,
double sectionControlPoint2y,
double sectionControlPoint1X,
double sectionControlPoint1Y,
double sectionControlPoint2X,
double sectionControlPoint2Y,
double regionControlPointX,
double regionControlPointY)
{
var geometryListNative = spline.CreateNativeObject();
return MeshKernelDll.CurvilinearSnapToSpline(meshKernelId,
ref geometryListNative,
sectionControlPoint1x,
sectionControlPoint1y,
sectionControlPoint2x,
sectionControlPoint2y,
sectionControlPoint1X,
sectionControlPoint1Y,
sectionControlPoint2X,
sectionControlPoint2Y,
regionControlPointX,
regionControlPointY);
}
Expand Down Expand Up @@ -942,7 +941,7 @@ public int Mesh2dComputeOrthogonalization(int meshKernelId,
public int Mesh2dMergeMeshes(int meshKernelId,
DisposableMesh2D disposableMesh2D)
{
GeometryListNative geometryListPolygonNative = new GeometryListNative { numberOfCoordinates = 0 };
var geometryListPolygonNative = new GeometryListNative { numberOfCoordinates = 0 };
Mesh2DNative mesh2D = disposableMesh2D.CreateNativeObject();
return MeshKernelDll.Mesh2dConnectMeshes(meshKernelId,
ref mesh2D,
Expand Down
Loading