Examples of AxisDirection


Examples of org.opengis.referencing.cs.AxisDirection

        final AxisDirection[] checks = new AxisDirection[axis.length];
        for (int i=0; i<checks.length; i++) {
            checks[i] = userCS.getAxis(i).getDirection().absolute();
        }
next:   for (int i=0; i<axis.length; i++) {
            final AxisDirection direction = axis[i].getDirection().absolute();
            for (int j=0; j<checks.length; j++) {
                final AxisDirection candidate = checks[j];
                if (candidate != null && candidate.equals(direction)) {
                    checks[j] = null// Flags as already compared.
                    continue next;
                }
            }
            return false;
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

        ensureNonNull("abbreviation", abbreviation);
        ensureNonNull("direction",    direction);
        ensureNonNull("unit",         unit);
        if (unit.isCompatible(NonSI.DEGREE_ANGLE)) {
            final UnitConverter fromDegrees = NonSI.DEGREE_ANGLE.getConverterTo(unit);
            final AxisDirection dir = direction.absolute();
            if (dir.equals(AxisDirection.NORTH)) {
                final double range = Math.abs(fromDegrees.convert(90));
                minimum = -range;
                maximum = +range;
                rangeMeaning = RangeMeaning.EXACT; // 90°N do not wraps to 90°S
                return;
            }
            if (dir.equals(AxisDirection.EAST)) {
                final double range = Math.abs(fromDegrees.convert(180));
                minimum = -range;
                maximum = +range;
                rangeMeaning = RangeMeaning.WRAPAROUND; // 180°E wraps to 180°W
                return;
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

     * @throws NoSuchElementException if the given name is not a know axis direction.
     */
    public static AxisDirection getDirection(String direction) throws NoSuchElementException {
        ensureNonNull("direction", direction);
        direction = direction.trim();
        AxisDirection candidate = DirectionAlongMeridian.findDirection(direction);
        if (candidate != null) {
            return candidate;
        }
        /*
         * Some EPSG direction names are of the form "South along 180 deg". We check that the
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

        if (!m.matches()) {
            // Not the expected pattern.
            return null;
        }
        String group = m.group(1);
        final AxisDirection baseDirection = findDirection(BASE_DIRECTIONS, group);
        if (baseDirection == null || !AxisDirection.NORTH.equals(baseDirection.absolute())) {
            // We expected "North" or "South" direction.
            return null;
        }
        group = m.group(2);
        double meridian;
        try {
            meridian = Double.parseDouble(group);
        } catch (NumberFormatException exception) {
            // Not a legal axis direction. Just ignore the exception,
            // since we are supposed to return 'null' in this situation.
            return null;
        }
        if (!(meridian >= -180 && meridian <= 180)) {
            // Meridian is NaN or is not in the valid range.
            return null;
        }
        group = m.group(4);
        if (group != null) {
            final AxisDirection sign = findDirection(BASE_DIRECTIONS, group);
            final AxisDirection abs = sign.absolute();
            if (sign == null || !AxisDirection.EAST.equals(abs)) {
                // We expected "East" or "West" direction.
                return null;
            }
            if (sign != abs) {
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

    /**
     * Searchs for the specified name in the specified set of directions.
     */
    private static AxisDirection findDirection(final AxisDirection[] values, final String direction) {
        for (int i=0; i<values.length; i++) {
            final AxisDirection candidate = values[i];
            final String name = candidate.name();
            if (direction.equalsIgnoreCase(name)) {
                return candidate;
            }
           
            // check for common abbreviations
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

    /**
     * Searchs for the specified name.
     */
    static AxisDirection findDirection(String direction) {
        final AxisDirection[] values = AxisDirection.values();
        AxisDirection candidate = findDirection(values, direction);
        if (candidate == null) {
            String modified = direction.replace('-', '_');
            if (modified != direction) {
                direction = modified;
                candidate = findDirection(values, modified);
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

        }
        buffer.append(" deg");
        if (md != 0 && mi != 180) {
            buffer.append(' ');
            final int base = buffer.length();
            final AxisDirection sign = meridian < 0 ? AxisDirection.WEST : AxisDirection.EAST;
            buffer.append(sign.name());
            toLowerCase(buffer, base);
        }
        final String name = buffer.toString();
        assert EPSG.matcher(name).matches() : name;
        return name;
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

     * Ensures that all axis are perpendicular.
     */
    private void ensurePerpendicularAxis() throws IllegalArgumentException {
        final int dimension = getDimension();
        for (int i=0; i<dimension; i++) {
            final AxisDirection axis0 = getAxis(i).getDirection();
            for (int j=i; ++j<dimension;) {
                final AxisDirection axis1 = getAxis(j).getDirection();
                final double angle = DefaultCoordinateSystemAxis.getAngle(axis0, axis1);
                if (Math.abs(Math.abs(angle) - 90) > DirectionAlongMeridian.EPS) {
                    throw new IllegalArgumentException(Errors.format(
                            ErrorKeys.NON_PERPENDICULAR_AXIS_$2, axis0.name(), axis1.name()));
                }
            }
        }
    }
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

     * Compares with the specified object. See class javadoc
     * for a description of the sorting order.
     */
    public int compareTo(final Object other) {
        final ComparableAxisWrapper that = (ComparableAxisWrapper) other;
        final AxisDirection d1 = this.axis.getDirection();
        final AxisDirection d2 = that.axis.getDirection();
        final int compass = DefaultCoordinateSystemAxis.getCompassAngle(d2, d1);
        if (compass != Integer.MIN_VALUE) {
            return compass;
        }
        if (isCompassDirection(d1)) {
View Full Code Here

Examples of org.opengis.referencing.cs.AxisDirection

     * Update the converters.
     */
    private void update() {
        for (int i=getDimension(); --i>=0;) {
            final CoordinateSystemAxis axis = getAxis(i);
            final AxisDirection   direction = axis.getDirection().absolute();
            final Unit<?>              unit = axis.getUnit();
            if (AxisDirection.EAST.equals(direction)) {
                longitudeAxis      = i;
                longitudeConverter = unit.getConverterTo(NonSI.DEGREE_ANGLE);
                continue;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.