jwo.landserf.process
Class DemToTinThread

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

public class DemToTinThread
extends LSThread
implements Scriptable

Converts a DEM to TIN representation. Uses the 'greedy insertion' algorithm described by Garland & Heckbert (1995).

Version:
2.3, 17th July, 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
DemToTinThread(GISFrame gisFrame)
          Creates an object ready for triangulation but does not perform the transformation.
DemToTinThread(GISFrame gisFrame, int numVertices, float tolRMSE, float tolError, boolean createErrorSurf)
          Converts a DEM into TIN representation.
 
Method Summary
 boolean doCommand(LSCommand command)
          Creates a vector map containing the triangulated points.
 void doProcessing()
          Convert the DEM stored as the primary raster in the GISFrame provided to the constructor into TIN representation.
 LSCommand getCommand()
          Reports the syntax required to allow contours to be created via a scripting command.
 RasterMap getErrorMap()
          Retrieves the newly created raster map containing the TIN error map (if chosen).
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects.
 Object getReturnedObject()
          Returns a vector map holding the triangulation.
 VectorMap getTIN()
          Retrieves the newly created vector map containing the TIN.
 
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

DemToTinThread

public DemToTinThread(GISFrame gisFrame)
Creates an object ready for triangulation but does not perform the transformation. This is primarily used for creating TINS or Delaunay triangulation via the scripting interface.

Parameters:
gisFrame - Frame in which to report results.

DemToTinThread

public DemToTinThread(GISFrame gisFrame,
                      int numVertices,
                      float tolRMSE,
                      float tolError,
                      boolean createErrorSurf)
Converts a DEM into TIN representation. TIN detail can be determined by any combination of numSamples, tolRMSE or tolError, where error is difference between TIN and DEM height at any point. To ignore any particular error criterion, its value should be set to -1.

Parameters:
gisFrame - containing DEM and TIN.
numVertices - Maximum number of vertices. If -1, this criterion will be ignored.
tolRMSE - Maximum Root Mean Squared Error tolerated. If -1, this criterion will be ignored.
tolError - Maximum error tolerated. If -1, this criterion will be ignored.
createErrorSurf - Generates an error surface if true.
Method Detail

getCommand

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

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

doCommand

public boolean doCommand(LSCommand command)
Creates a vector map containing the triangulated points. This will either be a TIN if the command parameter contains a raster, or a Delaunay triangulation if it contains a vector map containing points.

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

getReturnedObject

public Object getReturnedObject()
Returns a vector map holding the triangulation. 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 triangulating 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()
Convert the DEM stored as the primary raster in the GISFrame provided to the constructor into TIN representation. The newly created vector map containing the TIN is added to the GISFrame provided to the constructor as a primary vector. This can be retrieved directly via this class's method getTIN(), or by calling gisFrame.getVector1();. If error map output has been chosen, the newly created raster map containing the error surface is added to the GISFrame provided to the constructor as a secondary raster. This can be retrieved directly via this class's method getErrorMap(), or by calling gisFrame.getRaster2();.

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

Specified by:
doProcessing in class LSThread
See Also:
GISFrame

getErrorMap

public RasterMap getErrorMap()
Retrieves the newly created raster map containing the TIN error map (if chosen).

Returns:
New TIN error map, or null if error map not chosen or process yet to take place.

getTIN

public VectorMap getTIN()
Retrieves the newly created vector map containing the TIN.

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


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