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.
143144145146147148149150151152153
sb.add( gf.createPoint( new Coordinate(2, 2) ) ) ; features.add( sb.buildFeature("2")); sb = new SimpleFeatureBuilder(DocumentTypeBinding.FeatureType); sb.set( "Feature", features ); SimpleFeature f = sb.buildFeature("kml"); Encoder encoder = new Encoder(new KMLConfiguration()); encoder.setIndenting(true); ByteArrayOutputStream out = new ByteArrayOutputStream(); encoder.encode(f, KML.kml, out );
248249250251252253254255256257258
SimpleFeature buildFeature() { SimpleFeatureBuilder builder = this.builder != null ? this.builder : createBuilder(); SimpleFeatureType featureType = builder.getFeatureType(); SimpleFeature f = builder.buildFeature(id); if (geometry != null) { if(featureType.getGeometryDescriptor() == null) { //GEOT-4293, case of geometry coming after properties, we have to retype // the builder // JD: this is ugly, we should really come up with a better way to store internal
263264265266267268269270271272273
addGeometryType(typeBuilder, geometry); featureType = typeBuilder.buildFeatureType(); SimpleFeatureBuilder newBuilder = new SimpleFeatureBuilder(featureType); newBuilder.init(f); f = newBuilder.buildFeature(id); } f.setAttribute(featureType.getGeometryDescriptor().getLocalName(), geometry); } return f; }
5051525354555657585960
SimpleFeatureType featureType = fs.getSchema(); SimpleFeatureBuilder b = new SimpleFeatureBuilder( featureType ); b.add("four"); b.add( new GeometryFactory().createPoint( new Coordinate(4,4) ) ); SimpleFeature f = b.buildFeature(null); fs.addFeatures( DataUtilities.collection(f)); //pattern match to handle the multi primary key case assertTrue(((String)f.getUserData().get( "fid" )).matches( tname(featureType.getTypeName()) + ".4(\\..*)?"));
349350351352353354355356357358359
b.add(attValue); } //create the feature return b.buildFeature(fid); } public static CoordinateReferenceSystem crs(Node node) { if (node.getAttribute("srsName") != null) { URI srs = null;
104105106107108109110111112113114
DefaultFeatureCollection features = new DefaultFeatureCollection(null, b.getFeatureType()); for (int i = 0; i < 2; i++) { b.add(gf.createPoint(new Coordinate(i, i))); b.add(i); features.add(b.buildFeature(i + "")); } Map<String, Object> input = new HashMap(); input.put(BufferFeatureCollectionFactory.FEATURES.key, features); input.put(BufferFeatureCollectionFactory.BUFFER.key, 10d);
6667686970717273747576
tb.add( "integer", Integer.class ); SimpleFeatureBuilder b = new SimpleFeatureBuilder( tb.buildFeatureType() ); b.add( new GeometryFactory().createPoint( new Coordinate( 0, 0 ) ) ); b.add( 0 ); features.add( b.buildFeature( "zero" ) ); b.add( new GeometryFactory().createPoint( new Coordinate( 1, 1 ) ) ); b.add( 1 ); features.add( b.buildFeature( "one" ) );
7071727374757677787980
b.add( 0 ); features.add( b.buildFeature( "zero" ) ); b.add( new GeometryFactory().createPoint( new Coordinate( 1, 1 ) ) ); b.add( 1 ); features.add( b.buildFeature( "one" ) ); FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType(); fc.getFeature().add( features ); Document dom = encode( fc, WFS.FeatureCollection );
101102103104105106107108109110111
Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude)); featureBuilder.add(point); featureBuilder.add(name); featureBuilder.add(number); SimpleFeature feature = featureBuilder.buildFeature(null); features.add(feature); } } } finally { reader.close();
241242243244245246247248249250
Geometry point = factory.createPoint(new Coordinate(10, 10)); fb.add(point); fb.add(5); fc.add(fb.buildFeature(null)); return fc; } }