Search in sources :

Example 16 with Attribute

use of org.opengis.feature.Attribute in project geotoolkit by Geomatys.

the class JAXPStreamFeatureWriter method writeCharacteristics.

private void writeCharacteristics(Attribute att) throws XMLStreamException {
    final Iterator<Attribute> ite = att.characteristics().values().iterator();
    while (ite.hasNext()) {
        final Attribute chara = ite.next();
        final GenericName name = chara.getName();
        final String namespace = getNamespace(name);
        String localPart = name.tip().toString();
        if (localPart.startsWith("@")) {
            // remove the @
            localPart = localPart.substring(1);
        }
        Object value = chara.getValue();
        if (value instanceof Boolean) {
            value = (Boolean) value ? "1" : "0";
        }
        if (value != null) {
            writer.writeAttribute(namespace, localPart, ObjectConverters.convert(value, String.class));
        }
    }
}
Also used : GenericName(org.opengis.util.GenericName) Attribute(org.opengis.feature.Attribute) Utils.buildSchemaLocationString(org.geotoolkit.feature.xml.Utils.buildSchemaLocationString)

Aggregations

Attribute (org.opengis.feature.Attribute)16 AttributeType (org.opengis.feature.AttributeType)8 FeatureAssociationRole (org.opengis.feature.FeatureAssociationRole)6 FeatureType (org.opengis.feature.FeatureType)6 Feature (org.opengis.feature.Feature)5 PropertyType (org.opengis.feature.PropertyType)5 GenericName (org.opengis.util.GenericName)4 Collection (java.util.Collection)3 Map (java.util.Map)3 Entry (java.util.Map.Entry)3 MapDef (org.geotoolkit.report.graphic.map.MapDef)3 FeatureAssociation (org.opengis.feature.FeatureAssociation)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 DefaultAttributeType (org.apache.sis.feature.DefaultAttributeType)2