org.cts.op
Class CoordinateOperationSequence

java.lang.Object
  extended by org.cts.IdentifiableComponent
      extended by org.cts.op.AbstractCoordinateOperation
          extended by org.cts.op.CoordinateOperationSequence
All Implemented Interfaces:
Identifiable, CoordinateOperation

public class CoordinateOperationSequence
extends AbstractCoordinateOperation

A coordinate operation sequence can transform a coordinate through several ordered CoordinateOperations.

Author:
Michaƫl Michaud

Field Summary
 
Fields inherited from class org.cts.op.AbstractCoordinateOperation
precision
 
Fields inherited from interface org.cts.Identifiable
DEFAULT, LOCAL, UNKNOWN
 
Constructor Summary
CoordinateOperationSequence(Identifier identifier, CoordinateOperation... sequence)
          Create a CoordinateOperationSequence from an identifier and an array of CoordinateOperations.
CoordinateOperationSequence(Identifier identifier, CoordinateOperation[] sequence, double precision)
          Create a CoordinateOperationSequence from an identifier an array of CoordinateOperations and a precision.
CoordinateOperationSequence(Identifier identifier, List<CoordinateOperation> list)
          Create a CoordinateOperationSequence from an identifier and a List of CoordinateOperations.
CoordinateOperationSequence(Identifier identifier, List<CoordinateOperation> list, double precision)
          Creates a CoordinateOperationSequence from an identifier, a List of CoordinateOperations and a precision.
 
Method Summary
static List<CoordinateOperation> cleverAdd(List<CoordinateOperation> ops, CoordinateOperation op)
          cleverAdd add cleverly a CoordinateOperation in a list of CoordinateOperations by removing the last element of list if it is the inverse of the element to add.
 boolean equals(Object o)
          Returns true if object is equals to this.
 int hashCode()
          Returns the hash code for this CoordinateOperationSequence.
 CoordinateOperation inverse()
          Creates the inverse CoordinateOperation.
 String toString()
          Returns a String representation of this CoordinateOperationSequence.
 double[] transform(double[] coord)
          Implementation of the transform method for a sequence of transformation.
 
Methods inherited from class org.cts.op.AbstractCoordinateOperation
getPrecision
 
Methods inherited from class org.cts.IdentifiableComponent
addAlias, addRemark, getAliases, getAuthorityKey, getAuthorityName, getCode, getComponent, getIdentifier, getName, getRemarks, getShortName, setIdentifier, setRemarks, setShortName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.cts.Identifiable
addAlias, addRemark, getAliases, getAuthorityKey, getAuthorityName, getCode, getName, getRemarks, getShortName, setRemarks, setShortName
 

Constructor Detail

CoordinateOperationSequence

public CoordinateOperationSequence(Identifier identifier,
                                   CoordinateOperation... sequence)
Create a CoordinateOperationSequence from an identifier and an array of CoordinateOperations. Precision of this sequence is considered as the sum of all single org.cts.CoordinateOperation.

Parameters:
identifier - this operation sequence identifier
sequence - an array containing ordered operations to apply to coordinates

CoordinateOperationSequence

public CoordinateOperationSequence(Identifier identifier,
                                   List<CoordinateOperation> list)
Create a CoordinateOperationSequence from an identifier and a List of CoordinateOperations. Precision of this sequence is considered as the sum of all single org.cts.CoordinateOperation.

Parameters:
identifier - this operation sequence identifier
list - a list containing ordered operations to apply to coordinates

CoordinateOperationSequence

public CoordinateOperationSequence(Identifier identifier,
                                   CoordinateOperation[] sequence,
                                   double precision)
Create a CoordinateOperationSequence from an identifier an array of CoordinateOperations and a precision.

Parameters:
identifier - this operation sequence identifier
sequence - a list containing ordered operations to apply to coordinates
precision - precision of this CoordinateOperation as a whole.

CoordinateOperationSequence

public CoordinateOperationSequence(Identifier identifier,
                                   List<CoordinateOperation> list,
                                   double precision)
Creates a CoordinateOperationSequence from an identifier, a List of CoordinateOperations and a precision.

Parameters:
identifier - this operation sequence identifier
list - a list containing ordered operations to apply to coordinates
precision - precision of this CoordinateOperation as a whole.
Method Detail

transform

public double[] transform(double[] coord)
                   throws IllegalCoordinateException
Implementation of the transform method for a sequence of transformation. It is important that input coordinate is a 3D coordinate because any of the coordinate operation of the sequence may be a 3D coordinate of org.cts.CoordinateOperations.

Specified by:
transform in interface CoordinateOperation
Specified by:
transform in class AbstractCoordinateOperation
Parameters:
coord - the 3D coord to transform
Returns:
a double array containing the output coordinate
Throws:
IllegalCoordinateException - if coord is not compatible with this CoordinateOperation.

inverse

public CoordinateOperation inverse()
                            throws NonInvertibleOperationException
Creates the inverse CoordinateOperation.

Specified by:
inverse in interface CoordinateOperation
Overrides:
inverse in class AbstractCoordinateOperation
Throws:
NonInvertibleOperationException

cleverAdd

public static List<CoordinateOperation> cleverAdd(List<CoordinateOperation> ops,
                                                  CoordinateOperation op)
cleverAdd add cleverly a CoordinateOperation in a list of CoordinateOperations by removing the last element of list if it is the inverse of the element to add. If not, it simply add the CoordinateOperation at the end of the list. NB1: If op is the Identity transformation, it is added only if ops is empty. NB2: If ops contains only the identity transformation, it is replaced by op.

Parameters:
ops - the list in which the CoordinateOperation should be added
op - the CoordinateOperation to add list)

toString

public String toString()
Returns a String representation of this CoordinateOperationSequence. It gives a correct representation of CoordinateOperationSequence nested in a CoordinateOperationSequence, but will not display nicely a third level of nests operation.

Overrides:
toString in class IdentifiableComponent

equals

public boolean equals(Object o)
Returns true if object is equals to this. Tests equality between the length of the sequences and then the equality of each CoordinateOperation.

Overrides:
equals in class IdentifiableComponent
Parameters:
object - The object to compare this CoordinateOperationSequence against

hashCode

public int hashCode()
Returns the hash code for this CoordinateOperationSequence.

Overrides:
hashCode in class IdentifiableComponent


Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.