deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.model.coverage.grid
Class WorldFile

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

public class WorldFile
extends java.lang.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(java.lang.String name)
           
static WorldFile readWorldFile(java.io.InputStream is, WorldFile.TYPE type, int width, int height)
           
static WorldFile readWorldFile(java.lang.String filename, WorldFile.TYPE type)
           
static WorldFile readWorldFile(java.lang.String filename, WorldFile.TYPE type, java.awt.image.BufferedImage image)
          returns a class representation of a ESRI world file
static WorldFile readWorldFile(java.lang.String filename, WorldFile.TYPE type, int width, int height)
           
 java.lang.String toString()
           
static void writeWorldFile(java.io.OutputStream os, WorldFile wf)
          writes a WorldFile
static void writeWorldFile(WorldFile wf, java.lang.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(java.lang.String filename,
                                      WorldFile.TYPE type)
                               throws java.io.IOException
Parameters:
filename - name of the image/raster file inclusing path and extension
type -
Returns:
a class represention of a ESRI world file
Throws:
java.io.IOException

hasWorldfileSuffix

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

readWorldFile

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

readWorldFile

public static WorldFile readWorldFile(java.lang.String filename,
                                      WorldFile.TYPE type,
                                      int width,
                                      int height)
                               throws java.io.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:
java.io.IOException

readWorldFile

public static WorldFile readWorldFile(java.lang.String filename,
                                      WorldFile.TYPE type,
                                      java.awt.image.BufferedImage image)
                               throws java.io.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:
java.io.IOException

writeWorldFile

public static void writeWorldFile(WorldFile wf,
                                  java.lang.String fileBaseName)
                           throws java.io.IOException
writes a WorldFile

Parameters:
wf -
fileBaseName -
Throws:
java.io.IOException

writeWorldFile

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

Parameters:
os -
wf -
Throws:
java.io.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object

deegree 2.5 (2011/06/29 09:44 build-8-official)

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