es.prodevelop.gvsig.mobile.fmap.driver.raster.wms
Class WmsRasterDriver

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

public class WmsRasterDriver
extends java.lang.Object
implements GeorreferencedRasterDriver, InfoByPoint

This is the WMS driver. It is instantiated after the suer has used the WMS dialog.

Author:
jldominguez
See Also:
WMSLayerDescription, WMSProtocolHandler

Field Summary
static java.awt.Font ERROR_IMAGE_FONT
           
 
Fields inherited from interface es.prodevelop.gvsig.mobile.fmap.driver.raster.RasterDriver
ONE_PIXEL_IMAGE_ERROR, ONE_PIXEL_NO_DATA
 
Constructor Summary
WmsRasterDriver(java.lang.String svrUrl, java.lang.String lyrs, java.lang.String info_lyrs, java.lang.String info_lyrs_names, java.lang.String imgf, java.lang.String _srs, java.awt.geom.Rectangle2D fe, java.util.ArrayList info_fmts, java.lang.String v, java.lang.String symb)
          Constructor.
 
Method Summary
 void close()
          Closes the driver.
 void draw(java.awt.Graphics2D g, ViewPort viewPort)
          Draws the image on the given Graphics object.
 boolean fileAccepted(java.io.File fName)
          Define los tipos de fichero que puede leer el driver.
 java.awt.geom.AffineTransform getAffineTransform()
          Obtiene la matriz de transformación
 java.lang.Object getData(int x, int y, int band)
          Gets the data associated with the given pixel and band
 java.lang.String getFilePath()
           
 java.awt.geom.Rectangle2D getFullExtent()
          Obtiene la extensión en coordenadas del mundo real que ocupa este raster
 java.lang.String getImageFormat()
           
 java.util.ArrayList getInfo(java.awt.Point p, double tolerance, Cancellable cancel, java.lang.String srs)
          get info associated with the given screen pixel.
 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
 int[] getPixel(double wcx, double wcy)
          Gets the RGB values of the pixel for the given coordinates (in map units)
 IProjection getProjection()
          Obtiene la proyección en la que está el raster
 int getRasterDataType()
           
 java.lang.String getRequestedLayers()
           
 java.lang.String getRequestedStyles()
           
 java.net.URL getServerUrl()
           
 java.lang.String getSrs()
           
 java.lang.String getSymbol()
           
 int getTransparency()
           
 java.lang.String getVersion()
           
 void initialize()
          Initializes the driver.
 void initialize(IProjection p)
          Initializes the driver with the given projection
 boolean isGeoreferenced()
          Obtiene el flag que dice si la imagen está o no georreferenciada
 void open(java.io.File f)
          Not used.
 void setAffineTransform(java.awt.geom.AffineTransform t)
          Sets the affine transform associated with this driver.
 void setProjection(IProjection p)
          Sets a new projection
 void setTransparency(int trans)
          Sets the transparecncy level.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_IMAGE_FONT

public static final java.awt.Font ERROR_IMAGE_FONT
Constructor Detail

WmsRasterDriver

public WmsRasterDriver(java.lang.String svrUrl,
                       java.lang.String lyrs,
                       java.lang.String info_lyrs,
                       java.lang.String info_lyrs_names,
                       java.lang.String imgf,
                       java.lang.String _srs,
                       java.awt.geom.Rectangle2D fe,
                       java.util.ArrayList info_fmts,
                       java.lang.String v,
                       java.lang.String symb)
Constructor. All these paremeters come from the WMS dialog.

Parameters:
svrUrl - the server URL
lyrs - a comma separated string with the layer ids
info_lyrs - a comma separated string with the ids of the infoable layers
info_lyrs_names - a comma separated string with the names of the infoable layers
imgf - the image format to be requested
_srs - the SRS to be used in the requests
fe - the full extent of the layer, provided by the capabilities response
info_fmts - a list of the info formats supported by the server
v - the version of the WMS protocol to be used
symb - the separator symbol to be used in the request URLs
Method Detail

