Class FenceGeotrigger
- java.lang.Object
-
- com.esri.arcgisruntime.geotriggers.Geotrigger
-
- com.esri.arcgisruntime.geotriggers.FenceGeotrigger
-
public class FenceGeotrigger extends Geotrigger
AGeotrigger
that 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
GeotriggerFeed
that is monitored for changes - usually the device location read from aLocationDataSource
. - The
FenceRuleType
that describes the check that is performed with the feed and fence data - for example, "enters within 50 meters of". - The
FenceParameters
that the feed data are evaluated against. For example, a set of polygon features representing areas of interest. TheFenceParameters
can cover many features or graphics that are checked.
FeatureFenceParameters
is referenced by aFeatureLayer
that isFloorAware
, and theLocationDataSource
used to create theGeotriggerFeed
includesLocationDataSource.Location.KEY_FLOOR
information, then fences will only be entered when they are intersected by aLocationDataSource.Location
on 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
GeoModel
that includes a validGeoModelFloorDefinition
. All layers and tables that are used by the floor definition are loaded when theGeotriggerMonitor
is started.A
Location
can 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, String name)
Constructs FenceGeotrigger with an expression and a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FenceEnterExitSpatialRelationship
getEnterExitSpatialRelationship()
Gets the spatial relationship that determines whether a fence polygon has been entered or exited.FenceGeotriggerFeedAccuracyMode
getFeedAccuracyMode()
Describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed
.FenceParameters
getFenceParameters()
Gets theFenceParameters
that will be evaluated.FenceRuleType
getRuleType()
Gets theFenceRuleType
that describes the check performed with the feed and fence data.void
setEnterExitSpatialRelationship(FenceEnterExitSpatialRelationship enterExitSpatialRelationship)
Sets the spatial relationship that determines whether a fence polygon has been entered or exited.void
setFeedAccuracyMode(FenceGeotriggerFeedAccuracyMode feedAccuracyMode)
Describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed
.void
setRuleType(FenceRuleType ruleType)
Sets theFenceRuleType
that 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
- theGeotriggerFeed
that is monitored for changesruleType
- theFenceRuleType
that describes the check that will be performed upon the feed datafenceParameters
- theFenceParameters
that will be evaluated- Throws:
IllegalArgumentException
- if feed is nullIllegalArgumentException
- if ruleType is nullIllegalArgumentException
- if fenceParameters is null- Since:
- 100.12.0
-
FenceGeotrigger
public FenceGeotrigger(GeotriggerFeed feed, FenceRuleType ruleType, FenceParameters fenceParameters, ArcadeExpression messageExpression, String name)
Constructs FenceGeotrigger with an expression and a name.- Parameters:
feed
- theGeotriggerFeed
that is monitored for changesruleType
- theFenceRuleType
that describes the check that will be performed upon the feed datafenceParameters
- theFenceParameters
that will be evaluatedmessageExpression
- theArcadeExpression
that will be evaluated to create aGeotriggerNotificationInfo.getMessage()
, may be nullname
- the name for the FenceGeotrigger- Throws:
IllegalArgumentException
- if feed is nullIllegalArgumentException
- if ruleType is nullIllegalArgumentException
- if fenceParameters is nullIllegalArgumentException
- 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
Point
there is no difference between intersection and containment so these options will not affect behavior. When using aLocationGeotriggerFeed
, setgetFeedAccuracyMode()
toFenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACY
in 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
Point
there is no difference between intersection and containment so these options will not affect behavior. When using aLocationGeotriggerFeed
, setgetFeedAccuracyMode()
toFenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACY
in 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:
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
GeotriggerFeed
is used to provide theGeometry
for checking aGeotrigger
condition. 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
ArcadeExpression
with theLocationGeotriggerFeed.getFilter()
property to rejectLocationDataSource.Location
objects 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
GeotriggerFeed
is used to provide theGeometry
for checking aGeotrigger
condition. 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
ArcadeExpression
with theLocationGeotriggerFeed.getFilter()
property to rejectLocationDataSource.Location
objects with a poor accuracy.- Parameters:
feedAccuracyMode
- describes how a FenceGeotrigger will use accuracy information from aGeotriggerFeed
- Throws:
IllegalArgumentException
- if feedAccuracyMode is null- Since:
- 100.13.0
-
getFenceParameters
public FenceParameters getFenceParameters()
Gets theFenceParameters
that will be evaluated.For example, a set of polygon features representing areas of interest. The
FenceParameters
can cover many features or graphics that will be checked.There are three types of
FenceParameters
:- A
FeatureFenceParameters
that is constructed from aFeatureTable
. - A
GraphicFenceParameters
that is constructed from a list ofGraphic
objects. - A
GraphicsOverlayFenceParameters
that is constructed from aGraphicsOverlay
.
- Returns:
- the
FenceParameters
that will be evaluated - Since:
- 100.12.0
- A
-
getRuleType
public FenceRuleType getRuleType()
Gets theFenceRuleType
that 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
FenceRuleType
that describes the check performed with the feed and fence data - Since:
- 100.12.0
-
setRuleType
public void setRuleType(FenceRuleType ruleType)
Sets theFenceRuleType
that 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
- theFenceRuleType
that describes the check performed with the feed and fence data- Throws:
IllegalArgumentException
- if ruleType is null- Since:
- 100.12.0
-
-