Class VectorDataSet
- java.lang.Object
-
- org.openstreetmap.josm.data.vector.VectorDataSet
-
- All Implemented Interfaces:
Data,IDataSelectionEventSource<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>,Lockable,OsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>
public class VectorDataSet extends java.lang.Object implements OsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>, IDataSelectionEventSource<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>
A data class for Vector Data- Since:
- 17862
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<PrimitiveId>currentSelectedPrimitivesThe current selected primitives.private VectorDataStorecustomDataStoreprivate ListenerList<DataSelectionListener>dataSelectionListenerListenerListprivate java.util.Map<java.lang.Integer,Storage<MVTTile>>dataStoreMapprivate DownloadPolicydownloadPolicyDefault to normal download policyprotected static floatDUPE_NODE_DISTANCEThe distance to consider nodes duplicates -- mostly a memory saving measure.private java.util.Collection<PrimitiveId>highlightedprivate ListenerList<HighlightUpdateListener>highlightUpdateListenerListenerListprivate ListenerList<IDataSelectionListener<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>>listenersprivate booleanlockprivate shortmappaintCacheIdxprivate java.lang.Stringnameprivate java.util.concurrent.locks.ReentrantReadWriteLockreadWriteLockprivate java.lang.ObjectselectionLockprivate ElemStylesstylesThe paint style for this layerprivate UploadPolicyuploadPolicyDefault to a blocked upload policyprivate intzoomThe current zoom we are getting/adding to
-
Constructor Summary
Constructors Constructor Description VectorDataSet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHighlightUpdateListener(HighlightUpdateListener listener)Adds a listener that gets notified whenever way segment / virtual nodes highlights change.voidaddPrimitive(VectorPrimitive primitive)Add a primitive to the custom data storevoidaddSelected(java.util.Collection<? extends PrimitiveId> selection)Adds the primitives inselectionto the current selection and notifies allDataSelectionListener.voidaddSelected(PrimitiveId... osm)Adds the primitives inosmto the current selection and notifies allDataSelectionListener.private voidaddSelectedImpl(java.util.stream.Stream<? extends PrimitiveId> osm)voidaddSelectionListener(DataSelectionListener listener)Add a listener that listens to selection changes in this specific data set.booleanaddSelectionListener(IDataSelectionListener<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet> listener)Add a listenervoidaddTileData(MVTTile tile)Add tile data to this datasetvoidclear()Removes all primitives.voidclearMappaintCache()Clear the mappaint cache for this DataSet.voidclearSelection()Clears the current selection.voidclearSelection(java.util.Collection<? extends PrimitiveId> list)Removes the selection from every value in the collection.voidclearSelection(PrimitiveId... osm)Removes the selection from every value in the collection.private voidclearSelectionImpl(java.util.stream.Stream<? extends PrimitiveId> osm)booleancontainsNode(VectorNode vectorNode)Determines if the given node can be retrieved in the data set through its bounding box.booleancontainsRelation(VectorRelation vectorRelation)Determines if the given relation can be retrieved in the data set through its bounding box.booleancontainsWay(VectorWay vectorWay)Determines if the given way can be retrieved in the data set through its bounding box.private booleandoSelectionChange(java.util.function.Function<java.util.Set<VectorPrimitive>,IDataSelectionListener.SelectionChangeEvent<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>> command)Do a selection change.java.util.Collection<VectorPrimitive>getAllSelected()Replies an unmodifiable collection of primitives currently selected in this dataset, including deleted ones.private java.util.Optional<Storage<MVTTile>>getBestZoomDataStore()Get the best zoom datastorejava.util.Collection<DataSource>getDataSources()Returns the collection of data sources.DownloadPolicygetDownloadPolicy()Get the download policy.java.util.Collection<PrimitiveId>getHighlighted()Get the highlighted objectsjava.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.shortgetMappaintCacheIndex()java.lang.StringgetName()Returns the name of this data set (optional).java.util.Collection<VectorNode>getNodes()Replies an unmodifiable collection of nodes in this datasetVectorPrimitivegetPrimitiveById(PrimitiveId primitiveId)Get a primitive for an id<T extends VectorPrimitive>
java.util.Collection<T>getPrimitives(java.util.function.Predicate<? super VectorPrimitive> predicate)Gets a filtered collection of primitives matching the given predicate.java.util.stream.Stream<VectorPrimitive>getPrimitivesById(PrimitiveId... primitiveIds)Get all primitives for idsjava.util.concurrent.locks.LockgetReadLock()Get the current Read/Write lock.java.util.Collection<VectorRelation>getRelations()Replies an unmodifiable collection of relations in this datasetElemStylesgetStyles()Get the styles for this layerUploadPolicygetUploadPolicy()Get the upload policy.java.lang.StringgetVersion()Replies the API version this dataset was created from.java.util.Collection<VectorWay>getWays()Replies an unmodifiable collection of ways in this datasetintgetZoom()booleanisLocked()Determines if this is read-only/locked (thus it cannot be modified).booleanisSelected(VectorPrimitive osm)Determines whether the given primitive is selected or notvoidlock()Enables the read-only/locked mode.voidremoveHighlightUpdateListener(HighlightUpdateListener listener)Removes a listener that was added withOsmData.addHighlightUpdateListener(HighlightUpdateListener)voidremovePrimitive(VectorPrimitive primitive)Remove a primitive from the custom data storevoidremoveSelectionListener(DataSelectionListener listener)Remove a listener that listens to selection changes in this specific data set.booleanremoveSelectionListener(IDataSelectionListener<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet> listener)Remove a listenerjava.util.List<VectorNode>searchNodes(BBox bbox)Searches for nodes in the given bounding box.java.util.List<VectorRelation>searchRelations(BBox bbox)Searches for relations in the given bounding box.java.util.List<VectorWay>searchWays(BBox bbox)Searches for ways in the given bounding box.booleanselectionEmpty()Determines whether the selection is empty or notvoidsetDownloadPolicy(DownloadPolicy downloadPolicy)Sets the download policy.voidsetHighlighted(java.util.Collection<PrimitiveId> primitives)Mark some primitives as highlighted.voidsetHighlightedVirtualNodes(java.util.Collection<WaySegment> waySegments)set what virtual nodes should be highlighted.voidsetHighlightedWaySegments(java.util.Collection<WaySegment> waySegments)set what virtual ways should be highlighted.voidsetInvisibleLayers(java.util.Collection<java.lang.String> invisibleLayers)Mark some layers as invisiblevoidsetName(java.lang.String name)Sets the name of this data set.voidsetSelected(java.util.Collection<? extends PrimitiveId> selection)Sets the current selection to the primitives inselectionand notifies allDataSelectionListener.voidsetSelected(PrimitiveId... osm)Sets the current selection to the primitives inosmand notifies allDataSelectionListener.private voidsetSelectedImpl(java.util.stream.Stream<? extends PrimitiveId> osm)voidsetStyles(java.util.Collection<ElemStyles> styles)Set the styles for this layervoidsetUploadPolicy(UploadPolicy uploadPolicy)Sets the upload policy.voidsetZoom(int zoom)voidtoggleSelected(java.util.Collection<? extends PrimitiveId> osm)Toggles the selected state of the given collection of primitives.voidtoggleSelected(PrimitiveId... osm)Toggles the selected state of the given collection of primitives.private voidtoggleSelectedImpl(java.util.stream.Stream<? extends PrimitiveId> osm)private static <T> java.util.Optional<T>tryRead(java.util.concurrent.locks.ReentrantReadWriteLock lock, java.util.function.Supplier<T> supplier)Try to read something (here to avoid boilerplate)private static voidtryWrite(java.util.concurrent.locks.ReentrantReadWriteLock lock, java.lang.Runnable runnable)Try to write something (here to avoid boilerplate)voidunlock()Disables the read-only/locked mode.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.Data
getDataSourceArea, getDataSourceBounds
-
Methods inherited from interface org.openstreetmap.josm.data.osm.OsmData
allModifiedPrimitives, allNonDeletedCompletePrimitives, allNonDeletedPhysicalPrimitives, allNonDeletedPrimitives, allPreservedPrimitives, allPrimitives, clearHighlightedVirtualNodes, clearHighlightedWaySegments, getDataSourceBoundingBox, getPrimitiveById, getSelected, getSelectedNodes, getSelectedRelations, getSelectedWays, isModified
-
-
-
-
Field Detail
-
dataStoreMap
private final java.util.Map<java.lang.Integer,Storage<MVTTile>> dataStoreMap
-
customDataStore
private final VectorDataStore customDataStore
-
highlightUpdateListenerListenerList
private final ListenerList<HighlightUpdateListener> highlightUpdateListenerListenerList
-
dataSelectionListenerListenerList
private final ListenerList<DataSelectionListener> dataSelectionListenerListenerList
-
lock
private boolean lock
-
name
private java.lang.String name
-
mappaintCacheIdx
private short mappaintCacheIdx
-
selectionLock
private final java.lang.Object selectionLock
-
currentSelectedPrimitives
private java.util.Set<PrimitiveId> currentSelectedPrimitives
The current selected primitives. This is always a unmodifiable set. The set should be ordered in the order in which the primitives have been added to the selection.
-
listeners
private final ListenerList<IDataSelectionListener<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>> listeners
-
readWriteLock
private final java.util.concurrent.locks.ReentrantReadWriteLock readWriteLock
-
DUPE_NODE_DISTANCE
protected static final float DUPE_NODE_DISTANCE
The distance to consider nodes duplicates -- mostly a memory saving measure. 0.000_000_1 ~1.2 cm (+- 5.57 mm) Descriptions from https://xkcd.com/2170/ Notes on https://wiki.openstreetmap.org/wiki/Node indicate that IEEE 32-bit floats should not be used at high longitude (0.000_01 precision)- See Also:
- Constant Field Values
-
zoom
private int zoom
The current zoom we are getting/adding to
-
downloadPolicy
private DownloadPolicy downloadPolicy
Default to normal download policy
-
uploadPolicy
private UploadPolicy uploadPolicy
Default to a blocked upload policy
-
styles
private ElemStyles styles
The paint style for this layer
-
highlighted
private final java.util.Collection<PrimitiveId> highlighted
-
-
Constructor Detail
-
VectorDataSet
public VectorDataSet()
-
-
Method Detail
-
getDataSources
public java.util.Collection<DataSource> getDataSources()
Description copied from interface:DataReturns the collection of data sources.- Specified by:
getDataSourcesin interfaceData- Returns:
- the collection of data sources.
-
lock
public void lock()
Description copied from interface:LockableEnables the read-only/locked mode.
-
unlock
public void unlock()
Description copied from interface:LockableDisables the read-only/locked mode.
-
isLocked
public boolean isLocked()
Description copied from interface:LockableDetermines if this is read-only/locked (thus it cannot be modified).
-
getVersion
public java.lang.String getVersion()
Description copied from interface:OsmDataReplies the API version this dataset was created from. May be null.- Specified by:
getVersionin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- the API version this dataset was created from. May be null.
-
getName
public java.lang.String getName()
Description copied from interface:OsmDataReturns the name of this data set (optional).- Specified by:
getNamein interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- the name of this data set. Can be
null
-
setName
public void setName(java.lang.String name)
Description copied from interface:OsmDataSets the name of this data set.- Specified by:
setNamein interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
name- the new name of this data set. Can benullto reset it
-
addPrimitive
public void addPrimitive(VectorPrimitive primitive)
Add a primitive to the custom data store- Specified by:
addPrimitivein interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
primitive- the primitive to add
-
removePrimitive
public void removePrimitive(VectorPrimitive primitive)
Remove a primitive from the custom data store- Parameters:
primitive- The primitive to add to the custom data store
-
clear
public void clear()
Description copied from interface:OsmDataRemoves all primitives.- Specified by:
clearin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>
-
searchNodes
public java.util.List<VectorNode> searchNodes(BBox bbox)
Description copied from interface:OsmDataSearches for nodes in the given bounding box.- Specified by:
searchNodesin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
bbox- the bounding box- Returns:
- List of nodes in the given bbox. Can be empty but not null
-
containsNode
public boolean containsNode(VectorNode vectorNode)
Description copied from interface:OsmDataDetermines if the given node can be retrieved in the data set through its bounding box. Useful for dataset consistency test.- Specified by:
containsNodein interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
vectorNode- The node to search- Returns:
trueifncan be retrieved in this data set,falseotherwise
-
searchWays
public java.util.List<VectorWay> searchWays(BBox bbox)
Description copied from interface:OsmDataSearches for ways in the given bounding box.- Specified by:
searchWaysin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
bbox- the bounding box- Returns:
- List of ways in the given bbox. Can be empty but not null
-
containsWay
public boolean containsWay(VectorWay vectorWay)
Description copied from interface:OsmDataDetermines if the given way can be retrieved in the data set through its bounding box. Useful for dataset consistency test.- Specified by:
containsWayin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
vectorWay- The way to search- Returns:
trueifwcan be retrieved in this data set,falseotherwise
-
searchRelations
public java.util.List<VectorRelation> searchRelations(BBox bbox)
Description copied from interface:OsmDataSearches for relations in the given bounding box.- Specified by:
searchRelationsin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
bbox- the bounding box- Returns:
- List of relations in the given bbox. Can be empty but not null
-
containsRelation
public boolean containsRelation(VectorRelation vectorRelation)
Description copied from interface:OsmDataDetermines if the given relation can be retrieved in the data set through its bounding box. Useful for dataset consistency test.- Specified by:
containsRelationin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
vectorRelation- The relation to search- Returns:
trueifrcan be retrieved in this data set,falseotherwise
-
getPrimitiveById
public VectorPrimitive getPrimitiveById(PrimitiveId primitiveId)
Get a primitive for an id- Specified by:
getPrimitiveByIdin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
primitiveId- type and uniqueId of the primitive. Might be < 0 for newly created primitives- Returns:
- The primitive for the id. Please note that since this is vector data, there may be more primitives with this id.
Please use
getPrimitivesById(PrimitiveId...)to get all primitives for thatPrimitiveId.
-
getPrimitivesById
public java.util.stream.Stream<VectorPrimitive> getPrimitivesById(PrimitiveId... primitiveIds)
Get all primitives for ids- Parameters:
primitiveIds- The ids to search for- Returns:
- The primitives for the ids (note: as this is vector data, a
PrimitiveIdmay have multiple associated primitives)
-
getPrimitives
public <T extends VectorPrimitive> java.util.Collection<T> getPrimitives(java.util.function.Predicate<? super VectorPrimitive> predicate)
Description copied from interface:OsmDataGets a filtered collection of primitives matching the given predicate.- Specified by:
getPrimitivesin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Type Parameters:
T- The primitive type.- Parameters:
predicate- The predicate to match- Returns:
- The list of primitives.
-
getNodes
public java.util.Collection<VectorNode> getNodes()
Description copied from interface:OsmDataReplies an unmodifiable collection of nodes in this dataset- Specified by:
getNodesin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- an unmodifiable collection of nodes in this dataset
-
getWays
public java.util.Collection<VectorWay> getWays()
Description copied from interface:OsmDataReplies an unmodifiable collection of ways in this dataset- Specified by:
getWaysin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- an unmodifiable collection of ways in this dataset
-
getRelations
public java.util.Collection<VectorRelation> getRelations()
Description copied from interface:OsmDataReplies an unmodifiable collection of relations in this dataset- Specified by:
getRelationsin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- an unmodifiable collection of relations in this dataset
-
getDownloadPolicy
public DownloadPolicy getDownloadPolicy()
Description copied from interface:OsmDataGet the download policy.- Specified by:
getDownloadPolicyin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- the download policy
- See Also:
OsmData.setDownloadPolicy(DownloadPolicy)
-
setDownloadPolicy
public void setDownloadPolicy(DownloadPolicy downloadPolicy)
Description copied from interface:OsmDataSets the download policy.- Specified by:
setDownloadPolicyin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
downloadPolicy- the download policy. Must not be null- See Also:
OsmData.getUploadPolicy()
-
getUploadPolicy
public UploadPolicy getUploadPolicy()
Description copied from interface:OsmDataGet the upload policy.- Specified by:
getUploadPolicyin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- the upload policy
- See Also:
OsmData.setUploadPolicy(UploadPolicy)
-
setUploadPolicy
public void setUploadPolicy(UploadPolicy uploadPolicy)
Description copied from interface:OsmDataSets the upload policy.- Specified by:
setUploadPolicyin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
uploadPolicy- the upload policy. Must not be null- See Also:
OsmData.getUploadPolicy()
-
getReadLock
public java.util.concurrent.locks.Lock getReadLock()
Get the current Read/Write lock. This changes based off of zoom level. Please do not use this in a finally block- Specified by:
getReadLockin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- The current read/write lock
-
getHighlightedVirtualNodes
public java.util.Collection<WaySegment> getHighlightedVirtualNodes()
Description copied from interface:OsmDataReturns an unmodifiable collection of *WaySegments* whose virtual nodes should be highlighted. WaySegments are used to avoid having to create a VirtualNode class that wouldn't have much purpose otherwise.- Specified by:
getHighlightedVirtualNodesin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- unmodifiable collection of WaySegments
-
setHighlightedVirtualNodes
public void setHighlightedVirtualNodes(java.util.Collection<WaySegment> waySegments)
Description copied from interface:OsmDataset what virtual nodes should be highlighted. Requires a Collection of *WaySegments* to avoid a VirtualNode class that wouldn't have much use otherwise.- Specified by:
setHighlightedVirtualNodesin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
waySegments- Collection of way segments
-
getHighlightedWaySegments
public java.util.Collection<WaySegment> getHighlightedWaySegments()
Description copied from interface:OsmDataReturns an unmodifiable collection of WaySegments that should be highlighted.- Specified by:
getHighlightedWaySegmentsin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- unmodifiable collection of WaySegments
-
setHighlightedWaySegments
public void setHighlightedWaySegments(java.util.Collection<WaySegment> waySegments)
Description copied from interface:OsmDataset what virtual ways should be highlighted.- Specified by:
setHighlightedWaySegmentsin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
waySegments- Collection of way segments
-
setHighlighted
public void setHighlighted(java.util.Collection<PrimitiveId> primitives)
Mark some primitives as highlighted. API is *highly likely* to change, as the inherited methods are modified to accept primitives other than OSM primitives.- Parameters:
primitives- The primitives to highlight
-
getHighlighted
public java.util.Collection<PrimitiveId> getHighlighted()
Get the highlighted objects- Returns:
- The highlighted objects
-
addHighlightUpdateListener
public void addHighlightUpdateListener(HighlightUpdateListener listener)
Description copied from interface:OsmDataAdds a listener that gets notified whenever way segment / virtual nodes highlights change.- Specified by:
addHighlightUpdateListenerin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
listener- The Listener
-
removeHighlightUpdateListener
public void removeHighlightUpdateListener(HighlightUpdateListener listener)
Description copied from interface:OsmDataRemoves a listener that was added withOsmData.addHighlightUpdateListener(HighlightUpdateListener)- Specified by:
removeHighlightUpdateListenerin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
listener- The Listener
-
getAllSelected
public java.util.Collection<VectorPrimitive> getAllSelected()
Description copied from interface:OsmDataReplies an unmodifiable collection of primitives currently selected in this dataset, including deleted ones. May be empty, but not null.When iterating through the set it is ordered by the order in which the primitives were added to the selection.
- Specified by:
getAllSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- unmodifiable collection of primitives
-
getBestZoomDataStore
private java.util.Optional<Storage<MVTTile>> getBestZoomDataStore()
Get the best zoom datastore- Returns:
- A datastore with data, or
nullif no good datastore exists.
-
selectionEmpty
public boolean selectionEmpty()
Description copied from interface:OsmDataDetermines whether the selection is empty or not- Specified by:
selectionEmptyin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Returns:
- whether the selection is empty or not
-
isSelected
public boolean isSelected(VectorPrimitive osm)
Description copied from interface:OsmDataDetermines whether the given primitive is selected or not- Specified by:
isSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
osm- the primitive- Returns:
- whether
osmis selected or not
-
toggleSelected
public void toggleSelected(java.util.Collection<? extends PrimitiveId> osm)
Description copied from interface:OsmDataToggles the selected state of the given collection of primitives.- Specified by:
toggleSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
osm- The primitives to toggle
-
toggleSelected
public void toggleSelected(PrimitiveId... osm)
Description copied from interface:OsmDataToggles the selected state of the given collection of primitives.- Specified by:
toggleSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
osm- The primitives to toggle
-
toggleSelectedImpl
private void toggleSelectedImpl(java.util.stream.Stream<? extends PrimitiveId> osm)
-
setSelected
public void setSelected(java.util.Collection<? extends PrimitiveId> selection)
Description copied from interface:OsmDataSets the current selection to the primitives inselectionand notifies allDataSelectionListener.- Specified by:
setSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
selection- the selection
-
setSelected
public void setSelected(PrimitiveId... osm)
Description copied from interface:OsmDataSets the current selection to the primitives inosmand notifies allDataSelectionListener.- Specified by:
setSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
osm- the primitives to set.nullvalues are ignored for now, but this may be removed in the future.
-
setSelectedImpl
private void setSelectedImpl(java.util.stream.Stream<? extends PrimitiveId> osm)
-
addSelected
public void addSelected(java.util.Collection<? extends PrimitiveId> selection)
Description copied from interface:OsmDataAdds the primitives inselectionto the current selection and notifies allDataSelectionListener.- Specified by:
addSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
selection- the selection
-
addSelected
public void addSelected(PrimitiveId... osm)
Description copied from interface:OsmDataAdds the primitives inosmto the current selection and notifies allDataSelectionListener.- Specified by:
addSelectedin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
osm- the primitives to add
-
addSelectedImpl
private void addSelectedImpl(java.util.stream.Stream<? extends PrimitiveId> osm)
-
clearSelection
public void clearSelection(PrimitiveId... osm)
Description copied from interface:OsmDataRemoves the selection from every value in the collection.- Specified by:
clearSelectionin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
osm- The collection of ids to remove the selection from.
-
clearSelection
public void clearSelection(java.util.Collection<? extends PrimitiveId> list)
Description copied from interface:OsmDataRemoves the selection from every value in the collection.- Specified by:
clearSelectionin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
list- The collection of ids to remove the selection from.
-
clearSelection
public void clearSelection()
Description copied from interface:OsmDataClears the current selection.- Specified by:
clearSelectionin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>
-
clearSelectionImpl
private void clearSelectionImpl(java.util.stream.Stream<? extends PrimitiveId> osm)
-
doSelectionChange
private boolean doSelectionChange(java.util.function.Function<java.util.Set<VectorPrimitive>,IDataSelectionListener.SelectionChangeEvent<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>> command)
Do a selection change.This is the only method that changes the current selection state.
- Parameters:
command- A generator that generates theIDataSelectionListener.SelectionChangeEventfor the given base set of currently selected primitives.- Returns:
- true iff the command did change the selection.
-
addSelectionListener
public void addSelectionListener(DataSelectionListener listener)
Description copied from interface:OsmDataAdd a listener that listens to selection changes in this specific data set.- Specified by:
addSelectionListenerin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
listener- The listener.- See Also:
OsmData.removeSelectionListener(DataSelectionListener),To add a global listener.
-
removeSelectionListener
public void removeSelectionListener(DataSelectionListener listener)
Description copied from interface:OsmDataRemove a listener that listens to selection changes in this specific data set.- Specified by:
removeSelectionListenerin interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>- Parameters:
listener- The listener.- See Also:
OsmData.addSelectionListener(DataSelectionListener)
-
getMappaintCacheIndex
public short getMappaintCacheIndex()
-
clearMappaintCache
public void clearMappaintCache()
Description copied from interface:OsmDataClear the mappaint cache for this DataSet.- Specified by:
clearMappaintCachein interfaceOsmData<VectorPrimitive,VectorNode,VectorWay,VectorRelation>
-
setZoom
public void setZoom(int zoom)
-
getZoom
public int getZoom()
-
addTileData
public void addTileData(MVTTile tile)
Add tile data to this dataset- Parameters:
tile- The tile to add
-
tryRead
private static <T> java.util.Optional<T> tryRead(java.util.concurrent.locks.ReentrantReadWriteLock lock, java.util.function.Supplier<T> supplier)
Try to read something (here to avoid boilerplate)- Type Parameters:
T- The return type- Parameters:
lock- The locksupplier- The reading function- Returns:
- The optional return
-
tryWrite
private static void tryWrite(java.util.concurrent.locks.ReentrantReadWriteLock lock, java.lang.Runnable runnable)
Try to write something (here to avoid boilerplate)- Parameters:
lock- lockrunnable- The writing function
-
getStyles
public ElemStyles getStyles()
Get the styles for this layer- Returns:
- The styles
-
setStyles
public void setStyles(java.util.Collection<ElemStyles> styles)
Set the styles for this layer- Parameters:
styles- The styles to set for this layer
-
setInvisibleLayers
public void setInvisibleLayers(java.util.Collection<java.lang.String> invisibleLayers)
Mark some layers as invisible- Parameters:
invisibleLayers- The layer to not show
-
addSelectionListener
public boolean addSelectionListener(IDataSelectionListener<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet> listener)
Description copied from interface:IDataSelectionEventSourceAdd a listener- Specified by:
addSelectionListenerin interfaceIDataSelectionEventSource<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>- Parameters:
listener- The listener to add- Returns:
trueif the listener was added
-
removeSelectionListener
public boolean removeSelectionListener(IDataSelectionListener<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet> listener)
Description copied from interface:IDataSelectionEventSourceRemove a listener- Specified by:
removeSelectionListenerin interfaceIDataSelectionEventSource<VectorPrimitive,VectorNode,VectorWay,VectorRelation,VectorDataSet>- Parameters:
listener- The listener to remove- Returns:
trueif the listener was removed
-
-