Class ShapeFileReader

  • All Implemented Interfaces:
    UNITS

    public final class ShapeFileReader
    extends Object
    implements UNITS

    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: 2020-05-08 13:45:24 +0200 (Fri, 08 May 2020) $, @version $Revision: 6465 $, by $Author: pknoppers $, initial version Sep 11, 2014

    Author:
    Alexander Verbraeck, Guus Tamminga
    • Method Detail

      • readNodes

        public static Map<String,​OTSRoadNode> readNodes​(Network network,
                                                              String shapeFileName,
                                                              String numberType,
                                                              boolean returnCentroid,
                                                              boolean allCentroids)
                                                       throws IOException
        Parameters:
        network - Network; Network, the network
        shapeFileName - String; the nodes shapefile to read
        numberType - String; ???
        returnCentroid - boolean; if true only loop through the centroid/zones (in case of mixed nodes and centroids)
        allCentroids - boolean; if true: the file contains centroids (a centroid file)
        Returns:
        map of (shape file) nodes with nodenr as the key
        Throws:
        IOException - on error
      • inspectNodeCentroid

        public static boolean inspectNodeCentroid​(String number)
        Parameters:
        number - String; number string
        Returns:
        boolean: true if the number refers to a Centroid; false otherwise
      • readLinks

        public static void readLinks​(OTSRoadNetwork network,
                                     String shapeFileName,
                                     Map<String,​Link> links,
                                     Map<String,​OTSRoadNode> nodes,
                                     OTSSimulatorInterface simulator)
                              throws IOException
        Parameters:
        network - OTSRoadNetwork; the network
        shapeFileName - String; the nodes shapefile to read
        links - Map<String,Link>; : returns the file with real links
        nodes - Map<String,OTSNode>; the map of nodes to retrieve start and end node
        simulator - OTSSimulatorInterface; simulator for the animation registration
        Throws:
        IOException - on error
      • shapeFileInfo

        public static void shapeFileInfo​(String shapeFileName)
                                  throws IOException
        Parameters:
        shapeFileName - String; the areas shapefile to read
        Throws:
        IOException - on error
      • removeQuotes

        public static String removeQuotes​(String name)
        Parameters:
        name - String; the name with quotes
        Returns:
        name without quotes