Package org.opengis.util

Examples of org.opengis.util.NoSuchIdentifierException


        final String value;
        final DefinitionURI uri = DefinitionURI.parse(code);
        if (uri != null) {
            final String type = uri.type;
            if (type != null && !type.equalsIgnoreCase("crs")) {
                throw new NoSuchIdentifierException(Errors.format(Errors.Keys.UnknownType_1, type), type);
            }
            authority = uri.authority;
            value = uri.code;
        } else {
            final int s = code.indexOf(DefinitionURI.SEPARATOR);
            authority = CharSequences.trimWhitespaces(code.substring(0, Math.max(0, s)));
            value = CharSequences.trimWhitespaces(code.substring(s + 1));
        }
        if (authority == null || authority.isEmpty()) {
            throw new NoSuchIdentifierException(Errors.format(Errors.Keys.MissingAuthority_1, code), code);
        }
        /*
         * Code below this point is a temporary implementation to
         * be removed after we ported the EPSG authority factory.
         */
        NumberFormatException cause = null;
        try {
            if (authority.equalsIgnoreCase("CRS")) {
                switch (Integer.parseInt(value)) {
                    case 27: return CommonCRS.NAD27.normalizedGeographic();
                    case 83: return CommonCRS.NAD83.normalizedGeographic();
                    case 84: return CommonCRS.WGS84.normalizedGeographic();
                }
            } else if (authority.equalsIgnoreCase("EPSG")) {
                final int n = Integer.parseInt(value);
                if (n != 0) { // CommonCRS uses 0 as a sentinel value for "no EPSG code".
                    for (final CommonCRS candidate : CommonCRS.values()) {
                        if (candidate.geographic == n) return candidate.geographic();
                        if (candidate.geocentric == n) return candidate.geocentric();
                        if (candidate.geo3D      == n) return candidate.geographic3D();
                    }
                    for (final CommonCRS.Vertical candidate : CommonCRS.Vertical.values()) {
                        if (candidate.isEPSG && candidate.crs == n) {
                            return candidate.crs();
                        }
                    }
                }
            } else {
                throw new NoSuchIdentifierException(Errors.format(Errors.Keys.UnknownAuthority_1, authority), authority);
            }
        } catch (NumberFormatException e) {
            cause = e;
        }
        final NoSuchAuthorityCodeException e = new NoSuchAuthorityCodeException(
View Full Code Here

TOP

Related Classes of org.opengis.util.NoSuchIdentifierException

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.