/** Adds an array of attributes. */ public void addAll(Object[] values) { addAll(Arrays.asList(values)); }
/** * Quickly builds the feature using the specified values and id * * @param id * @param values * @return */ public SimpleFeature buildFeature(String id, Object[] values) { addAll(values); return buildFeature(id); }
/** * Static method to build a new feature. * * <p>If multiple features need to be created, this method should not be used and instead an * instance should be instantiated directly. * * <p>This method is a short-hand convenience which creates a builder instance internally and * adds all the specified attributes. * * @param type SimpleFeatureType defining the structure for the created feature * @param values Attribute values, must be in the order defined by SimpleFeatureType * @param id FeatureID for the generated feature, use null to allow one to be supplied for you */ public static SimpleFeature build(SimpleFeatureType type, Object[] values, String id) { SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); builder.addAll(values); return builder.buildFeature(id); }
builder.addAll(zone.getAttributes()); builder.add(classZoneId); addStatsToFeature(stats.zone(classZoneId)); builder.addAll(zone.getAttributes()); addStatsToFeature(stats); features.add(builder.buildFeature(zone.getID())); builder.addAll(zone.getAttributes()); features.add(builder.buildFeature(zone.getID()));
/** * Adds an array of attributes. */ public void addAll(Object[] values) { addAll(Arrays.asList(values)); }
/** * Quickly builds the feature using the specified values and id * @param id * @param values * @return */ public SimpleFeature buildFeature(String id, Object[] values ) { addAll( values ); return buildFeature( id ); }
/** * Static method to build a new feature. * <p> * If multiple features need to be created, this method should not be used * and instead an instance should be instantiated directly. * </p> * <p> * This method is a short-hand convenience which creates a builder instance * internally and adds all the specified attributes. * </p> * @param type SimpleFeatureType defining the structure for the created feature * @param values Attribute values, must be in the order defined by SimpleFeatureType * @param id FeatureID for the generated feature, use null to allow one to be supplied for you */ public static SimpleFeature build( SimpleFeatureType type, Object[] values, String id ) { SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); builder.addAll(values); return builder.buildFeature(id); }
builder.addAll(zone.getAttributes()); if (stats != null) { builder.add(stats.getCount());
static Collection<SimpleFeature> createFeaturesFromPolygons(Collection<Geometry> geometries) { Collection<SimpleFeature> features = new LinkedList<>(); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("polygon"); b.add("the_geom", Polygon.class); b.add("id", Long.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder fbuilder = new SimpleFeatureBuilder(type); for (Geometry geometry : geometries) { Object[] values = new Object[]{geometry}; fbuilder.addAll(values); SimpleFeature feature = fbuilder.buildFeature(null); features.add(feature); } return features; }
builder.addAll(zone.getAttributes()); builder.add(classZoneId); addStatsToFeature(stats.zone(classZoneId)); builder.addAll(zone.getAttributes()); addStatsToFeature(stats); features.add(builder.buildFeature(zone.getID())); builder.addAll(zone.getAttributes()); features.add(builder.buildFeature(zone.getID()));
@Override public SimpleFeature next() throws IOException, IllegalArgumentException, NoSuchElementException { if (this.append) { this.builder.addAll(new Object[this.state.getEntry().getDataStore().getSchema(this.getFeatureType().getTypeName()).getAttributeCount()]); this.each = this.buildFeature(); return this.each; } this.checkPendingWrite(); return this.each = super.next(); }
public SimpleFeature addFeature(final SimpleFeatureType featureType, final Object[] values) throws IOException, ParseException { SimpleFeatureStore fs; fs = (SimpleFeatureStore) dataStore.getFeatureSource(featureType.getName()); SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(featureType); sfb.addAll(values); SimpleFeature feature = sfb.buildFeature(null); fs.addFeatures(DataUtilities.collection(feature)); return feature; }
attributes.remove(attributeToRemoveIndex); sfb.addAll(attributes); featureList.add(sfb.buildFeature(null));
while (it.hasNext()) { SimpleFeature sf = it.next(); sfb.addAll(sf.getAttributes()); sfb.add(new String("")); featureList.add(sfb.buildFeature(null));
SimpleFeature sf = it.next(); List<Object> attributeValueList = sf.getAttributes(); sfb.addAll(attributeValueList); featureList.add(sfb.buildFeature(null));
sfb.addAll(attributeValueList); featureList.add(sfb.buildFeature(null));
SimpleFeature sf = it.next(); List<Object> attributeValueList = sf.getAttributes(); sfb.addAll(attributeValueList); featureList.add(sfb.buildFeature(null));
public void testSupportsDuplicatedData(@Nullable String... extraAttributes) throws Exception { insertAndAdd(points1, points2, points3); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(pointsType); featureBuilder.addAll(((SimpleFeature) points1).getAttributes()); SimpleFeature duplicateFeature = featureBuilder.buildFeature("duplcate-contents"); insertAndAdd(duplicateFeature); assertEquals(RevFeature.builder().build(points1), RevFeature.builder().build(duplicateFeature)); commit("points, two features pointing to the same RevFeature"); List<NodeRef> featureTypeTrees = repo.workingTree().getFeatureTypeTrees(); NodeRef typeTree = null; for (NodeRef nr : featureTypeTrees) { if (pointsName.equals(nr.path())) { typeTree = nr; break; } } assertNotNull(typeTree); ObjectId featureTypeId = typeTree.getMetadataId(); ObjectId treeId = typeTree.getObjectId(); RevTree canonicalTree = repo.getTree(treeId); assertEquals(4, canonicalTree.size()); IndexInfo indexInfo = createIndexForLayer(pointsName, extraAttributes); RevTree indexTree = updateIndex(indexInfo, featureTypeId, RevTree.EMPTY, canonicalTree); assertEquals(canonicalTree.size(), indexTree.size()); }
public void testSupportsDuplicatedData(String... extraAttributes) throws Exception { insertAndAdd(points1, points2, points3); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(pointsType); featureBuilder.addAll(((SimpleFeature) points1).getAttributes()); SimpleFeature duplicateFeature = featureBuilder.buildFeature("duplcate-contents"); insertAndAdd(duplicateFeature); assertEquals(RevFeatureBuilder.build(points1), RevFeatureBuilder.build(duplicateFeature)); commit("points, two features pointing to the same RevFeature"); List<NodeRef> featureTypeTrees = repo.workingTree().getFeatureTypeTrees(); NodeRef typeTree = null; for (NodeRef nr : featureTypeTrees) { if (pointsName.equals(nr.path())) { typeTree = nr; break; } } assertNotNull(typeTree); ObjectId featureTypeId = typeTree.getMetadataId(); ObjectId treeId = typeTree.getObjectId(); RevTree canonicalTree = repo.getTree(treeId); assertEquals(4, canonicalTree.size()); IndexInfo indexInfo = createIndexForLayer(pointsName, extraAttributes); RevTree indexTree = updateIndex(indexInfo, featureTypeId, RevTree.EMPTY, canonicalTree); assertEquals(canonicalTree.size(), indexTree.size()); }
builder.addAll(zone.getAttributes()); if(stats != null) { builder.add(stats.getCount());