Search in sources :

Example 1 with GMLCoreModule

use of org.citygml4j.model.module.gml.GMLCoreModule in project citygml4j by citygml4j.

the class ElementDecl method isFeatureCollection.

public boolean isFeatureCollection() {
    if (typeFlag.contains(TypeFlag.FEATURE_COLLECTION))
        return true;
    else if (typeFlag.contains(TypeFlag.NO_FEATURE_COLLECTION))
        return false;
    boolean isFeatureCollection = false;
    for (GMLCoreModule module : GMLCoreModule.getInstances()) {
        XSSchema gml = schema.schemaSet.getSchema(module.getNamespaceURI());
        if (gml == null)
            continue;
        switch(module.getVersion()) {
            case v3_1_1:
                isFeatureCollection = isDerivedFromComplexType(gml, "AbstractFeatureCollectionType");
                break;
        }
        if (isFeatureCollection)
            break;
    }
    if (isFeatureCollection) {
        typeFlag.add(TypeFlag.ABSTRACT_GML);
        typeFlag.add(TypeFlag.FEATURE);
        typeFlag.add(TypeFlag.FEATURE_COLLECTION);
    } else {
        typeFlag.add(TypeFlag.NO_FEATURE);
        typeFlag.add(TypeFlag.NO_FEATURE_COLLECTION);
    }
    return isFeatureCollection;
}
Also used : GMLCoreModule(org.citygml4j.model.module.gml.GMLCoreModule) XSSchema(com.sun.xml.xsom.XSSchema)

Example 2 with GMLCoreModule

use of org.citygml4j.model.module.gml.GMLCoreModule in project citygml4j by citygml4j.

the class ElementDecl method isFeatureProperty.

public boolean isFeatureProperty() {
    if (typeFlag.contains(TypeFlag.FEATURE_PROPERTY))
        return true;
    else if (typeFlag.contains(TypeFlag.NO_FEATURE_PROPERTY))
        return false;
    boolean isFeatureProperty = false;
    for (XSElementDecl child : getChildElements()) {
        Schema childSchema = schema.handler.getSchema(child.getTargetNamespace());
        List<ElementDecl> childElementDecls = childSchema.getElementDecls(child.getName());
        if (childElementDecls.size() == 1) {
            if (childElementDecls.get(0).isFeature())
                isFeatureProperty = true;
        } else {
            for (GMLCoreModule module : GMLCoreModule.getInstances()) {
                XSSchema gml = schema.schemaSet.getSchema(module.getNamespaceURI());
                if (gml == null)
                    continue;
                switch(module.getVersion()) {
                    case v3_1_1:
                        isFeatureProperty = child.getType().isDerivedFrom(gml.getType("AbstractFeatureType"));
                        break;
                }
                if (isFeatureProperty)
                    break;
            }
        }
        if (isFeatureProperty)
            break;
    }
    if (isFeatureProperty) {
        typeFlag.add(TypeFlag.FEATURE_PROPERTY);
        typeFlag.add(TypeFlag.NO_GEOMETRY_PROPERTY);
    } else
        typeFlag.add(TypeFlag.NO_FEATURE_PROPERTY);
    return isFeatureProperty;
}
Also used : XSSchema(com.sun.xml.xsom.XSSchema) GMLCoreModule(org.citygml4j.model.module.gml.GMLCoreModule) XSElementDecl(com.sun.xml.xsom.XSElementDecl) XSElementDecl(com.sun.xml.xsom.XSElementDecl) XSSchema(com.sun.xml.xsom.XSSchema)

Example 3 with GMLCoreModule

use of org.citygml4j.model.module.gml.GMLCoreModule in project citygml4j by citygml4j.

the class ElementDecl method isAbstractGML.

