Table of Contents

Class Zone

Namespace
Geotab.Checkmate.ObjectModel
Assembly
Geotab.Checkmate.ObjectModel.dll

Sometimes referred to as a "Geofence", a zone is a virtual geographic boundary, defined by its points representing a real-world geographic area.

[ReportClass]
public class Zone : NameEntityWithVersion, IEntity, IComparable, IIdentifiable, IVersion, IGroupLinked, IDefaultable
Inheritance
Zone
Implements
Derived
Inherited Members
Extension Methods

Constructors

Zone()

Initializes a new instance of the Zone class.

public Zone()

Zone(Id?)

Initializes a new instance of the Zone class.

public Zone(Id? id)

Parameters

id Id

The identifier.

Zone(Id?, long?, string?, string?, bool?, IList<ZoneType>?, IList<ISimpleCoordinate>?, DateTime?, DateTime?, Color?, bool?, IList<Group>?, string?, GeometryType?)

Initializes a new instance of the Zone class. Construct a new zone, providing the earthPolygon or the extent. If the earthPolygon is provided, the extent is not used.

public Zone(Id? id, long? version, string? name, string? comment, bool? displayed, IList<ZoneType>? zoneTypes, IList<ISimpleCoordinate>? polygonPoints, DateTime? activeFromValue, DateTime? activeToValue, Color? color, bool? mustIdentifyStops, IList<Group>? groups, string? externalReference = null, GeometryType? geometryType = null)

Parameters

id Id

The identifier.

version long?

The version.

name string

The Zone's name.

comment string

The Zone's comment.

displayed bool?

The Zone's visibility flag.

zoneTypes IList<ZoneType>

The Zone's collection of ZoneType(s).

polygonPoints IList<ISimpleCoordinate>

The Zone's collection of ISimpleCoordinate points representing its borders.

activeFromValue DateTime?

A value indicating when this Zone begins its active lifespan.

activeToValue DateTime?

A value indicating when this Zone finishes its active lifespan.

color Color

The Zone's. Color

mustIdentifyStops bool?

When set to true, the Zone's is linked to a matching stop Rule.

groups IList<Group>

Group collection this zone belongs to.

externalReference string

Allow customers to reference data from their own system.

geometryType GeometryType?

The geometry type of the Zone. See GeometryType.

Zone(Id?, string?, string?, bool?, IList<ZoneType>?, IList<ISimpleCoordinate>?, DateTime?, DateTime?, Color?, bool?, IList<Group>?, string?)

Initializes a new instance of the Zone class. Construct a new zone, providing the earthPolygon or the extent. If the earthPolygon is provided, the extent is not used.

[Obsolete("Use constructor with 'version' parameter.", false)]
public Zone(Id? id, string? name, string? comment, bool? displayed, IList<ZoneType>? zoneTypes, IList<ISimpleCoordinate>? polygonPoints, DateTime? activeFromValue, DateTime? activeToValue, Color? color, bool? mustIdentifyStops, IList<Group>? groups, string? externalReference = null)

Parameters

id Id

The identifier.

name string

The Zone's name.

comment string

The Zone's comment.

displayed bool?

The Zone's visibility flag.

zoneTypes IList<ZoneType>

The Zone's collection of ZoneType(s).

polygonPoints IList<ISimpleCoordinate>

The Zone's collection of ISimpleCoordinate points representing its borders.

activeFromValue DateTime?

A value indicating when this Zone begins its active lifespan.

activeToValue DateTime?

A value indicating when this Zone finishes its active lifespan.

color Color

The Zone's. Color

mustIdentifyStops bool?

When set to true, the Zone's is linked to a matching stop Rule.

groups IList<Group>

Group collection this zone belongs to.

externalReference string

Allow customers to reference data from their own system.

Zone(Zone)

Initializes a new instance of the Zone class.

protected Zone(Zone zone)

Parameters

zone Zone

The zone.

Fields

AreaZoneColor

false The color for all other zones.

public static readonly Color AreaZoneColor

Field Value

Color

CustomerZoneColor

false The color for customer zones.

public static readonly Color CustomerZoneColor

Field Value

Color

HomeZoneColor

false The color for home zones.

public static readonly Color HomeZoneColor

Field Value

Color

InHouseServiceCenterZoneColor

false The color for in-house service center zones.

public static readonly Color InHouseServiceCenterZoneColor

Field Value

Color

OfficeZoneColor

false The color for office zones.

public static readonly Color OfficeZoneColor

Field Value

Color

VendorServiceCenterZoneColor

false The color for vendor service center zones.

public static readonly Color VendorServiceCenterZoneColor

Field Value

Color

Properties

ActiveFrom

Gets or sets the date indicating when this zone begins it's active lifespan. Default [UtcNow].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneStartTime })]
public DateTime? ActiveFrom { get; set; }

Property Value

DateTime?

ActiveFrom

ActiveTo

Gets or sets the date indicating when this zone finishes it's active lifespan. Default [MaxDate].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneEndTime })]
public DateTime? ActiveTo { get; set; }

