jwo.landserf.structure
Class RasterMap

java.lang.Object
  extended by jwo.landserf.structure.SpatialObject
      extended by jwo.landserf.structure.RasterMap
All Implemented Interfaces:
Serializable, Cloneable, SpatialModel

public class RasterMap
extends SpatialObject
implements Cloneable

Models a GIS raster map. Stores the raster resolution and dimensions, raster values, shaded relief sun angles and colour table. Other information in common with all other spatial objects is stored in the Header class.

Version:
2.3, 27th September, 2008.
Author:
Jo Wood
See Also:
Header, Serialized Form

Field Summary
static int ASPECT
          Aspect.
static int CENTRE_RES
          Central residual.
static int COEFF_A
          x^2 quadratic coefficient.
static int COEFF_B
          y^2 quadratic coefficient.
static int COEFF_C
          xy quadratic coefficient.
static int COEFF_D
          x quadratic coefficient.
static int COEFF_E
          y quadratic coefficient.
static int COEFF_F
          Constant quadratic coefficient.
static int CROSC
          Cross-sectional curvature.
static int ELEV
          Elevation.
static int FEATURE
          Surface feature.
static int FIRST_PARAM
          First parameter in list.
static int FRACTAL
          Fractal Dimension.
static int FUZZY
          Fuzzy membership.
static int IMAGE
          Image (raster cells represent colours).
static int LAST_PARAM
          Last parameter in list.
static int LONGC
          Longitudinal curvature.
static int MAXIC
          Maximum curvature.
static int MEAN_RES
          Mean residual.
static int MEANC
          Mean curvature.
static int MINIC
          Minimum curvature.
static int NETWORK_FEATURE
          Surface feature network.
static int OTHER
          Other raster type.
static int PLANC
          Plan curvature.
static int PROFC
          Profile curvature.
static int RELIEF
          Shaded relief.
static int SLOPE
          Slope.
 
Fields inherited from interface jwo.landserf.structure.SpatialModel
ADJACENT, AREA, CONTOUR, ENCLOSES, INTERSECTION, LINE, MATCHES, MSN, NO_VALUE, OUT_OF_BOUNDS, OVERLAPS, POINT, RASTER_2D, RASTER_3D, SEPARATE, TIN, UNDEFINED, UNION, UNKNOWN, UNKNOWN_MODEL, VECTOR_2D, VECTOR_3D, VOLUME, WITHIN
 
Constructor Summary
RasterMap()
          Creates a blank raster with a single cell.
RasterMap(int numRows, int numCols)
          Creates a blank raster with a the given number of rows and columns.
RasterMap(int numRows, int numCols, Footprint fp)
          Creates a raster map with the given dimensions.
RasterMap(int numRows, int numCols, Footprint fp, Header header)
          Creates a raster map with the given dimensions.
RasterMap(RasterMap otherRaster)
          Creates a raster map based on the attributes of the given one.
RasterMap(RasterMap otherRaster, int nRows, int nCols)
          Creates a raster map based on the attributes of the given one, but re-interpolated to the given resolution.
RasterMap(VectorMap vectorMap)
          Creates a raster map based on the spatial extent of the given vector map.
 
