The specified id may be null. In this case an id will be generated internally by the builder.
null
After this method returns, all internal builder state is reset.
100101102103104105106107108109110
public void create() throws Exception { WKTReader wktReader = new WKTReader(); Point geometry = (Point) wktReader.read("POINT (0 0)"); SimpleFeatureBuilder build = new SimpleFeatureBuilder(layer.getSchema()); SimpleFeature feature = build.buildFeature("100000", new Object[] { geometry, "Tsjakamaka", 342 }); Object created = layer.create(feature); Assert.assertNotNull(created); }
208209210211212213214215216217218
values[i++] = null; } } values[i++] = internalFeature.getStyleInfo().getIndex(); values[i++] = internalFeature.getGeometry(); result.add(builder.buildFeature(internalFeature.getId(), values)); } return result; } private SimpleFeatureType createFeatureType(VectorLayer layer, CoordinateReferenceSystem mapCrs) {
7273747576777879808182
} else { attr.add(feature.getGeometry()); } } return builder.buildFeature(feature.getId(), attr.toArray()); } /** {@inheritDoc} */ public SimpleFeatureType toSimpleFeatureType(VectorLayerInfo vectorLayerInfo, List<String> attributeNames)
180181182183184185186187188189190
featureBuilder.add(s.stopName); featureBuilder.add(s.stopCode); featureBuilder.add(s.stopDesc); featureBuilder.add(s.gtfsStopId); featureBuilder.add(s.agency.name); SimpleFeature feature = featureBuilder.buildFeature(null); collection.add(feature); } } else if(gisExport.type.equals(GisUploadType.ROUTES)) {
226227228229230231232233234235236
featureBuilder.add(r.routeUrl); featureBuilder.add(r.routeColor); featureBuilder.add(r.routeTextColor); featureBuilder.add(r.agency.name); SimpleFeature feature = featureBuilder.buildFeature(null); collection.add(feature); } } } else
221222223224225226227228229230231
Geometry reprojectPoint = JTS.transform(point, transform); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); Object[] values = new Object[]{reprojectPoint, text, dateTimeString, String.valueOf(altim)}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + i++); newCollection.add(feature); pm.worked(1); } } finally { pm.done();
345346347348349350351352353354355
MultiLineString multiLineString = gF.createMultiLineString(new LineString[]{reprojectLineString}); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); Object[] values = new Object[]{multiLineString, startDate, endDate, log.text}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++); newCollection.add(feature); pm.worked(1); } pm.done();
400401402403404405406407408409410
Point reprojectPoint = (Point) JTS.transform(point, transform); Object[] values = new Object[]{reprojectPoint, String.valueOf(gpsPoint.altim), gpsPoint.utctime}; SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); builder.addAll(values); SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++); newCollection.add(feature); } pm.worked(1); } pm.done();
518519520521522523524525526527528
String dateTime = dateString + timeString; Object[] values = new Object[]{reprojectPoint, String.valueOf(altim), dateTime, azimuth, imageRelativePath}; SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType); builder.addAll(values); SimpleFeature feature = builder.buildFeature(null); newCollection.add(feature); } pm.worked(1); }
548549550551552553554555556557558
Coordinate coordinate = placesMap.get(name); MultiPoint point = gF.createMultiPoint(new Coordinate[]{coordinate}); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); Object[] values = new Object[]{point, name}; builder.addAll(values); SimpleFeature feature = builder.buildFeature(type.getTypeName() + "." + id); id++; newCollection.add(feature); pm.worked(1); } pm.done();