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
IdThe 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
IdThe identifier.
version
long?The version.
name
stringThe Zone's name.
comment
stringThe Zone's comment.
displayed
bool?The Zone's visibility flag.
zoneTypes
IList<ZoneType>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
ColormustIdentifyStops
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
stringAllow 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
IdThe identifier.
name
stringThe Zone's name.
comment
stringThe Zone's comment.
displayed
bool?The Zone's visibility flag.
zoneTypes
IList<ZoneType>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
ColormustIdentifyStops
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
stringAllow customers to reference data from their own system.
Zone(Zone)
Initializes a new instance of the Zone class.
protected Zone(Zone zone)
Parameters
zone
ZoneThe zone.
Fields
AreaZoneColor
public static readonly Color AreaZoneColor
Field Value
CustomerZoneColor
public static readonly Color CustomerZoneColor
Field Value
HomeZoneColor
public static readonly Color HomeZoneColor
Field Value
InHouseServiceCenterZoneColor
public static readonly Color InHouseServiceCenterZoneColor
Field Value
OfficeZoneColor
public static readonly Color OfficeZoneColor
Field Value
VendorServiceCenterZoneColor
public static readonly Color VendorServiceCenterZoneColor
Field Value
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
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
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
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
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
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
GeometryType
Gets or sets the geometry type of the zone.
public GeometryType? GeometryType { get; set; }
Property Value
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
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
Length
Gets or sets the zone's Length in km
public double? Length { get; set; }
Property Value
Metadata
Gets or sets the zone metadata.
public Dictionary<ZoneMetadataType, string>? Metadata { get; set; }
Property Value
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
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
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.
public IList<ISimpleCoordinate>? Points { get; set; }
Property Value
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
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
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
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()
public override string ToString()