es.prodevelop.gvsig.mobile.fmap.driver.raster.ecw
Class EcwRasterDriver

java.lang.Object
  extended byes.prodevelop.gvsig.mobile.fmap.driver.raster.ecw.EcwRasterDriver
All Implemented Interfaces:
Driver, GeorreferencedRasterDriver, RasterDriver

public class EcwRasterDriver
extends java.lang.Object
implements GeorreferencedRasterDriver

This is the ECW driver based on JNI access to Ermapper libraries.

Author:
jldominguez
See Also:
EcwReader, AffineTransform

Field Summary
static int UNITS_DEGREES
          Raster units constants
static int UNITS_FEET
          Raster units constants
static int UNITS_METERS
          Raster units constants
static int UNITS_UNKNOWN
          Raster units constants
 
Fields inherited from interface es.prodevelop.gvsig.mobile.fmap.driver.raster.RasterDriver
ONE_PIXEL_IMAGE_ERROR, ONE_PIXEL_NO_DATA
 
Constructor Summary
EcwRasterDriver(ViewPort vp)
          Constructor
 
Method Summary
 void close()
          Thios method tries to close the current ECW file.
 void draw(java.awt.Graphics2D g, ViewPort viewPort)
          draws the image on the provided Graphics object
 boolean fileAccepted(java.io.File fName)
          Tells whether the provided file is accepted as a ECW file.
 java.awt.geom.AffineTransform getAffineTransform()
          Gets the current affine transform
 int getBandCount()
           
 java.lang.Object getData(int x, int y, int band)
          Gets the data associated with the given coordinates and band index.
 java.lang.String getFilePath()
           
 java.awt.geom.Rectangle2D getFullExtent()
          Obtiene la extensión en coordenadas del mundo real que ocupa este raster
 double getGeoHeight()
           
 double getGeoWidth()
           
 long getHandler()
           
 int getHeight()
           
 double getMinGeoX()
           
 double getMinGeoY()
           
 java.lang.String getName()
          Debe devolver un objeto que se asociará en el manager al driver.
 int getNumBands()
          Obtiene el número de bandas del raster
 java.lang.String getPath()
           
 int[] getPixel(double wcx, double wcy)
          Gets the RGB values of the pixel of interest
 IProjection getProjection()
          Obtiene la proyección en la que está el raster
 int getRasterDataType()
           
 int getTransparency()
           
 int getUnits()
           
 int getWidth()
           
 void initialize()
          Initialize method, not used right now.
 void initialize(IProjection p)
          Initializes the driver, simply sets the projection.
 boolean isGeoreferenced()
          Obtiene el flag que dice si la imagen está o no georreferenciada
 boolean open()
          Opens the raster file.
 void open(java.io.File f)
          This method opens the provided file.
 void setAffineTransform(java.awt.geom.AffineTransform t)
          Sets the current affine transform
 void setProjection(IProjection p)
          Sets the projection.
 void setTransparency(int t)
          Sets the transparency value of this raster
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNITS_UNKNOWN

public static final int UNITS_UNKNOWN
Raster units constants

See Also:
Constant Field Values

UNITS_METERS

public static final int UNITS_METERS
Raster units constants

See Also:
Constant Field Values

UNITS_DEGREES

public static final int UNITS_DEGREES
Raster units constants

See Also:
Constant Field Values

UNITS_FEET

public static final int UNITS_FEET
Raster units constants

See Also:
Constant Field Values
Constructor Detail

EcwRasterDriver

public EcwRasterDriver(ViewPort vp)
Constructor

Parameters:
vp - a reference to the viewport to perform geographic computations
Method Detail

open

public boolean open()
Opens the raster file. This method has to be used after the file has been set, of course.

Returns:
whether the fiel could be opened succesfully

getGeoHeight

public double getGeoHeight()
Returns:
raster height in map units

getGeoWidth

public double getGeoWidth()
Returns:
raster width in map units

getHeight

public int getHeight()
Returns:
raster height in pixels

getHandler

public long getHandler()
Returns:
file handler (a long integer). if the file could not be opened this will probably return 0.

getMinGeoX

public double getMinGeoX()
Returns:
minimum x value in map units

getMinGeoY

public double getMinGeoY()
Returns:
minimum y value in map units

getBandCount

public int getBandCount()
Returns:
number of bands in raster

getPath

public java.lang.String getPath()
Returns:
full raster file path

getUnits

public int getUnits()
Returns:
a constant indicating the map units

getWidth

