Class Convert


  • public final class Convert
    extends java.lang.Object

    Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    $LastChangedDate: 2015-09-16 19:20:07 +0200 (Wed, 16 Sep 2015) $, @version $Revision: 1405 $, by $Author: averbraeck $, initial version 30.12.2014

    Author:
    Peter Knoppers, Moritz Bergmann
    • Constructor Detail

      • Convert

        public Convert()
        Construct a converter.
    • Method Detail

      • transform

        public static org.locationtech.jts.geom.Coordinate transform​(org.locationtech.jts.geom.Coordinate c)
                                                              throws javax.xml.crypto.dsig.TransformException
        Parameters:
        c - Coordinate; Coordinate in WGS84
        Returns:
        Coordinate in Geocentric Cartesian system
        Throws:
        javax.xml.crypto.dsig.TransformException - on problems with the coordinate transformation
      • convertLink

        public CrossSectionLink convertLink​(OTSRoadNetwork network,
                                            OSMLink link,
                                            OTSSimulatorInterface simulator)
                                     throws OTSGeometryException,
                                            NetworkException
        This method converts an OSM link to an OTS link.
        Parameters:
        network - OTSRoadNetwork; the network
        link - OSMLink; OSM Link to be converted
        simulator - OTSSimulatorInterface; the simulator that will animate the generates lanes (if it happens to be an instance of AnimatorInterface)
        Returns:
        OTS Link
        Throws:
        OTSGeometryException - on failure
        NetworkException - if link already exists in the network, if name of the link is not unique, or if the start node or the end node of the link are not registered in the network.
      • convertNode

        public OTSRoadNode convertNode​(OTSRoadNetwork network,
                                       OSMNode node)
                                throws NetworkException
        This method converts an OSM node to an OTS node.
        Parameters:
        network - OTSRoadNetwork; the network
        node - OSMNode; OSM Node to be converted
        Returns:
        OTSRoadNode
        Throws:
        NetworkException - if node already exists in the network, or if name of the node is not unique
      • makeLanes

        public java.util.List<Lane> makeLanes​(OTSRoadNetwork network,
                                              OSMLink osmlink,
                                              OTSSimulatorInterface simulator,
                                              WarningListener warningListener)
                                       throws NetworkException,
                                              javax.naming.NamingException,
                                              OTSGeometryException
        This method creates lanes out of an OSM link LaneTypes are not yet extensive and can be further increased through Tags provided by OSM. The standard lane width of 3.05 is an estimation based on the European width limitation for vehicles (2.55m) + 25cm each side.
        Parameters:
        network - OTSRoadNetwork; the network
        osmlink - Link OSMLink; the OSM link to make lanes for
        simulator - OTSSimulatorInterface; the simulator that will animate the generates lanes (if it happens to be an instance of AnimatorInterface)
        warningListener - WarningListener; the warning listener that will receive warning events
        Returns:
        List<Lane>
        Throws:
        NetworkException - on network inconsistency
        javax.naming.NamingException - on naming problems (in the animator)
        OTSGeometryException - when lane contour or center line cannot be instantiated
      • makeLaneType

        public static LaneType makeLaneType​(OTSRoadNetwork network,
                                            java.util.List<GTUType> gtuTypes)
        This method creates a LaneType which supports all GTUTypes that have been specified in the GTUType List "GTUs".
        Parameters:
        network - the network
        gtuTypes - List<GTUType>; list of GTUTypes
        Returns:
        LaneType permeable for all of the specific GTUTypes
      • makeLaneType

        public static LaneType makeLaneType​(OTSRoadNetwork network,
                                            GTUType gtuType)
        This method creates a LaneType which supports the specified GTUType.
        Parameters:
        network - the network
        gtuType - GTUType; the type of GTU that can travel on the new LaneType
        Returns:
        LaneType
      • findSinksandSources

        public static OSMNetwork findSinksandSources​(OSMNetwork net,
                                                     ProgressListener progressListener)
        Parameters:
        net - OSMNetwork; The OSM network which is to be searched for Sinks and Sources.
        progressListener - ProgressListener; the progress listener that will receive progress events
        Returns:
        Network with all possible sinks and sources tagged.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object