Class FenceGeotrigger
- java.lang.Object
-
- com.esri.arcgisruntime.geotriggers.Geotrigger
-
- com.esri.arcgisruntime.geotriggers.FenceGeotrigger
-
public class FenceGeotrigger extends Geotrigger
AGeotriggerthat defines regions or fences to be monitored using aGeotriggerMonitor.You can monitor areas of interest with a FenceGeotrigger, using spatial rules like enter or exit. This type of operation is also known as "Geofencing".
Three main components comprise a FenceGeotrigger:
- The
GeotriggerFeedthat is monitored for changes - usually the device location read from aLocationDataSource. - The
FenceRuleTypethat describes the check that is performed with the feed and fence data - for example, "enters within 50 meters of". - The
FenceParametersthat the feed data are evaluated against. For example, a set of polygon features representing areas of interest. TheFenceParameterscan cover many features or graphics that are checked.
FeatureFenceParametersis referenced by aFeatureLayerthat isFloorAware, and theLocationDataSourceused to create theGeotriggerFeedincludesLocationDataSource.Location.KEY_FLOORinformation, then fences will only be entered when they are intersected by aLocationDataSource.Locationon the correct floor. If the fence or location data does not include valid floor information, the floor is ignored and the fence is entered when it is intersected by the location.A floor aware feature layer or table must be part of a
GeoModelthat includes a validGeoModelFloorDefinition. All layers and tables that are used by the floor definition are loaded when theGeotriggerMonitoris started.A
Locationcan contain floor property as part ofLocationDataSource.Location.getAdditionalSourceProperties(). This can be supplied as part of your own implementation.- Since:
- 100.12.0
- The
-
-
Field Summary
-
Fields inherited from class com.esri.arcgisruntime.geotriggers.Geotrigger
mFeed, mMessageExpression
-
-
Constructor Summary
Constructors Constructor Description FenceGeotrigger(GeotriggerFeed feed, FenceRuleType ruleType, FenceParameters fenceParameters)Constructs a FenceGeotrigger.FenceGeotrigger(GeotriggerFeed feed, FenceRuleType ruleType, FenceParameters fenceParameters, ArcadeExpression messageExpression, java.lang.String name)Constructs FenceGeotrigger with an expression and a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FenceEnterExitSpatialRelationshipgetEnterExitSpatialRelationship()Gets the spatial relationship that determines whether a fence polygon has been entered or exited.FenceGeotriggerFeedAccuracyModegetFeedAccuracyMode()Describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed.FenceParametersgetFenceParameters()Gets theFenceParametersthat will be evaluated.FenceRuleTypegetRuleType()Gets theFenceRuleTypethat describes the check performed with the feed and fence data.voidsetEnterExitSpatialRelationship(FenceEnterExitSpatialRelationship enterExitSpatialRelationship)Sets the spatial relationship that determines whether a fence polygon has been entered or exited.voidsetFeedAccuracyMode(FenceGeotriggerFeedAccuracyMode feedAccuracyMode)Describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed.voidsetRuleType(FenceRuleType ruleType)Sets theFenceRuleTypethat describes the check performed with the feed and fence data.-
Methods inherited from class com.esri.arcgisruntime.geotriggers.Geotrigger
getFeed, getGeotriggerId, getMessageExpression, getName, getRequestedActions, setMessageExpression, setName
-
-
-
-
Constructor Detail
-
FenceGeotrigger
public FenceGeotrigger(GeotriggerFeed feed, FenceRuleType ruleType, FenceParameters fenceParameters)
Constructs a FenceGeotrigger.- Parameters:
feed- theGeotriggerFeedthat is monitored for changesruleType- theFenceRuleTypethat describes the check that will be performed upon the feed datafenceParameters- theFenceParametersthat will be evaluated- Throws:
java.lang.IllegalArgumentException- if feed is nulljava.lang.IllegalArgumentException- if ruleType is nulljava.lang.IllegalArgumentException- if fenceParameters is null- Since:
- 100.12.0
-
FenceGeotrigger
public FenceGeotrigger(GeotriggerFeed feed, FenceRuleType ruleType, FenceParameters fenceParameters, ArcadeExpression messageExpression, java.lang.String name)
Constructs FenceGeotrigger with an expression and a name.- Parameters:
feed- theGeotriggerFeedthat is monitored for changesruleType- theFenceRuleTypethat describes the check that will be performed upon the feed datafenceParameters- theFenceParametersthat will be evaluatedmessageExpression- theArcadeExpressionthat will be evaluated to create aGeotriggerNotificationInfo.getMessage(), may be nullname- the name for the FenceGeotrigger- Throws:
java.lang.IllegalArgumentException- if feed is nulljava.lang.IllegalArgumentException- if ruleType is nulljava.lang.IllegalArgumentException- if fenceParameters is nulljava.lang.IllegalArgumentException- if name is null- Since:
- 100.12.0
-
-
Method Detail
-
getEnterExitSpatialRelationship
public FenceEnterExitSpatialRelationship getEnterExitSpatialRelationship()
Gets the spatial relationship that determines whether a fence polygon has been entered or exited.When determining whether a feed entity has entered or exited a fence polygon, there are two spatial operations that can be used:
- Intersects, where the geometry of the feed must intersect the fence polygon.
- Contains, where the geometry of the feed must be contained by the fence polygon.
Note that when the feed geometry is a
Pointthere is no difference between intersection and containment so these options will not affect behavior. When using aLocationGeotriggerFeed, setgetFeedAccuracyMode()toFenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACYin order to create a polygon geometry that accounts for the area of uncertainty around aLocationDataSource.Location.getPosition().The default value is
FenceEnterExitSpatialRelationship.ENTER_INTERSECTS_AND_EXIT_DOES_NOT_INTERSECT.- Returns:
- the spatial relationship that determines whether a fence polygon has been entered or exited
- Since:
- 100.13.0
-
setEnterExitSpatialRelationship
public void setEnterExitSpatialRelationship(FenceEnterExitSpatialRelationship enterExitSpatialRelationship)
Sets the spatial relationship that determines whether a fence polygon has been entered or exited.When determining whether a feed entity has entered or exited a fence polygon, there are two spatial operations that can be used:
- Intersects, where the geometry of the feed must intersect the fence polygon.
- Contains, where the geometry of the feed must be contained by the fence polygon.
Note that when the feed geometry is a
Pointthere is no difference between intersection and containment so these options will not affect behavior. When using aLocationGeotriggerFeed, setgetFeedAccuracyMode()toFenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACYin order to create a polygon geometry that accounts for the area of uncertainty around aLocationDataSource.Location.getPosition().The default value is
FenceEnterExitSpatialRelationship.ENTER_INTERSECTS_AND_EXIT_DOES_NOT_INTERSECT.- Parameters:
enterExitSpatialRelationship- the spatial relationship that determines whether a fence polygon has been entered or exited- Throws:
java.lang.IllegalArgumentException- if enterExitSpatialRelationship is null- Since:
- 100.13.0
-
getFeedAccuracyMode
public FenceGeotriggerFeedAccuracyMode getFeedAccuracyMode()
Describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed.This property controls how the accuracy information from a
GeotriggerFeedis used to provide theGeometryfor checking aGeotriggercondition. In particular, you can choose how to use theLocationDataSource.Location.getHorizontalAccuracy()property to reflect the uncertainty around a fixedLocationDataSource.Location.getPosition(). Due to factors including signal strength, GPS positions can be inaccurate, with a largerLocation.getHorizontalAccuracy()representing a larger area where the device may actually be located. This can lead to spurious notifications when theLocation.getPosition()is inaccurate and is incorrectly reported as inside or outside of a fence. By using theLocation.getHorizontalAccuracy()you can choose to account for that wander in various ways.This property is used in conjunction with
getEnterExitSpatialRelationship()to affect when notifications are sent.The default value is FenceGeotriggerFeedAccuracyMode.useGeometry.
Note that you can also use an
ArcadeExpressionwith theLocationGeotriggerFeed.getFilter()property to rejectLocationDataSource.Locationobjects with a poor accuracy.- Returns:
- describes how a FenceGeotrigger will use accuracy information from a
GeotriggerFeed - Since:
- 100.13.0
-
setFeedAccuracyMode
public void setFeedAccuracyMode(FenceGeotriggerFeedAccuracyMode feedAccuracyMode)
Describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed.This property controls how the accuracy information from a
GeotriggerFeedis used to provide theGeometryfor checking aGeotriggercondition. In particular, you can choose how to use theLocationDataSource.Location.getHorizontalAccuracy()property to reflect the uncertainty around a fixedLocationDataSource.Location.getPosition(). Due to factors including signal strength, GPS positions can be inaccurate, with a largerLocation.getHorizontalAccuracy()representing a larger area where the device may actually be located. This can lead to spurious notifications when theLocation.getPosition()is inaccurate and is incorrectly reported as inside or outside of a fence. By using theLocation.getHorizontalAccuracy()you can choose to account for that wander in various ways.This property is used in conjunction with
getEnterExitSpatialRelationship()to affect when notifications are sent.The default value is FenceGeotriggerFeedAccuracyMode.useGeometry.
Note that you can also use an
ArcadeExpressionwith theLocationGeotriggerFeed.getFilter()property to rejectLocationDataSource.Locationobjects with a poor accuracy.- Parameters:
feedAccuracyMode- describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed- Throws:
java.lang.IllegalArgumentException- if feedAccuracyMode is null- Since:
- 100.13.0
-
getFenceParameters
public FenceParameters getFenceParameters()
Gets theFenceParametersthat will be evaluated.For example, a set of polygon features representing areas of interest. The
FenceParameterscan cover many features or graphics that will be checked.There are three types of
FenceParameters:- A
FeatureFenceParametersthat is constructed from aFeatureTable. - A
GraphicFenceParametersthat is constructed from a list ofGraphicobjects. - A
GraphicsOverlayFenceParametersthat is constructed from aGraphicsOverlay.
- Returns:
- the
FenceParametersthat will be evaluated - Since:
- 100.12.0
- A
-
getRuleType
public FenceRuleType getRuleType()
Gets theFenceRuleTypethat describes the check performed with the feed and fence data.The rule controls the spatial query that will be used - for example "enter" or "exit".
- Returns:
- the
FenceRuleTypethat describes the check performed with the feed and fence data - Since:
- 100.12.0
-
setRuleType
public void setRuleType(FenceRuleType ruleType)
Sets theFenceRuleTypethat describes the check performed with the feed and fence data.The rule controls the spatial query that will be used - for example "enter" or "exit".
- Parameters:
ruleType- theFenceRuleTypethat describes the check performed with the feed and fence data- Throws:
java.lang.IllegalArgumentException- if ruleType is null- Since:
- 100.12.0
-
-