Package org.geotools.referencing
Class Console
- Object
- 
- AbstractConsole
- 
- Console
 
 
- 
- All Implemented Interfaces:
- Runnable
 
 public class Console extends AbstractConsole A console for executing CRS operations from the command line. Instructions are read from the standard input stream and results are sent to the standard output stream. Instructions include:SETname=wktSet the specified name as a shortcut for the specified Well Know Text (wkt). This WKT can contains other shortcuts defined previously. transform =wktSet explicitly a math transform to use for coordinate transformations. This instruction is a more direct alternative to the usage of source crsandtarget crsinstruction.source crs =wktSet 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 =wktSet 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 infered. source pt =coordTransforms the specified coordinates from source CRS to target CRS and prints the result. target pt =coordInverse transforms the specified coordinates from target CRS to source CRS and prints the result. test tolerance =vectorSet the maximum difference between the transformed source point and the target point. Once this value is set, every occurence of the target ptinstruction will trig this comparaison. If a greater difference is found, an exception is thrown or a message is printed to the error stream.print setPrints the set of shortcuts defined in previous calls to SETinstruction.print crsPrints the source and target coordinate reference system math transform and its inverse as Well Know Text (wkt). print ptsPrints the source and target points, their transformed points, and the distance between them. exitQuit the console. - Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
 
- 
- 
Field Summary- 
Fields inherited from class AbstractConsoleerr, in, lineSeparator, out, parser
 
- 
 - 
Constructor SummaryConstructors Constructor Description Console()Creates a new console instance using standard input stream, standard output stream, error output stream and the system default line separator.Console(LineNumberReader in)Creates a new console instance using the specified input stream.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidexecute(String instruction)Execute the specified instruction.static voidmain(String... args)Run the console from the command line.protected voidreportError(Exception exception)Print an exception message to the standard error stream.protected voidtest()Invoked automatically when thetarget ptinstruction were executed and atest tolerancewere previously set.- 
Methods inherited from class AbstractConsoleaddDefinition, executeAll, getPrompt, loadDefinitions, parseObject, printDefinitions, run, setPrompt, stop
 
- 
 
- 
- 
- 
Constructor Detail- 
Consolepublic Console() Creates a new console instance using standard input stream, standard output stream, error output stream and the system default line separator.
 - 
Consolepublic Console(LineNumberReader in) Creates a new console instance using the specified input stream.- Parameters:
- in- The input stream.
 
 
- 
 - 
Method Detail- 
mainpublic static void main(String... args) Run the console from the command line. Before to process all instructions from the standard input stream, this method first process the following optional command-line arguments:-load<filename>Load a definition file before to run instructions from the standard input stream. -encoding<code>Set the character encoding. -locale<language>Set the language for the output (e.g. "fr" for French). - Parameters:
- args- the command line arguments
 
 - 
executeprotected void execute(String instruction) throws IOException, ParseException, FactoryException, TransformException Execute the specified instruction.- Specified by:
- executein class- AbstractConsole
- Parameters:
- instruction- The instruction to execute.
- Throws:
- IOException- if an I/O operation failed while writting to the output stream.
- ParseException- if a line can't be parsed.
- FactoryException- If a transform can't be created.
- TransformException- if a transform failed.
 
 - 
testprotected void test() throws TransformException, MismatchedDimensionExceptionInvoked automatically when thetarget ptinstruction were executed and atest tolerancewere 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.
 
 - 
reportErrorprotected void reportError(Exception exception) Print an exception message to the standard error stream. The error message includes the line number, and the column where the failure occured in the exception is an instance ofParseException.- Overrides:
- reportErrorin class- AbstractConsole
- Parameters:
- exception- The exception to report.
 
 
- 
 
-