Method Summary
 int calcBorder()
          Reports the estimated size of the border around raster.
 Object clone()
          Clones this raster map.
 void copyMetadataFrom(RasterMap otherRaster)
          Copies the non-spatial metadata from the given raster map to this one.
 float getAmbient()
          Returns the ambient light constant used in surface for relief calculation.
 float getAspectWeight()
          Returns the currently selected aspect bias.
 float getAttribute(float easting, float northing)
          Reports the attribute of the raster at the given location.
 float getAttribute(Footprint fp)
          Reports the attribute of the raster at the given location.
 float getAttribute(int row, int col)
          Reports the attribute of the raster at the given array coordinates.
 float getAzimAngle()
          Returns the sun azimuthal angle.
 void getBlendImage(int[] img, int imgWidth, RasterMap drape)
          Creates a blended image from this and the secondary raster.
 int getCol(float x)
          Returns the raster column corresponding to a given easting.
 int getCol(float x, boolean ignoreBounds)
          Returns the raster column corresponding to a given easting.
 float getCurveTol()
          Returns the currently selected curvature tolerance for feature extraction.
 float getDecayExp()
          Returns the currently selected local window distance decay exponent.
 float getDiffuse()
          Returns the diffuse light constant used in surface for relief calculation.
 float getElevAngle()
          Returns the sun elevation angle.
 Footprint getFootprint(float row, float col)
          Reports the footprint associated with a given row and column value in the raster.
 int[] getFrequencyDist(float width)
          Returns frequency distribution of the raster based on the raster's minimum and maximum values and given bin width.
 int[] getFrequencyDist(float min, float max, float width)
          Returns frequency distribution of the raster based on the given minimum,maximum and bin width.
 int[] getFrequencyDist(float min, float max, float width, boolean ignore, float ignoreVal)
          Returns frequency distribution of the raster based on the given minimum,maximum and bin width ignoring the given value if requested.
 int[] getFrequencyDist(float min, float max, float width, boolean ignore, float[] ignoreVals)
          Returns frequency distribution of the raster based on the given minimum,maximum and bin width ignoring the given values if requested.
 int[] getHammockDist(int m)
          Returns a modulus frequency distribution (hammock distribution) of the raster.
 int[] getHammockDist(int m, float ignoreVal)
          Returns a modulus frequency distribution (hammock distribution) of the raster ignoring given value.
 int[] getHammockDist(int m, float[] ignoreVals)
          Returns a modulus frequency distribution (hammock distribution) of the raster ignoring given values.
 void getHueIntImage(int[] img, int imgWidth, RasterMap drape)
          Creates a combined 'hue-intensity' image from this and another raster.
 void getHueSatImage(int[] img, int imgWidth, RasterMap drape)
          Creates a combined 'hue-saturation' image from this and another raster.
 void getImage(int[] img, int imgWidth)
          Converts raster into colour image for display.
 void getImageAdd(int[] img, int imgWidth, RasterMap drape)
          Adds the R, G and B components of this raster's image to the given secondary raster.
 float getMaxAttribute()
          Reports the maximum attribute value of the raster.
 float getMinAttribute()
          Reports the minimum attribute value of the raster.
 int getNumCols()
          Reports the number of columns in the raster.
 int getNumRows()
          Reports the number of rows in the raster.
 float getpBlend()
          Returns the currently selected weighting for this surface when image blending.
 float getpShade()
          Returns the weighting given to shaded relief.
 float[][] getRasterArray()
          Returns the array representing the raster map.
 int getRasterType()
          Deprecated. Should use getType() instead.
 int getRow(float y)
          Returns the raster row corresponding to a given northing.
 int getRow(float y, boolean ignoreBounds)
          Returns the raster row corresponding to a given northing.
 float getShadeExaggeration()
          Returns the currently vertical exaggeration used for calculating relief.
 void getShadeImage(int[] img, int imgWidth, RasterMap drape)
          Converts raster into shaded relief image for display.
 float getShine()
          Returns the 'shininess' of the surface for relief calculation, where 0 is matt and 1 is shiny.
 float getSlopeTol()
          Returns the currently selected slope tolerance for feature extraction.
 float getSpecular()
          Returns the specular light constant used in surface for relief calculation.
 int getType()
          Identifies the type of raster map, based on the type of information stored.
 String getTypeName()
          Name describing this raster map type.
