Package org.opengis.feature

Examples of org.opengis.feature.Property


            Name geometryAttributeName = builder.getFeatureType().getGeometryDescriptor().getName();
            builder.set(geometryAttributeName, next.getDefaultGeometryProperty().getValue());
            for (AttributeDescriptor attribute : builder.getFeatureType().getAttributeDescriptors()) {
                Name name = attribute.getName();
                if (!name.equals(geometryAttributeName)) {
                    Property property = next.getProperty(name);
                    if (property == null) {
                        throw new GeoToolsOpException(
                                GeoToolsOpException.StatusCode.INCOMPATIBLE_FEATURE_TYPE);
                    }
                    builder.set(name, next.getProperty(name).getValue());
View Full Code Here


    public Collection<Property> getProperties(Name name) {
        return getProperties(name.getLocalPart());
    }

    public Collection<Property> getProperties(String name) {
        Property p = createProperty(name);
        if (p == null)
            return Collections.emptyList();
        else
            return Collections.singletonList(p);
    }
View Full Code Here

        SimpleFeatureCollection features = road.getFeatures();
        assertEquals(4, features.size());

        SimpleFeature feature;
        Geometry geom;
        Property prop;
        GeometryType geomType;
        SimpleFeatureIterator iterator = features.features();
        while (iterator.hasNext()) {
            feature = iterator.next();
            prop = feature.getProperty("geom");
            assertTrue(prop.getType() instanceof GeometryType);
            geomType = (GeometryType) prop.getType();

            Object val = prop.getValue();
            assertTrue(val != null && val instanceof Geometry);
            geom = (Geometry) val;

            Object userData = geom.getUserData();
            assertTrue(userData != null && userData instanceof CoordinateReferenceSystem);
View Full Code Here

        FeatureIterator<Feature> features = exCollection.features();
        try {
            while (features.hasNext()) {
                Feature feature = features.next();
                String fId = feature.getIdentifier().getID();
                Property attribute = feature.getProperty("someAttribute");
                // <OCQL>Categorize(getID(), 'missing value', 2, 'a valid value')</OCQL>
                assertEquals(attribute.getValue(), VALUE_MAP.get(fId));
            }
        }
        finally {
            features.close();
        }
View Full Code Here

     * @param value
     *            Value for the simple content.
     * @return The attribute with simple content type.
     */
    private Attribute setSimpleContentValue(Attribute attribute, Object value) {
        Property simpleContent = null;
        if (attribute instanceof ComplexAttribute) {
          simpleContent = ((ComplexAttribute)attribute).getProperty(ComplexFeatureConstants.SIMPLE_CONTENT);
        }
        if (simpleContent == null) {
            Collection<Property> contents = new ArrayList<Property>();
          simpleContent = buildSimpleContent(attribute.getType(), value);
            contents.add(simpleContent);
            ArrayList<Attribute> nestedAttContents = new ArrayList<Attribute>();
            Attribute nestedAtt = new ComplexAttributeImpl(contents, attribute.getDescriptor(),
                    attribute.getIdentifier());
            nestedAttContents.add(nestedAtt);
            attribute.setValue(nestedAttContents);
           
            return nestedAtt;
        } else {
          PropertyType simpleContentType = getSimpleContentType((AttributeType) simpleContent.getType());
            Object convertedValue = FF.literal(value).evaluate(value,
                    simpleContentType.getBinding());
          simpleContent.setValue(convertedValue);
          return attribute;
        }       
    }
View Full Code Here

        Object convertedValue = null;
        Map <Object, Object> simpleContentProperties = null;
        if (isFeatureChainedSimpleContent(descriptor, value)) {
            List<Property> nestedPropList = getSimpleContentList(value);
            if (!nestedPropList.isEmpty()) {
              Property nestedProp = nestedPropList.iterator().next();
              if (Types.isGeometryType(descriptor.getType())
                  || nestedProp.getName().equals(descriptor.getName())) {
                convertedValue = nestedProp.getValue();
              } else {
                    convertedValue = nestedPropList;
              }
                simpleContentProperties = nestedProp.getUserData();
            }
        } else {
            // adapt value to context
            convertedValue = convertValue(descriptor, value);  
        }
View Full Code Here

    protected void cleanEmptyElements(Feature target) throws DataSourceException {
        try {
            ArrayList values = new ArrayList<Property>();
            for (Iterator i = target.getValue().iterator(); i.hasNext();) {
                Property p = (Property) i.next();
                if (hasChild(p) || p.getDescriptor().getMinOccurs() > 0 || getEncodeIfEmpty(p)) {
                    values.add(p);
                }
            }
            target.setValue(values);
        } catch (DataSourceException e) {
View Full Code Here

     * @param xpath
     *            The xPath matching the attribute
     * @return The first matching attribute
     */
    private Property getProperty(Attribute root, StepList xpath) {
        Property property = root;

        final StepList steps = new StepList(xpath);

        Iterator<Step> stepsIterator = steps.iterator();

View Full Code Here

        /**
         * We can handle *one* case and one case only
         */
        public boolean canHandle(Object object, String xpath, Class target) {
            if( object instanceof Property ){
                Property property = (Property) object;
                final Name name = property.getName();
                if( name != null ){
                    return name.getLocalPart().equals( xpath );
                } else {
                    // A property with no name? this is probably a place holder
                    // or Null Object (such as TransactionStateDiff.NULL).
View Full Code Here

   * @return
   */
  private Object unpack(Object value) {
     
      if (value instanceof org.opengis.feature.ComplexAttribute){
                Property simpleContent = ((org.opengis.feature.ComplexAttribute)value).getProperty(new NameImpl("simpleContent"));
                if (simpleContent == null) {
                    return null;
                } else {
                    return simpleContent.getValue();
                }
            }
           
            if(value instanceof org.opengis.feature.Attribute){
                return ((org.opengis.feature.Attribute)value).getValue();
View Full Code Here

TOP

Related Classes of org.opengis.feature.Property

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.