Class QuadBucketPrimitiveStore<N extends INode,​W extends IWay<N>,​R extends IRelation<?>>

  • Type Parameters:
    N - type representing OSM nodes
    W - type representing OSM ways
    R - type representing OSM relations
    Direct Known Subclasses:
    DataStore.LocalQuadBucketPrimitiveStore

    public class QuadBucketPrimitiveStore<N extends INode,​W extends IWay<N>,​R extends IRelation<?>>
    extends java.lang.Object
    Stores primitives in quad buckets. This can be used to hold a collection of primitives, e.g. in a DataSet This class does not do any synchronization.
    Since:
    12048
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private QuadBuckets<N> nodes
      All nodes goes here, even when included in other data (ways etc).
      private java.util.Collection<R> relations
      All relations/relationships
      private QuadBuckets<W> ways
      All ways (Streets etc.) in the DataSet.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPrimitive​(IPrimitive primitive)
      Adds a primitive to this quad bucket store
      void clear()
      Removes all primitives from the this store.
      boolean containsNode​(N n)
      Determines if the given node can be retrieved in the store through its bounding box.
      boolean containsRelation​(R r)
      Determines if the given relation can be retrieved in the store through its bounding box.
      boolean containsWay​(W w)
      Determines if the given way can be retrieved in the store through its bounding box.
      protected void reindexNode​(N node, java.util.function.Consumer<N> nUpdater, java.util.function.Consumer<W> wUpdater, java.util.function.Consumer<R> rUpdater)
      Re-index the node after it's position was changed.
      protected void reindexRelation​(R relation, java.util.function.Consumer<R> rUpdater)
      Re-index the relation after it's position was changed.
      protected void reindexWay​(W way, java.util.function.Consumer<W> wUpdater, java.util.function.Consumer<R> rUpdater)
      Re-index the way after it's position was changed.
      protected void removePrimitive​(IPrimitive primitive)  
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • nodes

        private final QuadBuckets<N extends INode> nodes
        All nodes goes here, even when included in other data (ways etc). This enables the instant conversion of the whole DataSet by iterating over this data structure.
      • ways

        private final QuadBuckets<W extends IWay<N>> ways
        All ways (Streets etc.) in the DataSet. The way nodes are stored only in the way list.
      • relations

        private final java.util.Collection<R extends IRelation<?>> relations
        All relations/relationships
    • Method Detail

      • searchNodes

        public java.util.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

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

        public java.util.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

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

        public java.util.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

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

        public void addPrimitive​(IPrimitive primitive)
        Adds a primitive to this quad bucket store
        Parameters:
        primitive - the primitive.
      • reindexNode

        protected void reindexNode​(N node,
                                   java.util.function.Consumer<N> nUpdater,
                                   java.util.function.Consumer<W> wUpdater,
                                   java.util.function.Consumer<R> rUpdater)
        Re-index the node after it's position was changed.
        Parameters:
        node - The node to re-index
        nUpdater - update node position
        wUpdater - update way position
        rUpdater - update relation position
      • reindexWay

        protected void reindexWay​(W way,
                                  java.util.function.Consumer<W> wUpdater,
                                  java.util.function.Consumer<R> rUpdater)
        Re-index the way after it's position was changed.
        Parameters:
        way - The way to re-index
        wUpdater - update way position
        rUpdater - update relation position
      • reindexRelation

        protected void reindexRelation​(R relation,
                                       java.util.function.Consumer<R> rUpdater)
        Re-index the relation after it's position was changed.
        Parameters:
        relation - The relation to re-index
        rUpdater - update relation position
      • clear

        public void clear()
        Removes all primitives from the this store.