public <O> O[] toArray(O[] a) { return collection.toArray(a); } }
public <O> O[] toArray(O[] a) { return delegate.toArray(a); }
public Object[] toArray() { return collection.toArray(); }
public Object[] toArray() { return delegate.toArray(); }
/** * Adapt a collection to a reader for use with FeatureStore.setFeatures( reader ). * * @param collection Collection of SimpleFeature * @return FeatureRedaer over the provided contents * @throws IOException IOException if there is any problem reading the content. */ public static FeatureReader<SimpleFeatureType, SimpleFeature> reader( FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { return reader(collection.toArray(new SimpleFeature[collection.size()])); }
public Object[] toArray(Object[] a) { return delegate.toArray(a); } public String getID() {
public Object[] toArray() { return delegate.toArray(); }
public <O> O[] toArray(O[] a) { return (O[]) fc.toArray(a); } }
public <O> O[] toArray(O[] a) { return collection.toArray(a); }
@Override public Object[] toArray() { timeoutVerifier.checkTimeout(); return delegate.toArray(); }
@Override public <O> O[] toArray(O[] a) { timeoutVerifier.checkTimeout(); return delegate.toArray(a); } }
public boolean addAll(FeatureCollection<FeatureType, Feature> c) { Feature[] array = (Feature[]) c.toArray(new Feature[c.size()]); return features.addAll(Arrays.asList(array)); } }
private SimpleFeature[] toSimpleFeatureArray(FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection) { final Object[] objects = featureCollection.toArray(new Object[featureCollection.size()]); final SimpleFeature[] simpleFeatures = new SimpleFeature[objects.length]; for (int i = 0; i < simpleFeatures.length; i++) { simpleFeatures[i] = (SimpleFeature)objects[i]; } return simpleFeatures; } }
@Override public SimpleFeature[] getSimpleFeatures() { if (!recordsParsed) { throw new IllegalStateException("The records have not been parsed yet."); } final Object[] objects = featureCollection.toArray(new Object[featureCollection.size()]); final SimpleFeature[] simpleFeatures = new SimpleFeature[objects.length]; for (int i = 0; i < simpleFeatures.length; i++) { simpleFeatures[i] = (SimpleFeature) objects[i]; } return simpleFeatures; }
SimpleFeature[] grabArray( FeatureCollection features, int size ){ try { SimpleFeature array[] = new SimpleFeature[ size ]; array = (SimpleFeature[]) features.toArray( array ); assertNotNull( array ); return array; } finally { features.purge(); } }
/** * Adapt a collection to a reader for use with FeatureStore.setFeatures( reader ). * * @param collection * Collection of SimpleFeature * * @return FeatureRedaer over the provided contents * @throws IOException * IOException if there is any problem reading the content. */ public static FeatureReader<SimpleFeatureType, SimpleFeature> reader( FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { return reader(collection.toArray(new SimpleFeature[collection.size()])); }
@Test public void testSpatialFilter() throws IOException { Filter filter = FF.bbox("", 60.042, 13.754, 68.410, 17.920, CSWRecordDescriptor.DEFAULT_CRS_NAME); FeatureCollection records = store.getRecords(new Query("Record", filter), Transaction.AUTO_COMMIT); assertEquals(1, records.size()); Feature record = (Feature) records.toArray()[0]; assertEquals("urn:uuid:1ef30a8b-876d-4828-9246-c37ab4510bbd", getSimpleLiteralValue(record, "identifier")); }
private static void assertAreEqual(PlacemarkGroup group, FeatureCollection<SimpleFeatureType, SimpleFeature> collection) { final SimpleFeature[] features = collection.toArray(new SimpleFeature[collection.size()]); assertEquals(group.getNodeCount(), features.length); for (int i = 0; i < group.getNodeCount(); i++) { SimpleFeature pinGroupFeature = group.get(i).getFeature(); assertTrue("Feature of pin group is not contained in feature collection\n", collection.contains(pinGroupFeature)); } }
@Test public void testScheme() throws IOException { Filter filter = FF.equals(FF.property("dc:identifier/dc:value", CSWRecordDescriptor.NAMESPACES), FF.literal("urn:uuid:6a3de50b-fa66-4b58-a0e6-ca146fdd18d4")); FeatureCollection records = store.getRecords(new Query("Record", filter), Transaction.AUTO_COMMIT); assertEquals(1, records.size()); Feature record = (Feature) records.toArray()[0]; assertEquals("http://www.digest.org/2.1", getSimpleLiteralScheme(record, "subject")); }
@Test public void testElementValueFilter() throws IOException { Filter filter = FF.equals(FF.property("dc:identifier/dc:value", CSWRecordDescriptor.NAMESPACES), FF.literal("urn:uuid:1ef30a8b-876d-4828-9246-c37ab4510bbd")); FeatureCollection records = store.getRecords(new Query("Record", filter), Transaction.AUTO_COMMIT); assertEquals(1, records.size()); Feature record = (Feature) records.toArray()[0]; assertEquals("urn:uuid:1ef30a8b-876d-4828-9246-c37ab4510bbd", getSimpleLiteralValue(record, "identifier")); assertEquals("http://purl.org/dc/dcmitype/Service", getSimpleLiteralValue(record, "type")); assertEquals("Proin sit amet justo. In justo. Aenean adipiscing nulla id tellus.", getSimpleLiteralValue(record, "abstract")); }