Package org.geotools.feature

Examples of org.geotools.feature.AttributeImpl


        if (attrDescr == null)
            return null;
        if (attrDescr instanceof GeometryDescriptor)
            return new GeometryAttributeImpl(value, (GeometryDescriptor) attrDescr, null);
        else
            return new AttributeImpl(value, attrDescr, null);

    }
View Full Code Here


        /**
         * Build the feature properties
         */
        // eg:simpleAttribute
        AttributeDescriptor simpleAttributeDesc = (AttributeDescriptor) fType.getDescriptor(SIMPLE_ATTRIBUTE);
        AttributeImpl simpleAttribute = new AttributeImpl("simple value", simpleAttributeDesc, null);
        properties.add(simpleAttribute);
        // eg:complexAttribute/eg:rootAttribute[1]
        Collection<Property> rootPropertiesOne = new ArrayList<Property>();
        AttributeDescriptor multiLeafDesc = (AttributeDescriptor) rootAttType.getDescriptor(MULTI_LEAF_ATTRIBUTE);
        // eg:complexAttribute/eg:rootAttribute[1]/eg:multiLeafAttribute[1]
        AttributeImpl leafOne = new AttributeImpl("multi leaf value 1", multiLeafDesc, null);
        rootPropertiesOne.add(leafOne);
        // eg:complexAttribute/eg:rootAttribute[1]/eg:multiLeafAttribute[2]
        AttributeImpl leafTwo = new AttributeImpl("multi leaf value 2", multiLeafDesc, null);
        rootPropertiesOne.add(leafTwo);
        // eg:complexAttribute/eg:rootAttribute[1]/eg:singleLeafAttribute
        AttributeDescriptor singleLeafDesc = (AttributeDescriptor) rootAttType.getDescriptor(SINGLE_LEAF_ATTRIBUTE);
        AttributeImpl singleLeaf = new AttributeImpl("single leaf value", singleLeafDesc, null);       
        rootPropertiesOne.add(singleLeaf);
       
        //NC- add, test xml-attribute
        Map<Name, Object> userData = new HashMap<Name, Object>();
        singleLeaf.getUserData().put(Attributes.class, userData);
        userData.put(Types.typeName(EG, "att"), "test attribute");       
       

        AttributeImpl rootOne = new ComplexAttributeImpl(rootPropertiesOne, rootDesc, null);

        // eg:complexAttribute/eg:rootAttribute[2]
        Collection<Property> rootPropertiesTwo = new ArrayList<Property>();
        // eg:complexAttribute/eg:rootAttribute[2]/eg:multiLeafAttribute[1]
        rootPropertiesTwo.add(leafOne);
        rootPropertiesTwo.add(singleLeaf);
        AttributeImpl rootTwo = new ComplexAttributeImpl(rootPropertiesTwo, rootDesc, null);

        // eg:complexAttribute/eg:rootAttribute[3]
        Collection<Property> rootPropertiesThree = new ArrayList<Property>();
        // eg:complexAttribute/eg:rootAttribute[3]/eg:singleLeafAttribute
        rootPropertiesThree.add(singleLeaf);
        AttributeImpl rootThree = new ComplexAttributeImpl(rootPropertiesThree, rootDesc, null);

        Collection<Property> complexProperties = new ArrayList<Property>(2);
        complexProperties.add(rootOne);
        complexProperties.add(rootTwo);
        complexProperties.add(rootThree);
        AttributeImpl complexAttribute = new ComplexAttributeImpl(complexProperties,
                complexDesc, null);
        properties.add(complexAttribute);

        Feature feature = new FeatureImpl(properties, fType, new FeatureIdImpl("test1"));

View Full Code Here

     */
    public void testLeafComplexAttribute() {
        Collection<Property> attributes = new ArrayList<Property>();
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(XSSchema.STRING_TYPE,
                ComplexFeatureConstants.SIMPLE_CONTENT, 1, 1, true, (Object) null);
        attributes.add(new AttributeImpl("rini", descriptor, null));
        ComplexAttribute gmlName = new ComplexAttributeImpl(attributes, GMLSchema.CODETYPE_TYPE, null);
        String nameString = Converters.convert(gmlName, String.class);
        assertEquals("rini", nameString);
    }
