jwo.landserf.process
Class PointDensityThread

java.lang.Object
  extended by java.lang.Thread
      extended by jwo.landserf.process.LSThread
          extended by jwo.landserf.process.PointDensityThread
All Implemented Interfaces:
Runnable, Scriptable, JWInterruptionListener

public class PointDensityThread
extends LSThread
implements Scriptable

Calculates the point density of a given vector coverage. Requires an input vector and raster. The raster provided determines the resolution of the density surface. The windowSize parameter determines the local area used to calculate density. Uses a linear distance decay away from centre of window to calculate density. Only point objects from the input vector map are processed.

Version:
2.3, 15th August, 2007.
Author:
Jo Wood

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PointDensityThread(GISFrame gisFrame)
          Prepares class for calculating the density surface.
PointDensityThread(GISFrame gisFrame, VectorMap vectorMap, RasterMap rasterMap, int windowSize)
          Prepares the class for transformation of the points in the given vector into a raster density surface.
 
Method Summary
 boolean doCommand(LSCommand command)
          Creates a raster map containing the density of points provided in the vector map.
 void doProcessing()
          Converts the vector points stored in the vector map provided by the constructor or scripting into a raster of point density values.
 LSCommand getCommand()
          Reports the syntax required to allow the density surface via a scripting command.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects.
 Object getReturnedObject()
          Returns a raster map holding the density surface.
 
Methods inherited from class jwo.landserf.process.LSThread
checkStoppedThread, interruptionRequested, resetTimer, run, setErrorMessage, setFinalMessage, setMessage
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointDensityThread

public PointDensityThread(GISFrame gisFrame)
Prepares class for calculating the density surface. Note that this constructor requires the vector map, raster map and window size to be set via scripting.

Parameters:
gisFrame - GUI in which to report results.

PointDensityThread

public PointDensityThread(GISFrame gisFrame,
                          VectorMap vectorMap,
                          RasterMap rasterMap,
                          int windowSize)
Prepares the class for transformation of the points in the given vector into a raster density surface.

Parameters:
gisFrame - GUI in which to report results.
vectorMap - Vector containing points.
rasterMap - Raster to hold density surface. This raster defines bounds and resolution of output.
windowSize - Size of local window to use in density calculation. Should be odd and at least 1.
Method Detail

getCommand

public LSCommand getCommand()
Reports the syntax required to allow the density surface via a scripting command.

Specified by:
getCommand in interface Scriptable
Returns:
Command syntax.

doCommand

public boolean doCommand(LSCommand command)
Creates a raster map containing the density of points provided in the vector map. This method is used for scripting control.

Specified by:
doCommand in interface Scriptable
Parameters:
command - Command containing parameter values.
Returns:
True if the density calculation is successful. If false, the details of the problem are reported to the gisFrame.

getReturnedObject

public Object getReturnedObject()
Returns a raster map holding the density surface. If command has yet to be issued this will return null.

Specified by:
getReturnedObject in interface Scriptable
Returns:
New spatial object or null if problems or command has not yet been issued.

getGISFrame

public GISFrame getGISFrame()
Retrieves the GISFrame that can be used for storing multiple spatial objects.

Specified by:
getGISFrame in interface Scriptable
Returns:
GISFrame storing spatial objects.

doProcessing

public void doProcessing()
Converts the vector points stored in the vector map provided by the constructor or scripting into a raster of point density values. The density surface is placed inside the raster map provided by the constructor or scripting. It is also set as the primary raster in gisFrame.

Note that this method will be called automatically if this is run as a threaded process (e.g. myPointDensityThread.start()). Alternatively it can be called directly as a non-threaded process.

Specified by:
doProcessing in class LSThread
See Also:
GISFrame


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