ch.epfl.scapetoad
Class IOManager

java.lang.Object
  extended by ch.epfl.scapetoad.IOManager

public class IOManager
extends java.lang.Object

The input/output manager reads and writes all the files for our application.


Constructor Summary
IOManager()
           
 
Method Summary
static java.lang.String geometryToSvgPath(Geometry geom, Envelope env, double scaleFactor, double minX, double maxX, double minY, double maxY)
          Converts a Geometry into a SVG path sequence.
static Layer openShapefile()
          Displays an open dialog and reads the shape file in.
static Layer readShapefile(java.lang.String shapefile)
          Reads the provided shape file and returns a Layer.
static void saveShapefile(FeatureCollection fc)
          Shows a save dialog and writes the Shapefile out.
static void saveSvg(Layer[] lyrs)
          Shows a save file dialog for exporting the layers into a SVG file.
static void writeShapefile(FeatureCollection fc, java.lang.String path)
          Writes the provided Feature Collection into a Shape file.
static void writeSvg(Layer[] lyrs, java.lang.String path)
          Writes the provided layers into a SVG file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOManager

public IOManager()
Method Detail

openShapefile

public static Layer openShapefile()
Displays an open dialog and reads the shape file in.


readShapefile

public static Layer readShapefile(java.lang.String shapefile)
Reads the provided shape file and returns a Layer.


saveShapefile

public static void saveShapefile(FeatureCollection fc)
Shows a save dialog and writes the Shapefile out.


writeShapefile

public static void writeShapefile(FeatureCollection fc,
                                  java.lang.String path)
Writes the provided Feature Collection into a Shape file.

Parameters:
fc - the FeatureCollection to write out.
path - the path of the .shp file.

saveSvg

public static void saveSvg(Layer[] lyrs)
Shows a save file dialog for exporting the layers into a SVG file.

Parameters:
lyrs - an array with the layers to include in the SVG file.

writeSvg

public static void writeSvg(Layer[] lyrs,
                            java.lang.String path)
Writes the provided layers into a SVG file.

Parameters:
lyrs - an array with the layers to include in the SVG file.
path - the location of the SVG file to create.

geometryToSvgPath

public static java.lang.String geometryToSvgPath(Geometry geom,
                                                 Envelope env,
                                                 double scaleFactor,
                                                 double minX,
                                                 double maxX,
                                                 double minY,
                                                 double maxY)
Converts a Geometry into a SVG path sequence.

Parameters:
geom - the Geometry to convert.
env - the Envelope we use for the coordinate conversion.
minX, - maxX, minY, maxY the maximum coordinates for the SVG coordinates and corresponding to the Envelope env.
Returns:
a string for use in a SVG path element.