public abstract class MapItemsDatabase
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
MapItemsDatabase.ContentListener |
static class |
MapItemsDatabase.FilteredMetaDataHolderCursor<T extends MetaDataHolder> |
static interface |
MapItemsDatabase.MetaDataHolderCursor<T extends MetaDataHolder> |
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<MapItemsDatabase.ContentListener> |
contentListeners |
Modifier | Constructor and Description |
---|---|
protected |
MapItemsDatabase() |
Modifier and Type | Method and Description |
---|---|
void |
addContentListener(MapItemsDatabase.ContentListener l) |
protected void |
checkReadOnly() |
abstract void |
close() |
double |
computeDistance(MapItem databaseMapItem,
GeoPoint point) |
void |
deleteChildGroups(long serialId) |
protected abstract void |
deleteChildGroupsImpl(long serialId)
Deletes all child groups of a group.
|
void |
deleteGroup(long serialId) |
protected abstract void |
deleteGroupImpl(long serialId)
Deletes the specified group.
|
void |
deleteItem(long serialId) |
protected abstract void |
deleteItemImpl(long serialId) |
void |
deleteItems(long parentGroupSerialId) |
protected abstract void |
deleteItemsImpl(long parentGroupSerialId)
Deletes all items for a specified group; not recursive.
|
protected void |
dispatchContentChanged() |
protected void |
dispatchContentChangedNoSync() |
abstract MapGroup |
getGroup(long serialId)
Returns the group with the specified serial ID.
|
abstract MapItemsDatabase.MetaDataHolderCursor<MapGroup> |
getGroups(long parentGroupSerialId)
Returns the child groups of the specified group.
|
abstract boolean |
getGroupVisible(long serialId)
Returns the visible property of the specified group.
|
abstract MapItem |
getItem(long serialId) |
abstract MapGroup |
getParentGroup(long childSerialId)
Returns the parent group of the specified group.
|
MapGroup |
insertGroup(long parentSerialId,
java.lang.String friendlyName,
boolean rootGroup) |
void |
insertGroup(MapGroup groupToAdd,
boolean rootGroup) |
protected abstract MapGroup |
insertGroupImpl(long parentSerialId,
java.lang.String friendlyName,
boolean rootGroup)
Inserts the specified group.
|
protected abstract void |
insertGroupImpl(MapGroup groupToAdd,
boolean rootGroup)
Inserts the specified group.
|
void |
insertItem(long parentGroupSerialId,
MapItem item) |
protected abstract void |
insertItemImpl(long parentGroupSerialId,
MapItem item)
Insert the specified item into the specified group.
|
abstract boolean |
isReadOnly()
Returns a flag indicating whether or not the database is read-only.
|
MapItem |
queryClosestItem(long parentGroupSerialId,
boolean recurse,
GeoPoint location,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly)
Finds the item closest to the specified point.
|
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
java.lang.String key,
java.lang.String value) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
java.lang.String key,
java.lang.String value,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
java.util.Map<java.lang.String,java.lang.String> metadata) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
java.lang.String key,
java.lang.String value) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(GeoPoint upperLeft,
GeoPoint lowerRight,
java.lang.String key,
java.lang.String value,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(long parentGroupSerialId,
boolean recurse,
GeoPoint center,
double radius,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(long parentGroupSerialId,
boolean recurse,
GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(java.util.Map<java.lang.String,java.lang.String> metadata) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(java.lang.String key,
java.lang.String value) |
MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItems(java.lang.String key,
java.lang.String value,
boolean visibleOnly) |
protected MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItemsImpl(long parentGroupSerialId,
boolean recurse,
GeoPoint center,
double radius,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly)
Queries items about a point within a specified radius.
|
protected abstract MapItemsDatabase.MetaDataHolderCursor<MapItem> |
queryItemsImpl(long parentGroupSerialId,
boolean recurse,
GeoPoint upperLeft,
GeoPoint lowerRight,
double mapScale,
java.util.Map<java.lang.String,java.lang.String> metadata,
boolean visibleOnly) |
void |
removeContentListener(MapItemsDatabase.ContentListener l) |
protected abstract void |
updateGroup(long serialId,
boolean visible)
Updates the visibility property of a group.
|
void |
updateGroup(long serialId,
java.lang.String friendlyName) |
protected abstract void |
updateGroupImpl(long serialId,
java.lang.String friendlyName)
Updates the friendly name of a group.
|
protected final java.util.Set<MapItemsDatabase.ContentListener> contentListeners
public abstract void close()
public abstract boolean isReadOnly()
true
if the database is read-only, false
otherwise.protected void checkReadOnly()
public abstract MapGroup getGroup(long serialId)
serialId
- The serial ID of the group.null
in the case that no group
with that serial ID is present.public abstract MapItemsDatabase.MetaDataHolderCursor<MapGroup> getGroups(long parentGroupSerialId)
0
is specified, the root
groups available from the database are returned.parentGroupSerialId
- The serial ID of a group. If 0
is specified, the root
groups available from this database are returned.public abstract MapGroup getParentGroup(long childSerialId)
childSerialId
- The group serial IDnull
if the specified group does
not have a parent.public abstract boolean getGroupVisible(long serialId)
serialId
- The group serial IDpublic void insertGroup(MapGroup groupToAdd, boolean rootGroup)
protected abstract void insertGroupImpl(MapGroup groupToAdd, boolean rootGroup)
MapGroup.getParentGroup()
on groupToAdd
.groupToAdd
- The group to be added.public MapGroup insertGroup(long parentSerialId, java.lang.String friendlyName, boolean rootGroup)
protected abstract MapGroup insertGroupImpl(long parentSerialId, java.lang.String friendlyName, boolean rootGroup)
parentSerialId
- The serial ID for the parent that the new group will be added tofriendlyName
- The friendly name of the new grouppublic void deleteChildGroups(long serialId)
protected abstract void deleteChildGroupsImpl(long serialId)
serialId
- The group serial ID.public void deleteGroup(long serialId)
protected abstract void deleteGroupImpl(long serialId)
serialId
- The serial ID of the grouppublic void updateGroup(long serialId, java.lang.String friendlyName)
protected abstract void updateGroupImpl(long serialId, java.lang.String friendlyName)
serialId
- The group serial IDfriendlyName
- The new friendly name for the group.protected abstract void updateGroup(long serialId, boolean visible)
serialId
- The group serial IDvisible
- The new value for the visible state of the group.public void insertItem(long parentGroupSerialId, MapItem item)
protected abstract void insertItemImpl(long parentGroupSerialId, MapItem item)
parentGroupSerialId
- The serial ID of the parent group for the item.item
- The item to be inserted.public void deleteItems(long parentGroupSerialId)
public void deleteItem(long serialId)
protected abstract void deleteItemsImpl(long parentGroupSerialId)
parentGroupSerialId
- The group serial IDprotected abstract void deleteItemImpl(long serialId)
serialId
- Item serial IDpublic abstract MapItem getItem(long serialId)
serialId
- The item serial IDpublic MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(java.lang.String key, java.lang.String value)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(java.lang.String key, java.lang.String value, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(java.util.Map<java.lang.String,java.lang.String> metadata)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, java.lang.String key, java.lang.String value)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, java.lang.String key, java.lang.String value, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, java.util.Map<java.lang.String,java.lang.String> metadata)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, double mapScale)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, java.lang.String key, java.lang.String value)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, java.lang.String key, java.lang.String value, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(long parentGroupSerialId, boolean recurse, GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
public MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItems(long parentGroupSerialId, boolean recurse, GeoPoint center, double radius, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
protected abstract MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItemsImpl(long parentGroupSerialId, boolean recurse, GeoPoint upperLeft, GeoPoint lowerRight, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
parentGroupSerialId
- The serial ID for the top-most group to include in the query. If
0
is specified, a deep search over all groups may be performed by
specifying recurse
as true
recurse
- true
to perform a recursive query, false
to limit
only to the specified group.upperLeft
- The upper-left bound of the region of interest for the query. If both
upperLeft
and lowerRight
are null
, the
query will not be restricted to a geographic extent.lowerRight
- The lower-right bound of the region of interest for the query. If both
upperLeft
and lowerRight
are null
, the
query will not be restricted to a geographic extent.mapScale
- The map scale for the query. Only items that should be displayed at the
specified scale should be included in the results. If specified as
Double.NaN
, the query should not be constrained by scale.metadata
- The metadata for the query. If non-empty, only items with matching metadata
should be included in the results.visibleOnly
- If true
only items that are currently visible should be
included in the results.protected MapItemsDatabase.MetaDataHolderCursor<MapItem> queryItemsImpl(long parentGroupSerialId, boolean recurse, GeoPoint center, double radius, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
The default implementation performs a query about a radius by performing a bounding box query
and excluding all results with a distance greater than radius
from
center
. This method relies on the implementations of
computeDistance(MapItem, GeoPoint)
. The default
implementation is inefficient and should be replaced as the underlying database allows.
parentGroupSerialId
- The serial ID for the top-most group to include in the query. If
0
is specified, a deep search over all groups may be performed by
specifying recurse
as true
recurse
- true
to perform a recursive query, false
to limit
only to the specified group.center
- The center point for the query's region of interest. May not be
null
.radius
- The radius of the query's region of interest specified in meters.mapScale
- The map scale for the query. Only items that should be displayed at the
specified scale should be included in the results. If specified as
Double.NaN
, the query should not be constrained by scale.metadata
- The metadata for the query. If non-empty, only items with matching metadata
should be included in the results.visibleOnly
- If true
only items that are currently visible should be
included in the results.public MapItem queryClosestItem(long parentGroupSerialId, boolean recurse, GeoPoint location, double mapScale, java.util.Map<java.lang.String,java.lang.String> metadata, boolean visibleOnly)
parentGroupSerialId
- The serial ID for the top-most group to include in the query. If
0
is specified, a deep search over all groups may be performed by
specifying recurse
as true
recurse
- true
to perform a recursive query, false
to limit
only to the specified group.location
- The location for the query. May not be' null
.mapScale
- The map scale for the query. Only items that should be displayed at the
specified scale should be included in the results. If specified as
Double.NaN
, the query should not be constrained by scale.metadata
- The metadata for the query. If non-empty, only items with matching metadata
should be included in the results.visibleOnly
- If true
only items that are currently visible should be
included in the results.public double computeDistance(MapItem databaseMapItem, GeoPoint point)
public void addContentListener(MapItemsDatabase.ContentListener l)
public void removeContentListener(MapItemsDatabase.ContentListener l)
protected void dispatchContentChanged()
protected void dispatchContentChangedNoSync()