org.cts.op
Class CoordinateRounding

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

public class CoordinateRounding
extends AbstractCoordinateOperation

A class to change the coordinate precision

Author:
Michaƫl Michaud

Field Summary
static CoordinateRounding CENTIMETER
          Round the coordinates to centimeter value.
static CoordinateRounding DECIMETER
          Round the coordinates to decimeter value.
static CoordinateRounding KILOMETER
          Round the coordinates to kilometer value.
static CoordinateRounding METER
          Round the coordinates to meter value.
static CoordinateRounding MILLIMETER
          Round the coordinates to millimeter value.
 
Fields inherited from class org.cts.op.AbstractCoordinateOperation
precision
 
Fields inherited from interface org.cts.Identifiable
DEFAULT, LOCAL, UNKNOWN
 
Method Summary
static CoordinateRounding createCoordinateRoundingOperation(double resolution)
          Creates a coordinate rounding operation from the smallest representable value.
static CoordinateRounding createCoordinateRoundingOperationFromDecimalPlaces(int decimalPlaces)
          Creates a coordinate rounding operation from a decimal place number.
 double[] transform(double[] coord)
          Returns a coordinate representing the same point as coord but with coordinates rounded as specified.
 
Methods inherited from class org.cts.op.AbstractCoordinateOperation
getPrecision, inverse
 
Methods inherited from class org.cts.IdentifiableComponent
addAlias, addRemark, equals, getAliases, getAuthorityKey, getAuthorityName, getCode, getComponent, getIdentifier, getName, getRemarks, getShortName, hashCode, setIdentifier, setRemarks, setShortName, toString
 
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
 

Field Detail

MILLIMETER

public static final CoordinateRounding MILLIMETER
Round the coordinates to millimeter value.


CENTIMETER

public static final CoordinateRounding CENTIMETER
Round the coordinates to centimeter value.


DECIMETER

public static final CoordinateRounding DECIMETER
Round the coordinates to decimeter value.


METER

public static final CoordinateRounding METER
Round the coordinates to meter value.


KILOMETER

public static final CoordinateRounding KILOMETER
Round the coordinates to kilometer value.

Method Detail

transform

public double[] transform(double[] coord)
                   throws IllegalCoordinateException
Returns a coordinate representing the same point as coord but with coordinates rounded as specified.

Specified by:
transform in interface CoordinateOperation
Specified by:
transform in class AbstractCoordinateOperation
Parameters:
coord - is an array containing one, two or three ordinates
Returns:
a double array containing the output coordinate
Throws:
IllegalCoordinateException - if coord is not compatible with this CoordinateOperation.

createCoordinateRoundingOperationFromDecimalPlaces

public static CoordinateRounding createCoordinateRoundingOperationFromDecimalPlaces(int decimalPlaces)
Creates a coordinate rounding operation from a decimal place number.

Parameters:
decimalPlaces - number of decimal places

createCoordinateRoundingOperation

public static CoordinateRounding createCoordinateRoundingOperation(double resolution)
Creates a coordinate rounding operation from the smallest representable value.

Parameters:
resolution - smallest representable value


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