Examples of ReferenceIdentifier


Examples of org.opengis.referencing.ReferenceIdentifier

     * insert between {@code "epsg-"} and the code.
     */
    @Test
    @DependsOnMethod("testWithManyIdentifiers")
    public void testAsSubtype() {
        final ReferenceIdentifier      identifier  = new NamedIdentifier(EPSG, "7019");
        final Set<ReferenceIdentifier> identifiers = Collections.singleton(identifier);
        final AbstractIdentifiedObject object      = new AbstractDatum(properties(identifiers));
        final ReferenceIdentifier      gmlId       = validate(object, identifiers, "epsg-datum-7019");
        assertNotNull("gmlId",                   gmlId);
        assertEquals ("gmlId.codespace", "EPSG", gmlId.getCodeSpace());
        assertEquals ("gmlId.code",      "7019", gmlId.getCode());
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     * with codespace.
     */
    @Test
    public void testIdentifiers() {
        // Expected values to be used later in the test.
        final ReferenceIdentifier id1 = new ImmutableIdentifier(OGP,     "EPSG",    "9804");
        final ReferenceIdentifier id2 = new ImmutableIdentifier(GEOTIFF, "GeoTIFF", "7");
        assertEquals("EPSG:9804", IdentifiedObjects.toString(id1));
        assertEquals("GeoTIFF:7", IdentifiedObjects.toString(id2));

        // The test.
        final BuilderMock builder = new BuilderMock();
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

    /**
     * Tests {@link DefinitionURI#toURN(String, ReferenceIdentifier)}.
     */
    @Test
    public void testToURN() {
        final ReferenceIdentifier identifier = new SimpleReferenceIdentifier(new SimpleCitation("EPSG"), "4326");
        assertEquals("urn:ogc:def:crs:EPSG::4326", DefinitionURI.format("crs", identifier));
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     *
     * @return The metadata to be marshalled.
     */
    @XmlElementRef
    public ImmutableIdentifier getElement() {
        final ReferenceIdentifier metadata = this.metadata;
        if (metadata == null) {
            return null;
        } else if (metadata instanceof ImmutableIdentifier) {
            return (ImmutableIdentifier) metadata;
        } else {
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

    /**
     * Formats the given object.
     */
    @Override
    public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
        final ReferenceIdentifier identifier = ((IdentifiedObject) obj).getName();
        if (identifier == null) {
            return toAppendTo.append(Vocabulary.getResources(locale).getString(Vocabulary.Keys.Unnamed));
        }
        if (identifier instanceof GenericName) {
            // The toString() behavior is specified by the GenericName javadoc.
            return toAppendTo.append(((GenericName) identifier).toInternationalString().toString(locale));
        }
        final String code = identifier.getCode();
        String cs = identifier.getCodeSpace();
        if (cs == null || cs.isEmpty()) {
            cs = Citations.getIdentifier(identifier.getAuthority());
        }
        if (cs != null) {
            toAppendTo.append(cs).append(DefaultNameSpace.DEFAULT_SEPARATOR);
        }
        return toAppendTo.append(code);
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     */
    public void setInvalidWKT(final IdentifiedObject unformattable, final Exception cause) {
        ArgumentChecks.ensureNonNull("unformattable", unformattable);
        if (invalidElement == null) {
            String name;
            final ReferenceIdentifier id = unformattable.getName();
            if (id == null || (name = id.getCode()) == null) {
                name = getName(unformattable.getClass());
            }
            invalidElement = name;
            errorCause     = cause;
        }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

         * If we had an uninitialized parameter (a parameter created by the DefaultParameterValueGroup constructor
         * and never been queried or set by the user), then the given parameter will replace the uninitialized.
         * The intend is to allow users to set its own parameters by a call to group.values().addAll(myParam).
         * Otherwise the given parameter will be added, in which case we need to check the cardinality.
         */
        final ReferenceIdentifier name = desc.getName();
        int count = 0;
        for (int i=0; i<size; i++) {
            final GeneralParameterValue value = values[i];
            if (name.equals(value.getDescriptor().getName())) {
                if (value instanceof UninitializedParameter) {
                    values[i] = parameter;
                    return true;
                }
                count++;
            }
        }
        if (count >= desc.getMaximumOccurs()) {
            throw new InvalidParameterCardinalityException(Errors.format(
                    Errors.Keys.TooManyOccurrences_2, count, name), name.getCode());
        }
        addUnchecked(parameter);
        modCount++;
        return true;
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

        if (!descriptors.contains(desc)) {
            /*
             * For a more accurate error message, check if the operation failed because the
             * parameter name was not found, or the parameter descriptor does not matches.
             */
            final ReferenceIdentifier name = desc.getName();
            for (final GeneralParameterDescriptor descriptor : descriptors) {
                if (name.equals(descriptor.getName())) {
                    throw new IllegalArgumentException(Errors.format(
                            Errors.Keys.MismatchedParameterDescriptor_1, name));
                }
            }
            throw new InvalidParameterNameException(Errors.format(
                    Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name.getCode());
        }
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     * Verifies if adding a parameter with the given descriptor is allowed by the cardinality constraints. If adding
     * the parameter would result in more occurrences than {@link DefaultParameterDescriptor#getMaximumOccurs()},
     * then this method throws an {@link InvalidParameterCardinalityException}.
     */
    private void ensureCanAdd(final GeneralParameterDescriptor desc) {
        final ReferenceIdentifier name = desc.getName();
        int count = 0;
        for (int i=0; i<size; i++) {
            if (name.equals(values[i].getDescriptor().getName())) {
                count++;
            }
        }
        if (count >= desc.getMaximumOccurs()) {
            throw new InvalidParameterCardinalityException(Errors.format(
                    Errors.Keys.TooManyOccurrences_2, count, name), name.getCode());
        }
    }
View Full Code Here

Examples of org.opengis.referencing.ReferenceIdentifier

     * then this method throws an {@link InvalidParameterCardinalityException}.
     */
    private void ensureCanRemove(final GeneralParameterDescriptor desc) {
        final int min = desc.getMinimumOccurs();
        if (min != 0) { // Optimization for a common case.
            final ReferenceIdentifier name = desc.getName();
            int count = 0;
            for (int i=0; i<size; i++) {
                if (name.equals(values[i].getDescriptor().getName())) {
                    if (++count > min) {
                        return;
                    }
                }
            }
            throw new InvalidParameterCardinalityException(Errors.format(
                    Errors.Keys.TooFewOccurrences_2, min, name), name.getCode());
        }
    }
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.