static String getTypeName(int rastType)
          Name describing the given raster map type.
 float[][] getWindow(int row, int col, int wSize)
          Returns a local window from the raster.
 int getWSize()
          Returns the currently selected local window size.
 float getXRes()
          Returns the resolution in the x direction.
 float getYRes()
          Returns the resolution in the y direction.
 float interpolateAttribute(float easting, float northing)
          Interpolates the attribute of the raster at the given coordinates.
 float interpolateAttribute(Footprint fp)
          Interpolates the attribute of the raster at the given coordinates.
 boolean readFile(String fileName)
          Reads the contents of the given native format file into this raster object.
 void reset()
          Resets the raster values while maintaining all metadata.
 void reset(int numRows, int numCols, float xRes, float yRes)
          Resets the raster with a new empty array of given size and resolution.
 void setAmbient(float ambient)
          Sets the ambient light constant used in surface for relief calculation.
 void setAspectWeight(float aspectWeight)
          Sets the aspect bias.
 void setAttribute(Footprint fp, float attribute)
          Sets the attribute of the raster at the given georeferenced coordinates.
 void setAttribute(int row, int col, float attribute)
          Sets the attribute of the raster at the given array coordinates.
 void setAttributes(float[][] rastArray)
          Sets the attributes of the raster map to those defined in the given array.
 void setAzimAngle(float azim)
          Sets the sun azimuthal angle.
 void setColourTable(ColourTable cTable)
          Sets the colour table associated with this raster.
 void setCurveTol(float ct)
          Sets a new curvature tolerance for feature extraction.
 void setDecayExp(float decayExp)
          Sets a new local window distance decay exponent.
 void setDefaultColours()
          Sets up a default colour scheme based on the range of values in this raster.
 void setDiffuse(float diffuse)
          Sets the diffuse constant used in surface for relief calculation.
 void setElevAngle(float elev)
          Sets the sun elevation angle.
 void setpBlend(float p)
          Sets the weighting for given to this surface when blending with another.
 void setpShade(float pShade)
          Sets the weighting given to shaded relief.
 void setShadeExaggeration(float zScale)
          Sets the vertical exaggeration used for calculating relief.
 void setShine(float shine)
          Sets the 'shininess' of the surface for relief calculation.
 void setSlopeTol(float slopeTol)
          Sets a new slope tolerance for feature extraction.
 void setSpecular(float specular)
          Sets the specular constant used in surface for relief calculation.
 void setType(int rasterType)
          Sets the type of raster stored (ELEV, SLOPE, IMAGE, OTHER etc).
 void setWSize(int ws)
          Sets a new local window size.
 boolean setXRes(float xRes)
          Sets the raster x resolution and checks it is consistent with the number of columns and outer boundaries.
 boolean setYRes(float yRes)
          Sets the raster y resolution and checks it is consistent with the number of rows and outer boundaries.
 SpatialModel subset(Footprint fp)
          Creates a new raster that is a subset of this raster using the intersection with the given footprint.
 String toString()
          Reports the details of this raster map.
 void updateBounds()
          Does a recalculation of the attribute bounds (minimum and maximum values).
 boolean writeFile(String fileName, int fileType, GISFrame gisFrame)
          Writes the contents of the raster and supplementary information to one or more files.
 boolean writeFile(String fileName, int fileType, GISFrame gisFrame, LSThread lsThread)
          Writes the contents of the raster and supplementary information to one or more files.
 
Methods inherited from class jwo.landserf.structure.SpatialObject
compare, getAttributeTable, getBounds, getColourTable, getComparisonText, getHeader, getIntersectionMER, getProjection, getUnionMER, move, setAttributeTable, setBounds, setHeader, setProjection
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ELEV

public static final int ELEV
Elevation.

See Also:
Constant Field Values

SLOPE

public static final int SLOPE
Slope.

See Also:
Constant Field Values

ASPECT

public static final int ASPECT
Aspect.

See Also:
Constant Field Values

PROFC

public static final int PROFC
Profile curvature.

See Also:
Constant Field Values

PLANC

public static final int PLANC
Plan curvature.

See Also:
Constant Field Values

CROSC

public static final int CROSC
Cross-sectional curvature.

See Also:
Constant Field Values

LONGC

public static final int LONGC
Longitudinal curvature.

See Also:
Constant Field Values

MINIC

public static final int MINIC
Minimum curvature.

See Also:
Constant Field Values

MAXIC

public static final int MAXIC
Maximum curvature.

See Also:
Constant Field Values

MEANC

public static final int MEANC
Mean curvature.

See Also:
Constant Field Values

FEATURE

public static final int FEATURE
Surface feature.

See Also:
Constant Field Values

NETWORK_FEATURE

public static final int NETWORK_FEATURE
Surface feature network.

See Also:
Constant Field Values

CENTRE_RES

public static final int CENTRE_RES
Central residual.

See Also:
Constant Field Values

MEAN_RES

public static final int MEAN_RES
Mean residual.

See Also:
Constant Field Values

RELIEF

public static final int RELIEF
Shaded relief.

See Also:
Constant Field Values

FRACTAL

public static final int FRACTAL
Fractal Dimension.

See Also:
Constant Field Values

COEFF_A

public static final int COEFF_A
x^2 quadratic coefficient.

See Also:
Constant Field Values

COEFF_B

public static final int COEFF_B
y^2 quadratic coefficient.

See Also:
Constant Field Values

COEFF_C

public static final int COEFF_C
xy quadratic coefficient.

See Also:
Constant Field Values

COEFF_D

public static final int COEFF_D
x quadratic coefficient.

See Also:
Constant Field Values

COEFF_E

public static final int COEFF_E
y quadratic coefficient.

See Also:
Constant Field Values

COEFF_F

public static final int COEFF_F
Constant quadratic coefficient.

See Also:
Constant Field Values

IMAGE

public static final int IMAGE
Image (raster cells represent colours).

See Also:
Constant Field Values

FUZZY

public static final int FUZZY
Fuzzy membership.

See Also:
Constant Field Values

OTHER

public static final int OTHER
Other raster type.

See Also:
Constant Field Values

FIRST_PARAM

public static final int FIRST_PARAM
First parameter in list.

See Also:
Constant Field Values

LAST_PARAM

