input
Class WKTMapReader

java.lang.Object
  extended by input.WKTReader
      extended by input.WKTMapReader

public class WKTMapReader
extends WKTReader

"Well-known text syntax" map data reader.
Note: Understands only LINESTRINGs and MULTILINESTRINGs. Skips all POINT data. Other data causes IOException.


Field Summary
 
Fields inherited from class input.WKTReader
LINESTRING, MULTILINESTRING, POINT
 
Constructor Summary
WKTMapReader(boolean bidi)
          Constructor.
 
Method Summary
 void addPaths(java.io.File file, int type)
          Adds paths to the map and adds given type to all nodes' type.
 void addPaths(java.io.Reader input, int nodeType)
          Add paths to current path set.
 SimMap getMap()
          Returns new a SimMap that is based on the read map
 java.util.Collection<MapNode> getNodes()
          Returns the map nodes that were read in a collection
 java.util.Map<Coord,MapNode> getNodesHash()
          Returns the original Map object that was used to read the map
 void setBidirectional(boolean bidi)
          Sets bidirectional paths on/off.
 
Methods inherited from class input.WKTReader
init, isDone, isKnownType, nextType, parseLineString, parseMultilinestring, parsePoint, readLines, readNestedContents, readNestedContents, readPoints, readPoints, readWord, setDone, skipAllWhitespace, skipUntil
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WKTMapReader

public WKTMapReader(boolean bidi)
Constructor. Creates a new WKT reader ready for addPaths() calls.

Parameters:
bidi - If true, all read paths are set bidirectional (i.e. if node A is a neighbor of node B, node B is also a neighbor of node A).
Method Detail

setBidirectional

public void setBidirectional(boolean bidi)
Sets bidirectional paths on/off.

Parameters:
bidi - If true, all paths are set bidirectional (false -> not)

getNodes

public java.util.Collection<MapNode> getNodes()
Returns the map nodes that were read in a collection

Returns:
the map nodes that were read in a collection

getNodesHash

public java.util.Map<Coord,MapNode> getNodesHash()
Returns the original Map object that was used to read the map

Returns:
the original Map object that was used to read the map

getMap

public SimMap getMap()
Returns new a SimMap that is based on the read map

Returns:
new a SimMap that is based on the read map

addPaths

public void addPaths(java.io.File file,
                     int type)
              throws java.io.IOException
Adds paths to the map and adds given type to all nodes' type.

Parameters:
file - The file where the WKT data is read from
type - The type to use (integer value, see class MapNode))
Throws:
java.io.IOException - If something went wrong while reading the file

addPaths

public void addPaths(java.io.Reader input,
                     int nodeType)
              throws java.io.IOException
Add paths to current path set. Adding paths multiple times has the same result as concatenating the data before adding it.

Parameters:
input - Reader where the WKT data is read from
nodeType - The type to use (integer value, see class MapNode))
Throws:
java.io.IOException - if something went wrong with reading from the input