Property Value

DateTime?

ActiveTo

CentroidLatitude

Gets the latitude coordinate of the zone's centroid.

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneCentroidLatitude })]
public double? CentroidLatitude { get; }

Property Value

double?

The centroid latitude.

CentroidLongitude

Gets the longitude coordinate of the zone's centroid.

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneCentroidLongitude })]
public double? CentroidLongitude { get; }

Property Value

double?

The centroid longitude.

Comment

Gets or sets a free text field where any user information can be stored and referenced for this entity. Default [""].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneComment })]
public string? Comment { get; set; }

Property Value

string

User comments.

Displayed

Gets or sets a value indicating whether this zone must be displayed when viewing a map or it should be hidden. Default [true].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneDisplayed })]
public bool? Displayed { get; set; }

Property Value

bool?

True if the zone will be viable on the map.

Extent

Gets the zone's extent.

public IList<ISimpleCoordinate>? Extent { get; }

Property Value

IList<ISimpleCoordinate>

The zone's extent.

ExternalReference

Gets or sets external Reference. Any type of external reference you would like to attach to the zone. For example; an ID from another data source referenced when exporting zone data into another program. Maximum length [255] Default [""].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneExternalReference })]
public string? ExternalReference { get; set; }

Property Value

string

ExternalReference

FillColor

Gets or sets the Color of the fill for this zone when showing on a map. Default [based on zone type; Customer: Orange, Office: Light Orange, Home: Green, Other: Blue].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneFillColor })]
public Color? FillColor { get; set; }

Property Value

Color

FillColor

GeometryType

Gets or sets the geometry type of the zone.

public GeometryType? GeometryType { get; set; }

Property Value

GeometryType?

GeometryType

Groups

Gets or sets the group(s) this zone belongs to.

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneGroup }, IsList = true)]
public IList<Group>? Groups { get; set; }

Property Value

IList<Group>

Groups

Id

Gets or sets the unique identifier for this entity. See Id.

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneId })]
public override Id? Id { get; set; }

Property Value

Id

The Id.

Length

Gets or sets the zone's Length in km

public double? Length { get; set; }

Property Value

double?

Length

Metadata

Gets or sets the zone metadata.

public Dictionary<ZoneMetadataType, string>? Metadata { get; set; }

Property Value

Dictionary<ZoneMetadataType, string>

Metadata

MustIdentifyStops

Gets or sets whether this zone name must be shown when devices stop in this zone. If [true] a "zone stop rule" (Rule with BaseType: ZoneStop) will automatically be created for this zone. This is to facilitate reporting on zone stops. The rule is not visible via the UI. Default [true].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneIsStopExceptionRequired })]
public bool? MustIdentifyStops { get; set; }

Property Value

bool?

MustIdentifyStops

Name

Gets or sets the name of this entity which identifies it and is used when displaying this entity.

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneName })]
public override string? Name { get; set; }

Property Value

string

The name.

Points

Gets or sets the list of points (see <xref href="Geotab.Checkmate.ObjectModel.Coordinate" data-throw-if-not-resolved="false"></xref>) that make up this zone. A zone should be closed, the first point is the same coordinate as the last point.
It is possible to add a zone with an unclosed set of points but the points will be closed by the system.
public IList<ISimpleCoordinate>? Points { get; set; }

Property Value

IList<ISimpleCoordinate>

List of points that make up the zone.

ZoneTypes

Gets or sets the list of ZoneType(s) this zone belongs to. Default [Customer].

[ExcelColumnHeader(new ReportHeading[] { ReportHeading.ZoneZoneTypes }, IsList = true)]
public IList<ZoneType>? ZoneTypes { get; set; }

Property Value

IList<ZoneType>

ZoneTypes

Methods

Clone()

Creates a new object that is a copy of the current instance.

public override IEntity Clone()

Returns

IEntity

A new object that is a copy of this instance.

DistanceFrom(double, double)

Gets the distance from this zone's closest border to the point in meters. If the point is inside, the distance is 0.

public double DistanceFrom(double lon, double lat)

Parameters

lon double

The longitude.

lat double

The latitude.

Returns

double

The minimum distance to the border.

GetDetails()

The zone's polygon if different from its rectangular extent. When a polygon has all points on the extent box the two are considered equivalent. Internally used by the ZoneBridge.

public IList<ISimpleCoordinate>? GetDetails()

Returns

IList<ISimpleCoordinate>

List of coordinates that define the zone.

Intersects(double, double)

Determine whether the coordinate is inside the zone.

public bool Intersects(double lon, double lat)

Parameters

lon double

The longitude.

lat double

The latitude.

Returns

bool

If true, the coordinate is inside the zone.

PopulateDefaults()

Populate non-required empty (null) properties with default values.

public void PopulateDefaults()

PopulateExtent()

Populates the zone's extent from the current polygonPoints Also internally used by the ZoneBridge.

public void PopulateExtent()

ToString()

Returns a string that represents the current. object

public override string ToString()

Returns

string

A string that represents the current. object