public static final int LAST_PARAM
Last parameter in list.

See Also:
Constant Field Values
Constructor Detail

RasterMap

public RasterMap()
Creates a blank raster with a single cell.


RasterMap

public RasterMap(int numRows,
                 int numCols)
Creates a blank raster with a the given number of rows and columns.

Parameters:
numRows - Number of rows in raster.
numCols - Number of columns in raster.

RasterMap

public RasterMap(int numRows,
                 int numCols,
                 Footprint fp)
Creates a raster map with the given dimensions.

Parameters:
numRows - Number of rows in raster.
numCols - Number of columns in raster.
fp - Location and size of bottom left pixel of raster.

RasterMap

public RasterMap(int numRows,
                 int numCols,
                 Footprint fp,
                 Header header)
Creates a raster map with the given dimensions.

Parameters:
numRows - Number of rows in raster.
numCols - Number of columns in raster.
fp - Location and size of bottom left pixel of raster.
header - Header associated with this raster.

RasterMap

public RasterMap(RasterMap otherRaster)
Creates a raster map based on the attributes of the given one. This creates an identical copy including all raster values.

Parameters:
otherRaster - Raster map to copy.

RasterMap

public RasterMap(RasterMap otherRaster,
                 int nRows,
                 int nCols)
Creates a raster map based on the attributes of the given one, but re-interpolated to the given resolution.

Parameters:
otherRaster - Raster map to copy.
nRows - Number of rows in the new raster.
nCols - Number of columns in the new raster.

RasterMap

public RasterMap(VectorMap vectorMap)
Creates a raster map based on the spatial extent of the given vector map. Defaults to a resolution sufficient to generate a raster with minimum size 101 cells. Will also copy the vector attribute table it if exists.

Parameters:
vectorMap - Vector map to copy
Method Detail

clone

public Object clone()
Clones this raster map. The cloned map is entirely independent of this one, but is initially identical.

Overrides:
clone in class Object
Returns:
A 'deep' clone of this raster map.

copyMetadataFrom

public void copyMetadataFrom(RasterMap otherRaster)
Copies the non-spatial metadata from the given raster map to this one. Note that this method does not copy the bounds, resolution or number of rows and columns since these are defined by the constructor.

Parameters:
otherRaster - Raster from which to copy metadata.

reset

public void reset()
Resets the raster values while maintaining all metadata.


reset

public void reset(int numRows,
                  int numCols,
                  float xRes,
                  float yRes)
Resets the raster with a new empty array of given size and resolution. Note that the bounds of the raster should be set separately and consistently with these dimensions.

Parameters:
numRows - Number of rows.
numCols - Number of columns.
xRes - Resolution in x direction.
yRes - Resolution in y direction.

setDefaultColours

public void setDefaultColours()
Sets up a default colour scheme based on the range of values in this raster.


setColourTable

public void setColourTable(ColourTable cTable)
Sets the colour table associated with this raster.

Overrides:
setColourTable in class SpatialObject
Parameters:
cTable - New colour table to associate with this object

subset

public SpatialModel subset(Footprint fp)
Creates a new raster that is a subset of this raster using the intersection with the given footprint. If any bounds of the new raster fall outside of the existing one, the new raster is clipped to the intersecting area.

Specified by:
subset in interface SpatialModel
Specified by:
subset in class SpatialObject
Parameters:
fp - Footprint defining subset.
Returns:
New raster containing given subset or null if the intersection between this raster and the given footprint is empty.

getImage

public void getImage(int[] img,
                     int imgWidth)
Converts raster into colour image for display. Colours are based on colour table associated with raster.

Specified by:
getImage in interface SpatialModel
Specified by:
getImage in class SpatialObject
Parameters:
img - Image array to store colours.
imgWidth - Image width.

getShadeImage

public void getShadeImage(int[] img,
                          int imgWidth,
                          RasterMap drape)
Converts raster into shaded relief image for display. Blends shaded relief with raster colour table. The relative importance of the shading and the colour can be controlled by setpShade().

Parameters:
img - Image array to store colours.
imgWidth - Image width.
drape - Raster to drape over surface.

getBlendImage

public void getBlendImage(int[] img,
                          int imgWidth,
                          RasterMap drape)
Creates a blended image from this and the secondary raster.

Parameters:
img - Image array to store colours.
imgWidth - Width of image.
drape - Secondary raster holding the hue value to combine with this one.

getImageAdd

public void getImageAdd(int[] img,
                        int imgWidth,
                        RasterMap drape)
Adds the R, G and B components of this raster's image to the given secondary raster.

