lejos.robotics.mapping
Class ShapefileLoader

java.lang.Object
  extended by lejos.robotics.mapping.ShapefileLoader

public class ShapefileLoader
extends Object

This class loads map data from a Shapefile and produces a LineMap object, which can be used by the leJOS navigation package.

There are many map editors which can use the Shapefile format (OpenEV, Global Mapper). Once you have created a map, export it as Shapefile. This will produce three files ending in .shp .shx and .dbf. The only file used by this class is .shp.

NOTE: Shapefiles can only contain one type of shape data (polygon or polyline, not both). A single file can't mix polylines with polygons.

This class' code can parse points and multipoints. However, a LineMap object can't deal with points (only lines) so points and multipoints are discarded.

Author:
BB

Constructor Summary
ShapefileLoader(InputStream in)
          Creates a ShapefileLoader object using an input stream.
 
Method Summary
 LineMap readLineMap()
          Retrieves a LineMap object from the Shapefile input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapefileLoader

public ShapefileLoader(InputStream in)
Creates a ShapefileLoader object using an input stream. Likely you will use a FileInputStream which points to the *.shp file containing the map data.

Parameters:
in -
Method Detail

readLineMap

public LineMap readLineMap()
                    throws IOException
Retrieves a LineMap object from the Shapefile input stream.

Returns:
the line map
Throws:
IOException