@Test public void testGetLinearUnit() { PJDatum pj; pj = new PJDatum(null, "+proj=merc +to_meter=" + (1 + PJDatum.EPS/2)); assertSame(Units.METRE, pj.getLinearUnit(false)); pj = new PJDatum(null, "+proj=merc +to_meter=" + (1000 - PJDatum.EPS/2)); assertSame(Units.KILOMETRE, pj.getLinearUnit(false)); }
public Unit<Length> getLinearUnit(final boolean vertical) { final double factor = getLinearUnitToMetre(vertical); int i = Arrays.binarySearch(LINEAR_FACTORS, factor); if (i < 0) { i = ~i; if (i == LINEAR_FACTORS.length || !(abs(factor - LINEAR_FACTORS[i]) <= EPS)) { if (i == 0 || !(abs(factor - LINEAR_FACTORS[--i]) <= EPS)) { return (factor == 0 || Double.isNaN(factor)) ? null : Units.METRE.multiply(factor); } } } return LINEAR_UNITS[i]; }
PJDatum extends PJ implements GeodeticDatum, PrimeMeridian, Ellipsoid { public Unit<Length> getLinearUnit(final boolean vertical) { final double factor = getLinearUnitToMetre(vertical); int i = Arrays.binarySearch(LINEAR_FACTORS, factor); if (i < 0) { i = ~i; if (i == LINEAR_FACTORS.length || !(abs(factor - LINEAR_FACTORS[i]) <= EPS)) { if (i == 0 || !(abs(factor - LINEAR_FACTORS[--i]) <= EPS)) { return (factor == 0 || Double.isNaN(factor)) ? null : Units.METRE.multiply(factor); } } } return LINEAR_UNITS[i]; } }
PJDatum extends PJ implements GeodeticDatum, PrimeMeridian, Ellipsoid { public Unit<Length> getLinearUnit(final boolean vertical) { final double factor = getLinearUnitToMetre(vertical); int i = Arrays.binarySearch(LINEAR_FACTORS, factor); if (i < 0) { i = ~i; if (i == LINEAR_FACTORS.length || !(abs(factor - LINEAR_FACTORS[i]) <= EPS)) { if (i == 0 || !(abs(factor - LINEAR_FACTORS[--i]) <= EPS)) { return (factor == 0 || Double.isNaN(factor)) ? null : Units.METRE.multiply(factor); } } } return LINEAR_UNITS[i]; } PJDatum(Identifier name, final String definition);   PJDatum(final PJDatum projected); }
PJDatum extends PJ implements GeodeticDatum, PrimeMeridian, Ellipsoid { public Unit<Length> getLinearUnit(final boolean vertical) { final double factor = getLinearUnitToMetre(vertical); int i = Arrays.binarySearch(LINEAR_FACTORS, factor); if (i < 0) { i = ~i; if (i == LINEAR_FACTORS.length || !(abs(factor - LINEAR_FACTORS[i]) <= EPS)) { if (i == 0 || !(abs(factor - LINEAR_FACTORS[--i]) <= EPS)) { return (factor == 0 || Double.isNaN(factor)) ? null : Units.METRE.multiply(factor); } } } return LINEAR_UNITS[i]; } PJDatum(Identifier name, final String definition);   PJDatum(final PJDatum projected); @Override String getDefinition(); @Override Identifier getName(); @Override Ellipsoid getEllipsoid(); @Override PrimeMeridian getPrimeMeridian(); @Override Unit<Length> getAxisUnit(); Unit<Length> getLinearUnit(final boolean vertical); @Override Unit<Angle> getAngularUnit(); @Override boolean isIvfDefinitive(); @Override double getInverseFlattening(); @Override boolean isSphere(); }
PJDatum extends PJ implements GeodeticDatum, PrimeMeridian, Ellipsoid { public Unit<Length> getLinearUnit(final boolean vertical) { final double factor = getLinearUnitToMetre(vertical); int i = Arrays.binarySearch(LINEAR_FACTORS, factor); if (i < 0) { i = ~i; if (i == LINEAR_FACTORS.length || !(abs(factor - LINEAR_FACTORS[i]) <= EPS)) { if (i == 0 || !(abs(factor - LINEAR_FACTORS[--i]) <= EPS)) { return (factor == 0 || Double.isNaN(factor)) ? null : Units.METRE.multiply(factor); } } } return LINEAR_UNITS[i]; } PJDatum(Identifier name, final String definition);   PJDatum(final PJDatum projected); @Override String getDefinition(); @Override Identifier getName(); @Override Ellipsoid getEllipsoid(); @Override PrimeMeridian getPrimeMeridian(); @Override Unit<Length> getAxisUnit(); Unit<Length> getLinearUnit(final boolean vertical); @Override Unit<Angle> getAngularUnit(); @Override boolean isIvfDefinitive(); @Override double getInverseFlattening(); @Override boolean isSphere();  }