jwo.landserf.process
Class SelectVectorThread

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

public class SelectVectorThread
extends LSThread
implements Scriptable

Allows a subset of vector objects to be selected from a vector map.

Version:
2.3, 12th 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
SelectVectorThread(GISFrame gisFrame)
          Creates an object ready for GISVector object selection but does not perform the selection itself.
SelectVectorThread(GISFrame gisFrame, String selectionCriteria)
          Creates an object that will select objects from a vector map.
 
Method Summary
 boolean doCommand(LSCommand command)
          Selects the objects from the vector map according to the criteria given in the scripting parameters.
 void doProcessing()
          Selects objects from the primary vector map according to the selection criteria specified in the constructor or script parameter.
 LSCommand getCommand()
          Reports the syntax required to allow objects to be selected from vector map via scripting command.
 VectorMap getgetNewVectorMap()
          Retrieves the vector map containing only the objects that satisfy the selection criteria.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects and messages.
 Object getReturnedObject()
          Returns a vector map containing only the objects that satisfy the selection criteria.
 
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

SelectVectorThread

public SelectVectorThread(GISFrame gisFrame)
Creates an object ready for GISVector object selection but does not perform the selection itself. This is primarily used for processing vector maps via the scripting interface.

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

SelectVectorThread

public SelectVectorThread(GISFrame gisFrame,
                          String selectionCriteria)
Creates an object that will select objects from a vector map.

Parameters:
gisFrame - Frame holding spatial objects and in which to report results.
selectionCriteria - Selection criteria. This should be a comma separated list of attribute values which can include 'n' to represent null values and 'to' to include ranges of attribute values.
Method Detail

doProcessing

public void doProcessing()
Selects objects from the primary vector map according to the selection criteria specified in the constructor or script parameter. The resulting vector map is added to the GISFrame provided to the constructor and selected as the new primary vector map. To retrieve it either call getNewVectorMap() from this class or call gisFrame.getVectorMap1();.

Note that this method will be called automatically if this is run as a threaded process (e.g. mySelectVectorThread.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 objects to be selected from vector map via scripting command.

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

doCommand

public boolean doCommand(LSCommand command)
Selects the objects from the vector map according to the criteria given in the scripting parameters.

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

getReturnedObject

public Object getReturnedObject()
Returns a vector map containing only the objects that satisfy the selection criteria. This is identical to getNewVectorMap except that it is compatible with the scriptable interface. If the command has yet to be issued this will return null.

Specified by:
getReturnedObject in interface Scriptable
Returns:
New spatial object or null if problems selecting 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.

getgetNewVectorMap

public VectorMap getgetNewVectorMap()
Retrieves the vector map containing only the objects that satisfy the selection criteria.

Returns:
New vector map with selected objects, or null if problems or selection has yet to take place.


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