Parameters:
img - Image array to store colours.
imgWidth - Width of image.
drape - Secondary raster holding the RGB values to combine with this one.

getHueSatImage

public void getHueSatImage(int[] img,
                           int imgWidth,
                           RasterMap drape)
Creates a combined 'hue-saturation' image from this and another raster. This raster provides the hue values and the given raster (drape) provides the the saturation value. Note that the saturation is found from the intensity of the given raster, not it's own saturation. This makes it easier to control though the use of simple grey-scale colour tables.

Parameters:
img - Image array to store colours.
imgWidth - Width of image.
drape - Raster holding the saturation value to combine with this.

getHueIntImage

public void getHueIntImage(int[] img,
                           int imgWidth,
                           RasterMap drape)
Creates a combined 'hue-intensity' image from this and another raster. The hue values of this raster are modified by the intensity (brightness) of the drape.

Parameters:
img - Image array to store colours.
imgWidth - Width of image.
drape - Raster holding the intensity values to combine.

getFrequencyDist

public int[] getFrequencyDist(float width)
Returns frequency distribution of the raster based on the raster's minimum and maximum values and given bin width.

Parameters:
width - Bin width of frequency distribution.
Returns:
Array containing frequencies.

getFrequencyDist

public int[] getFrequencyDist(float min,
                              float max,
                              float width)
Returns frequency distribution of the raster based on the given minimum,maximum and bin width.

Parameters:
min - Minimum from which to start frequency count.
max - Maximum with which to end frequency count.
width - Bin width of frequency distribution.
Returns:
Array containing frequencies.

getFrequencyDist

public int[] getFrequencyDist(float min,
                              float max,
                              float width,
                              boolean ignore,
                              float ignoreVal)
Returns frequency distribution of the raster based on the given minimum,maximum and bin width ignoring the given value if requested.

Parameters:
min - Minimum from which to start frequency count.
max - Maximum with which to end frequency count.
width - Bin width of frequency distribution.
ignore - Ignores given value if true.
ignoreVal - value to ignore.
Returns:
Array containing frequencies.

getFrequencyDist

public int[] getFrequencyDist(float min,
                              float max,
                              float width,
                              boolean ignore,
                              float[] ignoreVals)
Returns frequency distribution of the raster based on the given minimum,maximum and bin width ignoring the given values if requested.

Parameters:
min - Minimum from which to start frequency count.
max - Maximum with which to end frequency count.
width - Bin width of frequency distribution.
ignore - Ignores given values if true.
ignoreVals - Values to ignore.
Returns:
Array containing frequencies.

getHammockDist

public int[] getHammockDist(int m)
Returns a modulus frequency distribution (hammock distribution) of the raster.

Parameters:
m - Modulus value.
Returns:
Array containing frequencies.

getHammockDist

public int[] getHammockDist(int m,
                            float ignoreVal)
Returns a modulus frequency distribution (hammock distribution) of the raster ignoring given value.

Parameters:
m - Modulus value.
ignoreVal - Value to ignore in calculating hammock plot.
Returns:
Array containing frequencies.

getHammockDist

public int[] getHammockDist(int m,
                            float[] ignoreVals)
Returns a modulus frequency distribution (hammock distribution) of the raster ignoring given values.

Parameters:
m - Modulus value.
ignoreVals - Values to ignore in calculating hammock plot.
Returns:
Array containing frequencies.

writeFile

public boolean writeFile(String fileName,
                         int fileType,
                         GISFrame gisFrame)
Writes the contents of the raster and supplementary information to one or more files.

Parameters:
fileName - Name to save file under.
fileType - Type of file format to save.
gisFrame - GUI in which to report results.
Returns:
True if written successfully.
See Also:
FileHandler

writeFile

public boolean writeFile(String fileName,
                         int fileType,
                         GISFrame gisFrame,
                         LSThread lsThread)
Writes the contents of the raster and supplementary information to one or more files. This version allows the writing process to be interrupted if a valid LSThread is passed to it.

Parameters:
fileName - Name to save file under.
fileType - Type of file format to save.
gisFrame - GUI in which to report results.
lsThread - Thread that called this method (allowing it to be interrupted). Can be null, in which case, method cannot be interrupted.
Returns:
True if written successfully.
See Also:
FileHandler

readFile

public boolean readFile(String fileName)
Reads the contents of the given native format file into this raster object.

Parameters:
fileName - Name to file to read.
Returns:
True if read successfully.

toString

public String toString()
Reports the details of this raster map.

Overrides:
toString in class SpatialObject
Returns:
Summary of this raster map (title and bounds).

calcBorder

