Package org.opengis.referencing.cs

Examples of org.opengis.referencing.cs.CoordinateSystemAxis


        // see section 7.6.2 of the WCS 1.1.1 spec)
        List<Double> lower = bbox.getLowerCorner();
        List<Double> upper = bbox.getUpperCorner();
        for (int i = 0; i < lower.size(); i++) {
            if (lower.get(i) > upper.get(i)) {
                final CoordinateSystemAxis axis = bboxCRs.getCoordinateSystem().getAxis(i);
                // see if the coordinates can be fixed
                if (bboxCRs instanceof GeographicCRS && axis.getDirection() == AxisDirection.EAST) {

                    if (gridEnvelopeBboxCRS != null) {
                        // try to guess which one needs to be fixed
                        final double envMax = gridEnvelopeBboxCRS.getMaximum(i);
                        if (envMax >= lower.get(i))
                            upper.set(i, upper.get(i) + (axis.getMaximumValue() - axis.getMinimumValue()));
                        else
                            lower.set(i, lower.get(i) - (axis.getMaximumValue() - axis.getMinimumValue()));
                           
                    } else {
                        // just fix the upper and hope...
                        upper.set(i, upper.get(i) + (axis.getMaximumValue() - axis.getMinimumValue()));
                    }
                }

                // if even after the fix we're in the wrong situation, complain
                if (lower.get(i) > upper.get(i)) {
View Full Code Here


     * @param  crs The envelope CRS, or {@code null}.
     * @param  dimension The dimension for which to get the axis.
     * @return {@code true} if the range meaning is {@code WRAPAROUND}.
     */
    static boolean isWrapAround(final CoordinateReferenceSystem crs, final int dimension) {
        final CoordinateSystemAxis axis = getAxis(crs, dimension);
        return (axis != null) && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning());
    }
View Full Code Here

     */
    @Override
    public double getMinimum(final int dimension) throws IndexOutOfBoundsException {
        double lower = getLower(dimension);
        if (isNegative(getUpper(dimension) - lower)) { // Special handling for -0.0
            final CoordinateSystemAxis axis = getAxis(getCoordinateReferenceSystem(), dimension);
            lower = (axis != null) ? axis.getMinimumValue() : Double.NEGATIVE_INFINITY;
        }
        return lower;
    }
View Full Code Here

     */
    @Override
    public double getMaximum(final int dimension) throws IndexOutOfBoundsException {
        double upper = getUpper(dimension);
        if (isNegative(upper - getLower(dimension))) { // Special handling for -0.0
            final CoordinateSystemAxis axis = getAxis(getCoordinateReferenceSystem(), dimension);
            upper = (axis != null) ? axis.getMaximumValue() : Double.POSITIVE_INFINITY;
        }
        return upper;
    }
View Full Code Here

     */
    public double getSpan(final int dimension, final Unit<?> unit)
            throws IndexOutOfBoundsException, ConversionException
    {
        double value = getSpan(dimension);
        final CoordinateSystemAxis axis = getAxis(getCoordinateReferenceSystem(), dimension);
        if (axis != null) {
            final Unit<?> source = axis.getUnit();
            if (source != null) {
                value = source.getConverterToAny(unit).convert(value);
            }
        }
        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.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

            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

            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

    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

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.