public abstract class GeoFenceMonitor
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GeoFenceMonitor.Factory
Factory to create proper monitor, based on Map Item
Map Item should be the reference shape (see GeoFenceReceiver.getReferenceShape)
|
Modifier and Type | Field and Description |
---|---|
protected MapItem |
_item
Shape e.g.
|
protected java.util.Map<java.lang.String,java.lang.Boolean> |
_uidsLastState
Map item UID to last state (true=inside fence, false=outside fence)
Note, currently used for TriggerType.Both to see if an item entered or exited
|
protected MapView |
_view |
Constructor and Description |
---|
GeoFenceMonitor(MapView view,
GeoFence fence,
MapItem item) |
Modifier and Type | Method and Description |
---|---|
boolean |
addItem(PointMapItem item) |
java.util.List<GeoFenceAlerting.Alert> |
check()
Check if any tracked items have breached the Geo Fence
|
protected java.util.List<GeoFenceAlerting.Alert> |
check(GeoFence.Trigger trigger)
Check if any tracked items have breached the Geo Fence
|
protected abstract java.util.List<GeoFenceAlerting.Alert> |
check(GeoFence.Trigger trigger,
java.util.List<PointMapItem> items,
boolean bCheckPrevious)
Check if any tracked items have breached the Geo Fence
All items passed in so subclasses can optimize shape comparison math
|
protected boolean |
checkDismissed(PointMapItem item)
Subclasses should invoke this for each item to see if user has already
dismissed these alerts
|
boolean |
checkSelectedItem(PointMapItem item) |
protected static boolean |
checkTrigger(GeoFence.Trigger trigger,
boolean bInside)
Check if we should trigger
|
protected static boolean |
checkTrigger(GeoFence.Trigger trigger,
boolean bInside,
java.lang.Boolean bPreviouslyInside)
Check if we should trigger.
|
void |
clearSelectItems() |
void |
clearUidsLastState() |
void |
dispose() |
boolean |
equals(java.lang.Object o) |
abstract GeoPointMetaData |
getCenter()
Get center of monitored area
|
GeoFence |
getFence() |
abstract double |
getfurthestPointRange() |
MapItem |
getItem() |
java.util.List<PointMapItem> |
getItems()
Get items to track/compare
|
protected boolean |
getLastState(java.lang.String uid)
Get previous state for the specified UID
|
java.lang.String |
getMapItemUid()
Get UID of the Map item which identifies this GeoFence
This class caches the shape (e.g.
|
java.util.List<PointMapItem> |
getRescanItems()
Default impl return entire list based on MonitoredTypes
|
java.util.ArrayList<java.lang.String> |
getSelectedItemUids() |
int |
hashCode() |
boolean |
hasTrackedItems() |
protected boolean |
inElevationRange(GeoPoint point) |
boolean |
isMonitoring(PointMapItem item) |
boolean |
isValid() |
void |
persist()
Persist this monitor via its metadata item
|
boolean |
removeItem(PointMapItem item)
Remove tracking for the dismissed item
|
void |
setFence(GeoFence fence) |
void |
setSelectItems(java.util.List<PointMapItem> items)
Special handling for Self marker b/c it doesn't have a type and does not
show up in the Overlay Manager for selection by user
|
void |
setSelectUids(java.util.List<java.lang.String> uids)
List of UIDs to track that have yet to be resolved
|
void |
setUidsLastState(java.util.Map<java.lang.String,java.lang.Boolean> uidsLastState) |
int |
size() |
java.lang.String |
toString() |
protected final MapItem _item
protected final MapView _view
protected final java.util.Map<java.lang.String,java.lang.Boolean> _uidsLastState
public java.util.List<GeoFenceAlerting.Alert> check()
protected java.util.List<GeoFenceAlerting.Alert> check(GeoFence.Trigger trigger)
trigger
- the trigger to be usedprotected abstract java.util.List<GeoFenceAlerting.Alert> check(GeoFence.Trigger trigger, java.util.List<PointMapItem> items, boolean bCheckPrevious)
trigger
- the trigger to be useditems
- the list of itemsbCheckPrevious
- if true, only alert if current state differs from previous statepublic abstract GeoPointMetaData getCenter()
public abstract double getfurthestPointRange()
protected boolean checkDismissed(PointMapItem item)
item
- the itempublic boolean isValid()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void dispose()
public java.lang.String getMapItemUid()
public MapItem getItem()
public void persist()
public void setUidsLastState(java.util.Map<java.lang.String,java.lang.Boolean> uidsLastState)
public void clearUidsLastState()
public void setSelectItems(java.util.List<PointMapItem> items)
items
- the list of itemspublic void clearSelectItems()
public void setSelectUids(java.util.List<java.lang.String> uids)
uids
- UIDs to trackpublic boolean checkSelectedItem(PointMapItem item)
public java.util.ArrayList<java.lang.String> getSelectedItemUids()
public boolean hasTrackedItems()
public java.util.List<PointMapItem> getItems()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public void setFence(GeoFence fence)
public GeoFence getFence()
public boolean removeItem(PointMapItem item)
item
- public boolean isMonitoring(PointMapItem item)
public boolean addItem(PointMapItem item)
protected static boolean checkTrigger(GeoFence.Trigger trigger, boolean bInside)
trigger
- bInside
- protected static boolean checkTrigger(GeoFence.Trigger trigger, boolean bInside, java.lang.Boolean bPreviouslyInside)
trigger
- bInside
- bPreviouslyInside
- protected boolean getLastState(java.lang.String uid)
uid
- Item UIDpublic java.util.List<PointMapItem> getRescanItems()
protected boolean inElevationRange(GeoPoint point)