jwo.landserf.process
Class CombineThread

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

public class CombineThread
extends LSThread
implements Scriptable

Combines two spatial objects to create a new spatial object.

Version:
2.3, 15th December, 2006.
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
CombineThread(GISFrame gisFrame)
          Creates an object ready for combining files but does not perform the combination.
CombineThread(GISFrame gisFrame, int spatialType, int combineType, int combineRule, boolean replaceNull)
          Combines the two spatial objects stored in the gisFrame.
 
Method Summary
 boolean doCommand(LSCommand command)
          Combines the spatial objects specified in the given scripting parameters.
 void doProcessing()
          Combines two spatial objects according to the supplied rules.
 SpatialObject getCombinedMap()
          Retrieves the combined spatial object (either a RasterMap or VectorMap depending on what spatial types were provided to the constructor).
 LSCommand getCommand()
          Reports the syntax required to allow files to be combined via a scripting command.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects and messages.
 Object getReturnedObject()
          Returns the newly created combined spatial object.
 
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

CombineThread

public CombineThread(GISFrame gisFrame)
Creates an object ready for combining files but does not perform the combination. This is primarily used for combining files via the scripting interface.

Parameters:
gisFrame - Frame holding spatial objects and in which to report results.

CombineThread

public CombineThread(GISFrame gisFrame,
                     int spatialType,
                     int combineType,
                     int combineRule,
                     boolean replaceNull)
Combines the two spatial objects stored in the gisFrame.

Parameters:
gisFrame - Frame holding the spatial objects to combine.
spatialType - Type of spatial objects combination (should be one of CombineBox.RASTERS, CombineBox.VECTORS or CombineBox.RASTER_VECTOR.
combineType - Type of combination (INTERSECTION or UNION).
combineRule - Indicates the type of combination rule to apply. Depends on the spatial object type. For two rasters, rule determines priority attribute for intersection regions (PRIMARY, SECONDARY or AVERAGE. For vector maps and raster-vector combination, rule determines if intersection should be of bounding rectangles or objects in vector map.
replaceNull - Indicates whether null values will be replaced where possible (only applies to raster maps).
Method Detail

doProcessing

public void doProcessing()
Combines two spatial objects according to the supplied rules. The resulting spatial object is added to the GISFrame provided to the constructor, but will not be selected as either a primary or secondary raster/vector map. To retrieve it either call getCombinedMap() from this class or call gisFrame.getRasterMaps(); / gisFrame.getVectorMaps(); and retrieve the last object added to the collection.

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

Specified by:
doProcessing in class LSThread
See Also:
GISFrame

getCommand

public LSCommand getCommand()
Reports the syntax required to allow files to be combined via a scripting command.

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

doCommand

public boolean doCommand(LSCommand command)
Combines the spatial objects specified in the given scripting parameters.

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

getReturnedObject

public Object getReturnedObject()
Returns the newly created combined spatial object. 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 combining or command has not yet been issued.

getGISFrame

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

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

getCombinedMap

public SpatialObject getCombinedMap()
Retrieves the combined spatial object (either a RasterMap or VectorMap depending on what spatial types were provided to the constructor).

Returns:
New combined spatial object, or null if problems or combination yet to take place.


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