public interface JiffleRuntime
Modifier and Type | Method and Description |
---|---|
Map<String,RenderedImage> |
get_images()
Gets the images used by this object and returns them as a
Map
with variable names as keys and images as values. |
String[] |
getDestinationVarNames()
Gets the variable names associated with destination images.
|
double |
getHeight()
Gets the height of the processing area.
|
double |
getMaxX()
Gets the max X ordinate of the processing area.
|
double |
getMaxY()
Gets the max Y ordinate of the processing area.
|
double |
getMinX()
Gets the min X ordinate of the processing area.
|
double |
getMinY()
Gets the min Y ordinate of the processing area.
|
long |
getNumPixels()
Gets the total number of pixels in the processing area.
|
String[] |
getSourceVarNames()
Gets the variable names associated with source images.
|
Double |
getVar(String varName)
Returns the value of a variable that was declared in the
script's init block.
|
String[] |
getVarNames()
Returns the names of image scope variables that can be used with
the
getVar(String) and setVar(String, Double)
methods. |
double |
getWidth()
Gets the width of the processing area.
|
double |
getXRes()
Gets the pixel width (resolution in X direction) in world units.
|
double |
getYRes()
Gets the pixel height (resolution in Y direction) in world units.
|
boolean |
isWorldSet()
Checks whether the world bounds and pixel dimensions have been set.
|
double |
readFromImage(String srcImageName,
double x,
double y,
int band)
Gets a value from a source image for a given world position and
image band.
|
void |
setDefaultTransform(CoordinateTransform tr)
Sets a coordinate transform to be used by any source and destination images
submitted to the runtime object without their own transforms.
|
void |
setImageParams(Map<String,Jiffle.ImageRole> imageParams)
Supplies the runtime object with the names and roles if image variables
used in the script.
|
void |
setSourceImage(String varName,
RenderedImage image)
Associates a variable name with a source image.
|
void |
setSourceImage(String varName,
RenderedImage image,
CoordinateTransform tr)
Associates a variable name with a source image and coordinate transform.
|
void |
setSourceImageBandTransform(String varName,
BandTransform br)
Associates a given source image with a BandTransform
|
void |
setSourceImageCoordinateTransform(String varName,
CoordinateTransform tr)
Associates a given source image with a CoordinateTransform
|
void |
setVar(String varName,
Double value)
Sets the value of a variable that was declared in the script's
init block, overriding the default value in the script
if present.
|
void |
setWorldByNumPixels(Rectangle2D bounds,
int numX,
int numY)
Sets the world (processing area) bounds and the number of pixels in the
X and Y directions.
|
void |
setWorldByResolution(Rectangle2D bounds,
double xres,
double yres)
Sets the world (processing area) bounds and resolution (pixel dimensions).
|
void setWorldByResolution(Rectangle2D bounds, double xres, double yres)
bounds
- outer bounds of the processing areaxres
- pixel width in world unitsyres
- pixel height in world unitsIllegalArgumentException
- if bounds
is null
or emptyvoid setWorldByNumPixels(Rectangle2D bounds, int numX, int numY)
bounds
- outer bounds of the processing areanumX
- number of pixels in the X directionnumY
- number of pixels in the Y directionIllegalArgumentException
- if bounds
is null
or emptyvoid setDefaultTransform(CoordinateTransform tr) throws JiffleException, WorldNotSetException
tr
is null
the system default transform (IdentityCoordinateTransform
)
will be used.tr
- the coordinate transform to use as the default; or null
for the system defaultJiffleException
- if the world bounds and resolution have not
been set previouslyWorldNotSetException
double getMinX()
double getMaxX()
double getMinY()
double getMaxY()
double getWidth()
double getHeight()
double getXRes()
double getYRes()
long getNumPixels()
IllegalStateException
- if the processing area has not been setboolean isWorldSet()
true
if set; false
otherwiseString[] getVarNames()
getVar(String)
and setVar(String, Double)
methods.null
Double getVar(String varName)
varName
- variable namenull
if the variable name is
not foundvoid setVar(String varName, Double value) throws JiffleRuntimeException
value
to null
results in the
default script value being used.varName
- variable namevalue
- the new valueJiffleRuntimeException
- if the variable name is not foundvoid setImageParams(Map<String,Jiffle.ImageRole> imageParams)
jaitools.jiffle.Jiffle
instance that is creating the runtime object so that clients can use
the getSourceVarNames()
and getDestinationVarNames()
methods.imageParams
- a Map
of variable names (key) and roles (value)String[] getSourceVarNames()
null
String[] getDestinationVarNames()
null
void setSourceImage(String varName, RenderedImage image, CoordinateTransform tr) throws JiffleException
tr
is null
the default
identify transform will be used.
Note that Jiffle uses rounding to reduce the transformed coordinates to integers.
varName
- script variable representing the source imageimage
- writable imagetr
- transform for processing area to image coordinatesJiffleException
- if the world bounds and resolution have not
been set previouslyvoid setSourceImage(String varName, RenderedImage image)
setSourceImage(varName, image, null)
This convenience method is defined in the interface because it will be
commonly when working directly with image coordinates.varName
- script variable representing the source imageimage
- writable imagevoid setSourceImageBandTransform(String varName, BandTransform br) throws JiffleException
varName
- script variable representing the source imagebandTransform
- the script to band transformJiffleException
void setSourceImageCoordinateTransform(String varName, CoordinateTransform tr) throws JiffleException
varName
- script variable representing the source imagetr
- transform for processing area to image coordinatesJiffleException
double readFromImage(String srcImageName, double x, double y, int band)
srcImageName
- the source imagex
- source X ordinate in world unitsy
- source Y ordinate in world unitsband
- source bandMap<String,RenderedImage> get_images()
Map
with variable names as keys and images as values.Copyright © 2006–2018 GeoSolutions. All rights reserved.