org.gvsig.raster.algorithm.process
Class DataProcess

java.lang.Object
  extended by org.gvsig.raster.algorithm.process.ProcessUtils
      extended by org.gvsig.raster.algorithm.process.ProcessParamsManagement
          extended by org.gvsig.raster.algorithm.process.DataProcess
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, IIncrementable, IncrementableListener, org.gvsig.tools.dispose.Disposable

public abstract class DataProcess
extends ProcessParamsManagement
implements IIncrementable, IncrementableListener, java.lang.Runnable, org.gvsig.tools.dispose.Disposable

Clase base de todos los procesos raster. En ella se genstionan todas las funciones comunes como incremento de la tarea, gesti�n de eventos a la tarea, par�metros de la tarea, etc ... 18/12/2007

Author:
Nacho Brodin nachobrodin@gmail.com

Field Summary
protected  java.lang.Thread blinker
           
protected  IProcessActions externalActions
           
protected  IncrementableTask incrementableTask
           
protected  org.slf4j.Logger logger
           
protected  org.gvsig.fmap.dal.coverage.process.TaskEventManager taskEventManager
           
protected  java.util.Hashtable<java.lang.String,java.lang.Object> taskParams
           
 
Fields inherited from class org.gvsig.raster.algorithm.process.ProcessParamsManagement
inputParameters, OUTPUT_HEIGHT, OUTPUT_WIDTH, outputParameters, PREVIEW, PROCESS, PROCESS_NAME, REGISTER_INPUT_PARAMETERS_LABEL, REGISTER_OUTPUT_PARAMETERS_LABEL, ROI_EPSG, TIME, WINDOW
 
Fields inherited from class org.gvsig.raster.algorithm.process.ProcessUtils
doubleNODATA
 
Constructor Summary
DataProcess()
           
 
Method Summary
 void actionCanceled(IncrementableEvent e)
          Un evento de cancelado es enviado a la tarea cuando actionCanceled es activado.
 void actionResumed(IncrementableEvent e)
          Invocado cuando se aprieta el boton Resumir de la ventana
 void actionSuspended(IncrementableEvent e)
          Invocado cuando se aprieta el boton Suspender de la ventana
protected  void addOutputValue(java.lang.String key, java.lang.Object value)
          Adds a output from the process in runtime
 void dispose()
           
 void execute()
          Sequential execution of this task
protected  void finalize()
           
 IProcessActions getActions()
          Gets the object to execute external actions.
 IncrementableTask getIncrementableTask()
          Builds the window IncrementableTask to show the increment of the task.
 java.lang.String getLabel()
          Gets the last line in the increment window
 java.lang.String getLog()
          Gets the log of the increment window
 java.lang.String getName()
           
 int getPercent()
          Devuelve el porcentaje de 0 a 100 de la ventana IncrementableTask
 java.util.HashMap<java.lang.String,java.lang.Object> getResult()
          Gets the result of the process.
 long getTime()
          Gets the time that a task lasts
 IProcessActions getUniqueProcessActions()
          Gets the object to execute actions in the queue of processes
abstract  void init()
          A specific task will load parameters using this initialization.
protected  void insertLineLog(java.lang.String line)
          Inserts a new line in the increment window
 boolean isCancelable()
          Determines if this process can be canceled.
 boolean isPausable()
          Determines if this process can be paused.
abstract  void process()
          This call will be implemented by a specific process.
 void run()
          This method will be executed by the Thread.
 void setActions(IProcessActions actions)
          Sets the object to execute external actions.
 void setCancelable(boolean enabled)
          Sets the button to cancel the task
 void setName(java.lang.String name)
           
 void setProgressActive(boolean active)
          When the process is launched in a thread, this method enables or disables the GUI to show the progress.
 void setUniqueProcessActions(IProcessActions actions)
          Asigna el objeto para ejecutar acciones externar.
 void showIncrementableWindow()
          Show the increment of this task IncrementableTask
 void start()
          Starts the process.
 void updatePercent(int parcial, int total)
          Updates the percentaje of progress and manages the cancelation
 
Methods inherited from class org.gvsig.raster.algorithm.process.ProcessParamsManagement
addParam, getBooleanParam, getByteParam, getDoubleArrayParam, getDoubleParam, getExtentParam, getFloatParam, getIntArrayParam, getIntParam, getOutputHeight, getOutputWidth, getOutputWindow, getParam, getParameterClassList, getParameterTypeByProcess, getRasterTaskInputParameters, getRasterTaskOutputParameters, getROIEPSG, getStringParam, isForPreviews, isOutputRescaled, loadGlobalParameters, registerGlobalInputParameters, registerGlobalOutputParameters, registerInputParameter, registerOutputParameter, removeParam
 
Methods inherited from class org.gvsig.raster.algorithm.process.ProcessUtils
createOutputBuffer, createOutputBuffer, createSourceBuffer, debug, exportRaster, exportRaster, exportRaster, exportRaster, getData, getExtentResult, getIntersectionInPxCoords, getSourcePxBox, isAnalizedEntireLayer, isInsideOfROI, messageBoxError, messageBoxError, messageBoxError
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gvsig.raster.algorithm.gui.IIncrementable
getTitle
 

