PrecisionModel

@SerialVersionUID(7777263578777803835L) class PrecisionModel() extends Serializable with Comparable[PrecisionModel]
Companion
object
trait Comparable[PrecisionModel]
trait Serializable
class Object
trait Matchable
class Any

Value members

Constructors

def this(modelType: Type)

Creates a <code>PrecisionModel</code> that specifies an explicit precision model type. If the model type is FIXED the scale factor will default to 1.

Creates a <code>PrecisionModel</code> that specifies an explicit precision model type. If the model type is FIXED the scale factor will default to 1.

Value Params
modelType

the type of the precision model

def this(scale: Double, offsetX: Double, offsetY: Double)

Creates a <code>PrecisionModel</code> that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor.

Creates a <code>PrecisionModel</code> that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor.

Value Params
offsetX

not used.

offsetY

not used.

scale

amount by which to multiply a coordinate after subtracting the offset, to obtain a precise coordinate

def this(scale: Double)

Creates a <code>PrecisionModel</code> that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor.

Creates a <code>PrecisionModel</code> that specifies Fixed precision. Fixed-precision coordinates are represented as precise internal coordinates, which are rounded to the grid defined by the scale factor.

Value Params
scale

amount by which to multiply a coordinate after subtracting the offset, to obtain a precise coordinate

Copy constructor to create a new <code>PrecisionModel</code> from an existing one.

Copy constructor to create a new <code>PrecisionModel</code> from an existing one.

Concrete methods

override def compareTo(o: PrecisionModel): Int

Compares this {link PrecisionModel} object with the specified object for order. A PrecisionModel is greater than another if it provides greater precision. The comparison is based on the value returned by the {link #getMaximumSignificantDigits} method. This comparison is not strictly accurate when comparing floating precision models to fixed models; however, it is correct when both models are either floating or fixed.

Compares this {link PrecisionModel} object with the specified object for order. A PrecisionModel is greater than another if it provides greater precision. The comparison is based on the value returned by the {link #getMaximumSignificantDigits} method. This comparison is not strictly accurate when comparing floating precision models to fixed models; however, it is correct when both models are either floating or fixed.

Value Params
o

the <code>PrecisionModel</code> with which this <code>PrecisionModel</code> is being compared return a negative integer, zero, or a positive integer as this <code>PrecisionModel</code> is less than, equal to, or greater than the specified <code>PrecisionModel</code>

Definition Classes
Comparable
override def equals(other: Any): Boolean
Definition Classes
Any

Returns the maximum number of significant digits provided by this precision model. Intended for use by routines which need to print out decimal representations of precise values (such as {link WKTWriter}).

Returns the maximum number of significant digits provided by this precision model. Intended for use by routines which need to print out decimal representations of precise values (such as {link WKTWriter}).

This method would be more correctly called <tt>getMinimumDecimalPlaces</tt>, since it actually computes the number of decimal places that is required to correctly display the full precision of an ordinate value.

Since it is difficult to compute the required number of decimal places for scale factors which are not powers of 10, the algorithm uses a very rough approximation in this case. This has the side effect that for scale factors which are powers of 10 the value returned is 1 greater than the true value.

return the maximum number of decimal places provided by this precision model

def getOffsetX: Int

Returns the x-offset used to obtain a precise coordinate.

Returns the x-offset used to obtain a precise coordinate.

return the amount by which to subtract the x-coordinate before multiplying by the scale

def getOffsetY: Int

Returns the y-offset used to obtain a precise coordinate.

Returns the y-offset used to obtain a precise coordinate.

return the amount by which to subtract the y-coordinate before multiplying by the scale

def getScale: Double

Returns the scale factor used to specify a fixed precision model. The number of decimal places of precision is equal to the base-10 logarithm of the scale factor. Non-integral and negative scale factors are supported. Negative scale factors indicate that the places of precision is to the left of the decimal point.

Returns the scale factor used to specify a fixed precision model. The number of decimal places of precision is equal to the base-10 logarithm of the scale factor. Non-integral and negative scale factors are supported. Negative scale factors indicate that the places of precision is to the left of the decimal point.

return the scale factor for the fixed precision model

Gets the type of this precision model

Gets the type of this precision model

return the type of this precision model

See also

Type

def isFloating: Boolean

Tests whether the precision model supports floating point

Tests whether the precision model supports floating point

return <code>true</code> if the precision model supports floating point

def makePrecise(`val`: Double): Double

Rounds a numeric value to the PrecisionModel grid. Asymmetric Arithmetic Rounding is used, to provide uniform rounding behaviour no matter where the number is on the number line.

Rounds a numeric value to the PrecisionModel grid. Asymmetric Arithmetic Rounding is used, to provide uniform rounding behaviour no matter where the number is on the number line.

This method has no effect on NaN values.

<b>Note:</b> Java's <code>Math#rint</code> uses the "Banker's Rounding" algorithm, which is not suitable for precision operations elsewhere in JTS.

def makePrecise(coord: Coordinate): Unit

Rounds a Coordinate to the PrecisionModel grid.

Rounds a Coordinate to the PrecisionModel grid.

Returns the external representation of <code>internal</code>.

Returns the external representation of <code>internal</code>.

Value Params
internal

the original coordinate return the coordinate whose values will be changed to the external representation of <code>internal</code>

def toExternal(internal: Coordinate, external: Coordinate): Unit

Sets <code>external</code> to the external representation of <code>internal</code>.

Sets <code>external</code> to the external representation of <code>internal</code>.

Value Params
external

the coordinate whose values will be changed to the external representation of <code>internal</code>

internal

the original coordinate

def toInternal(external: Coordinate, internal: Coordinate): Unit

Sets <code>internal</code> to the precise representation of <code>external</code>.

Sets <code>internal</code> to the precise representation of <code>external</code>.

Value Params
external

the original coordinate

internal

the coordinate whose values will be changed to the precise representation of <code>external</code>

Returns the precise representation of <code>external</code>.

Returns the precise representation of <code>external</code>.

Value Params
external

the original coordinate return the coordinate whose values will be changed to the precise representation of <code>external</code>

override def toString: String
Definition Classes
Any