Package org.geotools.feature

Examples of org.geotools.feature.AttributeTypeBuilder


        TestEditBlackboard bb=new TestEditBlackboard();
        String fid="FeatureID";
        EditGeom geom = bb.newGeom(fid, null);
        bb.addPoint(10,10,geom.getShell());
        EditGeom geom2 = bb.newGeom(fid, null);
        AttributeTypeBuilder builder = new AttributeTypeBuilder();
        builder.setBinding(Geometry.class);
        builder.setName("geom");
        GeometryDescriptor at = (GeometryDescriptor) builder.buildDescriptor("geom", builder.buildGeometryType());
        Map<String, Bag> result = GeometryCreationUtil.createAllGeoms(geom, Point.class, at, false);
       
        assertEquals(1, result.get(fid).jts.size());

        bb.addPoint(100,100, geom2.getShell());
View Full Code Here


        TestEditBlackboard bb=new TestEditBlackboard();
        String fid="FeatureID";
        EditGeom geom = bb.newGeom(fid, null);
        bb.addPoint(10,10,geom.getShell());
        EditGeom geom2 = bb.newGeom(fid, null);
        AttributeTypeBuilder builder = new AttributeTypeBuilder();
        builder.setBinding(Geometry.class);
        builder.setName("geom");
        GeometryDescriptor at = builder.buildDescriptor("geom", builder.buildGeometryType());
        bb.addPoint(100,100, geom2.getShell());
       
        String fid2="FID2";
        EditGeom differentGeom=bb.newGeom(fid2, null);
        bb.addPoint(200,200, differentGeom.getShell());
View Full Code Here

            viewer.setInput(featureType);
        }

        private AttributeDescriptor createNewAttributeType( AttributeDescriptor editElement, String property,
                Object value ) {
          AttributeTypeBuilder builder = new AttributeTypeBuilder();
          builder.init(editElement);
          //builder.setName((String)property);
         
            switch( Integer.parseInt(property) ) {
            case NAME_COLUMN:
                return builder.buildDescriptor((String)value);
            case TYPE_COLUMN:
                int choice = -1;
                if( value instanceof Integer) {
                    choice = (Integer) value;
                }
                else if( value instanceof String) {
                    choice = Integer.parseInt( (String) value );
                }
               
                if (choice == -1)
                    return null;
                else {
                    Class type = legalTypes.get(choice).getType();
                    builder.setBinding(type);
                    return builder.buildDescriptor( editElement.getLocalName());
                }
            case OTHER_COLUMN:
                lastCRS=value;
               
                CoordinateReferenceSystem crs = (CoordinateReferenceSystem) value;
                if( FeatureTypeEditor.this.featureType.getGeometryDescriptor()==editElement ){
          setDefaultCRS(crs);
                }

                builder.setCRS(crs);
                return builder.buildDescriptor( editElement.getLocalName());
            default:
                return null;
            }
        }
View Full Code Here

      if (att != defaultGeomAttr) {
        builder.add(att);
      }
    }
    // create the default geometry with Geometry Class value
    AttributeTypeBuilder build = new AttributeTypeBuilder();
    build.setName(defaultGeomAttr.getLocalName());
    build.setNillable(true);
    build.setBinding(geometryClass);
    build.setCRS(crs);

    GeometryType type = build.buildGeometryType();

    builder.setDefaultGeometry(build.buildDescriptor(defaultGeomAttr.getLocalName(), type).getLocalName());

    builder.add(defaultGeomAttr.getLocalName(), geometryClass, crs);

    return builder.buildFeatureType();
View Full Code Here

    // adds the rest of attributes
    for (AttributeDescriptor att : prototype.getAttributeDescriptors()) {
      builder.add(att);
    }

    AttributeTypeBuilder build = new AttributeTypeBuilder();
    build.setName(attributeName);
    build.setNillable(true);
    build.setBinding(clazz);

    AttributeDescriptor att = build.buildDescriptor(attributeName);

    builder.add(att);

    return builder.buildFeatureType();
  }
View Full Code Here

                    }
                }

                if ( rebuild ) {
                    //rebuild with proper crs
                    AttributeTypeBuilder b = new AttributeTypeBuilder();
                    b.init(old);
                    b.setCRS( getCRS(info.getSRS()) );
                    ad = b.buildDescriptor(old.getLocalName());
                }
            }
            catch( Exception e ) {
                //log exception
            }
View Full Code Here

              attrUnionName);
          duplicatedName.append("2");

          attrUnionName = duplicatedName.toString();
        }
        AttributeTypeBuilder builder = new AttributeTypeBuilder();
        builder.setBinding(attributeType.getType().getBinding());
        builder.setNillable(attributeType.isNillable());

        AttributeDescriptor newAttribute = builder
            .buildDescriptor(attrUnionName);

        mapUnionAttributes.put(attrUnionName, newAttribute);
        mapOriginalUnion.put(new UnionKey(featureType.getTypeName(),
            attributeType.getLocalName()), attrUnionName);
View Full Code Here

    this.geometryName = geometryName;
    this.geometryClass = geomClass;

    GeometryDescriptor geoAttrType;

    AttributeTypeBuilder build = new AttributeTypeBuilder();
    build.setName(this.geometryName);
    build.setBinding(this.geometryClass);
    build.setNillable(true);
    build.setLength(100);
    build.setCRS(crs);

    GeometryType type = build.buildGeometryType();
    geoAttrType = build.buildDescriptor(this.geometryName, type);

    this.unionGeometryAttr = geoAttrType;

    return this;
  }
View Full Code Here

            targetGeomType = MultiPolygon.class;
          }
          final String geomTypeName = att.getLocalName();
          CoordinateReferenceSystem crs = defaultGeometry.getCoordinateReferenceSystem();

          AttributeTypeBuilder build = new AttributeTypeBuilder();
          build.setName(geomTypeName);
          build.setBinding(targetGeomType);
          build.setNillable(true);
          build.setCRS(crs);

          GeometryType type = build.buildGeometryType();
          att = build.buildDescriptor(geomTypeName, type);

        }
        builder.add(att);
        builder.setDefaultGeometry(att.getLocalName());
      } else {
View Full Code Here

      List<HNode> sortedLeafHNodes = new ArrayList<HNode>();
      worksheet.getHeaders().getSortedLeafHNodes(sortedLeafHNodes);
      for (HNode hNode : sortedLeafHNodes) {

        if (modeledHNodeIds.contains(hNode.getId())) {// &&
          AttributeTypeBuilder build = new AttributeTypeBuilder();
          build.setNillable(true);
          build.setBinding(String.class); // might need to change to
                          // specific bindings for
                          // sythetic data types
          AttributeDescriptor descriptor = build
              .buildDescriptor(hNode.getColumnName());
          featureSchema.add(descriptor);
          geomHNodeIdList.add(hNode.getId());

          if (hNode.getId().equals(kmlCategoryHNodeId))
View Full Code Here

TOP

Related Classes of org.geotools.feature.AttributeTypeBuilder

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.