public int calcBorder()
Reports the estimated size of the border around raster. Borders are generated when window operations cannot create values around the edge of the raster. The size of the border depends on the window used. 3x3 windows generate a border of 1 cell, 5x5 2 cells, 7x7 3 cells etc. This method estimates border sizes by counting the number of border cells in a raster that are entirely null.

Returns:
Estimated size of border. 0 indicates no border.

getNumRows

public int getNumRows()
Reports the number of rows in the raster.

Returns:
Number of raster rows.

getNumCols

public int getNumCols()
Reports the number of columns in the raster.

Returns:
Number of raster columns.

getXRes

public float getXRes()
Returns the resolution in the x direction.

Returns:
Resolution in the x direction.

getYRes

public float getYRes()
Returns the resolution in the y direction.

Returns:
Resolution in the y direction.

getMaxAttribute

public float getMaxAttribute()
Reports the maximum attribute value of the raster.

Specified by:
getMaxAttribute in class SpatialObject
Returns:
Maximum raster value.

getMinAttribute

public float getMinAttribute()
Reports the minimum attribute value of the raster.

Specified by:
getMinAttribute in class SpatialObject
Returns:
Minimum raster value.

updateBounds

public void updateBounds()
Does a recalculation of the attribute bounds (minimum and maximum values).

Specified by:
updateBounds in class SpatialObject

getAttribute

public float getAttribute(Footprint fp)
Reports the attribute of the raster at the given location.

Specified by:
getAttribute in interface SpatialModel
Specified by:
getAttribute in class SpatialObject
Parameters:
fp - Location to query.
Returns:
Attribute at given location or OUT_OF_BOUNDS if outside raster area, or NO_VALUE if null at this location.

getAttribute

public float getAttribute(float easting,
                          float northing)
Reports the attribute of the raster at the given location.

Parameters:
easting - Easting of location to query.
northing - Northing of location to query.
Returns:
Attribute at given location or OUT_OF_BOUNDS if outside raster area, or NO_VALUE if null at this location.

getAttribute

public float getAttribute(int row,
                          int col)
Reports the attribute of the raster at the given array coordinates.

Parameters:
row - Array row coordinate of cell to query.
col - Array column coordinate of cell to query.
Returns:
Attribute at given raster location or OUT_OF_BOUNDS if outside raster area, or NO_VALUE if null at this location.

interpolateAttribute

public float interpolateAttribute(Footprint fp)
Interpolates the attribute of the raster at the given coordinates. Performs a simple bilinear interpolation. Useful for resampling at new resolutions. If the raster uses a raw colour table (i.e. is an image), the R,G and B components are interpolated separately then recombined.

Parameters:
fp - Footprint of location to query.
Returns:
Interpolated attribute of the raster at query location or OUT_OF_BOUNDS if out of bounds. Returns NO_VALUE if null at this location.

interpolateAttribute

public float interpolateAttribute(float easting,
                                  float northing)
Interpolates the attribute of the raster at the given coordinates. Performs a simple bilinear interpolation. Useful for resampling at new resolutions. If the raster uses a raw colour table (i.e. is an image), the R,G and B components are interpolated separately then recombined. If the raster represents aspect,

Parameters:
easting - Easting of location to query.
northing - Northing of location to query.
Returns:
Interpolated attribute of the raster at query location or OUT_OF_BOUNDS if out of bounds. Returns NO_VALUE if null at this location.

getRasterArray

public float[][] getRasterArray()
Returns the array representing the raster map.

Returns:
Array representing the raster map.

getWindow

public float[][] getWindow(int row,
                           int col,
                           int wSize)
Returns a local window from the raster. Can be any size as long as within the bounds of the raster and does not contain null values.

Parameters:
row - Row coordinate of the window centre.
col - Column coordinate of the window centre.
wSize - Window size.
Returns:
Local window, or null if out of bounds

getRow

public int getRow(float y)
Returns the raster row corresponding to a given northing. Note that boundary conditions are 'rounded up' to the north, except at the northern boundary where they are kept within the bounds of the raster.

Parameters:
y - Northing to convert into row value.
Returns:
row value, or -1 if coordinate is out of bounds.
See Also:
getCol(float), getFootprint(float, float)

getRow

public int getRow(float y,
                  boolean ignoreBounds)
Returns the raster row corresponding to a given northing. If ignoreBounds is set to true, the row equivalent will be returned, even if this falls outside the raster. This will be negative if north of the northern boundary.

Parameters:
y - Northing to convert into row value.
ignoreBounds - If true, row value will not be constrained.
Returns:
row value, or -1 if coordinate is out of bounds and ignoreBounds is false.
See Also:
getCol(float), getFootprint(float, float)

