Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory.sort()


        // TODO: enable this when JTS learns how to compute centroids
        // without triggering the
        // generation of Coordinate[] out of the sequences...
        // q.setHints(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY,
        // PackedCoordinateSequenceFactory.class));
        q.setSortBy(new SortBy[] { ff.sort(attribute, SortOrder.DESCENDING) });

        // return the reader
        return fs.getFeatures(q).features();
    }
View Full Code Here


        s.createSchema(features, true, null);
        assertEquals(1, s.getTypeNames().length);
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        Query query = new Query();
        query.setSortBy(new org.opengis.filter.sort.SortBy[] {
            ff.sort("f", org.opengis.filter.sort.SortOrder.ASCENDING)
        });
        SimpleFeatureCollection fc = s.getFeatureSource("junk").getFeatures(query);
        assertEquals(features.size(), fc.size());
        // Read
        int c = 0;
View Full Code Here

        query.getPropertyName().add("property2");
        query.getXlinkPropertyName().add(xlinkPropertyName2);
        query.getFunction().add(function2);

        query.setFilter(ff.id(Collections.singleton(ff.featureId("fid"))));
        query.getSortBy().add(ff.sort("sortProperty", SortOrder.DESCENDING));

        return query;
    }
}
View Full Code Here

    }

    public void testGetFeaturesWithSort() throws Exception {
        init();
        FilterFactory ff = dataStore.getFilterFactory();
        SortBy sort = ff.sort("vendor_s", SortOrder.ASCENDING);
        Query query = new Query();
        query.setSortBy(new SortBy[] { sort });

        SimpleFeatureCollection features = featureSource.getFeatures(query);
        assertEquals(11, features.size());
View Full Code Here

            assertEquals("Cisco", f.getAttribute("vendor_s"));
        } finally {
            iterator.close();
        }

        sort = ff.sort("vendor_s", SortOrder.DESCENDING);
        query.setSortBy(new SortBy[] { sort });
        features = featureSource.getFeatures(query);
        iterator = features.features();
        try {
            assertTrue(iterator.hasNext());
View Full Code Here

    void assertDatesMatch(Filter filter, String...dates) throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
       
        Query query = new Query(aname("dates"), filter);
        query.setSortBy(new SortBy[]{ff.sort(aname("dt"), SortOrder.ASCENDING)});
        assertDatesMatch(query, dates);
    }
   
    void assertDatesMatch(Query query, String...dates) throws Exception {
        SimpleFeatureSource source = dataStore.getFeatureSource(tname("dates"));
View Full Code Here

        FilterFactory ff = dataStore.getFilterFactory();

        After after = ff.after(ff.property(aname("dt")), ff.property("other." + aname("dt")));
        Query q = new Query(tname("dates"));
        q.getJoins().add(new Join(tname("dates"), after).alias("other"));
        q.setSortBy(new SortBy[]{ff.sort(aname("dt"), SortOrder.ASCENDING)});
       
        assertDatesMatch(q, "2009-06-28 15:12:41", "2009-09-29 17:54:23", "2009-09-29 17:54:23");
    }

    static DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
View Full Code Here

        }
    }

    public void testGetFeaturesWithSort() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        SortBy sort = ff.sort(aname("stringProperty"), SortOrder.ASCENDING);
        Query query = new Query();
        query.setSortBy(new SortBy[] { sort });

        SimpleFeatureCollection features = featureSource.getFeatures(query);
        assertEquals(3, features.size());
View Full Code Here

        }
        finally {
            iterator.close();
        }

        sort = ff.sort(aname("stringProperty"), SortOrder.DESCENDING);
        query.setSortBy(new SortBy[] { sort });
        features = featureSource.getFeatures(query);

        iterator = features.features();
        try {
View Full Code Here

    public void testQueryCapabilitiesSort() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        QueryCapabilities caps = featureSource.getQueryCapabilities();
       
        // check we advertise support for sorting on basic attributes
        assertTrue(caps.supportsSorting(new SortBy[] {ff.sort(aname("intProperty"), SortOrder.ASCENDING)}));
        assertTrue(caps.supportsSorting(new SortBy[] {ff.sort(aname("stringProperty"), SortOrder.DESCENDING)}));
        assertTrue(caps.supportsSorting(new SortBy[] {ff.sort(aname("doubleProperty"), SortOrder.ASCENDING)}));

        // but we cannot sort geometries
        assertFalse(caps.supportsSorting(new SortBy[] {ff.sort(aname("geometry"), SortOrder.ASCENDING)}));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.