Field Detail

blinker

protected volatile java.lang.Thread blinker

externalActions

protected IProcessActions externalActions

incrementableTask

protected IncrementableTask incrementableTask

logger

protected org.slf4j.Logger logger

taskEventManager

protected org.gvsig.fmap.dal.coverage.process.TaskEventManager taskEventManager

taskParams

protected java.util.Hashtable<java.lang.String,java.lang.Object> taskParams
Constructor Detail

DataProcess

public DataProcess()
Method Detail

actionCanceled

public void actionCanceled(IncrementableEvent e)
Un evento de cancelado es enviado a la tarea cuando actionCanceled es activado. Para ello se crear� un objeto CancelEvent y se asignar� a la tarea en ejecuci�n. Esta lo procesar� cuando pueda e interrumpir� el proceso.

Specified by:
actionCanceled in interface IncrementableListener

actionResumed

public void actionResumed(IncrementableEvent e)
Description copied from interface: IncrementableListener
Invocado cuando se aprieta el boton Resumir de la ventana

Specified by:
actionResumed in interface IncrementableListener

actionSuspended

public void actionSuspended(IncrementableEvent e)
Description copied from interface: IncrementableListener
Invocado cuando se aprieta el boton Suspender de la ventana

Specified by:
actionSuspended in interface IncrementableListener

addOutputValue

protected void addOutputValue(java.lang.String key,
                              java.lang.Object value)
Adds a output from the process in runtime

Parameters:
key -
value -

dispose

public void dispose()
Specified by:
dispose in interface org.gvsig.tools.dispose.Disposable

execute

public void execute()
             throws org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException,
                    ProcessException
Sequential execution of this task

Throws:
ProcessException
org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class ProcessParamsManagement
Throws:
java.lang.Throwable

getActions

public IProcessActions getActions()
Gets the object to execute external actions. A user should be register this object to receive the events


getIncrementableTask

public IncrementableTask getIncrementableTask()
Builds the window IncrementableTask to show the increment of the task.


getLabel

public java.lang.String getLabel()
Gets the last line in the increment window

Specified by:
getLabel in interface IIncrementable
Returns:
String

getLog

public java.lang.String getLog()
Gets the log of the increment window

Specified by:
getLog in interface IIncrementable
Returns:
String

getName

public java.lang.String getName()

getPercent

public int getPercent()
Description copied from interface: IIncrementable
Devuelve el porcentaje de 0 a 100 de la ventana IncrementableTask

Specified by:
getPercent in interface IIncrementable
Returns:
int

getResult

public java.util.HashMap<java.lang.String,java.lang.Object> getResult()
Gets the result of the process. All processes will have a parameter PROCESS that it is the own process. It is useful to get the process name or other data. This result of the process is sent to the method "end" in IProcessActions when the task is thrown in a thread or is recovered by the user when the task is thrown sequentially.

Returns:
Result of the task

getTime

public long getTime()
Gets the time that a task lasts


getUniqueProcessActions

public IProcessActions getUniqueProcessActions()
Gets the object to execute actions in the queue of processes


init

public abstract void init()
A specific task will load parameters using this initialization.


insertLineLog

protected void insertLineLog(java.lang.String line)
Inserts a new line in the increment window


isCancelable

public boolean isCancelable()
Description copied from interface: IIncrementable

Determines if this process can be canceled.

Specified by:
isCancelable in interface IIncrementable
Returns:
true if this process can be canceled, otherwise false

isPausable

public boolean isPausable()
Description copied from interface: IIncrementable

Determines if this process can be paused.

Specified by:
isPausable in interface IIncrementable
Returns:
true if this process can be paused, otherwise false

process

public abstract void process()
                      throws org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException,
                             ProcessException
This call will be implemented by a specific process. It will do the actions to carry out the task

Throws:
java.lang.InterruptedException
org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException
ProcessException

run

public void run()
This method will be executed by the Thread. It will have the global actions for any task and it will call to the execute function.

Specified by:
run in interface java.lang.Runnable

setActions

public void setActions(IProcessActions actions)
Sets the object to execute external actions. A user should be register this object to receive the events


setCancelable

public void setCancelable(boolean enabled)
Sets the button to cancel the task


setName

public void setName(java.lang.String name)

setProgressActive

public void setProgressActive(boolean active)
When the process is launched in a thread, this method enables or disables the GUI to show the progress.


setUniqueProcessActions

public void setUniqueProcessActions(IProcessActions actions)
Asigna el objeto para ejecutar acciones externar.

Parameters:
IProcessActions -

showIncrementableWindow

public void showIncrementableWindow()
Show the increment of this task IncrementableTask


start

public void start()
Starts the process. It will call the run method


updatePercent

public void updatePercent(int parcial,
                          int total)
                   throws org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException
Updates the percentaje of progress and manages the cancelation

Parameters:
parcial -
total -
Throws:
org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException


Copyright © 2014 gvSIG Association. All Rights Reserved.