Class FenceGeotrigger


  • public class FenceGeotrigger
    extends Geotrigger
    A Geotrigger that defines regions or fences to be monitored using a GeotriggerMonitor.

    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 a LocationDataSource.
    • 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. The FenceParameters can cover many features or graphics that are checked.
    Since:
    100.12.0
    • Constructor Detail

      • FenceGeotrigger

        public FenceGeotrigger​(GeotriggerFeed feed,
                               FenceRuleType ruleType,
                               FenceParameters fenceParameters)
        Constructs a FenceGeotrigger.
        Parameters:
        feed - the GeotriggerFeed that is monitored for changes
        ruleType - the FenceRuleType that describes the check that will be performed upon the feed data
        fenceParameters - the FenceParameters that will be evaluated
        Throws:
        java.lang.IllegalArgumentException - if feed is null
        java.lang.IllegalArgumentException - if ruleType is null
        java.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 - the GeotriggerFeed that is monitored for changes
        ruleType - the FenceRuleType that describes the check that will be performed upon the feed data
        fenceParameters - the FenceParameters that will be evaluated
        messageExpression - the ArcadeExpression that will be evaluated to create a GeotriggerNotificationInfo.getMessage(), may be null
        name - the name for the FenceGeotrigger
        Throws:
        java.lang.IllegalArgumentException - if feed is null
        java.lang.IllegalArgumentException - if ruleType is null
        java.lang.IllegalArgumentException - if fenceParameters is null
        java.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.
        These operations can be used to determine whether a fence polygon has been entered, and also when it has been exited. Containment is a stricter version of intersection (e.g. when a fence contains a feed entity they also intersect) so will tend to result in fewer notifications when the two geometries are nearby. By using different combinations of these rules for enter and exit you can control the likelihood that notifications will be sent.

        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 a LocationGeotriggerFeed, set getFeedAccuracyMode() to FenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACY in order to create a polygon geometry that accounts for the area of uncertainty around a LocationDataSource.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.
        These operations can be used to determine whether a fence polygon has been entered, and also when it has been exited. Containment is a stricter version of intersection (e.g. when a fence contains a feed entity they also intersect) so will tend to result in fewer notifications when the two geometries are nearby. By using different combinations of these rules for enter and exit you can control the likelihood that notifications will be sent.

        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 a LocationGeotriggerFeed, set getFeedAccuracyMode() to FenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACY in order to create a polygon geometry that accounts for the area of uncertainty around a LocationDataSource.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 a GeotriggerFeed.

        This property controls how the accuracy information from a GeotriggerFeed is used to provide the Geometry for checking a Geotrigger condition. In particular, you can choose how to use the LocationDataSource.Location.getHorizontalAccuracy() property to reflect the uncertainty around a fixed LocationDataSource.Location.getPosition(). Due to factors including signal strength, GPS positions can be inaccurate, with a larger Location.getHorizontalAccuracy() representing a larger area where the device may actually be located. This can lead to spurious notifications when the Location.getPosition() is inaccurate and is incorrectly reported as inside or outside of a fence. By using the Location.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 the LocationGeotriggerFeed.getFilter() property to reject LocationDataSource.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 a GeotriggerFeed.

        This property controls how the accuracy information from a GeotriggerFeed is used to provide the Geometry for checking a Geotrigger condition. In particular, you can choose how to use the LocationDataSource.Location.getHorizontalAccuracy() property to reflect the uncertainty around a fixed LocationDataSource.Location.getPosition(). Due to factors including signal strength, GPS positions can be inaccurate, with a larger Location.getHorizontalAccuracy() representing a larger area where the device may actually be located. This can lead to spurious notifications when the Location.getPosition() is inaccurate and is incorrectly reported as inside or outside of a fence. By using the Location.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 the LocationGeotriggerFeed.getFilter() property to reject LocationDataSource.Location objects with a poor accuracy.

        Parameters:
        feedAccuracyMode - describes how a FenceGeotrigger will use accuracy information from a GeotriggerFeed
        Throws:
        java.lang.IllegalArgumentException - if feedAccuracyMode is null
        Since:
        100.13.0
      • getRuleType

        public FenceRuleType getRuleType()
        Gets the FenceRuleType 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 the FenceRuleType 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 - the FenceRuleType that describes the check performed with the feed and fence data
        Throws:
        java.lang.IllegalArgumentException - if ruleType is null
        Since:
        100.12.0