Package org.mapsforge.poi.storage
Interface PoiPersistenceManager
-
- All Known Implementing Classes:
AbstractPoiPersistenceManager
public interface PoiPersistenceManagerAbstracts from an underlying Storage/DB by providing methods for inserting / deleting / searchingPointOfInterestobjects in named Storage/DB. Remember to call theclose()method as soon as you are done manipulating the Storage/DB via thisPoiPersistenceManager.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Use this to free claimed resources.java.util.Collection<PointOfInterest>findInRect(org.mapsforge.core.model.BoundingBox bb, PoiCategoryFilter filter, java.util.List<org.mapsforge.core.model.Tag> patterns, int limit)Find allPointOfInterestin a rectangle specified by the givenBoundingBox.java.util.Collection<PointOfInterest>findNearPosition(org.mapsforge.core.model.LatLong point, int distance, PoiCategoryFilter filter, java.util.List<org.mapsforge.core.model.Tag> patterns, int limit)FetchPointOfInterestfrom underlying storage near a given position.PointOfInterestfindPointByID(long poiID)PoiCategoryManagergetCategoryManager()java.lang.StringgetPoiFile()PoiFileInfogetPoiFileInfo()voidinsertPointOfInterest(PointOfInterest poi)Inserts a singlePointOfInterestinto storage.voidinsertPointsOfInterest(java.util.Collection<PointOfInterest> pois)InsertsPointOfInterestinto storage.booleanisClosed()booleanisValidDataBase()voidreadPoiFileInfo()Reads the metadata for the current POI file.voidremovePointOfInterest(PointOfInterest poi)Removes a point of interest from storage.voidsetCategoryManager(PoiCategoryManager categoryManager)Sets this manager'sPoiCategoryManagerfor retrieving and editing POI categories.
-
-
-
Method Detail
-
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
java.util.Collection<PointOfInterest> findInRect(org.mapsforge.core.model.BoundingBox bb, PoiCategoryFilter filter, java.util.List<org.mapsforge.core.model.Tag> patterns, int limit)
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).limit- max number ofPointOfInterestto be returned.- Returns:
CollectionofPointOfInterestmatching a givenPoiCategoryFilterand data pattern contained in the rectangle specified by the givenBoundingBox.
-
findNearPosition
java.util.Collection<PointOfInterest> findNearPosition(org.mapsforge.core.model.LatLong point, int distance, PoiCategoryFilter filter, java.util.List<org.mapsforge.core.model.Tag> patterns, int limit)
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).limit- max number ofPointOfInterestto be returned.- Returns:
CollectionofPointOfInterestmatching a givenPoiCategoryFilterand data pattern near the given position.
-
findPointByID
PointOfInterest findPointByID(long poiID)
- 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
java.lang.String getPoiFile()
- Returns:
- the current POI file.
-
getPoiFileInfo
PoiFileInfo getPoiFileInfo()
- Returns:
- the metadata for the current POI file.
-
insertPointOfInterest
void insertPointOfInterest(PointOfInterest poi)
Inserts a singlePointOfInterestinto storage.- Parameters:
poi-PointOfInterestto insert into storage.
-
insertPointsOfInterest
void insertPointsOfInterest(java.util.Collection<PointOfInterest> pois)
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
void removePointOfInterest(PointOfInterest poi)
Removes a point of interest from storage.- Parameters:
poi- thePointOfInterestto be removed.
-
setCategoryManager
void setCategoryManager(PoiCategoryManager categoryManager)
Sets this manager'sPoiCategoryManagerfor retrieving and editing POI categories.- Parameters:
categoryManager- The category manager to be set.
-
-