Package org.mapsforge.poi.storage
Interface PoiPersistenceManager
- All Known Implementing Classes:
AbstractPoiPersistenceManager
public interface PoiPersistenceManager
Abstracts from an underlying Storage/DB by providing methods for inserting / deleting / searching
PointOfInterest objects in named Storage/DB.
Remember to call the close() method as soon as you are done manipulating the Storage/DB
via this PoiPersistenceManager.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Use this to free claimed resources.findInRect(org.mapsforge.core.model.BoundingBox bb, PoiCategoryFilter filter, List<org.mapsforge.core.model.Tag> patterns, org.mapsforge.core.model.LatLong orderBy, int limit, boolean findCategories) Find allPointOfInterestin a rectangle specified by the givenBoundingBox.findNearPosition(org.mapsforge.core.model.LatLong point, int distance, PoiCategoryFilter filter, List<org.mapsforge.core.model.Tag> patterns, org.mapsforge.core.model.LatLong orderBy, int limit, boolean findCategories) FetchPointOfInterestfrom underlying storage near a given position.findPointByID(long poiID) voidInserts a singlePointOfInterestinto storage.voidInsertsPointOfInterestinto storage.booleanisClosed()booleanvoidReads the metadata for the current POI file.voidRemoves a point of interest from storage.voidsetCategoryManager(PoiCategoryManager categoryManager) Sets this manager'sPoiCategoryManagerfor retrieving and editing POI categories.
-
Method Details
-
close
void close()Use this to free claimed resources. After that you might no longer be able to query for points of interest. This should always be called a soon as you are done querying. -
findInRect
Collection<PointOfInterest> findInRect(org.mapsforge.core.model.BoundingBox bb, PoiCategoryFilter filter, List<org.mapsforge.core.model.Tag> patterns, org.mapsforge.core.model.LatLong orderBy, int limit, boolean findCategories) Find allPointOfInterestin a rectangle specified by the givenBoundingBox. Only the POIs that are allowed by thePoiCategoryFilterobject and matching the data pattern will be returned.- Parameters:
bb-BoundingBoxspecifying the rectangle.filter- POI category filter object that helps determining whether a POI should be added to the set or not (may be null).patterns- the patterns to search in points of interest data (may be null).orderBy-LatLonglocation of the sort.limit- max number ofPointOfInterestto be returned.findCategories- find POI categories.- Returns:
CollectionofPointOfInterestmatching a givenPoiCategoryFilterand data pattern contained in the rectangle specified by the givenBoundingBox.
-
findNearPosition
Collection<PointOfInterest> findNearPosition(org.mapsforge.core.model.LatLong point, int distance, PoiCategoryFilter filter, List<org.mapsforge.core.model.Tag> patterns, org.mapsforge.core.model.LatLong orderBy, int limit, boolean findCategories) FetchPointOfInterestfrom underlying storage near a given position. Only the POIs that are allowed by thePoiCategoryFilterobject and matching the data pattern will be returned.- Parameters:
point-LatLongcenter of the search.distance- in metersfilter- POI category filter object that helps determining whether a POI should be added to the set or not (may be null).patterns- the patterns to search in points of interest data (may be null).orderBy-LatLonglocation of the sort.limit- max number ofPointOfInterestto be returned.findCategories- find POI categories.- Returns:
CollectionofPointOfInterestmatching a givenPoiCategoryFilterand data pattern near the given position.
-
findPointByID
- Parameters:
poiID- the id of the point of interest that shall be returned.- Returns:
- a single
PointOfInterestp where p.id == poiID.
-
getCategoryManager
PoiCategoryManager getCategoryManager()- Returns:
- The persistence manager's category manager for retrieving and editing POI categories.
-
getPoiFile
String getPoiFile()- Returns:
- the current POI file.
-
getPoiFileInfo
PoiFileInfo getPoiFileInfo()- Returns:
- the metadata for the current POI file.
-
insertPointOfInterest
Inserts a singlePointOfInterestinto storage.- Parameters:
poi-PointOfInterestto insert into storage.
-
insertPointsOfInterest
InsertsPointOfInterestinto storage.- Parameters:
pois- collection ofPointOfInterestto insert into storage.
-
isClosed
boolean isClosed()- Returns:
- true if the manager is closed.
-
isValidDataBase
boolean isValidDataBase()- Returns:
- true if the database is a valid POI database.
-
readPoiFileInfo
void readPoiFileInfo()Reads the metadata for the current POI file. -
removePointOfInterest
Removes a point of interest from storage.- Parameters:
poi- thePointOfInterestto be removed.
-
setCategoryManager
Sets this manager'sPoiCategoryManagerfor retrieving and editing POI categories.- Parameters:
categoryManager- The category manager to be set.
-