Package org.opengis.metadata.citation

Examples of org.opengis.metadata.citation.Citation


         *             ...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;
View Full Code Here


                    case 2:  factories = getDatumAuthorityFactories(hints);               break;
                    case 3:  factories = getCoordinateOperationAuthorityFactories(hints); break;
                    default: break loop;
                }
                for (final AuthorityFactory factory : factories) {
                    final Citation authority = factory.getAuthority();
                    if (authority != null) {
                        authorityNames.add(Citations.getIdentifier(authority));
                        for (final Identifier id : authority.getIdentifiers()) {
                            authorityNames.add(id.getCode());
                        }
                    }
                }
            }
View Full Code Here

    }
    /**
     * Returns the identifier for the specified object.
     */
    final String getIdentifier(final IdentifiedObject object) {
        Citation authority = getAuthority();
        if (ReferencingFactory.ALL.equals(authority)) {
            /*
             * "All" is a pseudo-authority declared by AllAuthoritiesFactory. This is not a real
             * authority, so we will not find any identifier if we search for this authority. We
             * will rather pickup the first identifier, regardless its authority.
View Full Code Here

     * @see #createFromCodes
     * @see #createFromNames
     * @throws FactoryException if an error occured while creating an object.
     */
    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.
View Full Code Here

            /*
             * Check if the authority has already been meet previously. If the authority is found
             * then 'authorityIndex' is set to its index. Otherwise the new authority is added to
             * the 'authorities' list.
             */
            Citation authority = factory.getAuthority();
            int authorityIndex;
            for (authorityIndex=0; authorityIndex<authorityCount; authorityIndex++) {
                final Citation candidate = authorities[authorityIndex];
                if (Citations.identifierMatches(candidate, authority)) {
                    authority = candidate;
                    break;
                }
            }
View Full Code Here

        } catch (FactoryException exception) {
            /*
             * The factory creation failed for an other reason, which may be more
             * serious. Now it is time to log a warning with a stack trace.
             */
            final Citation   citation = getAuthority();
            final Collection   titles = citation.getAlternateTitles();
            InternationalString title = citation.getTitle();
            if (titles != null) {
                for (final Iterator it=titles.iterator(); it.hasNext();) {
                    /*
                     * Uses the longuest title instead of the main one. In Geotools
                     * implementation, the alternate title may contains usefull informations
View Full Code Here

        } catch (FactoryException exception) {
            /*
             * The factory creation failed for an other reason, which may be more
             * serious. Now it is time to log a warning with a stack trace.
             */
            final Citation citation = getAuthority();
            final Collection<? extends InternationalString> titles = citation.getAlternateTitles();
            InternationalString title = citation.getTitle();
            if (titles != null) {
                for (final InternationalString candidate : titles) {
                    /*
                     * Uses the longuest title instead of the main one. In Geotools
                     * implementation, the alternate title may contains usefull informations
View Full Code Here

     * Tests the shallow equals and copy methods.
     */
    @Test
    public void testEquals() {
        final MetadataStandard std = MetadataStandard.ISO_19115;
        Citation citation = Citations.EPSG;
        assertFalse(std.shallowEquals(citation, Citations.GEOTIFF, true ));
        assertFalse(std.shallowEquals(citation, Citations.GEOTIFF, false));
        assertTrue (std.shallowEquals(citation, Citations.EPSG,    false));

        citation = new CitationImpl();
View Full Code Here

    /**
     * Tests the {@link PropertyMap} implementation.
     */
    @Test
    public void testMap() {
        final Citation citation = new CitationImpl(Citations.EPSG);
        final Map<String,Object> map = MetadataStandard.ISO_19115.asMap(citation);
        assertFalse(map.isEmpty());
        assertTrue (map.size() > 1);

        final Set<String> keys = map.keySet();
        assertTrue ("Property exists and should be defined.",            keys.contains("title"));
        assertFalse("Property exists but undefined for Citations.EPSG.", keys.contains("ISBN"));
        assertFalse("Property do not exists.",                           keys.contains("dummy"));

        final String s = keys.toString();
        assertTrue (s.indexOf("title")       >= 0);
        assertTrue (s.indexOf("identifiers") >= 0);
        assertFalse(s.indexOf("ISBN")        >= 0);

        final Object identifiers = map.get("identifiers");
        assertTrue(identifiers instanceof Collection);
        assertTrue(PropertyAccessorTest.containsEPSG(identifiers));

        final Map<String,Object> copy = new HashMap<String,Object>(map);
        assertEquals(map, copy);

        // Note: AbstractCollection do not defines hashCode(); we have to wraps in a HashSet.
        final int hashCode = citation.hashCode();
        assertEquals("hashCode() should be as in a Set.", hashCode, new HashSet<Object>(map .values()).hashCode());
        assertEquals("hashCode() should be as in a Set.", hashCode, new HashSet<Object>(copy.values()).hashCode());

        map.remove("identifiers");
        final int newHashCode = citation.hashCode();
        assertFalse(map.equals(copy));
        assertFalse(hashCode == newHashCode);
        assertEquals(newHashCode, new HashSet<Object>(map.values()).hashCode());
    }
View Full Code Here

    /**
     * Tests the constructor.
     */
    @Test
    public void testConstructor() {
        final Citation citation = Citations.EPSG;
        PropertyAccessor accessor;
        assertNull("No dummy interface expected.",
                PropertyAccessor.getType(citation.getClass(), "org.opengis.dummy"));
        accessor = createPropertyAccessor(citation);
        assertTrue("Count of 'get' methods.", accessor.count() >= 13);
    }
View Full Code Here

TOP

Related Classes of org.opengis.metadata.citation.Citation

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.