All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opengis.cite.iso19136.general.AppSchemaInfo Maven / Gradle / Ivy

Go to download

Checks GML application schemas or data sets for conformance to ISO 19136:2007.

There is a newer version: 3.2.1-r18
Show newest version
package org.opengis.cite.iso19136.general;

import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;

import org.apache.xerces.xs.XSComplexTypeDefinition;
import org.apache.xerces.xs.XSElementDeclaration;

/**
 * Provides information about the types of objects declared in a GML application
 * schema. Clause 21.2.1 in ISO 19136 requires a conforming schema to include
 * specific types of geographic objects.
 */
public class AppSchemaInfo {

    private Set gmlContentTypes = EnumSet
            .noneOf(GMLObjectType.class);
    private List featureTypes;
    private Set featureDefinitions;
    private List geometryTypes;
    private List topoTypes;
    private List timeTypes;
    private List crsTypes;
    private List coverageTypes;
    private List observationTypes;
    private List definitionTypes;

    public Set getGMLContentTypes() {
        return gmlContentTypes;
    }

    public List getFeatureTypes() {
        return featureTypes;
    }

    public void setFeatureTypes(List features) {
        if (!features.isEmpty()) {
            this.featureTypes = Collections.unmodifiableList(features);
            gmlContentTypes.add(GMLObjectType.FEATURE_TYPE);
        }
    }

    public Set getFeatureDefinitions() {
        return featureDefinitions;
    }

    public void setFeatureDefinitions(Set typeDefs) {
        if (null != typeDefs) {
            this.featureDefinitions = Collections.unmodifiableSet(typeDefs);
        }
    }

    public List getGeometryTypes() {
        return geometryTypes;
    }

    public void setGeometryTypes(List geometries) {
        if (!geometries.isEmpty()) {
            this.geometryTypes = Collections.unmodifiableList(geometries);
            gmlContentTypes.add(GMLObjectType.GEOMETRY);
        }
    }

    public List getTimeTypes() {
        return timeTypes;
    }

    public void setTimeTypes(List timeTypes) {
        if (!timeTypes.isEmpty()) {
            this.timeTypes = Collections.unmodifiableList(timeTypes);
            gmlContentTypes.add(GMLObjectType.TIME);
        }
    }

    public List getTopoTypes() {
        return topoTypes;
    }

    public void setTopoTypes(List topoTypes) {
        if (!topoTypes.isEmpty()) {
            this.topoTypes = Collections.unmodifiableList(topoTypes);
            gmlContentTypes.add(GMLObjectType.TOPOLOGY);
        }
    }

    public List getCoverageTypes() {
        return coverageTypes;
    }

    public void setCoverageTypes(List coverageTypes) {
        if (!coverageTypes.isEmpty()) {
            this.coverageTypes = Collections.unmodifiableList(coverageTypes);
            gmlContentTypes.add(GMLObjectType.COVERAGE);
        }
    }

    public List getCrsTypes() {
        return crsTypes;
    }

    public void setCrsTypes(List crsTypes) {
        if (!crsTypes.isEmpty()) {
            this.crsTypes = Collections.unmodifiableList(crsTypes);
            gmlContentTypes.add(GMLObjectType.CRS);
        }
    }

    public List getDefinitionTypes() {
        return definitionTypes;
    }

    public void setDefinitionTypes(List definitionTypes) {
        if (!definitionTypes.isEmpty()) {
            this.definitionTypes = Collections
                    .unmodifiableList(definitionTypes);
            gmlContentTypes.add(GMLObjectType.DEFINITION);
        }
    }

    public List getObservationTypes() {
        return observationTypes;
    }

    public void setObservationTypes(List obsTypes) {
        if (!obsTypes.isEmpty()) {
            this.observationTypes = Collections.unmodifiableList(obsTypes);
            gmlContentTypes.add(GMLObjectType.OBSERVATION);
        }
    }

    /**
     * Indicates whether or not the application schema includes any of the
     * schema components identified in clause 21.2.1. In essence, at least one
     * type of GML object must be defined.
     * 
     * @return {@code true} if the required schema components are present;
     *         {@code false} otherwise.
     */
    public boolean conforms() {
        return !gmlContentTypes.isEmpty();
    }

    @Override
    public String toString() {
        StringBuilder str = new StringBuilder("AppSchemaInfo [\n");
        str.append("featureTypes: ").append(featureTypes).append('\n');
        str.append("geometryTypes: ").append(geometryTypes).append('\n');
        str.append("topoTypes: ").append(topoTypes).append('\n');
        str.append("timeTypes: ").append(timeTypes).append('\n');
        str.append("crsTypes: ").append(crsTypes).append('\n');
        str.append("coverageTypes: ").append(coverageTypes).append('\n');
        str.append("observationTypes: ").append(observationTypes).append('\n');
        str.append("definitionTypes: ").append(definitionTypes).append('\n');
        str.append("]\n");
        return str.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy