Package org.opengis.referencing.cs

Examples of org.opengis.referencing.cs.CoordinateSystem


            upper = upper + geometry.getGridRange().getHigh(i) + " ";
        }
        writer.write("<grid dimension = \"" + dimensions + "\">\n");
        writer.write("<low>" + lower + "</low>\n");
        writer.write("<high>" + upper + "</high>\n");
        final CoordinateSystem cs = crs.getCoordinateSystem();
        for (int i=0; i < cs.getDimension(); i++) {
            writer.write("<axisName>" + cs.getAxis(i).getName().getCode() + "</axisName>\n");
        }
        if(geometry.getGridToCRS() instanceof AffineTransform) {
            AffineTransform aTX = (AffineTransform) geometry.getGridToCRS();
            writer.write("<geoTransform>");
                writer.write("<scaleX>" + aTX.getScaleX() + "</scaleX>\n");
View Full Code Here


     */
    public static void ensureDimensionMatches(final String name, final int expected,
            final CoordinateReferenceSystem crs) throws MismatchedDimensionException
    {
        if (crs != null) {
            final CoordinateSystem cs = crs.getCoordinateSystem();
            if (cs != null) { // Should never be null, but let be safe.
                final int dimension = cs.getDimension();
                if (dimension != expected) {
                    throw new MismatchedDimensionException(Errors.format(
                            Errors.Keys.MismatchedDimension_3, name, expected, dimension));
                }
            }
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

        boolean changed = false;
        if (crs != null) {
            final int d = ordinates.length >>> 1;
            final int beginIndex = beginIndex();
            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;}
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

   * @return a representative unit of the given crs.
   */
  public static Unit<?> getDefaultCRSUnit(CoordinateReferenceSystem crs) {

    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

            case STRICT: {
                // No need to check the class - this check has been done by super.equals(…).
                return Arrays.equals(axes, ((AbstractCS) object).axes);
            }
            default: {
                final CoordinateSystem that = (CoordinateSystem) object;
                final int dimension = getDimension();
                if (dimension != that.getDimension()) {
                    return false;
                }
                for (int i=0; i<dimension; i++) {
                    if (!deepEquals(getAxis(i), that.getAxis(i), mode)) {
                        return false;
                    }
                }
                return true;
            }
View Full Code Here

        boolean changed = false;
        if (crs != null) {
            final int d = ordinates.length >>> 1;
            final int beginIndex = beginIndex();
            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;}
View Full Code Here

        final GeographicCRS geographic = CommonCRS.WGS84.geographic();
        final GeographicCRS normalized = CommonCRS.WGS84.normalizedGeographic();
        Validators.validate(normalized);
        assertSame(geographic.getDatum(), normalized.getDatum());

        final CoordinateSystem φλ = geographic.getCoordinateSystem();
        final CoordinateSystem λφ = normalized.getCoordinateSystem();
        assertSame("Longitude", φλ.getAxis(1), λφ.getAxis(0));
        assertSame("Latitude",  φλ.getAxis(0), λφ.getAxis(1));
        assertSame("Cached value", normalized, CommonCRS.WGS84.normalizedGeographic());
    }
View Full Code Here

        Validators.validate(crs);
        assertEquals("WGS 72", crs.getName().getCode());
        assertSame   (CommonCRS.WGS72.geographic().getDatum(), crs.getDatum());
        assertNotSame(CommonCRS.WGS84.geographic().getDatum(), crs.getDatum());

        final CoordinateSystem cs = crs.getCoordinateSystem();
        final String name = cs.getName().getCode();
        assertTrue(name, name.startsWith("Earth centred"));
        assertEquals("dimension", 3, cs.getDimension());
        assertEquals(AxisDirection.GEOCENTRIC_X, cs.getAxis(0).getDirection());
        assertEquals(AxisDirection.GEOCENTRIC_Y, cs.getAxis(1).getDirection());
        assertEquals(AxisDirection.GEOCENTRIC_Z, cs.getAxis(2).getDirection());
        assertSame("Cached value", crs, CommonCRS.WGS72.geocentric());
    }
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.