public abstract class MapGroup extends FilterMetaDataHolder implements DeepMapItemQuery, HashtagSearch
Modifier and Type | Class and Description |
---|---|
static interface |
MapGroup.MapItemsCallback |
static interface |
MapGroup.OnFriendlyNameChangedListener |
static interface |
MapGroup.OnGroupListChangedListener |
static class |
MapGroup.OnItemCallback<T extends MapItem> |
static interface |
MapGroup.OnItemListChangedListener |
static interface |
MapGroup.OnVisibleChangedListener |
metadata
Modifier | Constructor and Description |
---|---|
|
MapGroup()
Create an empty MapGroup with a new serial ID.
|
protected |
MapGroup(long serialId) |
protected |
MapGroup(long serialId,
MetaDataHolder metadata) |
|
MapGroup(MetaDataHolder metadata) |
Modifier and Type | Method and Description |
---|---|
abstract MapGroup |
addGroup()
Create and add a MapGroup
|
abstract MapGroup |
addGroup(MapGroup groupIface)
Add a MapGroup
|
abstract MapGroup |
addGroup(java.lang.String friendlyName)
Create and add a MapGroup with a friendly display name
|
void |
addItem(MapItem item)
Add an item to the group.
|
protected abstract void |
addItemImpl(MapItem item)
Performs the actual addition of the item.
|
void |
addOnFriendlyNameChangedListener(MapGroup.OnFriendlyNameChangedListener l) |
void |
addOnGroupListChangedListener(MapGroup.OnGroupListChangedListener listener)
Add a groupList listener
|
void |
addOnItemListChangedListener(MapGroup.OnItemListChangedListener listener)
Add a itemList listener
|
void |
addOnVisibleChangedListener(MapGroup.OnVisibleChangedListener l) |
abstract void |
clearGroups() |
abstract void |
clearItems() |
boolean |
containsItem(MapItem item) |
static long |
createMapGroupSerialId()
Returns a serial ID that across an invocation of ATAK that is unique against all other IDs
returned by this method.
|
Marker |
createMarker(GeoPoint point,
java.lang.String uid)
Create a marker and specifically add it to the this group.
|
MapItem |
deepFindClosestItem(GeoPoint location) |
MapItem |
deepFindClosestItem(GeoPoint location,
double threshold) |
MapItem |
deepFindClosestItem(GeoPoint location,
double threshold,
java.util.Map<java.lang.String,java.lang.String> metadata)
Finds the closest MapItem to the specified point, that falls within the specified threshold.
|
MapItem |
deepFindClosestItem(GeoPoint location,
double threshold,
java.lang.String key,
java.lang.String value) |
MapItem |
deepFindClosestItem(GeoPoint location,
java.util.Map<java.lang.String,java.lang.String> metadata) |
MapItem |
deepFindClosestItem(GeoPoint location,
java.lang.String key,
java.lang.String value) |
static MapGroup |
deepFindGroupByNameBreadthFirst(MapGroup group,
java.lang.String friendlyname) |
static MapGroup |
deepFindGroupByNameDepthFirst(MapGroup group,
java.lang.String friendlyname) |
static MapGroup |
deepFindGroupBySerialIdBreadthFirst(MapGroup group,
long serialId) |
static MapGroup |
deepFindGroupBySerialIdDepthFirst(MapGroup group,
long serialId) |
abstract MapItem |
deepFindItem(java.util.Map<java.lang.String,java.lang.String> metadata)
Deep traverse the map group to find an item that matches search constraints.
|
MapItem |
deepFindItem(java.lang.String key,
java.lang.String value)
Deep traverse the map group to find an item that matches search constraints.
|
java.util.Collection<MapItem> |
deepFindItems(GeoPoint location,
double radius) |
java.util.Collection<MapItem> |
deepFindItems(GeoPoint location,
double radius,
java.util.Map<java.lang.String,java.lang.String> metadata)
Find map items within a given area
|
java.util.Collection<MapItem> |
deepFindItems(GeoPoint location,
double radius,
java.lang.String key,
java.lang.String value) |
java.util.List<MapItem> |
deepFindItems(java.lang.String key,
java.lang.String value)
Deep traverse the map group to find all items that matches search constraints.
|
static int |
deepFindItemsWithMetaString(java.util.List<MapItem> outList,
MapGroup group,
java.util.Map<java.lang.String,java.lang.String> metadata)
Finds all descendant items that match the specified metadata filter.
|
static int |
deepFindItemsWithMetaString(java.util.List<MapItem> outList,
MapGroup group,
java.lang.String key,
java.lang.String value)
Finds all descendant items that match the specified metadata filter.
|
static MapItem |
deepFindItemWithMetaString(MapGroup group,
java.util.Map<java.lang.String,java.lang.String> metadata) |
static MapItem |
deepFindItemWithMetaString(MapGroup group,
java.lang.String key,
java.lang.String value) |
static MapItem |
deepFindItemWithSerialId(MapGroup group,
long serialId) |
MapGroup |
deepFindMapGroup(java.lang.String friendlyname)
Finds and returns THE FIRST child map group of this map group with a friendly name that
matches 'friendlyname' in a breadth-first-search process.
|
MapItem |
deepFindUID(java.lang.String uid)
Stock implementation of searching for a UID.
|
abstract boolean |
deepForEachItem(MapGroup.MapItemsCallback cb) |
MapItem |
deepHitTest(int xpos,
int ypos,
GeoPoint point,
MapView view)
Perform a hit-test for map items
|
java.util.SortedSet<MapItem> |
deepHitTestItems(int xpos,
int ypos,
GeoPoint point,
MapView view)
Perform a hit-test for map items
|
static boolean |
deepMapItems(MapGroup group,
MapGroup.MapItemsCallback func) |
static int |
deepMapItemsCount(MapGroup group) |
static int |
deepMapItemsCount(MapGroup group,
MapGroup.MapItemsCallback func) |
protected void |
dispatchFriendlyNameChanged() |
protected void |
dispatchGroupAdded(MapGroup group)
Invoked when a MapGroup is added
|
protected void |
dispatchGroupRemoved(MapGroup group)
Invoked when a MapGroup is removed
|
protected void |
dispatchItemAdded(MapItem itemIface)
Invoked when a MapItem is added
|
protected void |
dispatchItemRemoved(MapItem itemIface)
Invoked when a MapItem is removed
|
protected void |
dispatchVisibleChanged() |
MapItem |
findClosestItem(GeoPoint location)
Find the closest item to the geosptial point or an empty map if nothing is found.
|
MapItem |
findClosestItem(GeoPoint location,
double threshold)
Finds the closest MapItem to the specified point, that falls within the specified threshold.
|
abstract MapItem |
findClosestItem(GeoPoint location,
double threshold,
java.util.Map<java.lang.String,java.lang.String> metadata)
Finds the closest MapItem to the specified point, that falls within the specified threshold.
|
MapItem |
findClosestItem(GeoPoint location,
double threshold,
java.lang.String key,
java.lang.String value) |
MapItem |
findClosestItem(GeoPoint location,
java.util.Map<java.lang.String,java.lang.String> metadata) |
MapItem |
findClosestItem(GeoPoint location,
java.lang.String key,
java.lang.String value) |
abstract MapItem |
findItem(java.util.Map<java.lang.String,java.lang.String> metadata) |
MapItem |
findItem(java.lang.String key,
java.lang.String value) |
java.util.Collection<MapItem> |
findItems(GeoPoint location,
double radius)
Finds all MapItems within the radius around the specified point.
|
abstract java.util.Collection<MapItem> |
findItems(GeoPoint location,
double radius,
java.util.Map<java.lang.String,java.lang.String> metadata) |
java.util.Collection<MapItem> |
findItems(GeoPoint location,
double radius,
java.lang.String key,
java.lang.String value) |
abstract java.util.List<MapItem> |
findItems(java.util.Map<java.lang.String,java.lang.String> metadata) |
java.util.List<MapItem> |
findItems(java.lang.String key,
java.lang.String value) |
static int |
findItemsWithMetaString(java.util.List<MapItem> outList,
MapGroup group,
java.util.Map<java.lang.String,java.lang.String> metadata)
Finds all child items that match the specified metadata filter.
|
static MapItem |
findItemWithMetaString(MapGroup group,
java.util.Map<java.lang.String,java.lang.String> metadata)
Finds the first child item that match the specified metadata filter.
|
static MapItem |
findItemWithMetaString(MapGroup group,
java.lang.String key,
java.lang.String value) |
static MapItem |
findItemWithMetaStringImpl(MapGroup group,
java.util.Map<java.lang.String,java.lang.String> literal,
java.util.Map<java.lang.String,java.lang.String> regex)
Finds the first matching child item
|
static MapGroup |
findMapGroup(MapGroup group,
java.lang.String friendlyName) |
MapGroup |
findMapGroup(java.lang.String friendlyname)
Finds and returns THE FIRST child map group of this map group with a friendly name that
matches 'friendlyname'.
|
abstract boolean |
forEachItem(MapGroup.MapItemsCallback cb)
Executes the callback on each of this group's child items until a value of
true
is returned by the callback. |
abstract MapGroup |
getChildGroupById(long id) |
abstract java.util.Collection<MapGroup> |
getChildGroups() |
abstract java.lang.String |
getFriendlyName()
Get the friendly name of the MapGroup
|
abstract int |
getGroupCount()
Get the number of child MapGroups
|
abstract MapItem |
getItemById(long id) |
abstract int |
getItemCount()
Get the number of MapItems in the group
|
abstract java.util.Collection<MapItem> |
getItems() |
java.util.Collection<MapItem> |
getItemsRecursive()
Get a flat list of all map items in the group hierarchy
|
MapGroup |
getParentGroup()
Get the parent MapGroup
|
static java.lang.String |
getPath(MapGroup group) |
long |
getSerialId() |
abstract boolean |
getVisible() |
protected boolean |
hasItemListChangedListeners() |
protected MapItem |
hitTest(int xpos,
int ypos,
GeoPoint point,
MapView view)
Deprecated.
This is now handled by the
RootMapGroup via
HitTestControl . Implementation will be kept intact until
deprecation removal. |
protected java.util.SortedSet<MapItem> |
hitTestItems(int xpos,
int ypos,
GeoPoint point,
MapView view)
Deprecated.
This is now handled by the
RootMapGroup via
HitTestControl . Implementation will be kept intact until
deprecation removal. |
static boolean |
mapItems(MapGroup group,
MapGroup.MapItemsCallback func) |
static int |
mapItemsCount(MapGroup group,
MapGroup.MapItemsCallback func) |
static boolean |
matchItemWithMetaString(MapItem item,
java.util.Map<java.lang.String,java.lang.String> metadata)
Check if the specified item matches the metadata filter
|
static boolean |
matchItemWithMetaString(MapItem item,
java.util.Map<java.lang.String,java.lang.String> literal,
java.util.Map<java.lang.String,java.lang.String> regex)
Check if the map item matches the literal & regex expressions
|
static boolean |
matchItemWithMetaString(MapItem item,
java.lang.String key,
java.lang.String value)
Check if the specified item matches the key/value pair
|
protected void |
onAddedNoSync(MapGroup newParent) |
protected void |
onRemovedNoSync() |
boolean |
removeGroup(MapGroup group)
Remove a MapGroup if it belongs to this one.
|
protected abstract boolean |
removeGroupImpl(MapGroup group,
boolean referenceOnly)
Implements group removal.
|
void |
removeItem(MapItem item)
Removes the given MapItem from this map group, if it is a member.
|
protected abstract boolean |
removeItemImpl(MapItem item)
Implementation for removing an item from a map group.
|
void |
removeOnFriendlyNameChangedListener(MapGroup.OnFriendlyNameChangedListener l) |
void |
removeOnGroupListChangedListener(MapGroup.OnGroupListChangedListener listener)
Remove a groupList listener
|
void |
removeOnItemListChangedListener(MapGroup.OnItemListChangedListener listener)
Add a itemList listener
|
void |
removeOnVisibleChangedListener(MapGroup.OnVisibleChangedListener l) |
java.util.Collection<HashtagContent> |
search(java.util.Collection<java.lang.String> tags)
Search for content based on tags
|
void |
setDefaultZOrder(double zOrder)
Set the default z-order for any items added to this group
|
abstract void |
setFriendlyName(java.lang.String friendlyName) |
abstract void |
setVisible(boolean visible) |
void |
setVisibleIgnoreChildren(boolean visible)
Set group visibility without modifying the visibility of
children items
|
copyMetaData, get, getMetaBoolean, getMetaData, getMetaDouble, getMetaIntArray, getMetaInteger, getMetaLong, getMetaMap, getMetaParcelable, getMetaSerializable, getMetaString, getMetaStringArrayList, hasMetaValue, removeMetaData, setMetaBoolean, setMetaData, setMetaDataImpl, setMetaDouble, setMetaIntArray, setMetaInteger, setMetaLong, setMetaMap, setMetaParcelable, setMetaSerializable, setMetaString, setMetaStringArrayList, toggleMetaData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deepFindItems, deepFindItems
public MapGroup()
public MapGroup(MetaDataHolder metadata)
protected MapGroup(long serialId)
protected MapGroup(long serialId, MetaDataHolder metadata)
public final long getSerialId()
public abstract void clearItems()
public abstract void clearGroups()
public abstract void setVisible(boolean visible)
public void setVisibleIgnoreChildren(boolean visible)
public abstract boolean getVisible()
public void setDefaultZOrder(double zOrder)
zOrder
- Z-order or NaN to ignorepublic final void addOnGroupListChangedListener(MapGroup.OnGroupListChangedListener listener)
listener
- the listenerpublic final void removeOnGroupListChangedListener(MapGroup.OnGroupListChangedListener listener)
listener
- the listenerpublic abstract int getGroupCount()
public final boolean removeGroup(MapGroup group)
permaGroup
metadata set to true
, it will remain a child BUT all of its child groups and
items will be removed.group
- the MapGroup to removeprotected abstract boolean removeGroupImpl(MapGroup group, boolean referenceOnly)
group
- the MapGroup to removereferenceOnly
- If true
only references to the group should be removed.
This will be the common case when the remove is effected by adding the child to
another group. If false
it is assumed that the group is being
disposed of.public abstract MapGroup addGroup(MapGroup groupIface)
groupIface
- the MapGroup to addpublic abstract MapGroup addGroup()
public abstract MapGroup addGroup(java.lang.String friendlyName)
friendlyName
- the friendly display namepublic final void addOnItemListChangedListener(MapGroup.OnItemListChangedListener listener)
listener
- the listenerpublic final void removeOnItemListChangedListener(MapGroup.OnItemListChangedListener listener)
listener
- the listenerpublic abstract int getItemCount()
public MapGroup getParentGroup()
public void addItem(MapItem item)
item
- the item to addpublic Marker createMarker(GeoPoint point, java.lang.String uid)
protected abstract void addItemImpl(MapItem item)
dispatchItemAdded(MapItem)
method will
be invoked immediately after this method returns.item
- The item to be addedpublic MapItem findItem(java.lang.String key, java.lang.String value)
public abstract MapItem findItem(java.util.Map<java.lang.String,java.lang.String> metadata)
public java.util.List<MapItem> findItems(java.lang.String key, java.lang.String value)
public abstract java.util.List<MapItem> findItems(java.util.Map<java.lang.String,java.lang.String> metadata)
public MapItem deepFindUID(java.lang.String uid)
public MapItem deepFindItem(java.lang.String key, java.lang.String value)
key
- the key to seach onvalue
- the value for the keypublic abstract MapItem deepFindItem(java.util.Map<java.lang.String,java.lang.String> metadata)
deepFindItem
in interface DeepMapItemQuery
metadata
- the map of keys and values that need to be matched when searching for an item.public java.util.List<MapItem> deepFindItems(java.lang.String key, java.lang.String value)
key
- the key to seach onvalue
- the value for the keypublic MapItem findClosestItem(GeoPoint location)
location
- the point to search with.public MapItem findClosestItem(GeoPoint location, java.lang.String key, java.lang.String value)
public MapItem findClosestItem(GeoPoint location, java.util.Map<java.lang.String,java.lang.String> metadata)
public MapItem findClosestItem(GeoPoint location, double threshold)
location
- The locationthreshold
- The search threshold, in meters. Only items that are within this distance
from the point are considered. If no threshold is desired, the value
0.0d
should be specified.public MapItem findClosestItem(GeoPoint location, double threshold, java.lang.String key, java.lang.String value)
public abstract MapItem findClosestItem(GeoPoint location, double threshold, java.util.Map<java.lang.String,java.lang.String> metadata)
location
- The locationthreshold
- The search threshold, in meters. Only items that are within this distance
from the point are considered. If no threshold is desired, the value
0.0d
should be specified.metadata
- public MapItem deepFindClosestItem(GeoPoint location)
public MapItem deepFindClosestItem(GeoPoint location, java.lang.String key, java.lang.String value)
public MapItem deepFindClosestItem(GeoPoint location, java.util.Map<java.lang.String,java.lang.String> metadata)
public MapItem deepFindClosestItem(GeoPoint location, double threshold)
public MapItem deepFindClosestItem(GeoPoint location, double threshold, java.lang.String key, java.lang.String value)
public MapItem deepFindClosestItem(GeoPoint location, double threshold, java.util.Map<java.lang.String,java.lang.String> metadata)
DeepMapItemQuery
deepFindClosestItem
in interface DeepMapItemQuery
location
- The locationthreshold
- The search threshold, in meters. Only items that are within this distance
from the point are considered. If no threshold is desired, the value
0.0d
should be specified.metadata
- Extra query metadatapublic java.util.Collection<MapItem> findItems(GeoPoint location, double radius)
location
- The locationradius
- The search threshold, in meters.public java.util.Collection<MapItem> findItems(GeoPoint location, double radius, java.lang.String key, java.lang.String value)
public abstract java.util.Collection<MapItem> findItems(GeoPoint location, double radius, java.util.Map<java.lang.String,java.lang.String> metadata)
public java.util.Collection<MapItem> deepFindItems(GeoPoint location, double radius)
public java.util.Collection<MapItem> deepFindItems(GeoPoint location, double radius, java.lang.String key, java.lang.String value)
public java.util.Collection<MapItem> deepFindItems(GeoPoint location, double radius, java.util.Map<java.lang.String,java.lang.String> metadata)
DeepMapItemQuery
deepFindItems
in interface DeepMapItemQuery
location
- Geodetic locationradius
- Radius in metersmetadata
- Extra query metadata@Deprecated protected MapItem hitTest(int xpos, int ypos, GeoPoint point, MapView view)
RootMapGroup
via
HitTestControl
. Implementation will be kept intact until
deprecation removal.@Deprecated protected java.util.SortedSet<MapItem> hitTestItems(int xpos, int ypos, GeoPoint point, MapView view)
RootMapGroup
via
HitTestControl
. Implementation will be kept intact until
deprecation removal.public MapItem deepHitTest(int xpos, int ypos, GeoPoint point, MapView view)
DeepMapItemQuery
deepHitTest
in interface DeepMapItemQuery
xpos
- X-positionypos
- Y-positionpoint
- Ppoint on the map that was touchedview
- Map viewpublic java.util.SortedSet<MapItem> deepHitTestItems(int xpos, int ypos, GeoPoint point, MapView view)
DeepMapItemQuery
deepHitTestItems
in interface DeepMapItemQuery
xpos
- X-positionypos
- Y-positionpoint
- Ppoint on the map that was touchedview
- Map viewpublic MapGroup findMapGroup(java.lang.String friendlyname)
friendlyname
- the friendly name of the group to findpublic MapGroup deepFindMapGroup(java.lang.String friendlyname)
friendlyname
- the friendly name of the group to findpublic abstract boolean forEachItem(MapGroup.MapItemsCallback cb)
true
is returned by the callback.cb
- public abstract boolean deepForEachItem(MapGroup.MapItemsCallback cb)
public abstract java.lang.String getFriendlyName()
public abstract void setFriendlyName(java.lang.String friendlyName)
protected final void dispatchItemAdded(MapItem itemIface)
itemIface
- the MapItem that was addedprotected void dispatchItemRemoved(MapItem itemIface)
itemIface
- the MapItem that was removedprotected final void dispatchGroupAdded(MapGroup group)
group
- the MapGroup that was addedprotected final void dispatchGroupRemoved(MapGroup group)
group
- the MapGroup that was removedprotected final void dispatchVisibleChanged()
protected final void dispatchFriendlyNameChanged()
public void addOnVisibleChangedListener(MapGroup.OnVisibleChangedListener l)
public final void removeOnVisibleChangedListener(MapGroup.OnVisibleChangedListener l)
public final void addOnFriendlyNameChangedListener(MapGroup.OnFriendlyNameChangedListener l)
public final void removeOnFriendlyNameChangedListener(MapGroup.OnFriendlyNameChangedListener l)
protected final void onAddedNoSync(MapGroup newParent)
protected final void onRemovedNoSync()
protected final boolean hasItemListChangedListeners()
public final void removeItem(MapItem item)
protected abstract boolean removeItemImpl(MapItem item)
public abstract java.util.Collection<MapGroup> getChildGroups()
public abstract java.util.Collection<MapItem> getItems()
public abstract MapGroup getChildGroupById(long id)
public abstract MapItem getItemById(long id)
public boolean containsItem(MapItem item)
public java.util.Collection<MapItem> getItemsRecursive()
public java.util.Collection<HashtagContent> search(java.util.Collection<java.lang.String> tags)
HashtagSearch
search
in interface HashtagSearch
tags
- List of hashtags to search forpublic static MapItem deepFindItemWithMetaString(MapGroup group, java.lang.String key, java.lang.String value)
public static java.lang.String getPath(MapGroup group)
public static MapItem deepFindItemWithMetaString(MapGroup group, java.util.Map<java.lang.String,java.lang.String> metadata)
public static MapItem findItemWithMetaString(MapGroup group, java.lang.String key, java.lang.String value)
public static MapItem findItemWithMetaString(MapGroup group, java.util.Map<java.lang.String,java.lang.String> metadata)
group
- metadata
- public static MapItem findItemWithMetaStringImpl(MapGroup group, java.util.Map<java.lang.String,java.lang.String> literal, java.util.Map<java.lang.String,java.lang.String> regex)
group
- literal
- regex
- public static boolean matchItemWithMetaString(MapItem item, java.lang.String key, java.lang.String value)
item
- key
- value
- public static boolean matchItemWithMetaString(MapItem item, java.util.Map<java.lang.String,java.lang.String> metadata)
item
- metadata
- public static boolean matchItemWithMetaString(MapItem item, java.util.Map<java.lang.String,java.lang.String> literal, java.util.Map<java.lang.String,java.lang.String> regex)
item
- literal
- regex
- public static int deepFindItemsWithMetaString(java.util.List<MapItem> outList, MapGroup group, java.lang.String key, java.lang.String value)
outList
- group
- key
- findItemsWithMetaString(List, MapGroup, Map)
public static int deepFindItemsWithMetaString(java.util.List<MapItem> outList, MapGroup group, java.util.Map<java.lang.String,java.lang.String> metadata)
outList
- group
- metadata
- findItemsWithMetaString(List, MapGroup, Map)
public static int findItemsWithMetaString(java.util.List<MapItem> outList, MapGroup group, java.util.Map<java.lang.String,java.lang.String> metadata)
outList
- group
- metadata
- public static MapItem deepFindItemWithSerialId(MapGroup group, long serialId)
public static MapGroup deepFindGroupByNameDepthFirst(MapGroup group, java.lang.String friendlyname)
public static MapGroup deepFindGroupByNameBreadthFirst(MapGroup group, java.lang.String friendlyname)
public static MapGroup deepFindGroupBySerialIdDepthFirst(MapGroup group, long serialId)
public static MapGroup deepFindGroupBySerialIdBreadthFirst(MapGroup group, long serialId)
public static boolean mapItems(MapGroup group, MapGroup.MapItemsCallback func)
public static boolean deepMapItems(MapGroup group, MapGroup.MapItemsCallback func)
public static long createMapGroupSerialId()
ALL IMPLEMENTERS OF MapGroup
SHOULD DERIVE THEIR SERIAL ID USING THIS
METHOD!
public static int mapItemsCount(MapGroup group, MapGroup.MapItemsCallback func)
public static int deepMapItemsCount(MapGroup group, MapGroup.MapItemsCallback func)
public static int deepMapItemsCount(MapGroup group)