Package org.opengis.referencing.cs

Examples of org.opengis.referencing.cs.CoordinateSystem


        final DefaultCompoundCRS   crs4 = new DefaultCompoundCRS(singletonMap(NAME_KEY, "4D"), crs3, TIME);
        Validators.validate(crs4);
        /*
         * Verifies the coordinate system axes.
         */
        final CoordinateSystem cs = crs4.getCoordinateSystem();
        assertInstanceOf("coordinateSystem", DefaultCompoundCS.class, cs);
        assertEquals("dimension", 4, cs.getDimension());
        assertSame(HardCodedAxes.GEODETIC_LONGITUDE,     cs.getAxis(0));
        assertSame(HardCodedAxes.GEODETIC_LATITUDE,      cs.getAxis(1));
        assertSame(HardCodedAxes.GRAVITY_RELATED_HEIGHT, cs.getAxis(2));
        assertSame(HardCodedAxes.TIME,                   cs.getAxis(3));
        /*
         * Verifies the list of components, including after serialization
         * since readObject(ObjectInputStream) is expected to recreate it.
         */
        verifyComponents(crs2, crs3, crs4);
View Full Code Here


     */
    public static void assertIsWGS84(final GeodeticCRS crs, final boolean isExtentMandatory, final boolean isRangeMandatory) {
        assertEquals("name", "WGS 84", crs.getName().getCode());
        assertIsWorld(crs.getDomainOfValidity(), isExtentMandatory);
        assertIsWGS84(crs.getDatum(), isExtentMandatory);
        final CoordinateSystem cs = crs.getCoordinateSystem();
        assertInstanceOf("coordinateSystem", EllipsoidalCS.class, cs);
        assertIsGeodetic2D((EllipsoidalCS) cs, isRangeMandatory);
    }
View Full Code Here

    public boolean normalize() {
        boolean changed = false;
        final CoordinateReferenceSystem crs = getCoordinateReferenceSystem();
        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;
View Full Code Here

             * geographic or geocentric type from the coordinate system. We do this
             * check here for instantiating the most appropriate SIS type.
             */
            final Map<String,?> properties = IdentifiedObjects.getProperties(object);
            final GeodeticDatum datum = ((GeodeticCRS) object).getDatum();
            final CoordinateSystem cs = object.getCoordinateSystem();
            if (cs instanceof EllipsoidalCS) {
                return new DefaultGeographicCRS(properties, datum, (EllipsoidalCS) cs);
            }
            if (cs instanceof SphericalCS) {
                return new DefaultGeocentricCRS(properties, datum, (SphericalCS) cs);
View Full Code Here

                    }
                }
            } while ((a = !a) == allowCreateEllipsoidal);
        }
        if (allowCreateEllipsoidal && crs instanceof GeographicCRS) {
            final CoordinateSystem cs = crs.getCoordinateSystem();
            final int i = AxisDirections.indexOfColinear(cs, AxisDirection.UP);
            if (i >= 0) {
                final CoordinateSystemAxis axis = cs.getAxis(i);
                VerticalCRS c = CommonCRS.Vertical.ELLIPSOIDAL.crs();
                if (!c.getCoordinateSystem().getAxis(0).equals(axis)) {
                    final Map<String,?> properties = IdentifiedObjects.getProperties(c);
                    c = new DefaultVerticalCRS(properties, c.getDatum(), new DefaultVerticalCS(properties, axis));
                }
View Full Code Here

        formatter.newLine();
        formatter.indent(isWKT1 ? 0 : +1);
        formatter.append(toFormattable(datum.getPrimeMeridian()));
        formatter.indent(isWKT1 ? 0 : -1);
        formatter.newLine();
        CoordinateSystem cs = super.getCoordinateSystem();
        if (isWKT1) { // WKT 1 writes unit before axes, while WKT 2 writes them after axes.
            formatter.append(unit);
            if (unit == null) {
                formatter.setInvalidWKT(this, null);
            }
            /*
             * Replaces the given coordinate system by an instance conform to the conventions used in WKT 1.
             * Note that we can not delegate this task to subclasses, because XML unmarshalling of a geodetic
             * CRS will NOT create an instance of a subclass (because the distinction between geographic and
             * geocentric CRS is not anymore in ISO 19111:2007).
             */
            if (!(cs instanceof EllipsoidalCS)) { // Tested first because this is the most common case.
                if (cs instanceof CartesianCS) {
                    cs = Legacy.forGeocentricCRS((CartesianCS) cs, true);
                } else {
                    formatter.setInvalidWKT(cs, null);
                }
            }
        } else {
            formatter.append(toFormattable(cs)); // The concept of CoordinateSystem was not explicit in WKT 1.
            formatter.indent(+1);
        }
        final int dimension = cs.getDimension();
        for (int i=0; i<dimension; i++) {
            formatter.newLine();
            formatter.append(toFormattable(cs.getAxis(i)));
        }
        if (!isWKT1) { // WKT 2 writes unit after axes, while WKT 1 wrote them before axes.
            formatter.newLine();
            formatter.append(unit);
            formatter.indent(-1);
View Full Code Here

     * @param  dimension The dimension for which to get the axis.
     * @return The axis at the given dimension, or {@code null}.
     */
    static CoordinateSystemAxis getAxis(final CoordinateReferenceSystem crs, final int dimension) {
        if (crs != null) {
            final CoordinateSystem cs = crs.getCoordinateSystem();
            if (cs != null) {
                return cs.getAxis(dimension);
            }
        }
        return null;
    }
View Full Code Here

            /*
             * Assign the minimum and maximum ordinate values in the dimension where a wraparound has been found.
             * 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) {
View Full Code Here

     * Returns the coordinate system if it is of the given type, or {@code null} otherwise.
     * This method is invoked by subclasses that can accept more than one CS type.
     */
    @SuppressWarnings("unchecked")
    final <T extends CoordinateSystem> T getCoordinateSystem(final Class<T> type) {
        final CoordinateSystem cs = coordinateSystem;
        if (type.isInstance(cs)) {
            // Special case for AfficeCS: must ensure that the cs is not the CartesianCS subtype.
            if (type != AffineCS.class || !(cs instanceof CartesianCS)) {
                return (T) cs;
            }
View Full Code Here

     * @return {@inheritDoc}
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        final String  keyword = super.formatTo(formatter);
        final CoordinateSystem cs = coordinateSystem;
        final boolean isWKT1  = formatter.getConvention().majorVersion() == 1;
        final Unit<?> unit    = ReferencingUtilities.getUnit(cs);
        final Unit<?> oldUnit = formatter.addContextualUnit(unit);
        formatter.newLine();
        formatter.append(toFormattable(getDatum()));
        formatter.newLine();
        if (isWKT1) { // WKT 1 writes unit before axes, while WKT 2 writes them after axes.
            formatter.append(unit);
            if (unit == null) {
                formatter.setInvalidWKT(this, null);
            }
        } else {
            formatter.append(toFormattable(cs)); // The concept of CoordinateSystem was not explicit in WKT 1.
            formatter.indent(+1);
        }
        final int dimension = cs.getDimension();
        for (int i=0; i<dimension; i++) {
            formatter.newLine();
            formatter.append(toFormattable(cs.getAxis(i)));
        }
        if (!isWKT1) { // WKT 2 writes unit after axes, while WKT 1 wrote them before axes.
            formatter.newLine();
            formatter.append(unit);
            formatter.indent(-1);
View Full Code Here

TOP

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

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.