Examples of ReferenceIdentifier


Examples of org.opengis.referencing.ReferenceIdentifier

            final Set<String> preferredCodespaces, final boolean isBrief)
    {
        values = new ArrayList<Object>(2); // In the vast majority of cases, we will have only one value.
        units  = new ArrayList<Object>(2);
        identifiers = new LinkedHashMap<String,Set<Object>>();
        ReferenceIdentifier name = object.getName();
        if (name != null) { // Paranoiac check.
            final String codespace = name.getCodeSpace();
            if (preferredCodespaces == null || preferredCodespaces.contains(codespace)) {
                addIdentifier(codespace, name.getCode()); // Value needs to be a String here.
                name = null;
            }
        }
        /*
         * For detailed content, add aliases.
         * For brief content, add the first alias if we have not been able to add the name.
         */
        if (!isBrief || identifiers.isEmpty()) {
            final Collection<GenericName> aliases = object.getAlias();
            if (aliases != null) { // Paranoiac check.
                for (GenericName alias : aliases) {
                    String codespace = NameToIdentifier.getCodeSpace(alias, locale);
                    if (codespace != null) {
                        alias = alias.tip();
                    } else {
                        final NameSpace scope = alias.scope();
                        if (scope != null && !scope.isGlobal()) {
                            codespace = NameToIdentifier.toString(scope.name().tip(), locale);
                        }
                    }
                    if (preferredCodespaces == null || preferredCodespaces.contains(codespace)) {
                        addIdentifier(codespace, NameToIdentifier.toString(alias, locale));
                        name = null;
                        if (isBrief) {
                            break;
                        }
                    }
                }
            }
        }
        /*
         * If we found no name and no alias in the codespaces requested by the user,
         * unconditionally add the name regardless its namespace.
         */
        if (name != null) {
            addIdentifier(name.getCodeSpace(), name.getCode()); // Value needs to be a String here.
        }
        /*
         * Add identifiers (detailed mode only).
         */
        if (!isBrief) {
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     * Note: we do not bother checking for {@code NoSuchElementException} because this iterator
     * will be used only by JAXB, which is presumed checking for {@link #hasNext()} correctly.
     */
    @Override
    public ReferenceIdentifier next() {
        final ReferenceIdentifier n = next;
        while (alias.hasNext()) {
            final GenericName c = alias.next();
            if (c instanceof ReferenceIdentifier) {
                next = (ReferenceIdentifier) c;
                return n;
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

    /**
     * Invoked by JAXB at unmarshalling time for setting the identifier.
     */
    private void setIdentifier(final Code identifier) {
        if (identifier != null) {
            final ReferenceIdentifier id = identifier.getIdentifier();
            if (id != null && canSetProperty("identifier", identifiers != null)) {
                identifiers = Collections.singleton(id);
            }
        }
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     * @return The {@code <gml:identifier>} as a {@code Code} instance, or {@code null} if none.
     */
    public static Code forIdentifiedObject(final Class<?> type, final Iterable<? extends ReferenceIdentifier> identifiers) {
        if (identifiers != null) {
            boolean isHTTP = false;
            ReferenceIdentifier fallback = null;
            for (final ReferenceIdentifier identifier : identifiers) {
                final String code = identifier.getCode();
                if (code == null) continue; // Paranoiac check.
                if (code.regionMatches(true, 0, "urn:", 0, 4)) {
                    return new Code(identifier);
                }
                if (!isHTTP) {
                    isHTTP = code.regionMatches(true, 0, "http:", 0, 5);
                    if (isHTTP || fallback == null) {
                        fallback = identifier;
                    }
                }
            }
            /*
             * If no "urn:" or "http:" form has been found, try to create a "urn:" form the first identifier.
             * For example "EPSG:4326" may be converted to "urn:ogc:def:crs:EPSG:8.2:4326". If the first identifier
             * can not be converted to a "urn:" form, then it will be returned as-is.
             */
            if (fallback != null) {
                if (!isHTTP) {
                    final String urn = DefinitionURI.format(toURNType(type), fallback);
                    if (urn != null) {
                        final Code code = new Code();
                        code.codeSpace = Citations.getIdentifier(fallback.getAuthority());
                        code.code = urn;
                        return code;
                    }
                }
                return new Code(fallback);
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

                "  </gmd:code>\n" +
                "  <gmd:codeSpace>\n" +
                "    <gco:CharacterString>L101</gco:CharacterString>\n" +
                "  </gmd:codeSpace>\n" +
                "</gmd:RS_Identifier>";
        final ReferenceIdentifier id = (ReferenceIdentifier) XML.unmarshal(expected);
        assertEquals("codespace", "L101", id.getCodeSpace());
        assertEquals("code", "EPSG:4326", id.getCode());
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     * Returns a hash code value for this object.
     */
    @Override
    public final int hashCode() {
        int code = (int) serialVersionUID;
        final ReferenceIdentifier id = referenceSystemIdentifier;
        if (id != null) {
            code ^= id.hashCode();
        }
        return code;
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     */
    @Override
    public String toString() {
        final String code, codespace;
        final Citation authority;
        final ReferenceIdentifier id = referenceSystemIdentifier;
        if (id != null) {
            code      = id.getCode();
            codespace = id.getCodeSpace();
            authority = id.getAuthority();
        } else {
            code      = null;
            codespace = null;
            authority = null;
        }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

         * @return
         */
        public boolean isParameterSupported(final Identifier name) {
            if (!domainsMap.isEmpty()) {
                for (DomainDescriptor domain : domainsMap.values()) {
                    final ReferenceIdentifier nameLoc = domain.getDomainaParameterDescriptor()
                            .getName();
                    if (nameLoc.equals(name)) {
                        return true;
                    }
                }
            }
            return false;
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

                        if (params != null) {
                                Parameter<?> param;
                                final int length = params.length;
                                for (int i = 0; i < length; i++) {
                                        param = (Parameter) params[i];
                                        final ReferenceIdentifier name=param.getDescriptor().getName();
                                        if (name.equals(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName())) {
                                            gtParams = (GeoToolsWriteParams) param.getValue();
                                            continue;
                                        }
                                        if (name.equals(GeoTiffFormat.WRITE_TFW.getName())){
                                            writeTfw = (Boolean) param.getValue();
                                            continue;
                                        }
                                        if (name.equals(GeoTiffFormat.PROGRESS_LISTENER.getName())) {
                                            listener = (ProgressListener) param.getValue();
                                            continue;
                                        }
                                        if (name.equals(GeoTiffFormat.RETAIN_AXES_ORDER.getName())) {
                                            retainAxesOrder = (Boolean) param.getValue();
                                            continue;
                                        }                                       
                                }
                        }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

        CoverageReadRequest request = new CoverageReadRequest();
        if (params != null) {
            for (GeneralParameterValue gParam : params) {
                if (gParam instanceof ParameterValue<?>) {
                    final ParameterValue<?> param = (ParameterValue<?>) gParam;
                    final ReferenceIdentifier name = param.getDescriptor().getName();
                    try {
                        extractParameter(param, name, request, gridSource);
                    } catch (Exception e) {
                        throw new IOException(e);
                    }
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.