Table of Contents

Class Geofence

Namespace
Pamoja.Kit
Assembly
Pamoja.Kit.dll

Keeps a tracked point inside an area, and notices when it leaves.

public sealed class Geofence : IDisposable
Inheritance
Geofence
Implements
Inherited Members

Examples

using var pen = new Geofence(new Coordinate(-1.2921, 36.8219), 50.0);
pen.Update(new Coordinate(-1.2921, 36.8219)); // Boundary.Inside
pen.Update(new Coordinate(-1.2930, 36.8219)); // Boundary.Exited

Remarks

A fence is a centre and a radius. Feeding it successive fixes reports whether each is inside or outside and, crucially, the single fix that crossed, so an alert fires once on the crossing rather than on every fix while away.

Constructors

Geofence(Coordinate, double)

Creates a circular fence around a centre fix.

public Geofence(Coordinate center, double radiusM)

Parameters

center Coordinate

The centre of the fence.

radiusM double

The fence radius, in metres.

Exceptions

PamojaException

The native fence could not be created.

Methods

Contains(Coordinate)

Reports whether a fix lies inside, without recording a crossing.

public bool Contains(Coordinate point)

Parameters

point Coordinate

The fix to test.

Returns

bool

true if the fix is inside the fence.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Update(Coordinate)

Feeds a fix in and reports where it sits, including a crossing.

public Boundary Update(Coordinate point)

Parameters

point Coordinate

The latest fix.

Returns

Boundary

The boundary state for this fix.