public int getWidth()
Returns:
the raster width in pixels

initialize

public void initialize(IProjection p)
                throws java.io.IOException
Initializes the driver, simply sets the projection.

Specified by:
initialize in interface GeorreferencedRasterDriver
Parameters:
p - the raster projection
Throws:
java.io.IOException

getProjection

public IProjection getProjection()
Description copied from interface: GeorreferencedRasterDriver
Obtiene la proyección en la que está el raster

Specified by:
getProjection in interface GeorreferencedRasterDriver
Returns:
the raster projection

setProjection

public void setProjection(IProjection p)
Sets the projection.

Specified by:
setProjection in interface GeorreferencedRasterDriver
Parameters:
p - the raster projection

getFullExtent

public java.awt.geom.Rectangle2D getFullExtent()
Description copied from interface: GeorreferencedRasterDriver
Obtiene la extensión en coordenadas del mundo real que ocupa este raster

Specified by:
getFullExtent in interface GeorreferencedRasterDriver
Returns:
the raster full extent in map units

isGeoreferenced

public boolean isGeoreferenced()
Description copied from interface: GeorreferencedRasterDriver
Obtiene el flag que dice si la imagen está o no georreferenciada

Specified by:
isGeoreferenced in interface GeorreferencedRasterDriver
Returns:
whether this is a georreferenced raster. Returns true.

setAffineTransform

public void setAffineTransform(java.awt.geom.AffineTransform t)
Sets the current affine transform

Specified by:
setAffineTransform in interface GeorreferencedRasterDriver
Parameters:
t - the new affine transform

getAffineTransform

public java.awt.geom.AffineTransform getAffineTransform()
Gets the current affine transform

Specified by:
getAffineTransform in interface GeorreferencedRasterDriver
Returns:
the current affine transform

fileAccepted

public boolean fileAccepted(java.io.File fName)
Tells whether the provided file is accepted as a ECW file. Simply checks the extension.

Specified by:
fileAccepted in interface RasterDriver
Parameters:
fName - file object of interest
Returns:
whether its an accepted ECW file or not

open

public void open(java.io.File f)
          throws java.io.IOException
This method opens the provided file.

Specified by:
open in interface RasterDriver
Parameters:
f - the ECW file to be opened
Throws:
java.io.IOException

initialize

public void initialize()
                throws java.io.IOException
Initialize method, not used right now.

Specified by:
initialize in interface RasterDriver
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Thios method tries to close the current ECW file.

Specified by:
close in interface RasterDriver
Throws:
java.io.IOException

getNumBands

public int getNumBands()
Description copied from interface: RasterDriver
Obtiene el número de bandas del raster

Specified by:
getNumBands in interface RasterDriver
Returns:
the number of bands of thsi raster

getTransparency

public int getTransparency()
Specified by:
getTransparency in interface RasterDriver
Returns:
the transparency value of this raster

setTransparency

public void setTransparency(int t)
Sets the transparency value of this raster

Specified by:
setTransparency in interface RasterDriver
Parameters:
t - the new transparency value of this raster

draw

public void draw(java.awt.Graphics2D g,
                 ViewPort viewPort)
          throws FMapDriverException
draws the image on the provided Graphics object

Specified by:
draw in interface RasterDriver
Parameters:
g - the graphics object on which the image must be drawn
viewPort - the current viewport
Throws:
FMapDriverException

getRasterDataType

public int getRasterDataType()
Specified by:
getRasterDataType in interface RasterDriver
Returns:
the raster data type of this raster.

getData

public java.lang.Object getData(int x,
                                int y,
                                int band)
Gets the data associated with the given coordinates and band index.

Specified by:
getData in interface RasterDriver
Parameters:
x - x coordinate of the POI
y - y coordinate of the POI
band - band index
Returns:
the data associated to the given coordinates and band

getPixel

public int[] getPixel(double wcx,
                      double wcy)
Gets the RGB values of the pixel of interest

Specified by:
getPixel in interface RasterDriver
Parameters:
wcx - x coordinate in map units
wcy - y coordinate in map units
Returns:
array of RGB values of the pixel of interest

getName

public java.lang.String getName()
Description copied from interface: Driver
Debe devolver un objeto que se asociará en el manager al driver. El DriverManager recibirá peticiones de un objeto y deberá devolver el driver asociado

Specified by:
getName in interface Driver
Returns:
the driver name

getFilePath

public java.lang.String getFilePath()
Specified by:
getFilePath in interface RasterDriver
Returns:
the full file path