Package 

Class OSMEnvironment

  • All Implemented Interfaces:
    it.unibo.alchemist.model.interfaces.BenchmarkableEnvironment , it.unibo.alchemist.model.interfaces.Environment , it.unibo.alchemist.model.interfaces.MapEnvironment , java.io.Serializable , java.lang.Iterable

    
    public final class OSMEnvironment<T>
    extends Abstract2DEnvironment<T, GeoPosition> implements MapEnvironment<T, GraphHopperOptions, GraphHopperRoutingService>
                        

    This class serves as template for more specific implementations of environments using a map. It encloses the navigation logic, but leaves the subclasses to decide how to provide map data (e.g. loading from disk or rely on online services). The data is then stored in-memory for performance reasons.

    • Constructor Detail

      • OSMEnvironment

        OSMEnvironment(Incarnation<T, GeoPosition> incarnation)
        Builds a new OSMEnvironment without an actual backing map.
        Parameters:
        incarnation - the incarnation to be used.
      • OSMEnvironment

        OSMEnvironment(Incarnation<T, GeoPosition> incarnation, String file)
        Builds a new OSMEnvironment, with nodes not forced on streets.
        Parameters:
        incarnation - the incarnation to be used.
        file - the file path where the map data is stored
      • OSMEnvironment

        OSMEnvironment(Incarnation<T, GeoPosition> incarnation, String file, boolean onStreets, boolean onlyOnStreets)
        Parameters:
        incarnation - the incarnation to be used.
        file - the file path where the map data is stored
        onStreets - if true, the nodes will be placed on the street nearest to the desired it.unibo.alchemist.model.interfaces.Position.
        onlyOnStreets - if true, the nodes which are too far from a street will be simply discarded.
      • OSMEnvironment

        OSMEnvironment(Incarnation<T, GeoPosition> incarnation, String file, int approximation)
        Parameters:
        incarnation - the incarnation to be used.
        file - the file path where the map data is stored.
        approximation - the amount of ciphers of the IEEE 754 encoded position that may be discarded when comparing two positions, allowing a quicker retrieval of the route between two position, since the cache may already contain a similar route which can be considered to be the same route, according to the level of precision determined by this value
      • OSMEnvironment

        OSMEnvironment(Incarnation<T, GeoPosition> incarnation, String file, int approximation, boolean onStreets, boolean onlyOnStreets)
        Parameters:
        incarnation - the incarnation to be used.
        file - the file path where the map data is stored.
        approximation - the amount of ciphers of the IEEE 754 encoded position that may be discarded when comparing two positions, allowing a quicker retrieval of the route between two position, since the cache may already contain a similar route which can be considered to be the same route, according to the level of precision determined by this value
        onStreets - if true, the nodes will be placed on the street nearest to the desired it.unibo.alchemist.model.interfaces.Position.
        onlyOnStreets - if true, the nodes which are too far from a street will be simply discarded.
    • Method Detail

      • computeRoute

         Route<GeoPosition> computeRoute(GeoPosition p1, GeoPosition p2)

        This method relies on the map data, and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific Action calling this method to effectively move nodes along the path.

        Parameters:
        p1 - start position
        p2 - end position The absolute coordinate where this node wants to move to
      • computeRoute

         Route<GeoPosition> computeRoute(GeoPosition from, GeoPosition to, GraphHopperOptions options)

        This method relies on the map data, and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific Action calling this method to effectively move nodes along the path.

        Parameters:
        from - start position
        to - end position The absolute coordinate where this node wants to move to
        options - options to use.
      • computeRoute

         Route<GeoPosition> computeRoute(Node<T> node, GeoPosition coord)

        This method relies on the map data, and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific Action calling this method to effectively move nodes along the path.

        Parameters:
        node - The Node to move
        coord - The absolute coordinate where this node wants to move to
      • computeRoute

         Route<GeoPosition> computeRoute(Node<T> node, GeoPosition coord, GraphHopperOptions options)

        This method relies on the map data, and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific Action calling this method to effectively move nodes along the path.

        Parameters:
        node - The Node to move
        coord - The absolute coordinate where this node wants to move to
        options - The options tipe for this route
      • computeRoute

         Route<GeoPosition> computeRoute(Node<T> node, Node<T> node2)

        This method relies on the map data, and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific Action calling this method to effectively move nodes along the path. It uses the fastest path as metric.

        Parameters:
        node - The start node
        node2 - the second node's position will be used as destination