public Object[] toArray(Object[] a) { Object[] array = delegate.toArray(a); for (int i = 0; i < array.length; i++) { try { array[i] = reproject((SimpleFeature) array[i]); } catch (IOException e) { throw new RuntimeException(e); } } return array; }
public Object[] toArray() { Object[] array = delegate.toArray(); for (int i = 0; i < array.length; i++) { try { array[i] = reproject((SimpleFeature) array[i]); } catch (IOException e) { throw new RuntimeException(e); } } return array; }
public Object[] toArray() { return delegate.toArray(); }
public <F> F[] toArray(F[] a) { return delegate.toArray(a); }
public Object[] toArray() { Object[] res = backendCollection.toArray(); for (int i = 0; i < res.length; i++) { res[i] = new PreGeneralizedSimpleFeature( getSchema(), indexMapping, (SimpleFeature) res[i], geomPropertyName, backendGeomPropertyName); } return res; }
public Object[] toArray(Object[] arg0) { Object[] res = backendCollection.toArray(arg0); for (int i = 0; i < res.length; i++) { res[i] = new PreGeneralizedSimpleFeature( getSchema(), indexMapping, (SimpleFeature) res[i], geomPropertyName, backendGeomPropertyName); } return res; } }
/** * Test the second page of one feature per page. * * @throws IOException */ @Test public void oneFeatureSecondPage() throws IOException { Query query = new Query(); query.setMaxFeatures(1); query.setStartIndex(1); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.2", features[0].getID()); }
/** * Test a page of two features that only contains one because startindex is too close to the * end. * * @throws IOException */ @Test public void twoFeaturesReturnOne() throws IOException { Query query = new Query(); query.setMaxFeatures(2); query.setStartIndex(2); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.3", features[0].getID()); }
/** * Test the first page of one feature per page. * * @throws IOException */ @Test public void oneFeatureFirstPage() throws IOException { Query query = new Query(); query.setMaxFeatures(1); query.setStartIndex(0); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.1", features[0].getID()); }
/** * Test the third page of one feature per page. * * @throws IOException */ @Test public void oneFeatureThirdPage() throws IOException { Query query = new Query(); query.setMaxFeatures(1); query.setStartIndex(2); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.3", features[0].getID()); }
/** * Test the third page of one feature per page with natural sorting. * * @throws IOException */ @Test public void naturalSortedOneFeatureThirdPage() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.NATURAL_ORDER}); query.setMaxFeatures(1); query.setStartIndex(2); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.3", features[0].getID()); }
/** * Test the second page of one feature per page with natural sorting. * * @throws IOException */ @Test public void naturalSortedOneFeatureSecondPage() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.NATURAL_ORDER}); query.setMaxFeatures(1); query.setStartIndex(1); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.2", features[0].getID()); }
/** * Test the third page of one feature per page with reverse sorting. * * @throws IOException */ @Test public void reverseSortedOneFeatureThirdPage() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.REVERSE_ORDER}); query.setMaxFeatures(1); query.setStartIndex(2); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.1", features[0].getID()); }
/** * Test the first page of one feature per page with reverse sorting. * * @throws IOException */ @Test public void reverseSortedOneFeatureFirstPage() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.REVERSE_ORDER}); query.setMaxFeatures(1); query.setStartIndex(0); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.3", features[0].getID()); }
/** * Test the second page of one feature per page with reverse sorting. * * @throws IOException */ @Test public void reverseSortedOneFeatureSecondPage() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.REVERSE_ORDER}); query.setMaxFeatures(1); query.setStartIndex(1); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(1, fs.getCount(query)); Assert.assertEquals("mock.2", features[0].getID()); }
/** * Test that the default query returns all features unsorted. * * @throws IOException */ @Test public void defaultFeatures() throws IOException { Query query = new Query(); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(3, fs.getCount(query)); Assert.assertEquals("mock.3", features[0].getID()); Assert.assertEquals("mock.1", features[1].getID()); Assert.assertEquals("mock.2", features[2].getID()); }
/** * Test the page of two features per page that should contain the last two features. * * @throws IOException */ @Test public void twoFeaturesLastPage() throws IOException { Query query = new Query(); query.setMaxFeatures(2); query.setStartIndex(1); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(2, fs.getCount(query)); Assert.assertEquals("mock.2", features[0].getID()); Assert.assertEquals("mock.3", features[1].getID()); }
/** * Test the first page of two features per page. * * @throws IOException */ @Test public void twoFeaturesFirstPage() throws IOException { Query query = new Query(); query.setMaxFeatures(2); query.setStartIndex(0); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(2, fs.getCount(query)); Assert.assertEquals("mock.1", features[0].getID()); Assert.assertEquals("mock.2", features[1].getID()); }
/** * Test natural sorting. * * @throws IOException */ @Test public void naturalSortedFeatures() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.NATURAL_ORDER}); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(3, fs.getCount(query)); Assert.assertEquals("mock.1", features[0].getID()); Assert.assertEquals("mock.2", features[1].getID()); Assert.assertEquals("mock.3", features[2].getID()); }
/** * Test reverse sorting. * * @throws IOException */ @Test public void reverseSortedFeatures() throws IOException { Query query = new Query(); query.setSortBy(new SortBy[] {SortBy.REVERSE_ORDER}); SimpleFeatureSource fs = store.getFeatureSource(TYPENAME); SimpleFeature[] features = (SimpleFeature[]) fs.getFeatures(query).toArray(); Assert.assertEquals(3, fs.getCount(query)); Assert.assertEquals("mock.3", features[0].getID()); Assert.assertEquals("mock.2", features[1].getID()); Assert.assertEquals("mock.1", features[2].getID()); }