org.geotools.data
Class WorldFileReader

Object
  extended by WorldFileReader

public class WorldFileReader
extends Object

This class is responsible for parsing a world file in order to build an affine transform using the parameters provided in the file itself.

The parameters found in the file should be as follows:

  1. size of pixel in x direction
  2. rotation term for row
  3. rotation term for column
  4. size of pixel in y direction
  5. x coordinate of centre of upper left pixel in map units
  6. y coordinate of centre of upper left pixel in map units
Note that the last two coordinates refer to the centre of the pixel!

It is worth to point out that various data sources describe the parameters in the world file as the mapping from the pixel centres' to the associated world coords. Here we directly build the needed grid to world transform and we DO NOT add any half a pixel translation given that, as stated above, the values we receive should map to the centre of the pixel.

Since:
2.3
Author:
Simone Giannecchini, GeoSolutions
Module:
modules/library/main (gt-main.jar)

Field Summary
static int DEFAULT_BUFFER_SIZE
          Default size for the underlying buffer,
 
Constructor Summary
WorldFileReader(File inFile)
          Default constructor for a WorldFileReader.
WorldFileReader(File worldfile, int bufferSize)
          Constructor for a WorldFileReader.
WorldFileReader(URL worldfile)
          Constructor for a WorldFileReader.
WorldFileReader(URL worldfile, int bufferSize)
          Constructor for a WorldFileReader.
 
Method Summary
 AffineTransform getAffineTransform()
          Creates an AffineTransform for interoperability with Java2d.
 double getRotationX()
           
 double getRotationY()
           
 MathTransform getTransform()
           
 double getXPixelSize()
           
 double getXULC()
           
 double getYPixelSize()
           
 double getYULC()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
Default size for the underlying buffer,

See Also:
Constant Field Values
Constructor Detail

WorldFileReader

public WorldFileReader(File inFile)
                throws IOException
Default constructor for a WorldFileReader.

Parameters:
inFile - holds the location where to read from.
Throws:
IOException - in case something bad happens.

WorldFileReader

public WorldFileReader(File worldfile,
                       int bufferSize)
                throws IOException
Constructor for a WorldFileReader.

Parameters:
worldfile - holds the location where to read from.
bufferSize - to buffer when reading.
Throws:
IOException - in case something bad happens.

WorldFileReader

public WorldFileReader(URL worldfile,
                       int bufferSize)
                throws IOException
Constructor for a WorldFileReader.

Parameters:
worldfile - URL where to read from.
bufferSize - to buffer when reading.
Throws:
IOException - in case something bad happens.

WorldFileReader

public WorldFileReader(URL worldfile)
                throws IOException
Constructor for a WorldFileReader.

Parameters:
worldfile - URL where to read from.
bufferSize - to buffer when reading.
Throws:
IOException - in case something bad happens.
Method Detail

getRotationX

public double getRotationX()

getRotationY

public double getRotationY()

getXPixelSize

public double getXPixelSize()

getXULC

public double getXULC()

getYPixelSize

public double getYPixelSize()

getYULC

public double getYULC()

getTransform

public MathTransform getTransform()

getAffineTransform

public AffineTransform getAffineTransform()
Creates an AffineTransform for interoperability with Java2d.

Returns:
an AffineTransform representing the transformation represented by the underlying world file.


Copyright © 1996-2009 Geotools. All Rights Reserved.