public boolean isAbstractGML() {
    if (typeFlag.contains(TypeFlag.ABSTRACT_GML))
        return true;
    else if (typeFlag.contains(TypeFlag.NO_ABSTRACT_GML))
        return false;
    boolean isAbstractGML = false;
    for (GMLCoreModule module : GMLCoreModule.getInstances()) {
        XSSchema gml = schema.schemaSet.getSchema(module.getNamespaceURI());
        if (gml == null)
            continue;
        switch(module.getVersion()) {
            case v3_1_1:
                isAbstractGML = isDerivedFromComplexType(gml, "AbstractGMLType");
                break;
        }
        if (isAbstractGML)
            break;
    }
    if (isAbstractGML) {
        typeFlag.add(TypeFlag.ABSTRACT_GML);
    } else {
        typeFlag.add(TypeFlag.NO_ABSTRACT_GML);
        typeFlag.add(TypeFlag.NO_FEATURE);
        typeFlag.add(TypeFlag.NO_FEATURE_COLLECTION);
        typeFlag.add(TypeFlag.NO_CITY_OBJECT);
        typeFlag.add(TypeFlag.NO_GEOMETRY);
    }
    return isAbstractGML;
}
Also used : GMLCoreModule(org.citygml4j.model.module.gml.GMLCoreModule) XSSchema(com.sun.xml.xsom.XSSchema)

Example 4 with GMLCoreModule

use of org.citygml4j.model.module.gml.GMLCoreModule in project citygml4j by citygml4j.

the class ElementDecl method isFeature.

public boolean isFeature() {
    if (typeFlag.contains(TypeFlag.FEATURE))
        return true;
    else if (typeFlag.contains(TypeFlag.NO_FEATURE))
        return false;
    boolean isFeature = false;
    for (GMLCoreModule module : GMLCoreModule.getInstances()) {
        XSSchema gml = schema.schemaSet.getSchema(module.getNamespaceURI());
        if (gml == null)
            continue;
        switch(module.getVersion()) {
            case v3_1_1:
                isFeature = isDerivedFromComplexType(gml, "AbstractFeatureType");
                break;
        }
        if (isFeature)
            break;
    }
    if (isFeature) {
        typeFlag.add(TypeFlag.ABSTRACT_GML);
        typeFlag.add(TypeFlag.FEATURE);
    } else {
        typeFlag.add(TypeFlag.NO_FEATURE);
        typeFlag.add(TypeFlag.NO_CITY_OBJECT);
    }
    return isFeature;
}
Also used : GMLCoreModule(org.citygml4j.model.module.gml.GMLCoreModule) XSSchema(com.sun.xml.xsom.XSSchema)

Example 5 with GMLCoreModule

use of org.citygml4j.model.module.gml.GMLCoreModule in project citygml4j by citygml4j.

the class ElementDecl method isGeometryProperty.

public boolean isGeometryProperty() {
    if (typeFlag.contains(TypeFlag.GEOMETRY_PROPERTY))
        return true;
    else if (typeFlag.contains(TypeFlag.NO_GEOMETRY_PROPERTY))
        return false;
    boolean isGeometryProperty = false;
    for (XSElementDecl child : getChildElements()) {
        Schema childSchema = schema.handler.getSchema(child.getTargetNamespace());
        List<ElementDecl> childElementDecls = childSchema.getElementDecls(child.getName());
        if (childElementDecls.size() == 1) {
            if (childElementDecls.get(0).isGeometry())
                isGeometryProperty = true;
        } else {
            for (GMLCoreModule module : GMLCoreModule.getInstances()) {
                XSSchema gml = schema.schemaSet.getSchema(module.getNamespaceURI());
                if (gml == null)
                    continue;
                switch(module.getVersion()) {
                    case v3_1_1:
                        isGeometryProperty = child.getType().isDerivedFrom(gml.getType("AbstractGeometryType"));
                        break;
                }
                if (isGeometryProperty)
                    break;
            }
        }
        if (isGeometryProperty)
            break;
    }
    if (isGeometryProperty) {
        typeFlag.add(TypeFlag.GEOMETRY_PROPERTY);
        typeFlag.add(TypeFlag.NO_FEATURE_PROPERTY);
    } else
        typeFlag.add(TypeFlag.NO_GEOMETRY_PROPERTY);
    return isGeometryProperty;
}
Also used : XSSchema(com.sun.xml.xsom.XSSchema) GMLCoreModule(org.citygml4j.model.module.gml.GMLCoreModule) XSElementDecl(com.sun.xml.xsom.XSElementDecl) XSElementDecl(com.sun.xml.xsom.XSElementDecl) XSSchema(com.sun.xml.xsom.XSSchema)

Aggregations

XSSchema (com.sun.xml.xsom.XSSchema)6 GMLCoreModule (org.citygml4j.model.module.gml.GMLCoreModule)6 XSElementDecl (com.sun.xml.xsom.XSElementDecl)2