Examples of CoordinateSystemAxis


Examples of org.opengis.referencing.cs.CoordinateSystemAxis

    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 = (axis != null) ? axis.getMaximumValue() : Double.POSITIVE_INFINITY;
        }
        return upper;
    }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

        if (crs != null) {
            final int dimension = getDimension();
            final CoordinateSystem cs = crs.getCoordinateSystem();
            for (int i=0; i<dimension; i++) {
                double ordinate = getOrdinate(i);
                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 (ordinate < minimum) ordinate = minimum;
                    else if (ordinate > maximum) ordinate = maximum;
                    else continue;
                } else if (RangeMeaning.WRAPAROUND.equals(rm)) {
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

    assert crs != null;
    CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
    Unit<?> unit = CRSUtilities.getUnit(coordinateSystem);
    if (unit == null) {
      CoordinateSystemAxis axis = coordinateSystem.getAxis(0);
      unit = axis.getUnit();
    }
    return unit;
  }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

    public AbstractCS(final Map<String,?> properties, CoordinateSystemAxis... axes) {
        super(properties);
        ensureNonNull("axes", axes);
        this.axes = axes = axes.clone();
        for (int i=0; i<axes.length; i++) {
            final CoordinateSystemAxis axis = axes[i];
            ensureNonNullElement("axes", i, axis);
            final ReferenceIdentifier name = axis.getName();
            ensureNonNullElement("axes[#].name", i, name);
            final AxisDirection direction = axis.getDirection();
            ensureNonNullElement("axes[#].direction", i, direction);
            final Unit<?> unit = axis.getUnit();
            ensureNonNullElement("axes[#].unit", i, unit);
            /*
             * Ensures that axis direction and units are compatible with the
             * coordinate system to be created. For example CartesianCS will
             * accept only linear or dimensionless units.
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

            final int dimension = endIndex() - beginIndex;
            final CoordinateSystem cs = crs.getCoordinateSystem();
            for (int i=0; i<dimension; i++) {
                final int iLower = beginIndex + i;
                final int iUpper = iLower + d;
                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 (ordinates[iLower] < minimum) {ordinates[iLower] = minimum; changed = true;}
                    if (ordinates[iUpper] > maximum) {ordinates[iUpper] = maximum; changed = true;}
                } else if (RangeMeaning.WRAPAROUND.equals(rm)) {
                    final double csSpan = maximum - minimum;
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

            final int iLower = beginIndex + i;
            final int iUpper = iLower + d;
            final double lower = ordinates[iLower];
            final double upper = ordinates[iUpper];
            if (isNegative(upper - lower)) {
                final CoordinateSystemAxis axis = getAxis(crs, i);
                if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) {
                    ordinates[iLower] = axis.getMinimumValue();
                    ordinates[iUpper] = axis.getMaximumValue();
                    changed = true;
                } else {
                    throw new IllegalStateException(Errors.format(Errors.Keys.IllegalOrdinateRange_3,
                            (axis != null) ? axis.getName() : i, lower, upper));
                }
            }
        }
        return changed;
    }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

                       Objects.equals(rangeMeaning, that.rangeMeaning) &&
                       doubleToLongBits(minimumValue) == doubleToLongBits(that.minimumValue) &&
                       doubleToLongBits(maximumValue) == doubleToLongBits(that.maximumValue);
            }
            case BY_CONTRACT: {
                final CoordinateSystemAxis that = (CoordinateSystemAxis) object;
                return equalsIgnoreMetadata(that, true) &&
                       Objects.equals(getAbbreviation(), that.getAbbreviation()) &&
                       Objects.equals(getRangeMeaning(), that.getRangeMeaning());
            }
        }
        /*
         * At this point the comparison is in "ignore metadata" mode. We compare the axis range
         * only if the range meaning is "wraparound" for both axes, because only in such case a
         * coordinate operation may shift some ordinate values (typically ±360° on longitudes).
         */
        final CoordinateSystemAxis that = (CoordinateSystemAxis) object;
        if (!equalsIgnoreMetadata(that, RangeMeaning.WRAPAROUND.equals(this.getRangeMeaning()) &&
                                        RangeMeaning.WRAPAROUND.equals(that.getRangeMeaning())))
        {
            return false;
        }
        ReferenceIdentifier name = that.getName();
        if (name != UNNAMED) {
            /*
             * Checking the abbreviation is not sufficient. For example the polar angle and the
             * spherical latitude have the same abbreviation (θ). Legacy names like "Longitude"
             * (in addition to ISO 19111 "Geodetic longitude") bring more potential confusion.
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

                double min = element.getMinimumValue();
                double max = element.getMaximumValue();
                final VerticalCRS crs = element.getVerticalCRS();
                Unit<?> unit = null;
                if (crs != null) {
                    final CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(0);
                    unit = axis.getUnit();
                    if (AxisDirection.DOWN.equals(axis.getDirection())) {
                        final double tmp = min;
                        min = -max;
                        max = -tmp;
                    }
                }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

     */
    @Test
    public void testShiftLongitudeRange() {
        final DefaultGeographicCRS crs3 = HardCodedCRS.WGS84_3D;
        final DefaultCompoundCRS   crs4 = new DefaultCompoundCRS(singletonMap(NAME_KEY, "4D"), crs3, TIME);
        CoordinateSystemAxis axis = crs4.getCoordinateSystem().getAxis(0);
        assertEquals("longitude.minimumValue", -180.0, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue", +180.0, axis.getMaximumValue(), STRICT);

        assertSame("Expected a no-op.", crs4, crs4.forConvention(AxesConvention.RIGHT_HANDED));
        final DefaultCompoundCRS shifted =   crs4.forConvention(AxesConvention.POSITIVE_RANGE);
        assertNotSame("Expected a new CRS.", crs4, shifted);
        Validators.validate(shifted);

        axis = shifted.getCoordinateSystem().getAxis(0);
        assertEquals("longitude.minimumValue",      0.0, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue",    360.0, axis.getMaximumValue(), STRICT);
        assertSame("Expected a no-op.",         shifted, shifted.forConvention(AxesConvention.POSITIVE_RANGE));
        assertSame("Expected cached instance.", shifted, crs4   .forConvention(AxesConvention.POSITIVE_RANGE));
    }
View Full Code Here

Examples of org.opengis.referencing.cs.CoordinateSystemAxis

     *
     * @param cs The coordinate system to verify.
     */
    public static void assertIsProjected2D(final CartesianCS cs) {
        assertEquals("dimension", 2, cs.getDimension());
        final CoordinateSystemAxis E = cs.getAxis(0);
        final CoordinateSystemAxis N = cs.getAxis(1);
        assertNotNull("axis", E);
        assertNotNull("axis", N);
        assertEquals("axis[0].name",         "Easting",           E.getName().getCode());
        assertEquals("axis[1].name",         "Northing",          N.getName().getCode());
        assertEquals("axis[0].abbreviation", "E",                 E.getAbbreviation());
        assertEquals("axis[1].abbreviation", "N",                 N.getAbbreviation());
        assertEquals("axis[0].direction",    AxisDirection.EAST,  E.getDirection());
        assertEquals("axis[1].direction",    AxisDirection.NORTH, N.getDirection());
        assertEquals("axis[0].unit",         SI.METRE,            E.getUnit());
        assertEquals("axis[1].unit",         SI.METRE,            N.getUnit());
        verifyRange(E, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null, true);
        verifyRange(N, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null, true);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.