Skip to content

Class Geofencer

ClassList > Geofencer

More...

  • #include <geofencer.h>

Inherits the following classes: QObject

Public Types

Type Name
enum Behaviors

Public Properties

Type Name
property bool active
property QgsVectorLayer * areasLayer
property Behaviors behavior
property bool isAlerting
property bool isWithin
property QString isWithinAreaName
property QString lastWithinAreaName
property QgsPoint position
property QgsCoordinateReferenceSystem positionCrs

Public Signals

Type Name
signal void activeChanged
signal void areasLayerChanged
signal void behaviorChanged
signal void invertLogicChanged
signal void isAlertingChanged
signal void isWithinChanged
signal void positionChanged
signal void positionCrsChanged
signal void projectChanged

Public Functions

Type Name
Geofencer (QObject * parent=nullptr)
bool active () const
Q_INVOKABLE void applyProjectSettings (QgsProject * project)
QgsVectorLayer * areasLayer () const
Behaviors behavior () const
bool isAlerting () const
bool isWithin () const
QString isWithinAreaName () const
QString lastWithinAreaName () const
QgsPoint position () const
QgsCoordinateReferenceSystem positionCrs () const
void setActive (bool active)
void setAreasLayer (QgsVectorLayer * layer)
void setBehavior (Behaviors behavior)
void setPosition (const QgsPoint & position)
void setPositionCrs (const QgsCoordinateReferenceSystem & crs)
virtual ~Geofencer ()

Detailed Description

This class provides an interface to manage geofencing of areas as well as providing feedback whenever the position trespasses into or out of those areas.

Public Types Documentation

enum Behaviors

enum Geofencer::Behaviors {
    AlertWhenInsideGeofencedArea = 1,
    AlertWhenOutsideGeofencedArea,
    InformWhenEnteringLeavingGeofencedArea
};

Public Properties Documentation

property active [1/2]

bool Geofencer::active;

property areasLayer [1/2]

QgsVectorLayer * Geofencer::areasLayer;

property behavior [1/2]

Behaviors Geofencer::behavior;

property isAlerting [1/2]

bool Geofencer::isAlerting;

property isWithin [1/2]

bool Geofencer::isWithin;

property isWithinAreaName [1/2]

QString Geofencer::isWithinAreaName;

property lastWithinAreaName [1/2]

QString Geofencer::lastWithinAreaName;

property position [1/2]

QgsPoint Geofencer::position;

property positionCrs [1/2]

QgsCoordinateReferenceSystem Geofencer::positionCrs;

Public Signals Documentation

signal activeChanged

void Geofencer::activeChanged;

signal areasLayerChanged

void Geofencer::areasLayerChanged;

signal behaviorChanged

void Geofencer::behaviorChanged;

signal invertLogicChanged

void Geofencer::invertLogicChanged;

signal isAlertingChanged

void Geofencer::isAlertingChanged;

signal isWithinChanged

void Geofencer::isWithinChanged;

signal positionChanged

void Geofencer::positionChanged;

signal positionCrsChanged

void Geofencer::positionCrsChanged;

signal projectChanged

void Geofencer::projectChanged;

Public Functions Documentation

function Geofencer

explicit Geofencer::Geofencer (
    QObject * parent=nullptr
) 

function active [2/2]

inline bool Geofencer::active () const

Returns TRUE when geofencing is active.

See also: setActive


function applyProjectSettings

Q_INVOKABLE void Geofencer::applyProjectSettings (
    QgsProject * project
) 

Sets the polygon layer holding areas from a given project.


function areasLayer [2/2]

inline QgsVectorLayer * Geofencer::areasLayer () const

Returns the polygon layer holding areas.


function behavior [2/2]

inline Behaviors Geofencer::behavior () const

Returns thegeofencing behavior.


function isAlerting [2/2]

inline bool Geofencer::isAlerting () const

Returns TRUE when the geofencer's behavior is triggering an alarm.


function isWithin [2/2]

bool Geofencer::isWithin () const

Returns whether the current position is within an area.


function isWithinAreaName [2/2]

QString Geofencer::isWithinAreaName () const

Returns the area name within which the current position overlaps. If no overlap, an empty string will be returned.


function lastWithinAreaName [2/2]

QString Geofencer::lastWithinAreaName () const

Returns the last area name within which the position had overlapped. If no overlap has yet to occur, an empty string will be returned.


function position [2/2]

inline QgsPoint Geofencer::position () const

Returns the position to be used to check for overlap with areas.


function positionCrs [2/2]

inline QgsCoordinateReferenceSystem Geofencer::positionCrs () const

Returns the position's coordinate reference system (CRS).


function setActive

void Geofencer::setActive (
    bool active
) 

Sets the geofencing active state.

See also: active


function setAreasLayer

void Geofencer::setAreasLayer (
    QgsVectorLayer * layer
) 

Sets the polygon layer holding areas.


function setBehavior

void Geofencer::setBehavior (
    Behaviors behavior
) 

Sets the geofencing behavior.


function setPosition

void Geofencer::setPosition (
    const QgsPoint & position
) 

Sets the position to be used to check for overlap with areas.


function setPositionCrs

void Geofencer::setPositionCrs (
    const QgsCoordinateReferenceSystem & crs
) 

Sets the position's coordinate reference system (CRS).


function ~Geofencer

virtual Geofencer::~Geofencer () 


The documentation for this class was generated from the following file src/core/positioning/geofencer.h