|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Precision
Specifies the precision model of the direct positions in a geometry.
A precision model defines a grid of allowable points. The round(org.opengis.geometry.DirectPosition)
method
allows to round a direct position to the nearest allowed point. The getType()
method describes the collapsing behavior of a direct position.
Precision
instances can be sorted by their scale.
Method Summary | |
---|---|
int |
compareTo(Precision other)
Compares this precision model with the specified one. |
int |
getMaximumSignificantDigits()
Deprecated. This is redundant with getScale() . |
double |
getScale()
Multiplying factor used to obtain a precise ordinate. |
PrecisionType |
getType()
Returns the type of this precision model. |
void |
round(DirectPosition position)
Rounds a direct position to this precision model in place. |
Method Detail |
---|
int compareTo(Precision other)
compareTo
in interface Comparable<Precision>
other
- Other precision model to compare against.
int getMaximumSignificantDigits()
getScale()
.
Apparently this is usually used for output, note GML generation usually has its own concept of significant digits. You may be able to capture this in terms of the getScale().
getScale()
double getScale()
Multiply by this value and then divide by this value to round correctly:
So to round todouble scale = pm.getScale(); return Math.round(value * scale) / scale;
3
significant digits we would have a scale of 1000
.
Tip: the number of significant digits can be computed as below:
int significantDigits = (int) Math.ceil(Math.log10(pm.getScale()));
PrecisionType getType()
void round(DirectPosition position)
It is likely that a Precision
instance will keep different rounding rules for different
axis (example x & y ordinates may be handled differently then height),
by always rounding a direct position as a whole we will enable this functionality.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |