Package org.opengis.referencing.cs

Examples of org.opengis.referencing.cs.CoordinateSystemAxis


             * The 'for' loop below iterates only over the 'i' values for which the 'isWrapAround' bit is set to 1.
             */
            int mask = 1; // For identifying whether we need to set the lower or the upper ordinate.
            final CoordinateSystem cs = crs.getCoordinateSystem(); // Should not be null at this point.
            for (int i; (i = Long.numberOfTrailingZeros(isWrapAround)) != Long.SIZE; isWrapAround &= ~(1L << i)) {
                final CoordinateSystemAxis axis = cs.getAxis(i);
                final double min = axis.getMinimumValue();
                final double max = axis.getMaximumValue();
                for (int j=0; j<ordinates.length; j++) {
                    c = ordinates[j];
                    if ((j & mask) == 0) {
                        c[i + dimension] = max;
                    } else {
View Full Code Here


     * Tests the {@link DefaultEllipsoidalCS#forConvention(AxesConvention)} method.
     */
    @Test
    public void testShiftLongitudeRange() {
        final DefaultEllipsoidalCS cs = HardCodedCS.GEODETIC_3D;
        CoordinateSystemAxis axis = cs.getAxis(0);
        assertEquals("longitude.minimumValue", -180, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue", +180, axis.getMaximumValue(), STRICT);

        assertSame("Expected a no-op.", cs,  cs.forConvention(AxesConvention.NORMALIZED));
        final DefaultEllipsoidalCS shifted = cs.forConvention(AxesConvention.POSITIVE_RANGE);
        assertNotSame("Expected a new CS.", cs, shifted);
        Validators.validate(shifted);

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

     */
    @Test
    @DependsOnMethod("testShiftLongitudeRange")
    public void testShiftLongitudeRangeGradians() {
        final DefaultEllipsoidalCS cs = HardCodedCS.ELLIPSOIDAL_gon;
        CoordinateSystemAxis axis = cs.getAxis(0);
        assertEquals("longitude.minimumValue", -200, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue", +200, axis.getMaximumValue(), STRICT);

        assertSame("Expected a no-op.", cs,  cs.forConvention(AxesConvention.RIGHT_HANDED));
        final DefaultEllipsoidalCS shifted = cs.forConvention(AxesConvention.POSITIVE_RANGE);
        assertNotSame("Expected a new CS.", cs, shifted);
        Validators.validate(shifted);

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

     * Tests the {@link DefaultEllipsoidalCS#forConvention(AxesConvention)} involving unit conversions.
     */
    @Test
    public void testUnitConversion() {
        final DefaultEllipsoidalCS cs = HardCodedCS.ELLIPSOIDAL_gon;
        CoordinateSystemAxis axis = cs.getAxis(0);
        assertEquals("unit", NonSI.GRADE, axis.getUnit());
        assertEquals("longitude.minimumValue", -200, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue", +200, axis.getMaximumValue(), STRICT);

        final DefaultEllipsoidalCS converted = cs.forConvention(AxesConvention.NORMALIZED);
        assertNotSame("Expected a new CS.", cs, converted);
        Validators.validate(converted);

        axis = converted.getAxis(0);
        assertEquals("unit", NonSI.DEGREE_ANGLE, axis.getUnit());
        assertEquals("longitude.minimumValue", -180, axis.getMinimumValue(), STRICT);
        assertEquals("longitude.maximumValue", +180, axis.getMaximumValue(), STRICT);
    }
View Full Code Here

        GeodeticObjectVerifier.assertIsGeodetic2D(cs, true);
        /*
         * Values in the following tests are specific to our XML file.
         * The actual texts in the EPSG database are more descriptive.
         */
        final CoordinateSystemAxis φ = cs.getAxis(0);
        final CoordinateSystemAxis λ = cs.getAxis(1);
        assertEquals("name",    "Latitude (north), Longitude (east)",     cs.getName().getCode());
        assertEquals("remarks", "Used in two-dimensional GeographicCRS.", cs.getRemarks().toString());
        assertIdentifierEquals(        "identifier", "OGP", "EPSG", null, "6422", getSingleton(cs.getIdentifiers()));
        assertIdentifierEquals("axis[0].identifier", "OGP", "EPSG", null, "106",  getSingleton(φ.getIdentifiers()));
        assertIdentifierEquals("axis[1].identifier", "OGP", "EPSG", null, "107",  getSingleton(λ.getIdentifiers()));
        assertEquals("axis[0].abbreviation", "φ", φ.getAbbreviation());
        assertEquals("axis[1].abbreviation", "λ", λ.getAbbreviation());
        /*
         * Marshal and compare with the original file.
         */
        assertMarshalEqualsFile(XML_FILE, cs, "xmlns:*", "xsi:schemaLocation");
    }
View Full Code Here

        GeodeticObjectVerifier.assertIsProjected2D(cs);
        /*
         * Values in the following tests are specific to our XML file.
         * The actual texts in the EPSG database are more descriptive.
         */
        final CoordinateSystemAxis E = cs.getAxis(0);
        final CoordinateSystemAxis N = cs.getAxis(1);
        assertEquals("name",    "Easting, northing (E,N)", cs.getName().getCode());
        assertEquals("remarks", "Used in ProjectedCRS.", cs.getRemarks().toString());
        assertIdentifierEquals(        "identifier", "OGP", "EPSG", null, "4400", getSingleton(cs.getIdentifiers()));
        assertIdentifierEquals("axis[0].identifier", "OGP", "EPSG", null, "1",    getSingleton(E.getIdentifiers()));
        assertIdentifierEquals("axis[1].identifier", "OGP", "EPSG", null, "2",    getSingleton(N.getIdentifiers()));
        /*
         * Marshal and compare with the original file.
         */
        assertMarshalEqualsFile(XML_FILE, cs, "xmlns:*", "xsi:schemaLocation");
    }
View Full Code Here

     * @since 2.4
     */
    public static void checkCoordinatesRange(Geometry geom, CoordinateReferenceSystem crs)
            throws PointOutsideEnvelopeException {
        // named x,y, but could be anything
        CoordinateSystemAxis x = crs.getCoordinateSystem().getAxis(0);
        CoordinateSystemAxis y = crs.getCoordinateSystem().getAxis(1);

        // check if unbounded, many projected systems are, in this case no check
        // is needed
        boolean xUnbounded = Double.isInfinite(x.getMinimumValue())
                && Double.isInfinite(x.getMaximumValue());
        boolean yUnbounded = Double.isInfinite(y.getMinimumValue())
                && Double.isInfinite(y.getMaximumValue());

        if (xUnbounded && yUnbounded) {
            return;
        }

        // check each coordinate
        Coordinate[] c = geom.getCoordinates();

        for (int i = 0; i < c.length; i++) {
            if (!xUnbounded && ((c[i].x < x.getMinimumValue()) || (c[i].x > x.getMaximumValue()))) {
                throw new PointOutsideEnvelopeException(c[i].x + " outside of ("
                        + x.getMinimumValue() + "," + x.getMaximumValue() + ")");
            }

            if (!yUnbounded && ((c[i].y < y.getMinimumValue()) || (c[i].y > y.getMaximumValue()))) {
                throw new PointOutsideEnvelopeException(c[i].y + " outside of ("
                        + y.getMinimumValue() + "," + y.getMaximumValue() + ")");
            }
        }
    }
View Full Code Here

    }

    private int indexOf(CoordinateReferenceSystem crs, Set<AxisDirection> direction) {
        CoordinateSystem cs = crs.getCoordinateSystem();
        for (int index = 0; index < cs.getDimension(); index++) {
            CoordinateSystemAxis axis = cs.getAxis(index);
            if (direction.contains(axis.getDirection()))
                return index;
        }
        return -1;
    }
View Full Code Here

        sourceCRS = factory.createCoordinateReferenceSystem("EPSG:32661");
        targetCRS = factory.createCoordinateReferenceSystem("4326");
        operation = opf.createOperation(sourceCRS, targetCRS);
        final MathTransform    transform = operation.getMathTransform();
        final CoordinateSystem  sourceCS = sourceCRS.getCoordinateSystem();
        final CoordinateSystemAxis axis0 = sourceCS.getAxis(0);
        final CoordinateSystemAxis axis1 = sourceCS.getAxis(1);
        assertEquals("Northing",                axis0.getName().getCode());
        assertEquals("Easting",                 axis1.getName().getCode());
        assertEquals("South along 180 deg",     axis0.getDirection().name());
        assertEquals("South along 90 deg East", axis1.getDirection().name());
        assertFalse(transform.isIdentity());
        assertTrue(transform instanceof ConcatenatedTransform);
        ConcatenatedTransform ct = (ConcatenatedTransform) transform;
        // An affine transform for swapping axis should be
        // performed before and after the map projection.
View Full Code Here

                    String bbox = null;
                    if (gd.getCoordinateReferenceSystem() != null) {
                        CoordinateReferenceSystem crs = gd.getCoordinateReferenceSystem();
                        CoordinateSystem cs = crs.getCoordinateSystem();
                        if (cs.getDimension() == 2) {
                            CoordinateSystemAxis a0 = cs.getAxis(0);
                            CoordinateSystemAxis a1 = cs.getAxis(1);
                            bbox = "(";
                            bbox += (Double.isInfinite(a0.getMinimumValue()) ?
                                DEFAULT_AXIS_MIN : a0.getMinimumValue()) + ", ";
                            bbox += (Double.isInfinite(a1.getMinimumValue()) ?
                                DEFAULT_AXIS_MIN : a1.getMinimumValue()) + ", ";

                            bbox += (Double.isInfinite(a0.getMaximumValue()) ?
                                DEFAULT_AXIS_MAX : a0.getMaximumValue()) + ", ";
                            bbox += Double.isInfinite(a1.getMaximumValue()) ?
                                DEFAULT_AXIS_MAX : a1.getMaximumValue();
                            bbox += ")";
                        }
                    }
                   
                    if (bbox == null) {
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.