com.bbn.openmap.dataAccess.image
Class WorldFile

java.lang.Object
  extended by com.bbn.openmap.dataAccess.image.WorldFile
Direct Known Subclasses:
ErrWorldFile

public class WorldFile
extends java.lang.Object

A world file is a small text file that describes the geographic location of an image on a map. It looks like this:

            20.154 <the dimension of a pixel in map units in the x direction>
            0.000 <rotation term for row>
            0.000 <rotation term for column>
            -20.154 <the dimension of a pixel in map units in the y direction>
            424178 <the x coordinate of the center of pixel 1,1 (upper-left pixel)>
            4313415 <the y coordinate of the center of pixel 1,1 (upper-left pixel)>
 
The naming convention of the world file is that it should have the same name as the file it represents, with a modified extension. The extension should be the extension of the image file with a w attached to it, or the first and third letters of the image file extension with a w appended to it. It can also have a .wld extension.

Author:
dietrick

Field Summary
protected  double colRot
          The rotation term for column.
static java.util.logging.Logger logger
           
protected  double rowRot
          The rotation term for row.
protected  double x
          The x coordinate of the center of pixel 1,1 (upper-left pixel).
protected  double xDim
          The dimension of a pixel in map units in the x direction.
protected  double y
          The y coordinate of the center of pixel 1,1 (upper-left pixel).
protected  double yDim
          The dimension of a pixel in map units in the y direction.
 
Constructor Summary
protected WorldFile()
           
  WorldFile(double xDim, double yDim, double rowRot, double colRot, double x, double y)
           
  WorldFile(java.io.InputStream is)
           
  WorldFile(java.net.URL fileURL)
           
 
Method Summary
protected static java.io.InputStream checkValidityAndGetStream(java.lang.String wfURLString)
           
static WorldFile get(java.net.URL imageFileURL)
          Given a path to a image file, discover the world file which should be next to it.
 double getColRot()
           
 double getRowRot()
           
 double getX()
           
 double getXDim()
           
 double getY()
           
 double getYDim()
           
 void read(java.io.InputStream is)
           
 void setColRot(double colRot)
           
 void setRowRot(double rowRot)
           
 void setX(double x)
           
 void setXDim(double dim)
           
 void setY(double y)
           
 void setYDim(double dim)
           
 java.lang.String toString()
           
 void write(java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger

xDim

protected double xDim
The dimension of a pixel in map units in the x direction.


yDim

protected double yDim
The dimension of a pixel in map units in the y direction.


rowRot

protected double rowRot
The rotation term for row.


colRot

protected double colRot
The rotation term for column.


x

protected double x
The x coordinate of the center of pixel 1,1 (upper-left pixel).


y

protected double y
The y coordinate of the center of pixel 1,1 (upper-left pixel).

Constructor Detail

WorldFile

protected WorldFile()

WorldFile

public WorldFile(double xDim,
                 double yDim,
                 double rowRot,
                 double colRot,
                 double x,
                 double y)

WorldFile

public WorldFile(java.net.URL fileURL)
          throws java.net.MalformedURLException,
                 java.io.IOException
Throws:
java.net.MalformedURLException
java.io.IOException

WorldFile

public WorldFile(java.io.InputStream is)
          throws java.net.MalformedURLException,
                 java.io.IOException
Throws:
java.net.MalformedURLException
java.io.IOException
Method Detail

read

public void read(java.io.InputStream is)
          throws java.io.IOException
Throws:
java.io.IOException

write

public void write(java.io.OutputStream os)
           throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

get

public static WorldFile get(java.net.URL imageFileURL)
Given a path to a image file, discover the world file which should be next to it.

Parameters:
imageFileURL - the path to the image file, not the world file.
Returns:
WorldFile object for the image.

checkValidityAndGetStream

protected static java.io.InputStream checkValidityAndGetStream(java.lang.String wfURLString)

getColRot

public double getColRot()

setColRot

public void setColRot(double colRot)

getRowRot

public double getRowRot()

setRowRot

public void setRowRot(double rowRot)

getX

public double getX()

setX

public void setX(double x)

getXDim

public double getXDim()

setXDim

public void setXDim(double dim)

getY

public double getY()

setY

public void setY(double y)

getYDim

public double getYDim()

setYDim

public void setYDim(double dim)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details