Package org.opengis.referencing.cs

Examples of org.opengis.referencing.cs.CoordinateSystemAxis


     * @param isRangeMandatory {@code true} if the axes range and range meaning properties shall be defined,
     *        or {@code false} if they are optional.
     */
    public static void assertIsGeodetic2D(final EllipsoidalCS cs, final boolean isRangeMandatory) {
        assertEquals("dimension", 2, cs.getDimension());
        final CoordinateSystemAxis latitude  = cs.getAxis(0);
        final CoordinateSystemAxis longitude = cs.getAxis(1);
        assertNotNull("axis", latitude);
        assertNotNull("axis", longitude);
        assertEquals("axis[0].name",      "Geodetic latitude",  latitude .getName().getCode());
        assertEquals("axis[1].name",      "Geodetic longitude", longitude.getName().getCode());
        assertEquals("axis[0].direction", AxisDirection.NORTH,  latitude .getDirection());
        assertEquals("axis[1].direction", AxisDirection.EAST,   longitude.getDirection());
        assertEquals("axis[0].unit",      NonSI.DEGREE_ANGLE,   latitude .getUnit());
        assertEquals("axis[1].unit",      NonSI.DEGREE_ANGLE,   longitude.getUnit());
        verifyRange(latitude,   -90,  +90, RangeMeaning.EXACT, isRangeMandatory);
        verifyRange(longitude, -180, +180, RangeMeaning.WRAPAROUND, isRangeMandatory);
    }
View Full Code Here


        verifyIdentifiers("test2", datum);
        assertEquals("scope", "World", datum.getScope().toString());
        assertEquals("vertDatumType", VerticalDatumType.DEPTH, datum.getVerticalDatumType()); // Inferred from the name.
        final VerticalCS cs = crs.getCoordinateSystem();
        verifyIdentifiers("test3", cs);
        final CoordinateSystemAxis axis = cs.getAxis(0);
        verifyIdentifiers("test4", axis);
        assertEquals("axisAbbrev", "d", axis.getAbbreviation());
        assertEquals("axisDirection", AxisDirection.DOWN, axis.getDirection());
        /*
         *     …
         *   </gmd:MD_DataIdentification>
         * </gmd:identificationInfo>
         *
 
View Full Code Here

     * of test failure, both classes could be at fault.
     */
    @Test
    public void testCreateAxis() {
        for (final short code : new short[] {106, 107, 110, 114, 113}) {
            final CoordinateSystemAxis actual = StandardDefinitions.createAxis(code);
            Validators.validate(actual);
            switch (code) {
                case 106: compare(HardCodedAxes.GEODETIC_LATITUDE,      actual); break;
                case 107: compare(HardCodedAxes.GEODETIC_LONGITUDE,     actual); break;
                case 110: compare(HardCodedAxes.ELLIPSOIDAL_HEIGHT,     actual); break;
View Full Code Here

     * for {@link AxesConvention#POSITIVE_RANGE}.
     */
    @Test
    public void testShiftLongitudeRange() {
        final DefaultGeographicCRS crs = HardCodedCRS.WGS84_3D;
        CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(0);
        assertEquals("longitude.minimumValue", -180.0, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue", +180.0, axis.getMaximumValue(), STRICT);

        assertSame("Expected a no-op.", crs,  crs.forConvention(AxesConvention.RIGHT_HANDED));
        final DefaultGeographicCRS shifted =  crs.forConvention(AxesConvention.POSITIVE_RANGE);
        assertNotSame("Expected a new CRS.", crs, 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, crs    .forConvention(AxesConvention.POSITIVE_RANGE));
    }
View Full Code Here

            case 0:  value=x; span=width;  break;
            case 1:  value=y; span=height; break;
            default: throw indexOutOfBounds(dimension);
        }
        if (isNegative(span)) { // Special handling for -0.0
            final CoordinateSystemAxis axis = getAxis(crs, dimension);
            return (axis != null) ? axis.getMinimumValue() : NEGATIVE_INFINITY;
        }
        return value;
    }
View Full Code Here

            case 0:  value=x; span=width;  break;
            case 1:  value=y; span=height; break;
            default: throw indexOutOfBounds(dimension);
        }
        if (isNegative(span)) { // Special handling for -0.0
            final CoordinateSystemAxis axis = getAxis(crs, dimension);
            return (axis != null) ? axis.getMaximumValue() : POSITIVE_INFINITY;
        }
        return value + span;
    }
View Full Code Here

             *          ↓   ↓
             *    ──────┐   ┌───────
             *    …next │   │ start…
             *    ──────┘   └───────
             */
            final CoordinateSystemAxis axis = getAxis(crs, 0);
            final Rectangle2D.Double start = rect[0];
            final Rectangle2D.Double next  = rect[1];
            start.width = axis.getMaximumValue() - x;
            next.x      = axis.getMinimumValue();
            next.width += x - next.x;
        }
        if ((isWrapAround & 2) != 0) {
            /*
             *              │   ⋮   │
             *              │ start │
             * (y)        → └───────┘
             * (y+height) → ┌───────┐
             *              │ next  │
             *              │   ⋮   │
             */
            final CoordinateSystemAxis axis = getAxis(crs, 1);
            final Rectangle2D.Double start = rect[0];
            final Rectangle2D.Double next  = rect[isWrapAround - 1]; // == 1 if y is the only wraparound axis, or 2 otherwise.
            start.height = axis.getMaximumValue() - y;
            next.y       = axis.getMinimumValue();
            next.height += y - next.y;
        }
        if (isWrapAround == 3) {
            /*
             * If there is a wraparound along both axes, copy the values.
View Full Code Here

            case 6423: name = "Ellipsoidal 3D"; dim = 3; axisCode = 111; break;
            case 6500: name = "Earth centred";  dim = 3; axisCode = 118; isCartesian = true; break;
            default:   throw new AssertionError(code);
        }
        final Map<String,?> properties = properties(code, name, null, false);
        CoordinateSystemAxis xAxis = null, yAxis = null, zAxis = null;
        switch (dim) {
            default: throw new AssertionError(dim);
            case 3:  zAxis = createAxis(--axisCode);
            case 2:  yAxis = createAxis(--axisCode);
            case 1:  xAxis = createAxis(--axisCode);
View Full Code Here

    public double getMinimum(final int dimension) throws IndexOutOfBoundsException {
        ensureValidIndex(endIndex(), dimension);
        final int i = dimension + beginIndex();
        double lower = ordinates[i];
        if (isNegative(ordinates[i + (ordinates.length >>> 1)] - lower)) { // Special handling for -0.0
            final CoordinateSystemAxis axis = getAxis(crs, dimension);
            lower = (axis != null) ? axis.getMinimumValue() : Double.NEGATIVE_INFINITY;
        }
        return lower;
    }
View Full Code Here

    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

TOP

Related Classes of org.opengis.referencing.cs.CoordinateSystemAxis

Copyright © 2018 www.massapicom. 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.