O
- the base type of OSM primitivesN
- type representing OSM nodesW
- type representing OSM waysR
- type representing OSM relationspublic interface OsmData<O extends IPrimitive,N extends INode,W extends IWay<N>,R extends IRelation<?>> extends Data, Lockable
DataSet
.
This class holds OSM data but does not rely on implementation types,
allowing plugins to define their own representation of OSM data if needed.Modifier and Type | Method and Description |
---|---|
void |
addHighlightUpdateListener(HighlightUpdateListener listener)
Adds a listener that gets notified whenever way segment / virtual nodes highlights change.
|
void |
addPrimitive(O primitive)
Adds a primitive.
|
void |
addSelected(java.util.Collection<? extends PrimitiveId> selection)
Adds the primitives in
selection to the current selection
and notifies all DataSelectionListener . |
void |
addSelected(PrimitiveId... osm)
Adds the primitives in
osm to the current selection
and notifies all DataSelectionListener . |
void |
addSelectionListener(DataSelectionListener listener)
Add a listener that listens to selection changes in this specific data set.
|
default java.util.Collection<O> |
allModifiedPrimitives()
Returns a collection containing all modified primitives.
|
default java.util.Collection<O> |
allNonDeletedCompletePrimitives()
Returns a collection containing all not-deleted complete primitives.
|
default java.util.Collection<O> |
allNonDeletedPhysicalPrimitives()
Returns a collection containing all not-deleted complete physical primitives.
|
default java.util.Collection<O> |
allNonDeletedPrimitives()
Returns a collection containing all not-deleted primitives.
|
default java.util.Collection<O> |
allPreservedPrimitives()
Returns a collection containing all primitives preserved from filtering.
|
default java.util.Collection<O> |
allPrimitives()
Returns a collection containing all primitives of the dataset.
|
void |
clear()
Removes all primitives.
|
default void |
clearHighlightedVirtualNodes()
clear all highlights of virtual nodes
|
default void |
clearHighlightedWaySegments()
clear all highlights of way segments
|
void |
clearMappaintCache()
Clear the mappaint cache for this DataSet.
|
void |
clearSelection()
Clears the current selection.
|
void |
clearSelection(java.util.Collection<? extends PrimitiveId> list)
Removes the selection from every value in the collection.
|
void |
clearSelection(PrimitiveId... osm)
Removes the selection from every value in the collection.
|
boolean |
containsNode(N n)
Determines if the given node can be retrieved in the data set through its bounding box.
|
boolean |
containsRelation(R r)
Determines if the given relation can be retrieved in the data set through its bounding box.
|
boolean |
containsWay(W w)
Determines if the given way can be retrieved in the data set through its bounding box.
|
java.util.Collection<O> |
getAllSelected()
Replies an unmodifiable collection of primitives currently selected
in this dataset, including deleted ones.
|
default ProjectionBounds |
getDataSourceBoundingBox()
Returns the data sources bounding box.
|
DownloadPolicy |
getDownloadPolicy()
Get the download policy.
|
java.util.Collection<WaySegment> |
getHighlightedVirtualNodes()
Returns an unmodifiable collection of *WaySegments* whose virtual
nodes should be highlighted.
|
java.util.Collection<WaySegment> |
getHighlightedWaySegments()
Returns an unmodifiable collection of WaySegments that should be highlighted.
|
java.lang.String |
getName()
Returns the name of this data set (optional).
|
java.util.Collection<N> |
getNodes()
Replies an unmodifiable collection of nodes in this dataset
|
default O |
getPrimitiveById(long id,
OsmPrimitiveType type)
Returns a primitive with a given id from the data set.
|
O |
getPrimitiveById(PrimitiveId primitiveId)
Returns a primitive with a given id from the data set.
|
<T extends O> |
getPrimitives(java.util.function.Predicate<? super O> predicate)
Gets a filtered collection of primitives matching the given predicate.
|
java.util.concurrent.locks.Lock |
getReadLock()
Returns the lock used for reading.
|
java.util.Collection<R> |
getRelations()
Replies an unmodifiable collection of relations in this dataset
|
default java.util.Collection<O> |
getSelected()
Replies an unmodifiable collection of primitives currently selected
in this dataset, except deleted ones.
|
default java.util.Collection<N> |
getSelectedNodes()
Returns selected nodes.
|
default java.util.Collection<R> |
getSelectedRelations()
Returns selected relations.
|
default java.util.Collection<W> |
getSelectedWays()
Returns selected ways.
|
UploadPolicy |
getUploadPolicy()
Get the upload policy.
|
java.lang.String |
getVersion()
Replies the API version this dataset was created from.
|
java.util.Collection<W> |
getWays()
Replies an unmodifiable collection of ways in this dataset
|
default boolean |
isModified()
Replies true if there is at least one primitive in this dataset with
IPrimitive.isModified() == true . |
boolean |
isSelected(O osm)
Determines whether the given primitive is selected or not
|
void |
removeHighlightUpdateListener(HighlightUpdateListener listener)
Removes a listener that was added with
addHighlightUpdateListener(HighlightUpdateListener) |
void |
removeSelectionListener(DataSelectionListener listener)
Remove a listener that listens to selection changes in this specific data set.
|
java.util.List<N> |
searchNodes(BBox bbox)
Searches for nodes in the given bounding box.
|
java.util.List<R> |
searchRelations(BBox bbox)
Searches for relations in the given bounding box.
|
java.util.List<W> |
searchWays(BBox bbox)
Searches for ways in the given bounding box.
|
boolean |
selectionEmpty()
Determines whether the selection is empty or not
|
void |
setDownloadPolicy(DownloadPolicy downloadPolicy)
Sets the download policy.
|
void |
setHighlightedVirtualNodes(java.util.Collection<WaySegment> waySegments)
set what virtual nodes should be highlighted.
|
void |
setHighlightedWaySegments(java.util.Collection<WaySegment> waySegments)
set what virtual ways should be highlighted.
|
void |
setName(java.lang.String name)
Sets the name of this data set.
|
void |
setSelected(java.util.Collection<? extends PrimitiveId> selection)
Sets the current selection to the primitives in
selection
and notifies all DataSelectionListener . |
void |
setSelected(PrimitiveId... osm)
Sets the current selection to the primitives in
osm
and notifies all DataSelectionListener . |
void |
setUploadPolicy(UploadPolicy uploadPolicy)
Sets the upload policy.
|
void |
toggleSelected(java.util.Collection<? extends PrimitiveId> osm)
Toggles the selected state of the given collection of primitives.
|
void |
toggleSelected(PrimitiveId... osm)
Toggles the selected state of the given collection of primitives.
|
getDataSourceArea, getDataSourceBounds, getDataSources
java.lang.String getVersion()
java.lang.String getName()
null
void setName(java.lang.String name)
name
- the new name of this data set. Can be null
to reset itvoid addPrimitive(O primitive)
primitive
- the primitivevoid clear()
java.util.List<N> searchNodes(BBox bbox)
bbox
- the bounding boxboolean containsNode(N n)
n
- The node to searchtrue
if n
can be retrieved in this data set, false
otherwisejava.util.List<W> searchWays(BBox bbox)
bbox
- the bounding boxboolean containsWay(W w)
w
- The way to searchtrue
if w
can be retrieved in this data set, false
otherwisejava.util.List<R> searchRelations(BBox bbox)
bbox
- the bounding boxboolean containsRelation(R r)
r
- The relation to searchtrue
if r
can be retrieved in this data set, false
otherwisedefault O getPrimitiveById(long id, OsmPrimitiveType type)
id
- uniqueId of the primitive. Might be < 0 for newly created primitivestype
- the type of the primitive. Must not be null.java.lang.NullPointerException
- if type is nullO getPrimitiveById(PrimitiveId primitiveId)
primitiveId
- type and uniqueId of the primitive. Might be < 0 for newly created primitives<T extends O> java.util.Collection<T> getPrimitives(java.util.function.Predicate<? super O> predicate)
T
- The primitive type.predicate
- The predicate to matchjava.util.Collection<N> getNodes()
java.util.Collection<W> getWays()
java.util.Collection<R> getRelations()
default java.util.Collection<O> allPrimitives()
default java.util.Collection<O> allNonDeletedPrimitives()
AbstractPrimitive.isDeleted()
default java.util.Collection<O> allNonDeletedCompletePrimitives()
AbstractPrimitive.isDeleted()
,
AbstractPrimitive.isIncomplete()
default java.util.Collection<O> allNonDeletedPhysicalPrimitives()
AbstractPrimitive.isDeleted()
,
AbstractPrimitive.isIncomplete()
default java.util.Collection<O> allModifiedPrimitives()
AbstractPrimitive.isModified()
default java.util.Collection<O> allPreservedPrimitives()
OsmPrimitive.isPreserved()
DownloadPolicy getDownloadPolicy()
setDownloadPolicy(DownloadPolicy)
void setDownloadPolicy(DownloadPolicy downloadPolicy)
downloadPolicy
- the download policy. Must not be nullgetUploadPolicy()
UploadPolicy getUploadPolicy()
setUploadPolicy(UploadPolicy)
void setUploadPolicy(UploadPolicy uploadPolicy)
uploadPolicy
- the upload policy. Must not be nullgetUploadPolicy()
java.util.concurrent.locks.Lock getReadLock()
java.util.Collection<WaySegment> getHighlightedVirtualNodes()
java.util.Collection<WaySegment> getHighlightedWaySegments()
default void clearHighlightedVirtualNodes()
default void clearHighlightedWaySegments()
void setHighlightedVirtualNodes(java.util.Collection<WaySegment> waySegments)
waySegments
- Collection of way segmentsvoid setHighlightedWaySegments(java.util.Collection<WaySegment> waySegments)
waySegments
- Collection of way segmentsvoid addHighlightUpdateListener(HighlightUpdateListener listener)
listener
- The Listenervoid removeHighlightUpdateListener(HighlightUpdateListener listener)
addHighlightUpdateListener(HighlightUpdateListener)
listener
- The Listenerdefault java.util.Collection<O> getSelected()
java.util.Collection<O> getAllSelected()
default java.util.Collection<N> getSelectedNodes()
default java.util.Collection<W> getSelectedWays()
default java.util.Collection<R> getSelectedRelations()
boolean selectionEmpty()
boolean isSelected(O osm)
osm
- the primitiveosm
is selected or notvoid toggleSelected(java.util.Collection<? extends PrimitiveId> osm)
osm
- The primitives to togglevoid toggleSelected(PrimitiveId... osm)
osm
- The primitives to togglevoid setSelected(java.util.Collection<? extends PrimitiveId> selection)
selection
and notifies all DataSelectionListener
.selection
- the selectionvoid setSelected(PrimitiveId... osm)
osm
and notifies all DataSelectionListener
.osm
- the primitives to set. null
values are ignored for now, but this may be removed in the future.void addSelected(java.util.Collection<? extends PrimitiveId> selection)
selection
to the current selection
and notifies all DataSelectionListener
.selection
- the selectionvoid addSelected(PrimitiveId... osm)
osm
to the current selection
and notifies all DataSelectionListener
.osm
- the primitives to addvoid clearSelection(PrimitiveId... osm)
osm
- The collection of ids to remove the selection from.void clearSelection(java.util.Collection<? extends PrimitiveId> list)
list
- The collection of ids to remove the selection from.void clearSelection()
void addSelectionListener(DataSelectionListener listener)
listener
- The listener.removeSelectionListener(DataSelectionListener)
,
To add a global listener.
void removeSelectionListener(DataSelectionListener listener)
listener
- The listener.addSelectionListener(DataSelectionListener)
default ProjectionBounds getDataSourceBoundingBox()
void clearMappaintCache()
default boolean isModified()
IPrimitive.isModified()
== true
.IPrimitive.isModified()
== true
.