Package org.opengis.metadata

Examples of org.opengis.metadata.Identifier


         *           PROJCS["NAD27 / Idaho Central",
         *             GEOGCS[...etc...],
         *             ...etc...
         *             AUTHORITY["EPSG","26769"]]
         */
        final Identifier identifier = getIdentifier(info);
        if (identifier!=null && authorityAllowed(info)) {
            final Citation authority = identifier.getAuthority();
            if (authority != null) {
                /*
                 * Since WKT often use abbreviations, search for the shortest
                 * title or alternate title. If one is found, it will be used
                 * as the authority name (e.g. "EPSG").
                 */
                InternationalString inter = authority.getTitle();
                String title = (inter!=null) ? inter.toString(symbols.locale) : null;
                for (final InternationalString alt : authority.getAlternateTitles()) {
                    if (alt != null) {
                        final String candidate = alt.toString(symbols.locale);
                        if (candidate != null) {
                            if (title==null || candidate.length() < title.length()) {
                                title = candidate;
                            }
                        }
                    }
                }
                if (title != null) {
                    appendSeparator(lineChanged);
                    buffer.append("AUTHORITY")
                          .append(symbols.open)
                          .append(symbols.quote)
                          .append(title)
                          .append(symbols.quote);
                    final String code = identifier.getCode();
                    if (code != null) {
                        buffer.append(symbols.separator)
                              .append(symbols.quote)
                              .append(code)
                              .append(symbols.quote);
View Full Code Here


     * @return The preferred identifier, or {@code null} if none.
     *
     * @since 2.3
     */
    public Identifier getIdentifier(final IdentifiedObject info) {
        Identifier first = null;
        if (info != null) {
            final Collection<? extends Identifier> identifiers = info.getIdentifiers();
            if (identifiers != null) {
                for (final Identifier id : identifiers) {
                    if (authorityMatches(id.getAuthority())) {
View Full Code Here

     *
     * @param  info The object to looks for a preferred name.
     * @return The preferred name.
     */
    public String getName(final IdentifiedObject info) {
        final Identifier name = info.getName();
        if (!authorityMatches(name.getAuthority())) {
            final Collection<GenericName> aliases = info.getAlias();
            if (aliases != null) {
                /*
                 * The main name doesn't matches. Search in alias. We will first
                 * check if alias implements Identifier (this is the case of
                 * Geotools implementation). Otherwise, we will look at the
                 * scope in generic name.
                 */
                for (final GenericName alias : aliases) {
                    if (alias instanceof Identifier) {
                        final Identifier candidate = (Identifier) alias;
                        if (authorityMatches(candidate.getAuthority())) {
                            return candidate.getCode();
                        }
                    }
                }
                // The "null" locale argument is required for getting the unlocalized version.
                final String title = authority.getTitle().toString(null);
View Full Code Here

     * returns the code of the first {@linkplain IdentifiedObject#getIdentifiers identifier},
     * if any, or the code of the{@linkplain IdentifiedObject#getName primary name} otherwise.
     * Subclasses may overrides this method if they want to use a different key for this set.
     */
    protected String getAuthorityCode(final IdentifiedObject object) {
        final Identifier id;
        final Set identifiers = object.getIdentifiers();
        if (identifiers!=null && !identifiers.isEmpty()) {
            id = (Identifier) identifiers.iterator().next();
        } else {
            id = object.getName();
        }
        return id.getCode();
    }
View Full Code Here

     */
    final IdentifiedObject createFromIdentifiers(final IdentifiedObject object) throws FactoryException {
        final Citation authority = getProxy().getAuthorityFactory().getAuthority();
        final boolean isAll = ReferencingFactory.ALL.equals(authority);
        for (final Iterator it=object.getIdentifiers().iterator(); it.hasNext();) {
            final Identifier id = (Identifier) it.next();
            if (!isAll && !Citations.identifierMatches(authority, id.getAuthority())) {
                // The identifier is not for this authority. Looks the other ones.
                continue;
            }
            IdentifiedObject candidate;
            try {
                candidate = getProxy().create(id.getCode());
            } catch (NoSuchAuthorityCodeException e) {
                // The identifier was not recognized. No problem, let's go on.
                continue;
            }
            candidate = deriveEquivalent(candidate, object);
View Full Code Here

     * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
     * @throws FactoryException if the query failed for some other reason.
     */
    public InternationalString getDescriptionText(final String code) throws FactoryException {
        IdentifiedObject identifiedObject = createObject(code);
                final Identifier identifier = identifiedObject.getName();
        if (identifier instanceof GenericName) {
            return ((GenericName) identifier).toInternationalString();
        }
        return new SimpleInternationalString(identifier.getCode());
    }
View Full Code Here

     * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found.
     * @throws FactoryException if the query failed for some other reason.
     */
    public InternationalString getDescriptionText(final String code) throws FactoryException {
        IdentifiedObject identifiedObject = createObject(code);
    final Identifier identifier = identifiedObject.getName();
        if (identifier instanceof GenericName) {
            return ((GenericName) identifier).toInternationalString();
        }
        return new SimpleInternationalString( identifier.getCode() );
    }
View Full Code Here

                    where      = "ELLIPSOID_CODE";
                } else {
                    return super.getCodeCandidates(object);
                }
                dependency = getIdentifiedObjectFinder(dependency.getClass()).find(dependency);
                Identifier id = AbstractIdentifiedObject.getIdentifier(dependency, getAuthority());
                if (id == null || (code = id.getCode()) == null) {
                    return super.getCodeCandidates(object);
                }
            }
            String sql = "SELECT " + select + " FROM " + from + " WHERE " + where + "='" + code + '\'';
            sql = adaptSQL(sql);
View Full Code Here

        }
      }
     
      Iterator iter = crs.getIdentifiers().iterator();
      while (iter.hasNext()) {
        Identifier ident = (Identifier) iter.next();
        String epsgCode = ident.toString();
        if (codes.contains(epsgCode)) {
          if (crsCache.get(crs) == null) {
            crsCache.put(crs, new TreeSet());
          }
          TreeSet set = (TreeSet) crsCache.get(crs);
View Full Code Here

            node.putInt(LAST_ID, lastID);
            newWKT = processingWKT(text, lastID);
        } else {
            Set<ReferenceIdentifier> ids = createdCRS.getIdentifiers();
            if (!ids.isEmpty()) {
                Identifier id = ids.iterator().next();
                code = id.toString();
                name = createdCRS.getName().getCode() + " (" + code + ")"; //$NON-NLS-1$ //$NON-NLS-2$
            } else {
                name = code = createdCRS.getName().getCode();
            }
View Full Code Here

TOP

Related Classes of org.opengis.metadata.Identifier

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.