A Geotrigger that defines regions or fences to be monitored using a GeotriggerMonitor. More...
Header: | #include <FenceGeotrigger.h> |
Since: | Esri::ArcGISRuntime 100.12 |
Inherits: | Esri::ArcGISRuntime::Geotrigger |
Public Functions
FenceGeotrigger(Esri::ArcGISRuntime::GeotriggerFeed *feed, Esri::ArcGISRuntime::FenceRuleType ruleType, Esri::ArcGISRuntime::FenceParameters *fenceParameters, QObject *parent = nullptr) | |
FenceGeotrigger(Esri::ArcGISRuntime::GeotriggerFeed *feed, Esri::ArcGISRuntime::FenceRuleType ruleType, Esri::ArcGISRuntime::FenceParameters *fenceParameters, Esri::ArcGISRuntime::ArcadeExpression *messageExpression, const QString &geotriggerName, QObject *parent = nullptr) | |
virtual | ~FenceGeotrigger() override |
Esri::ArcGISRuntime::FenceEnterExitSpatialRelationship | enterExitSpatialRelationship() const |
Esri::ArcGISRuntime::FenceGeotriggerFeedAccuracyMode | feedAccuracyMode() const |
Esri::ArcGISRuntime::FenceParameters * | fenceParameters() const |
Esri::ArcGISRuntime::FenceRuleType | ruleType() const |
void | setEnterExitSpatialRelationship(Esri::ArcGISRuntime::FenceEnterExitSpatialRelationship enterExitSpatialRelationship) |
void | setFeedAccuracyMode(Esri::ArcGISRuntime::FenceGeotriggerFeedAccuracyMode feedAccuracyMode) |
void | setRuleType(Esri::ArcGISRuntime::FenceRuleType ruleType) |
Detailed Description
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 an AbstractLocationDataSource.
- 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.
A FenceGeotrigger can also take into account floors within buildings. If the feature table used to create the FeatureFenceParameters is referenced by a FeatureLayer that is FloorAware, and the AbstractLocationDataSource used to create the GeotriggerFeed includes LocationSourcePropertiesKeys::floor information, then fences will only be entered when they are intersected by a 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 valid GeoModelFloorDefinition. All layers and tables that are used by the floor definition are loaded when the GeotriggerMonitor is started.
A Location can contain the floor property as part of Location::additionalSourceProperties. This is populated automatically by IndoorsLocationDataSource, or can be supplied as part of your own implementation.
Relevant samples:
- Set up location-driven Geotriggers: Create a notification every time a given location data source has entered and/or exited a set of features or graphics.
Member Function Documentation
FenceGeotrigger::FenceGeotrigger (Esri::ArcGISRuntime::GeotriggerFeed *feed, Esri::ArcGISRuntime::FenceRuleType ruleType , Esri::ArcGISRuntime::FenceParameters *fenceParameters , QObject *parent = nullptr)
Constructs a FenceGeotrigger.
- 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.
- parent - The optional parent QObject.
FenceGeotrigger::FenceGeotrigger (Esri::ArcGISRuntime::GeotriggerFeed *feed, Esri::ArcGISRuntime::FenceRuleType ruleType , Esri::ArcGISRuntime::FenceParameters *fenceParameters , Esri::ArcGISRuntime::ArcadeExpression *messageExpression , const QString &geotriggerName , QObject *parent = nullptr)
Constructs FenceGeotrigger with an expression and a name.
- 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::message.
- geotriggerName - The name for the FenceGeotrigger.
- parent - The optional parent QObject.
[override virtual]
FenceGeotrigger::~FenceGeotrigger ()
Destructor.
[since Esri::ArcGISRuntime 100.13]
Esri::ArcGISRuntime::FenceEnterExitSpatialRelationship FenceGeotrigger::enterExitSpatialRelationship () const
Returns the spatial relationship that determines whether a fence polygon has been entered or exited.
There are two spatial operations you can use to determine whether a feed entity has entered or exited a fence polygon.
- Intersects: the feed geometry must intersect the fence polygon.
- Contains: the feed geometry must be contained by the fence polygon.
These operations determine whether a fence polygon has been entered, and also when it has been exited (the feed geometry no longer intersects or is no longer contained by the fence polygon). Because the contains condition is more strict that intersects (a geometry can intersect another geometry without being contained by it) it tends 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 both options behave the same. When using a LocationGeotriggerFeed, set feedAccuracyMode to FenceGeotriggerFeedAccuracyMode::UseGeometryWithAccuracy in order to create a polygon geometry that accounts for the area of uncertainty around a Location::position.
The default value is FenceEnterExitSpatialRelationship::EnterIntersectsAndExitDoesNotIntersect.
This function was introduced in Esri::ArcGISRuntime 100.13.
See also setEnterExitSpatialRelationship().
[since Esri::ArcGISRuntime 100.13]
Esri::ArcGISRuntime::FenceGeotriggerFeedAccuracyMode FenceGeotrigger::feedAccuracyMode () const
Returns how a FenceGeotrigger uses 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 Location::horizontalAccuracy property to reflect the uncertainty around a fixed Location::position. Due to various factors, GPS positions may be inaccurate, with Location::horizontalAccuracy representing a radius that defines the area containing the actual location. Spurious notifications may occur when the Location::position is inaccurate and is incorrectly reported as inside or outside of a fence. You can use the Location::horizontalAccuracy to account for that uncertainty.
This property is used in conjunction with enterExitSpatialRelationship to affect when notifications are sent.
The default value is FenceGeotriggerFeedAccuracyMode::UseGeometry.
Note that you can also use an ArcadeExpression with the LocationGeotriggerFeed::filter property to reject Location objects with a poor accuracy.
This function was introduced in Esri::ArcGISRuntime 100.13.
See also setFeedAccuracyMode().
Esri::ArcGISRuntime::FenceParameters *FenceGeotrigger::fenceParameters () const
Returns the FenceParameters 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 a FeatureTable.
- A GraphicFenceParameters that is constructed from a list of Graphic objects.
- A GraphicsOverlayFenceParameters that is constructed from a GraphicsOverlay.
Esri::ArcGISRuntime::FenceRuleType FenceGeotrigger::ruleType () const
Returns 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".
See also setRuleType().
[since Esri::ArcGISRuntime 100.13]
void FenceGeotrigger::setEnterExitSpatialRelationship (Esri::ArcGISRuntime::FenceEnterExitSpatialRelationship enterExitSpatialRelationship )
Sets the enterExitSpatialRelationship to enterExitSpatialRelationship.
This function was introduced in Esri::ArcGISRuntime 100.13.
See also enterExitSpatialRelationship.
[since Esri::ArcGISRuntime 100.13]
void FenceGeotrigger::setFeedAccuracyMode (Esri::ArcGISRuntime::FenceGeotriggerFeedAccuracyMode feedAccuracyMode )
Sets the feedAccuracyMode to feedAccuracyMode.
This function was introduced in Esri::ArcGISRuntime 100.13.
See also feedAccuracyMode.
void FenceGeotrigger::setRuleType (Esri::ArcGISRuntime::FenceRuleType ruleType )
Sets the ruleType to ruleType.
See also ruleType.