deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.coverage.grid
Class WorldFile

java.lang.Object
  extended by org.deegree.model.coverage.grid.WorldFile

public class WorldFile
extends Object

class representation of a ESRI world file. A world file may defines bounding coordinates centered on the outter pixel (e.g. ESRI software) or outside the bounding pixels (e.g.Oracle spatial). Reading a worldfile this must be considered so the type of a worldfile must be passed. For this a enum named TYPE ist defined.

Version:
$Revision: 18195 $, $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Andreas Poth, last edited by: $Author: mschneider $

Nested Class Summary
static class WorldFile.TYPE
          TYPE enumerates the world file types.
 
Constructor Summary
WorldFile(double resx, double resy, double rotation1, double rotation2, Envelope envelope)
          Create a new WorldFile with an envelope that spans from the center of the corner pixels.
WorldFile(double resx, double resy, double rotation1, double rotation2, Envelope envelope, WorldFile.TYPE type)
          Create a new WorldFile with an envelope.
 
Method Summary
 Envelope getEnvelope()
          returns the envelope described by a word file.
 Envelope getEnvelope(WorldFile.TYPE envType)
          returns the envelope described by a word file
 double getResx()
          returns the x-resolution described by a word file
 double getResy()
          returns the y-resolution described by a word file
 double getRotation1()
          returns the first rotation described by a word file
 double getRotation2()
          returns the second rotation described by a word file
static boolean hasWorldfileSuffix(String name)
           
static WorldFile readWorldFile(InputStream is, WorldFile.TYPE type, int width, int height)
           
static WorldFile readWorldFile(String filename, WorldFile.TYPE type)
           
static WorldFile readWorldFile(String filename, WorldFile.TYPE type, BufferedImage image)
          returns a class representation of a ESRI world file
static WorldFile readWorldFile(String filename, WorldFile.TYPE type, int width, int height)
           
 String toString()
           
static void writeWorldFile(OutputStream os, WorldFile wf)
          writes a WorldFile
static void writeWorldFile(WorldFile wf, String fileBaseName)
          writes a WorldFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorldFile

public WorldFile(double resx,
                 double resy,
                 double rotation1,
                 double rotation2,
                 Envelope envelope)
Create a new WorldFile with an envelope that spans from the center of the corner pixels.

Parameters:
resx - resolution x-direction
resy - resolution y-direction (negative value)
rotation1 - first rotation parameter
rotation2 - second rotation parameter
envelope - the envelope of the worldfile

WorldFile

public WorldFile(double resx,
                 double resy,
                 double rotation1,
                 double rotation2,
                 Envelope envelope,
                 WorldFile.TYPE type)
Create a new WorldFile with an envelope.

Parameters:
resx - resolution x-direction
resy - resolution y-direction (negative value)
rotation1 - first rotation parameter
rotation2 - second rotation parameter
envelope - the envelope of the worldfile
type - whether the envelope spans from the center or from the outer bounds of the corner pixels
Method Detail

readWorldFile

public static WorldFile readWorldFile(String filename,
                                      WorldFile.TYPE type)
                               throws IOException
Parameters:
filename - name of the image/raster file inclusing path and extension
type -
Returns:
a class represention of a ESRI world file
Throws:
IOException

hasWorldfileSuffix

public static boolean hasWorldfileSuffix(String name)
Parameters:
name -
Returns:
true, if the name ends with .tfw, .wld, .jgw, .gfw, .gifw, .pgw or .pngw.

readWorldFile

public static WorldFile readWorldFile(InputStream is,
                                      WorldFile.TYPE type,
                                      int width,
                                      int height)
                               throws NumberFormatException,
                                      IOException
Parameters:
is -
type -
width - image width in pixel
height - image height in pixel
Returns:
a class representation of a ESRI world file
Throws:
IOException
NumberFormatException

readWorldFile

public static WorldFile readWorldFile(String filename,
                                      WorldFile.TYPE type,
                                      int width,
                                      int height)
                               throws IOException
Parameters:
filename - name of the image/raster file inclusing path and extension
type -
width - image width in pixel
height - image height in pixel
Returns:
a class representation of a ESRI world file
Throws:
IOException

readWorldFile

public static WorldFile readWorldFile(String filename,
                                      WorldFile.TYPE type,
                                      BufferedImage image)
                               throws IOException
returns a class representation of a ESRI world file

Parameters:
filename - name of the image/raster file including path and extension
type - world file type
image - image/raster the world file belongs too
Returns:
a class representation of a ESRI world file
Throws:
IOException

writeWorldFile

public static void writeWorldFile(WorldFile wf,
                                  String fileBaseName)
                           throws IOException
writes a WorldFile

Parameters:
wf -
fileBaseName -
Throws:
IOException

writeWorldFile

public static void writeWorldFile(OutputStream os,
                                  WorldFile wf)
                           throws IOException
writes a WorldFile

Parameters:
os -
wf -
Throws:
IOException

getEnvelope

public Envelope getEnvelope()
returns the envelope described by a word file. The envelope spans the center coordinates of the corner pixels.

Returns:
the envelope described by a word file

getEnvelope

public Envelope getEnvelope(WorldFile.TYPE envType)
returns the envelope described by a word file

Parameters:
envType - whether the result envelope should span from the center or from the outer bounds of the corner pixels
Returns:
the envelope described by a word file

getResx

public double getResx()
returns the x-resolution described by a word file

Returns:
the x-resolution described by a word file

getResy

public double getResy()
returns the y-resolution described by a word file

Returns:
the y-resolution described by a word file

getRotation1

public double getRotation1()
returns the first rotation described by a word file

Returns:
the first rotation described by a word file

getRotation2

public double getRotation2()
returns the second rotation described by a word file

Returns:
the second rotation described by a word file

toString

public String toString()
Overrides:
toString in class Object

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org