getCol

public int getCol(float x)
Returns the raster column corresponding to a given easting. Note that boundary conditions are 'rounded up' to the east, except at the eastern boundary where they are kept within the bounds of the raster.

Parameters:
x - Easting to convert into column value.
Returns:
column value, or -1 if coordinate is out of bounds.
See Also:
getRow(float), getFootprint(float, float)

getCol

public int getCol(float x,
                  boolean ignoreBounds)
Returns the raster column corresponding to a given easting. If ignoreBounds is set to true, the column equivalent will be returned, even if this falls outside the raster. This will be negative if west of the western boundary.

Parameters:
x - Easting to convert into column value.
ignoreBounds - If true, column value will not be constrained.
Returns:
column value, or -1 if coordinate is out of bounds and ignoreBounds is false.
See Also:
getRow(float), getFootprint(float, float)

getFootprint

public Footprint getFootprint(float row,
                              float col)
Reports the footprint associated with a given row and column value in the raster.

Parameters:
row - Array row coordinate of cell to query. Can be non-integer to calculate sub-pixel location.
col - Array column coordinate of cell to query. Can be non-integer to calculate sub-pixel location.
Returns:
Point footprint representing raster row,column location or null of out of bounds. Since this is a point query, the footprint refers to the centre of the cell and has no width or height.
See Also:
getRow(float), getCol(float)

getType

public int getType()
Identifies the type of raster map, based on the type of information stored.

Specified by:
getType in interface SpatialModel
Overrides:
getType in class SpatialObject
Returns:
Raster type (ELEV, SLOPE, ASPECT, IMAGE etc.)

getRasterType

public int getRasterType()
Deprecated. Should use getType() instead.

Identifies the type of raster map, based on the type of information stored.

Returns:
Raster type (ELEV, SLOPE, ASPECT, IMAGE etc.)

getTypeName

public String getTypeName()
Name describing this raster map type.

Overrides:
getTypeName in class SpatialObject
Returns:
Text describing this raster map type.

getTypeName

public static String getTypeName(int rastType)
Name describing the given raster map type.

