Interface OsmData<O extends IPrimitive,​N extends INode,​W extends IWay<N>,​R extends IRelation<?>>

  • Type Parameters:
    O - the base type of OSM primitives
    N - type representing OSM nodes
    W - type representing OSM ways
    R - type representing OSM relations
    All Superinterfaces:
    Data, Lockable
    All Known Implementing Classes:
    DataSet, VectorDataSet

    public interface OsmData<O extends IPrimitive,​N extends INode,​W extends IWay<N>,​R extends IRelation<?>>
    extends Data, Lockable
    Abstraction of 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.
    Since:
    13764
    • Method Detail

      • getVersion

        String getVersion()
        Replies the API version this dataset was created from. May be null.
        Returns:
        the API version this dataset was created from. May be null.
      • getName

        String getName()
        Returns the name of this data set (optional).
        Returns:
        the name of this data set. Can be null
        Since:
        12718
      • setName

        void setName​(String name)
        Sets the name of this data set.
        Parameters:
        name - the new name of this data set. Can be null to reset it
        Since:
        12718
      • addPrimitive

        void addPrimitive​(O primitive)
        Adds a primitive.
        Parameters:
        primitive - the primitive
      • clear

        void clear()
        Removes all primitives.
      • searchNodes

        List<NsearchNodes​(BBox bbox)
        Searches for nodes in the given bounding box.
        Parameters:
        bbox - the bounding box
        Returns:
        List of nodes in the given bbox. Can be empty but not null
      • containsNode

        boolean containsNode​(N n)
        Determines if the given node can be retrieved in the data set through its bounding box. Useful for dataset consistency test.
        Parameters:
        n - The node to search
        Returns:
        true if n can be retrieved in this data set, false otherwise
      • searchWays

        List<WsearchWays​(BBox bbox)
        Searches for ways in the given bounding box.
        Parameters:
        bbox - the bounding box
        Returns:
        List of ways in the given bbox. Can be empty but not null
      • containsWay

        boolean containsWay​(W w)
        Determines if the given way can be retrieved in the data set through its bounding box. Useful for dataset consistency test.
        Parameters:
        w - The way to search
        Returns:
        true if w can be retrieved in this data set, false otherwise
      • searchRelations

        List<RsearchRelations​(BBox bbox)
        Searches for relations in the given bounding box.
        Parameters:
        bbox - the bounding box
        Returns:
        List of relations in the given bbox. Can be empty but not null
      • containsRelation

        boolean containsRelation​(R r)
        Determines if the given relation can be retrieved in the data set through its bounding box. Useful for dataset consistency test.
        Parameters:
        r - The relation to search
        Returns:
        true if r can be retrieved in this data set, false otherwise
      • getPrimitiveById

        default O getPrimitiveById​(long id,
                                   OsmPrimitiveType type)
        Returns a primitive with a given id from the data set. null, if no such primitive exists
        Parameters:
        id - uniqueId of the primitive. Might be < 0 for newly created primitives
        type - the type of the primitive. Must not be null.
        Returns:
        the primitive
        Throws:
        NullPointerException - if type is null
      • getPrimitiveById

        O getPrimitiveById​(PrimitiveId primitiveId)
        Returns a primitive with a given id from the data set. null, if no such primitive exists
        Parameters:
        primitiveId - type and uniqueId of the primitive. Might be < 0 for newly created primitives
        Returns:
        the primitive
      • getPrimitives

        <T extends OCollection<T> getPrimitives​(Predicate<? super O> predicate)
        Gets a filtered collection of primitives matching the given predicate.
        Type Parameters:
        T - The primitive type.
        Parameters:
        predicate - The predicate to match
        Returns:
        The list of primitives.
        Since:
        10590
      • getNodes

        Collection<NgetNodes()
        Replies an unmodifiable collection of nodes in this dataset
        Returns:
        an unmodifiable collection of nodes in this dataset
      • getWays

        Collection<WgetWays()
        Replies an unmodifiable collection of ways in this dataset
        Returns:
        an unmodifiable collection of ways in this dataset
      • getRelations

        Collection<RgetRelations()
        Replies an unmodifiable collection of relations in this dataset
        Returns:
        an unmodifiable collection of relations in this dataset
      • allPrimitives

        default Collection<OallPrimitives()
        Returns a collection containing all primitives of the dataset.
        Returns:
        A collection containing all primitives of the dataset. Data is not ordered
      • getReadLock

        Lock getReadLock()
        Returns the lock used for reading.
        Returns:
        the lock used for reading
      • getHighlightedVirtualNodes

        Collection<WaySegmentgetHighlightedVirtualNodes()
        Returns 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.
        Returns:
        unmodifiable collection of WaySegments
      • setHighlightedVirtualNodes

        void setHighlightedVirtualNodes​(Collection<WaySegment> waySegments)
        set what virtual nodes should be highlighted. Requires a Collection of *WaySegments* to avoid a VirtualNode class that wouldn't have much use otherwise.
        Parameters:
        waySegments - Collection of way segments
      • getSelected

        default Collection<OgetSelected()
        Replies an unmodifiable collection of primitives currently selected in this dataset, except 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.
        Returns:
        unmodifiable collection of primitives
      • getAllSelected

        Collection<OgetAllSelected()
        Replies 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.
        Returns:
        unmodifiable collection of primitives
      • selectionEmpty

        boolean selectionEmpty()
        Determines whether the selection is empty or not
        Returns:
        whether the selection is empty or not
      • isSelected

        boolean isSelected​(O osm)
        Determines whether the given primitive is selected or not
        Parameters:
        osm - the primitive
        Returns:
        whether osm is selected or not
      • toggleSelected

        void toggleSelected​(Collection<? extends PrimitiveId> osm)
        Toggles the selected state of the given collection of primitives.
        Parameters:
        osm - The primitives to toggle
      • toggleSelected

        void toggleSelected​(PrimitiveId... osm)
        Toggles the selected state of the given collection of primitives.
        Parameters:
        osm - The primitives to toggle
      • setSelected

        void setSelected​(PrimitiveId... osm)
        Sets the current selection to the primitives in osm and notifies all DataSelectionListener.
        Parameters:
        osm - the primitives to set. null values are ignored for now, but this may be removed in the future.
      • clearSelection

        void clearSelection​(PrimitiveId... osm)
        Removes the selection from every value in the collection.
        Parameters:
        osm - The collection of ids to remove the selection from.
      • clearSelection

        void clearSelection​(Collection<? extends PrimitiveId> list)
        Removes the selection from every value in the collection.
        Parameters:
        list - The collection of ids to remove the selection from.
      • clearMappaintCache

        void clearMappaintCache()
        Clear the mappaint cache for this DataSet.
        Since:
        13420