jwo.landserf.process
Class PitRemovalThread

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

public class PitRemovalThread
extends LSThread
implements Scriptable

Detects pits in a DEM and creates a pitless surface. This is useful for hydrological analysis that requires all cells to drain to the boundary of the DEM.

Version:
2.3, 14th October, 2008.
Author:
Jo Wood

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int CHANNELLING
          Indicates pits to be removed via channelling outflow.
static int INFILLING
          Indicates pits to be removed via infilling.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PitRemovalThread(GISFrame gisFrame)
          Processes the primary DEM by identifying pits and creates a new pitless surface.
PitRemovalThread(GISFrame gisFrame, int removalType)
          Processes the primary DEM by identifying pits and creates a new pitless surface.
 
Method Summary
 boolean doCommand(LSCommand command)
          Creates a pitless surface.
 void doProcessing()
          Removes pits from the DEM stored as the primary raster in the GISFrame provided to the constructor.
 LSCommand getCommand()
          Reports the syntax required to allow a pitless surface to be created via a scripting command.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects.
 RasterMap getPitlessMap()
          Retrieves the newly created pitless DEM.
 RasterMap getPitMap()
          Retrieves the newly created raster map containing pits removed from DEM.
 Object getReturnedObject()
          Returns a raster map holding the pitless 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
 

Field Detail

INFILLING

public static final int INFILLING
Indicates pits to be removed via infilling.

See Also:
Constant Field Values

CHANNELLING

public static final int CHANNELLING
Indicates pits to be removed via channelling outflow.

See Also:
Constant Field Values
Constructor Detail

PitRemovalThread

public PitRemovalThread(GISFrame gisFrame)
Processes the primary DEM by identifying pits and creates a new pitless surface. Assumes pit removal will be via pit infilling unless type is set via scripting parameters.

Parameters:
gisFrame - GISFrame holding DEM to process.

PitRemovalThread

public PitRemovalThread(GISFrame gisFrame,
                        int removalType)
Processes the primary DEM by identifying pits and creates a new pitless surface.

Parameters:
gisFrame - GISFrame holding DEM to process.
removalType - Type of pit removal. Should be one of INFILLING or CHANNELLING.
Method Detail

getCommand

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

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

doCommand

public boolean doCommand(LSCommand command)
Creates a pitless surface. This method is used for scripting control.

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

getReturnedObject

public Object getReturnedObject()
Returns a raster map holding the pitless 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()
Removes pits from the DEM stored as the primary raster in the GISFrame provided to the constructor. A newly created raster map containing the pitless DEM and one containing the location and depth of pits are added to the GISFrame provided to the constructor. The pitless DEM can be retrieved directly via this class's getPitlessMap() method, or by calling gisFrame.getRaster2();. The raster map containing pits can be retrieved via getPitMap() or by calling gisFrame.getRasters() and selecting the last raster map added.

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

Specified by:
doProcessing in class LSThread
See Also:
GISFrame

getPitlessMap

public RasterMap getPitlessMap()
Retrieves the newly created pitless DEM.

Returns:
New pitless DEM, or null if process yet to take place.

getPitMap

public RasterMap getPitMap()
Retrieves the newly created raster map containing pits removed from DEM.

Returns:
New pits map, or null if process yet to take place.


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