Parameters:
rastType - Raster type identifier used to find name.
Returns:
Text describing the raster type ('Elevation', 'slope', 'aspect', 'image' etc.

getElevAngle

public float getElevAngle()
Returns the sun elevation angle.

Returns:
Sun elevation angle (in radians).

getAzimAngle

public float getAzimAngle()
Returns the sun azimuthal angle.

Returns:
Sun azimuthal angle (in radians).

getpShade

public float getpShade()
Returns the weighting given to shaded relief.

Returns:
Shaded relief weighting (0 - 1).

getpBlend

public float getpBlend()
Returns the currently selected weighting for this surface when image blending.

Returns:
Blending weighting (0-1).

getAspectWeight

public float getAspectWeight()
Returns the currently selected aspect bias. If zero, normal shaded relief will be calculated. As it approaches 1, aspect takes greater importance than slope in calculating shading. High aspect bias highlights local detail.

Returns:
Aspect weighting.

getShadeExaggeration

public float getShadeExaggeration()
Returns the currently vertical exaggeration used for calculating relief. Values greater than 1 will increase shadow, values between 0.1 and less than 1 will decrease shadowing effect. Note this has no impact on the actual elevation attribute used for analysis.

Returns:
Vertical exaggeration used for shaded relief.

getWSize

public int getWSize()
Returns the currently selected local window size.

Returns:
Local window size.

getDecayExp

public float getDecayExp()
Returns the currently selected local window distance decay exponent.

Returns:
Local window distance decay exponent.

getShine

public float getShine()
Returns the 'shininess' of the surface for relief calculation, where 0 is matt and 1 is shiny.

Returns:
Shininess value (0 - 1).

getDiffuse

public float getDiffuse()
Returns the diffuse light constant used in surface for relief calculation.

Returns:
Diffuse light component (0 - 1).

getSpecular

public float getSpecular()
Returns the specular light constant used in surface for relief calculation.

Returns:
Specular light component (0 - 1).

getAmbient

public float getAmbient()
Returns the ambient light constant used in surface for relief calculation.

Returns:
Ambient light component (0 - 1).

getSlopeTol

public float getSlopeTol()
Returns the currently selected slope tolerance for feature extraction. Slopes greater than this value can only be a RIDGE, a CHANNEL or PLANAR feature. Therefore, the higher the value, the smaller the proportion of the surface classified as ridges or channels.

Returns:
Slope tolerance in radians for feature extraction.
See Also:
SurfParam.RIDGE, SurfParam.CHANNEL, SurfParam.PLANAR

getCurveTol

public float getCurveTol()
Returns the currently selected curvature tolerance for feature extraction. The higher the value, the greater the proportion of the surface classified as planar.

Returns:
Curvature tolerance for feature extraction.

setXRes

public boolean setXRes(float xRes)
Sets the raster x resolution and checks it is consistent with the number of columns and outer boundaries.

Parameters:
xRes - Resolution in the x direction.
Returns:
Consistency with other raster dimension properties.

setYRes

public boolean setYRes(float yRes)
Sets the raster y resolution and checks it is consistent with the number of rows and outer boundaries.

Parameters:
yRes - Resolution in the y direction.
Returns:
Consistency with other raster dimension properties.

setAttribute

public void setAttribute(int row,
                         int col,
                         float attribute)
Sets the attribute of the raster at the given array coordinates.

Parameters:
row - Array row coordinate of cell to set.
col - Array column coordinate of cell to set.
attribute - Attribute of the raster at query location.

setAttribute

public void setAttribute(Footprint fp,
                         float attribute)
Sets the attribute of the raster at the given georeferenced coordinates.

Parameters:
fp - Location of attribute to set.
attribute - New attribute of the raster cell.

setAttributes

public void setAttributes(float[][] rastArray)
Sets the attributes of the raster map to those defined in the given array. The dimensions of the array should match those identified by getNumRows() and getNumCols(), which in turn were declared in the constructor. Note that this creates an independent copy of the array values rather than a reference to the original array.

Parameters:
rastArray - 2D array of raster values.

setType

public void setType(int rasterType)
Sets the type of raster stored (ELEV, SLOPE, IMAGE, OTHER etc).

Parameters:
rasterType - Type of raster stored.

setElevAngle

public void setElevAngle(float elev)
Sets the sun elevation angle.

Parameters:
elev - Sun elevation angle (in radians).

setAzimAngle

public void setAzimAngle(float azim)
Sets the sun azimuthal angle.

Parameters:
azim - Sun azimuthal angle (in radians).

setpShade

public void setpShade(float pShade)
Sets the weighting given to shaded relief.

Parameters:
pShade - Shaded relief proportion (0 - 1)

setShadeExaggeration

public void setShadeExaggeration(float zScale)
Sets the vertical exaggeration used for calculating relief. Values greater than 1 will increase shadow, values between 0.1 and less than 1 will decrease shadowing effect. Note this has no impact on the actual elevation attribute used for analysis.

Parameters:
zScale - Vertical exaggeration used for shaded relief.

setAspectWeight

public void setAspectWeight(float aspectWeight)
Sets the aspect bias. If zero, normal shaded relief will be calculated. As it approaches 1, aspect takes greater importance than slope in calculating shading. High aspect bias highlights local detail.

Parameters:
aspectWeight - Determines how much importance to give aspect in shading calculation.

setWSize

public void setWSize(int ws)
Sets a new local window size.

Parameters:
ws - New local window size.

setShine

public void setShine(float shine)
Sets the 'shininess' of the surface for relief calculation.

Parameters:
shine - Shininess value (0 - 1).

setDiffuse

public void setDiffuse(float diffuse)
Sets the diffuse constant used in surface for relief calculation.

Parameters:
diffuse - Diffuse light component (0 - 1).

setSpecular

public void setSpecular(float specular)
Sets the specular constant used in surface for relief calculation.

Parameters:
specular - Specular light component (0 - 1).

setAmbient

public void setAmbient(float ambient)
Sets the ambient light constant used in surface for relief calculation.

Parameters:
ambient - Ambient light component (0 - 1).

setDecayExp

public void setDecayExp(float decayExp)
Sets a new local window distance decay exponent.

Parameters:
decayExp - New local window distance decay exponent.

setSlopeTol

public void setSlopeTol(float slopeTol)
Sets a new slope tolerance for feature extraction. Slopes greater than this value can only be a RIDGE, a CHANNEL or PLANAR feature. Therefore, the higher the value, the smaller the proportion of the surface classified as ridges or channels.

Parameters:
slopeTol - New slope tolerance in radians for feature extraction.
See Also:
SurfParam

setCurveTol

public void setCurveTol(float ct)
Sets a new curvature tolerance for feature extraction. The higher the value, the greater the proportion of the surface classified as planar.

Parameters:
ct - New curvature tolerance for feature extraction.
See Also:
SurfParam

setpBlend

public void setpBlend(float p)
Sets the weighting for given to this surface when blending with another.

Parameters:
p - Weighting (0-1) used for image blending.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009