Package org.geotools.data.simple

Examples of org.geotools.data.simple.SimpleFeatureSource


    }

    @Test
    public void testQueryCapabilities() throws Exception {
        final String typeName = testData.getTempTableName();
        SimpleFeatureSource fs = store.getFeatureSource(typeName);

        QueryCapabilities queryCapabilities = fs.getQueryCapabilities();
        assertFalse(queryCapabilities.isOffsetSupported());
        assertTrue(queryCapabilities.isReliableFIDSupported());

        assertFalse(queryCapabilities.supportsSorting(new SortBy[] { NATURAL_ORDER }));
        assertFalse(queryCapabilities.supportsSorting(new SortBy[] { REVERSE_ORDER }));
        assertFalse(queryCapabilities.supportsSorting(new SortBy[] { ff.sort("nonExistent",
                ASCENDING) }));

        assertFalse(queryCapabilities.supportsSorting(new SortBy[] { ff.sort("nonExistent",
                ASCENDING) }));

        // no sorting on geometry columns!
        String geometryAttribute = fs.getSchema().getGeometryDescriptor().getLocalName();
        assertFalse(queryCapabilities.supportsSorting(new SortBy[] { ff.sort(geometryAttribute,
                ASCENDING) }));

        SortBy[] supported = { ff.sort("INT32_COL", ASCENDING),//
                ff.sort("INT32_COL", DESCENDING),//
View Full Code Here


    }

    @Test
    public void testFilterDateColumn() throws Exception {
        final String typeName = testData.getTempTableName();
        SimpleFeatureSource fs = store.getFeatureSource(typeName);

        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
        // Year, month, date, hour, minute, second.
        cal.set(2004, 06, 1, 0, 0, 0);
View Full Code Here

    }

    @Test
    public void testSorting() throws Exception {
        final String typeName = testData.getTempTableName();
        SimpleFeatureSource fs = store.getFeatureSource(typeName);

        Query query = new Query(typeName);

        final String sortAtt = "INT32_COL";
        SortBy[] sortBy;
        SimpleFeatureIterator features;

        sortBy = new SortBy[] { ff.sort(sortAtt, ASCENDING) };
        query.setSortBy(sortBy);
        features = fs.getFeatures(query).features();
        try {
            Integer previous = Integer.valueOf(Integer.MIN_VALUE);
            while (features.hasNext()) {
                Integer intVal = (Integer) features.next().getAttribute(sortAtt);
                assertTrue(previous + " < " + intVal + "?", previous.intValue() < intVal.intValue());
                previous = intVal;
            }
        } finally {
            features.close();
        }

        sortBy = new SortBy[] { ff.sort(sortAtt, DESCENDING) };
        query.setSortBy(sortBy);
        features = fs.getFeatures(query).features();
        try {
            Integer previous = Integer.valueOf(Integer.MAX_VALUE);
            while (features.hasNext()) {
                Integer intVal = (Integer) features.next().getAttribute(sortAtt);
                assertTrue(previous + " > " + intVal + "?", previous.intValue() > intVal.intValue());
                previous = intVal;
            }
        } finally {
            features.close();
        }

        sortBy = new SortBy[] { ff.sort(sortAtt, DESCENDING), ff.sort("FLOAT32_COL", ASCENDING) };
        query.setSortBy(sortBy);
        features = fs.getFeatures(query).features();
        try {
            Integer previous = Integer.valueOf(Integer.MAX_VALUE);
            while (features.hasNext()) {
                Integer intVal = (Integer) features.next().getAttribute(sortAtt);
                assertTrue(previous + " > " + intVal + "?", previous.intValue() > intVal.intValue());
View Full Code Here

    @Test
    public void testBboxFilterWithEmptyAttributeName() throws Exception {
        BBOX emptyAttNameFilter = ff.bbox("", -10, -10, 10, 10, "EPSG:4326");
        String typeName = testData.getTempTableName();

        SimpleFeatureSource source;
        source = store.getFeatureSource(typeName);
        SimpleFeatureCollection features;
        features = source.getFeatures(emptyAttNameFilter);

        SimpleFeatureIterator iterator = features.features();
        try {
            assertTrue(iterator.hasNext());
        } finally {
View Full Code Here

    }

    @Test
    public void testRenderPostGIS() throws Exception {
        DataStore dataStore = getPostGISDataStore();
        SimpleFeatureSource featureSource;
        featureSource = dataStore.getFeatureSource(postgisTypeName);
        try {
            testRender(featureSource);
        } finally {
            dataStore.dispose();
View Full Code Here

    }

    @Test
    public void testRenderShapefile() throws Exception {
        DataStore dataStore = getShapefileDataStore();
        SimpleFeatureSource featureSource;
        featureSource = dataStore.getFeatureSource(shapefileTypeName);
        try {
            testRender(featureSource);
        } finally {
            dataStore.dispose();
View Full Code Here

        }
    }

    @Test
    public void testRenderArcSDE() throws Exception {
        SimpleFeatureSource featureSource;
        ArcSDEDataStore dataStore = testData.getDataStore();
        featureSource = dataStore.getFeatureSource(typeName);
        try {
            testRender(featureSource);
        } finally {
View Full Code Here

    }

    @Test
    public void testFeatureSourceArcSDE() throws IOException {
        DataStore dataStore = testData.getDataStore();
        SimpleFeatureSource featureSource;
        featureSource = dataStore.getFeatureSource(typeName);
        try {
            testFeatureSource(featureSource);
        } finally {
            dataStore.dispose();
View Full Code Here

    }

    @Test
    public void testFeatureSourcePostGIS() throws IOException {
        DataStore dataStore = getPostGISDataStore();
        SimpleFeatureSource featureSource;
        featureSource = dataStore.getFeatureSource(postgisTypeName);

        try {
            testFeatureSource(featureSource);
        } finally {
View Full Code Here

    }

    @Test
    public void testFeatureSourceShapefile() throws IOException {
        DataStore dataStore = getShapefileDataStore();
        SimpleFeatureSource featureSource;
        featureSource = dataStore.getFeatureSource(shapefileTypeName);

        try {
            testFeatureSource(featureSource);
        } finally {
View Full Code Here

TOP

Related Classes of org.geotools.data.simple.SimpleFeatureSource

Copyright © 2018 www.massapicom. 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.