org.geotoolkit.console
Class ReferencingConsole

Object
  extended by InteractiveConsole
      extended by ReferencingConsole
All Implemented Interfaces:
Runnable

public class ReferencingConsole
extends InteractiveConsole

A console for executing CRS operations from the command line. This class understands the following set of instructions:

set name = wkt Set the specified name as a shortcut for the specified (wkt) (Well Know Text). This WKT can contains other shortcuts defined previously.
load filename Load the specified file, which is expected to be name=key pairs. The effect is the same as if the above set command was invoked for every lines in the given file.
transform = wkt Set explicitly a math transform to use for coordinate transformations. This instruction is a more direct alternative to the usage of source crs and target crs instruction.
source crs = wkt Set the source coordinate reference system to the specified object. This object can be specified as a Well Know Text (wkt) or as a shortcut previously set.
target crs = wkt Set the target coordinate reference system to the specified object. This object can be specified as a Well Know Text (wkt) or as a shortcut previously set. Once both source and target CRS are specified a math transform from source to target CRS is automatically inferred.
source pt = coord Transforms the specified coordinates from source CRS to target CRS and prints the result.
target pt = coord Inverse transforms the specified coordinates from target CRS to source CRS and prints the result.
tolerance forward = vector Set the maximum difference between the transformed source point and the target point. Once this value is set, every occurrence of the target pt instruction will trig this comparison. If a greater difference is found, an exception is thrown or a message is printed to the error stream.
tolerance inverse = vector Same as tolerance forward, but performs the test on the result of the inverse transform.
print set Prints the set of shortcuts defined in previous calls to SET instruction.
print crs Prints the source and target coordinate reference system as Well Know Text (wkt).
print mt Prints the math transform and its inverse as Well Know Text (wkt).
print pts Prints the source and target points, their transformed points, and the distance between them.
exit Quit the console.

Since:
2.1
Version:
3.00
Author:
Martin Desruisseaux (IRD)
Module:
referencing/geotk-referencing (download)    View source code for this class

Field Summary
 
Fields inherited from class InteractiveConsole
err, out
 
Constructor Summary
protected ReferencingConsole(LineNumberReader in)
          Creates a new instance using the specified input stream.
 
Method Summary
protected  void execute(String instruction)
          Executes the given instruction.
protected  void test()
          Invoked automatically when the target pt instruction was executed and a test tolerance was previously set.
 
Methods inherited from class InteractiveConsole
getPrompt, reportError, run, setPrompt, setSymbols, stop
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferencingConsole

protected ReferencingConsole(LineNumberReader in)
Creates a new instance using the specified input stream.

Parameters:
in - The input stream.
Method Detail

execute

protected void execute(String instruction)
                throws Exception
Executes the given instruction.

Overrides:
execute in class InteractiveConsole
Parameters:
instruction - The instruction to execute.
Throws:
Exception - if the instruction failed.

test

protected void test()
             throws TransformException,
                    MismatchedDimensionException
Invoked automatically when the target pt instruction was executed and a test tolerance was previously set. The default implementation compares the transformed source point with the expected target point. If a mismatch greater than the tolerance error is found, an exception is thrown. Subclasses may overrides this method in order to performs more tests.

Throws:
TransformException - if the source point can't be transformed, or a mistmatch is found.
MismatchedDimensionException - if the transformed source point doesn't have the expected dimension.


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.