View Full Code Here

     */
    public void testParentComplexAttribute() {
        Collection<Property> attributes = new ArrayList<Property>();
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(XSSchema.STRING_TYPE,
                ComplexFeatureConstants.SIMPLE_CONTENT, 1, 1, true, (Object) null);
        attributes.add(new AttributeImpl("rini", descriptor, null));
        ComplexAttribute gmlName = new ComplexAttributeImpl(attributes, GMLSchema.CODETYPE_TYPE, null);
       
        Collection<Property> parentAttributes = new ArrayList<Property>();
        parentAttributes.add(gmlName);
        ComplexAttribute parentAtt = new ComplexAttributeImpl(parentAttributes, GMLSchema.ABSTRACTFEATURETYPE_TYPE, null);
View Full Code Here

     * Test that normal Attribute shouldn't be affected by the converter.
     */
    public void testAttribute() {
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(XSSchema.STRING_TYPE,
                ComplexFeatureConstants.SIMPLE_CONTENT, 1, 1, true, (Object) null);
        Attribute att = new AttributeImpl("rini", descriptor, null);
        Set<ConverterFactory> factories = Converters.getConverterFactories(att.getClass(), String.class);
        for (ConverterFactory factory : factories) {
            assertFalse(factory instanceof ComplexAttributeConverterFactory);
        }
    }
View Full Code Here

        AttributeType simpleContentType = getSimpleContentType(type);
        Object convertedValue = FF.literal(value).evaluate(value,
                getSimpleContentType(type).getBinding());
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(simpleContentType,
                ComplexFeatureConstants.SIMPLE_CONTENT, 1, 1, true, (Object) null);
        return new AttributeImpl(convertedValue, descriptor, null);
    }
View Full Code Here

      for (PropertyDescriptor pd : schema.getDescriptors()) {
        if (pd instanceof AttributeDescriptor) {
          if (pd instanceof GeometryDescriptor) {
            value.add(new GeometryAttributeImpl (((AttributeDescriptor) pd).getDefaultValue(), (GeometryDescriptor) pd, null) );
          } else {
            value.add(new AttributeImpl (((AttributeDescriptor) pd).getDefaultValue(), (AttributeDescriptor) pd, null) );
          }
        }               
        }
     
      return ff.createFeature(value, (FeatureTypeschema, SimpleFeatureBuilder.createDefaultFeatureId());       
View Full Code Here

        // If the value is nillable anyway then just default it to null:
        if (propertyDescriptor.isNillable()
            && AttributeDescriptor.class
                .isAssignableFrom(propertyDescriptor.getClass())) {
          do {
            Property nullProperty = new AttributeImpl(
                propertyDescriptor.getType().getBinding()
                    .cast(null),
                (AttributeDescriptor) propertyDescriptor, null);

            properties.add(nullProperty);
View Full Code Here

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

        AttributeType p = new AttributeTypeImpl(attName, String.class, false, false, null, null,
                null);
        AttributeDescriptor pd = new AttributeDescriptorImpl(p, attName, 0, 0, false, null);

        propertyDescriptors.add(pd);
        properties.add(new AttributeImpl(codeSpace, pd, null));

        p = new AttributeTypeImpl(new NameImpl("simpleContent"), String.class, false, false, null,
                null, null);
        AttributeDescriptor pd2 = new AttributeDescriptorImpl(p, new NameImpl("simpleContent"), 0,
                0, false, null);

        properties.add(new AttributeImpl(value, pd2, null));
        propertyDescriptors.add(pd2);

        ComplexTypeImpl at = new ComplexTypeImpl(myType, propertyDescriptors, false, false,
                Collections.EMPTY_LIST, null, null);
View Full Code Here

TOP

Related Classes of org.geotools.feature.AttributeImpl

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.