Package org.opengis.feature

Examples of org.opengis.feature.Attribute


                    polymorphicTypeName.getLocalPart(), this.namespaces
                            .getPrefix(polymorphicTypeName.getNamespaceURI())), 1));
            if (!fTypeMapping.getFeatureIdExpression().equals (Expression.NIL)) {
                id = fTypeMapping.getFeatureIdExpression().evaluate(source, String.class);
            }
            Attribute instance = xpathAttributeBuilder.set(target, prefixedXpath, null, id,
                    type, false, attDescriptor, null);
            setClientProperties(instance, source, clientPropsMappings);
            for (AttributeMapping mapping : polymorphicMappings) {
                if (skipTopElement(polymorphicTypeName, mapping, type)) {
                    // if the top level mapping for the Feature itself, the attribute instance
View Full Code Here


                        }
                    }
                }
            }
            if (!exists) {
                Attribute instance = xpathAttributeBuilder.set(target, xpath, null, null,
                        targetNodeType, true, null);
                setClientProperties(instance, singleVal, clientPropsMappings);
            }
        }
    }
View Full Code Here

                    // ignore the top level mapping for the Feature itself
                    // as it was already set
                    continue;
                }
                if (attMapping.isList()) {
                    Attribute instance = setAttributeValue(target, null, sources.get(0),
                            attMapping, null, null, selectedProperties.get(attMapping));
                    if (sources.size() > 1 && instance != null) {
                        List<Object> values = new ArrayList<Object>();
                        Expression sourceExpr = attMapping.getSourceExpression();
                        for (Feature source : sources) {
                            values.add(getValue(sourceExpr, source));                       
                        }
                        String valueString = StringUtils.join(values.iterator(), " ");
                        StepList fullPath = attMapping.getTargetXPath();
                        StepList leafPath = fullPath.subList(fullPath.size() - 1, fullPath.size());
                        if (instance instanceof ComplexAttributeImpl) {             
                            // xpath builder will work out the leaf attribute to set values on
                            xpathAttributeBuilder.set(instance, leafPath, valueString, null, null,
                                    false, sourceExpr);
                        } else {
                            // simple attributes
                          instance.setValue(valueString);
                        }
                    }
                } else if (attMapping.isMultiValued()) {
                    // extract the values from multiple source features of the same id
                    // and set them to one built feature
View Full Code Here

    if (!super.equals(obj)) {
        return false;
    }
   
    Attribute att = (Attribute) obj;
   
    return Utilities.equals( id, att.getIdentifier() );
  }
View Full Code Here

            ComplexAttribute complex = (ComplexAttribute) attribute;
            Collection properties = (Collection) complex.getValue();
            for (Iterator itr = properties.iterator(); itr.hasNext();) {
                Property property = (Property) itr.next();
                if (property instanceof Attribute) {
                    Attribute att = (Attribute) property;
                    add(att.getIdentifier() == null ? null : att.getIdentifier().toString(), att
                            .getValue(), att.getName());
                } else if (property instanceof Association) {
                    Association assoc = (Association) property;
                    associate(assoc.getValue(), assoc.getName());
                }
            }
View Full Code Here

     *                The value of the attribute.
     *
     */
    public Attribute add(String id, Object value, Name name) {
        AttributeDescriptor descriptor = attributeDescriptor(name);
        Attribute attribute = create(value, null, descriptor, id);
        properties().add(attribute);
        return attribute;
    }
View Full Code Here

     *                The id of the attribute, or null.
     *
     * @return The build attribute.
     */
    public Attribute build(String id) {
        Attribute built = create(properties(), type, descriptor, id);

        // FIXME
        // // if geometry, set the crs
        // if (built instanceof GeometryAttribute) {
        // ((GeometryAttribute) built).getDescriptor().setCRS(getCRS());
        // }

        // if feature, set crs and default geometry
        if (built instanceof Feature) {
            Feature feature = (Feature) built;
            // FIXME feature.setCRS(getCRS());
            if (defaultGeometry != null) {
                for (Iterator itr = feature.getProperties().iterator(); itr.hasNext();) {
                    Attribute att = (Attribute) itr.next();
                    if (att instanceof GeometryAttribute) {
                        if (defaultGeometry.equals(att.getValue())) {
                            feature.setDefaultGeometryProperty((GeometryAttribute) att);
                        }
                    }

                }
View Full Code Here

     * @param id
     * @return
     */
    public Attribute addAnyTypeValue(Object value, AttributeType type,
            AttributeDescriptor descriptor, String id) {
        Attribute attribute = create(value, type, descriptor, id);
        properties().add(attribute);
        return attribute;
    }
View Full Code Here

    public static SimpleFeature build( SimpleFeatureType ft, Object atts[], String fid ){
        LenientFeatureFactory featureFactory = new LenientFeatureFactory();
        List<Attribute> properties = new ArrayList<Attribute>();
        for( int i=0; i<atts.length;i++){
            Object value = atts[i];
            Attribute property = featureFactory.createAttribute(value, ft.getDescriptor(i), null);
            properties.add(property);           
        }
        return featureFactory.createSimpleFeature(properties, ft, fid );
    }
View Full Code Here

      if( obj instanceof SimpleFeature){
          SimpleFeature feature = (SimpleFeature) obj;
          return feature.getID();
      }
      if( obj instanceof Attribute){
        Attribute attribute = (Attribute) obj;
          return attribute.getIdentifier().getID();
      }
    return ""; // no ID
  }
View Full Code Here

TOP

Related Classes of org.opengis.feature.Attribute

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.