getVersion

public java.lang.String getVersion()
Returns:
the WMS protocol version to be used

getSymbol

public java.lang.String getSymbol()
Returns:
the separator symbol to be used in the request URLs

initialize

public void initialize(IProjection p)
                throws java.io.IOException
Initializes the driver with the given projection

Specified by:
initialize in interface GeorreferencedRasterDriver
Parameters:
p - the projection used by this driver
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 projection used by this driver

setProjection

public void setProjection(IProjection p)
Sets a new projection

Specified by:
setProjection in interface GeorreferencedRasterDriver
Parameters:
p - the new 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 full extent of this layer

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 image (return strue)

setAffineTransform

public void setAffineTransform(java.awt.geom.AffineTransform t)
Sets the affine transform associated with this driver. Currently unused.

Specified by:
setAffineTransform in interface GeorreferencedRasterDriver
Parameters:
t - Matriz de transformación

getAffineTransform

public java.awt.geom.AffineTransform getAffineTransform()
Description copied from interface: GeorreferencedRasterDriver
Obtiene la matriz de transformación

Specified by:
getAffineTransform in interface GeorreferencedRasterDriver
Returns:
the affine transform associated with the last viewport used

fileAccepted

public boolean fileAccepted(java.io.File fName)
Description copied from interface: RasterDriver
Define los tipos de fichero que puede leer el driver. Si devuelve true, el fichero está aceptado (es de los que el driver puede leer), si devuelve false es porque no lo puede leer.

Specified by:
fileAccepted in interface RasterDriver
Returns:
whether the file is accepted as a raster file. Returns false, because it makes no sense in a WMS driver.

open

public void open(java.io.File f)
          throws java.io.IOException
Not used.

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

initialize

public void initialize()
                throws java.io.IOException
Initializes the driver. Currently unused.

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

close

public void close()
           throws java.io.IOException
Closes the driver. Tries to prevent memory leaks.

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

getFilePath

public java.lang.String getFilePath()
Specified by:
getFilePath in interface RasterDriver
Returns:
the raster file file path. Returns null, has no sense here.

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 raster image band count

getTransparency

public int getTransparency()
Specified by:
getTransparency in interface RasterDriver
Returns:
the transparency level of the image associated with this driver

setTransparency

public void setTransparency(int trans)
Sets the transparecncy level. Currently unused.

Specified by:
setTransparency in interface RasterDriver

draw

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

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

getRasterDataType

public int getRasterDataType()
Specified by:
getRasterDataType in interface RasterDriver
Returns:
the data type of the individual bands

getData

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

Specified by:
getData in interface RasterDriver
Parameters:
x - the x coordinate of the pixel of interest
y - the y coordinate of the pixel of interest
band -

getPixel

public int[] getPixel(double wcx,
                      double wcy)
Gets the RGB values of the pixel for the given coordinates (in map units)

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

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

getInfo

public java.util.ArrayList getInfo(java.awt.Point p,
                                   double tolerance,
                                   Cancellable cancel,
                                   java.lang.String srs)
                            throws FMapDriverException
get info associated with the given screen pixel.

Specified by:
getInfo in interface InfoByPoint
Parameters:
p - the screen point of interest
tolerance - tolerance ised for query width (unused here)
cancel - cancel object
srs - used SRS
Returns:
Throws:
FMapDriverException

getServerUrl

public java.net.URL getServerUrl()
Returns:
the server URL

getRequestedLayers

public java.lang.String getRequestedLayers()
Returns:
comma separated string of requested layers

getRequestedStyles

public java.lang.String getRequestedStyles()
Returns:
comma separated string of requested styles, one for each layer

getImageFormat

public java.lang.String getImageFormat()
Returns:
the requested image format

getSrs

public java.lang.String getSrs()
Returns:
the requested SRS