jwo.landserf.process
Class FracSurfaceThread

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

public class FracSurfaceThread
extends LSThread
implements Scriptable

Calculates a fractal surface using spectral synthesis. Algorithm from Peitgen and Saupe (1988).

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
FracSurfaceThread(GISFrame gisFrame)
          Fills the current primary raster with a fractal surface with default fractal dimension of 2.1, mean of 500, and standard deviation of 100.
FracSurfaceThread(GISFrame gisFrame, float fracDim)
          Fills the current primary raster with a fractal surface with given fractal dimension and default mean of 500, and standard deviation of 100.
FracSurfaceThread(GISFrame gisFrame, float fracDim, float mean, float stdev)
          Fills the current primary raster with a fractal surface with given fractal dimension, mean, and standard deviation.
FracSurfaceThread(GISFrame gisFrame, float fracDim, float mean, float stdev, long seed)
          Fills the current primary raster with a fractal surface with given fractal dimension, mean, standard deviation and random seed.
 
Method Summary
 boolean doCommand(LSCommand command)
          Creates the fractal surface.
 void doProcessing()
          Creates the raster surface and places the contents into the currently selected primary raster map.
 LSCommand getCommand()
          Reports the syntax required to allow fractal surfaces to be created.
 GISFrame getGISFrame()
          Retrieves the GISFrame that can be used for storing multiple spatial objects.
 Object getReturnedObject()
          Would return an object, but null in this case since no new object is created.
 boolean spectralSynthesis(float[] realNum, float[] imagNum, int nn, float h)
          Creates a 2-d fractal surface via spectral synthesis.
 
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

FracSurfaceThread

public FracSurfaceThread(GISFrame gisFrame)
Fills the current primary raster with a fractal surface with default fractal dimension of 2.1, mean of 500, and standard deviation of 100.

Parameters:
gisFrame - Frame in which to report results.

FracSurfaceThread

public FracSurfaceThread(GISFrame gisFrame,
                         float fracDim)
Fills the current primary raster with a fractal surface with given fractal dimension and default mean of 500, and standard deviation of 100.

Parameters:
gisFrame - Frame in which to report results.
fracDim - Fractal dimension of surface.

FracSurfaceThread

public FracSurfaceThread(GISFrame gisFrame,
                         float fracDim,
                         float mean,
                         float stdev)
Fills the current primary raster with a fractal surface with given fractal dimension, mean, and standard deviation.

Parameters:
gisFrame - Frame in which to report results.
fracDim - Fractal dimension of surface.
mean - Mean of surface values.
stdev - Standard deviation of surface values.

FracSurfaceThread

public FracSurfaceThread(GISFrame gisFrame,
                         float fracDim,
                         float mean,
                         float stdev,
                         long seed)
Fills the current primary raster with a fractal surface with given fractal dimension, mean, standard deviation and random seed.

Parameters:
gisFrame - Frame in which to report results.
fracDim - Fractal dimension of surface.
mean - Mean of surface values.
stdev - Standard deviation of surface values.
seed - Number to seed random number generator.
Method Detail

doProcessing

public void doProcessing()
Creates the raster surface and places the contents into the currently selected primary raster map. Note that unlike some of the classes in the jwo.landserf.process package, this class does not create a new raster map, but instead 'fills' the existing primary raster stored in the GISFrame provided to the constructor. This is to make it easier to allow a fractal surface to be created by default in a new GISFrame. To retrieve the fractal surface, call GISFrame.getRaster1() after this process has completed.

Specified by:
doProcessing in class LSThread

getCommand

public LSCommand getCommand()
Reports the syntax required to allow fractal surfaces to be created.

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

doCommand

public boolean doCommand(LSCommand command)
Creates the fractal surface.

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

getReturnedObject

public Object getReturnedObject()
Would return an object, but null in this case since no new object is created. The new fractal surface values are placed in the raster supplied to doCommand().

Specified by:
getReturnedObject in interface Scriptable
Returns:
Always null.

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.

spectralSynthesis

public boolean spectralSynthesis(float[] realNum,
                                 float[] imagNum,
                                 int nn,
                                 float h)
Creates a 2-d fractal surface via spectral synthesis. Algorithm is based on the one by D. Sauper (1988), p.108.

Parameters:
realNum - Array of real components of coefficients and fractal surface.
imagNum - Array of imaginary components of coefficients and fractal surface.
nn - Size of array along one dimensions (2^n).
h - Relates to fractal dimension (D) as D = 3 - h.
Returns:
True if surface created successfully.


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