Double.isInfinite(x.getMinimumValue()) && Double.isInfinite(x.getMaximumValue()); boolean yUnbounded = Double.isInfinite(y.getMinimumValue()) && Double.isInfinite(y.getMaximumValue()); if (!xUnbounded && ((c[i].x < x.getMinimumValue()) || (c[i].x > x.getMaximumValue()))) { throw new PointOutsideEnvelopeException( c[i].x + x.getMinimumValue() + "," + x.getMaximumValue() + ")"); if (!yUnbounded && ((c[i].y < y.getMinimumValue()) || (c[i].y > y.getMaximumValue()))) { throw new PointOutsideEnvelopeException( c[i].y + y.getMinimumValue() + "," + y.getMaximumValue() + ")");
(Double.isInfinite(a0.getMaximumValue()) ? DEFAULT_AXIS_MAX : a0.getMaximumValue()) + ", "; bbox += Double.isInfinite(a1.getMaximumValue()) ? DEFAULT_AXIS_MAX : a1.getMaximumValue(); bbox += ")";
/** * Constructs a new coordinate system axis with the same values than the specified one. This * copy constructor provides a way to wrap an arbitrary implementation into a Geotools one or a * user-defined one (as a subclass), usually in order to leverage some implementation-specific * API. This constructor performs a shallow copy, i.e. the properties are not cloned. * * @param axis The coordinate system axis to copy. * @since 2.2 */ public DefaultCoordinateSystemAxis(final CoordinateSystemAxis axis) { super(axis); abbreviation = axis.getAbbreviation(); direction = axis.getDirection(); unit = axis.getUnit(); minimum = axis.getMinimumValue(); maximum = axis.getMaximumValue(); rangeMeaning = axis.getRangeMeaning(); }
: axis.getMinimumValue(); max[i] = Double.isInfinite(axis.getMaximumValue()) ? DEFAULT_AXIS_MAX : axis.getMaximumValue(); if (max[i] - min[i] < extent) extent = max[i] - min[i]; } else {
double upAxisMax = upAxis.getMaximumValue();
private static double getValue( final BitSet set, final CoordinateSystemAxis axis, final int dimension) { return (set.get(dimension)) ? axis.getMaximumValue() : axis.getMinimumValue(); }
final CoordinateSystemAxis axis = cs.getAxis(i); final double minimum = axis.getMinimumValue(); final double maximum = axis.getMaximumValue(); final RangeMeaning rm = axis.getRangeMeaning(); if (RangeMeaning.EXACT.equals(rm)) {
/** * If the range meaning of the given axis is "wraparound", returns the spanning of that axis. * Otherwise returns {@link Double#NaN}. * * @param axis the axis for which to get the spanning. * @return the spanning of the given axis. */ static double getSpan(final CoordinateSystemAxis axis) { if (isWrapAround(axis)) { return axis.getMaximumValue() - axis.getMinimumValue(); } return Double.NaN; }
/** * If the range meaning of the given axis is "wraparound", returns the spanning of that axis. * Otherwise returns {@link Double#NaN}. * * @param axis the axis for which to get the spanning. * @return the spanning of the given axis. */ static double getSpan(final CoordinateSystemAxis axis) { if (isWrapAround(axis)) { return axis.getMaximumValue() - axis.getMinimumValue(); } return Double.NaN; }
private static boolean isUnbounded(final CoordinateSystemAxis csa) { final double min = csa.getMinimumValue(); final double max = csa.getMaximumValue(); if (!Double.isFinite(max) || !Double.isFinite(min)) { return true; } return false; }
/** * Compares the unit and direction of this axis with the ones of the given axis. * The range minimum and maximum values are compared only if {@code cr} is {@code true}, * i.e. it is caller responsibility to determine if range shall be considered as metadata. * * @param that the axis to compare with this axis. * @param mode whether the unit comparison is approximative or exact. * @param cr {@code true} for comparing also the range minimum and maximum values. * @return {@code true} if unit, direction and optionally range extremum are equal. */ private boolean equalsIgnoreMetadata(final CoordinateSystemAxis that, final ComparisonMode mode, final boolean cr) { return Objects.equals(getDirection(), that.getDirection()) && Utilities.deepEquals(getUnit(), that.getUnit(), mode) && (!cr || (doubleToLongBits(getMinimumValue()) == doubleToLongBits(that.getMinimumValue()) && doubleToLongBits(getMaximumValue()) == doubleToLongBits(that.getMaximumValue()))); }
/** * Validates the given axis. * * @param object The object to validate, or {@code null}. * * @todo Add checks for abbreviations and names standardized by ISO 19111. */ public void validate(final CoordinateSystemAxis object) { if (object == null) { return; } validateIdentifiedObject(object); assertValidRange("CoordinateSystemAxis: expected maximum >= minimum.", object.getMinimumValue(), object.getMaximumValue()); }
/** * Compares the unit and direction of this axis with the ones of the given axis. * The range minimum and maximum values are compared only if {@code cr} is {@code true}, * i.e. it is caller responsibility to determine if range shall be considered as metadata. * * @param that the axis to compare with this axis. * @param mode whether the unit comparison is an approximation or exact. * @param cr {@code true} for comparing also the range minimum and maximum values. * @return {@code true} if unit, direction and optionally range extremum are equal. */ private boolean equalsIgnoreMetadata(final CoordinateSystemAxis that, final ComparisonMode mode, final boolean cr) { return Objects.equals(getDirection(), that.getDirection()) && Utilities.deepEquals(getUnit(), that.getUnit(), mode) && (!cr || (doubleToLongBits(getMinimumValue()) == doubleToLongBits(that.getMinimumValue()) && doubleToLongBits(getMaximumValue()) == doubleToLongBits(that.getMaximumValue()))); }
/** * Creates a rectangle for the given CRS and coordinate values. */ @Override Rectangle2D createFromExtremums(CoordinateReferenceSystem crs, double xmin, double ymin, double xmax, double ymax) { if (xmin > xmax) { // This implementation does not support spanning anti-meridian. final CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(0); xmin = axis.getMinimumValue(); xmax = axis.getMaximumValue(); } return new Rectangle2D.Double(xmin, ymin, xmax - xmin, ymax - ymin); }
/** * {@inheritDoc} */ @Override public double getMaximum(final int dimension) throws IndexOutOfBoundsException { ensureValidIndex(endIndex(), dimension); final int i = dimension + beginIndex(); double upper = ordinates[i + (ordinates.length >>> 1)]; if (isNegative(upper - ordinates[i])) { // Special handling for -0.0 final CoordinateSystemAxis axis = getAxis(crs, dimension); upper = isWrapAround(axis) ? axis.getMaximumValue() : Double.NaN; } return upper; }
/** * Creates an axis identical to the given one with an EPSG code added. * This is a helper method for {@link #testIdentifierRemoval()}. */ private static CoordinateSystemAxis addIdentifier(final CoordinateSystemAxis axis, final short epsg) { final Map<String,Object> properties = new HashMap<>(8); properties.putAll(IdentifiedObjects.getProperties(axis)); properties.put(DefaultCoordinateSystemAxis.IDENTIFIERS_KEY, new ImmutableIdentifier(null, "EPSG", String.valueOf(epsg))); properties.put(DefaultCoordinateSystemAxis.MINIMUM_VALUE_KEY, axis.getMinimumValue()); properties.put(DefaultCoordinateSystemAxis.MAXIMUM_VALUE_KEY, axis.getMaximumValue()); properties.put(DefaultCoordinateSystemAxis.RANGE_MEANING_KEY, axis.getRangeMeaning()); return new DefaultCoordinateSystemAxis(properties, axis.getAbbreviation(), axis.getDirection(), axis.getUnit()); }
/** * {@inheritDoc} */ @Override public double getMaximum(final int dimension) throws IndexOutOfBoundsException { ensureValidIndex(endIndex(), dimension); final int i = dimension + beginIndex(); double upper = ordinates[i + (ordinates.length >>> 1)]; if (isNegative(upper - ordinates[i])) { // Special handling for -0.0 final CoordinateSystemAxis axis = getAxis(crs, dimension); upper = isWrapAround(axis) ? axis.getMaximumValue() : Double.NaN; } return upper; }
final double max = envelope.getMaximum(i); final double v1 = axis.getMinimumValue(); final double v2 = axis.getMaximumValue(); final boolean b1 = (v1 > min && v1 < max); final boolean b2 = (v2 > min && v2 < max); final double extremum = testMax ? axis.getMaximumValue() : axis.getMinimumValue(); if (Double.isInfinite(extremum) || Double.isNaN(extremum)) {
/** * Test if the WKT string is recognized and decoded properly * @throws Exception if the test fails */ @Test public void testWksString() throws Exception { String wkt = DefaultGeographicCRS.WGS84.toWKT(); assertEquals(true, WKTCRSDecoder.isWKT(wkt)); CoordinateReferenceSystem c = WKTCRSDecoder.decode(wkt); assertEquals(180, (int)c.getCoordinateSystem().getAxis(0).getMaximumValue()); assertEquals(90, (int)c.getCoordinateSystem().getAxis(1).getMaximumValue()); } }
/** * Compares only the properties which are known to be defined in {@link StandardDefinitions}. */ private static void compare(final CoordinateSystemAxis expected, final CoordinateSystemAxis actual) { assertEquals("name", expected.getName().getCode(), actual.getName().getCode()); assertEquals("abbreviation", expected.getAbbreviation(), actual.getAbbreviation()); assertEquals("unit", expected.getUnit(), actual.getUnit()); assertEquals("direction", expected.getDirection(), actual.getDirection()); assertEquals("minimumValue", expected.getMinimumValue(), actual.getMinimumValue(), STRICT); assertEquals("maximumValue", expected.getMaximumValue(), actual.getMaximumValue(), STRICT); assertEquals("rangeMeaning", expected.getRangeMeaning(), actual.getRangeMeaning()); }