Package org.geotools.data.store

Examples of org.geotools.data.store.ContentFeatureSource


            t[i].start();
        }
        for (int i = 0; i < t.length; i++) {
            t[i].join();
        }
        ContentFeatureSource featureSource = dataStore.getFeatureSource(tname("ft2"));
        int size = featureSource.getFeatures().size();
        if (errors[0]) fail();
    }
View Full Code Here


        assertEquals(new Coordinate(10, 51), ls2.getCoordinateN(1));
    }

    @Test
    public void testCompoundClosed() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Closed mixed line"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
        assertNotNull(g);
        assertTrue(g instanceof CompoundCurvedGeometry<?>);
View Full Code Here

        assertArrayEquals(new double[] { 20, 78, 15, 80, 10, 78 }, cs.getControlPoints(), 0d);
    }

    @Test
    public void testCircle() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")), ff.literal("Circle"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
        assertNotNull(g);
        assertTrue(g instanceof Polygon);
View Full Code Here

        assertEquals(new Coordinate(15, 150), arc.getCenter());
    }

    @Test
    public void testCompoundPolygon() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Compound polygon"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
        assertNotNull(g);
        assertTrue(g instanceof Polygon);
View Full Code Here

        assertArrayEquals(new double[] { 14, 10, 10, 14, 6, 10 }, cs.getControlPoints(), 0d);
    }

    @Test
    public void testCompoundPolygonWithHole() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Compound polygon with hole"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
        assertNotNull(g);
        assertTrue(g instanceof Polygon);
View Full Code Here

        assertEquals(new Coordinate(15, 17), arc.getCenter());
    }

    @Test
    public void testMultipolygon() throws Exception {
        ContentFeatureSource fs = dataStore.getFeatureSource(tname("curves"));
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyIsEqualTo filter = ff.equal(ff.property(aname("name")),
                ff.literal("Multipolygon with curves"), true);
        ContentFeatureCollection fc = fs.getFeatures(filter);
        assertEquals(1, fc.size());
        SimpleFeature feature = DataUtilities.first(fc);
        Geometry g = (Geometry) feature.getDefaultGeometry();
        assertNotNull(g);
        assertTrue(g instanceof MultiPolygon);
View Full Code Here

    protected List<ConnectionLifecycleListener> connectionLifecycleListeners = new CopyOnWriteArrayList<ConnectionLifecycleListener>();

    private volatile NamePatternEscaping namePatternEscaping;

    public JDBCFeatureSource getAbsoluteFeatureSource(String typeName) throws IOException {
        ContentFeatureSource featureSource = getFeatureSource(typeName);
        if (featureSource instanceof JDBCFeatureSource) {
            return (JDBCFeatureSource) featureSource;
        }
        return ((JDBCFeatureStore)featureSource).getFeatureSource();
    }
View Full Code Here

    }

    // disabled as the liter coordinate sequence has still not been updated to support 3d data
    public void testRendererBehaviour() throws Exception {
        // make sure the hints are supported
        ContentFeatureSource fs = dataStore.getFeatureSource(tname(LINE3D));
        assertTrue(fs.getSupportedHints().contains(Hints.JTS_COORDINATE_SEQUENCE_FACTORY));

        // setup a query that mimicks the streaming renderer behaviour
        DefaultQuery q = new DefaultQuery(tname(LINE3D));
        Hints hints = new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY,
                new LiteCoordinateSequenceFactory());
        q.setHints(hints);

        // check the srs you get is the expected one
        FeatureCollection fc = fs.getFeatures(q);
        FeatureType fcSchema = fc.getSchema();
        assertEquals(epsg4326, fcSchema.getCoordinateReferenceSystem());
        assertEquals(epsg4326, fcSchema.getGeometryDescriptor().getCoordinateReferenceSystem());

        // build up the reference 2d line, the 3d one is (1 1 0, 2 2 0, 4 2 1, 5
View Full Code Here

        // not in the headers
        URL u = TestData.url(TestCaseSupport.class, "deleted/archsites.dbf");
        File shpFile = DataUtilities.urlToFile(u);
       
        ShapefileDataStore store = new ShapefileDataStore(DataUtilities.fileToURL(shpFile));
        ContentFeatureSource fs = store.getFeatureSource();
        // this one reads the shp header, which still contains trace of all records
        assertEquals(25, fs.getCount(Query.ALL));
        // now read manually and check we skip the records with the dbf entry marked as deleted
        SimpleFeatureIterator fi = fs.getFeatures().features();
        int count = 0;
        while(fi.hasNext()) {
            fi.next();
            count++;
        }
View Full Code Here

        });
    }

    public void testNearestNeighbor() throws Exception {
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        ContentFeatureSource source = dataStore.getFeatureSource(tname("NEIGHBORS"));

        SimpleFeatureIterator features = execSdoNN(source, ff, -10, -10, 1, -1, null);
        try {
            assertTrue(features.hasNext());
            SimpleFeature f = features.next();
View Full Code Here

TOP

Related Classes of org.geotools.data.store.ContentFeatureSource

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.