Package org.geotools.data

Examples of org.geotools.data.ResourceInfo


        return dataStore.getFeatureSource(name);
    }
    @Override
    protected IGeoResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
        SimpleFeatureSource featureSource = toFeatureSource();
        ResourceInfo gtInfo = featureSource.getInfo();
        return new FeatureSourceGeoResourceInfo(gtInfo);
    }
View Full Code Here


        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = ds
                .getFeatureSource(wfsResource.typename);
       
        writable = featureSource instanceof FeatureStore;

        ResourceInfo resourceInfo = featureSource.getInfo();
        SimpleFeatureType ft = null;
        try {
            ft = ds.getSchema(wfsResource.typename);
        } catch (Exception crippled) {
            // unable to handle the describe feature type response for this
            // typeName
            if (WfsPlugin.getDefault().isDebugging()) {
                crippled.printStackTrace();
            }
        }
        bounds = resourceInfo.getBounds();
       
        // relax bounds for wfs ...
        // bounds = ReferencedEnvelopeCache.getReferencedEnvelope( crs );
       
        description = resourceInfo.getDescription();
        title = resourceInfo.getTitle();

        crs = resourceInfo.getCRS();
        if (crs == null && ft != null) {
            crs = ft.getCoordinateReferenceSystem();
        }
       
        name = wfsResource.typename;
        schema = resourceInfo.getSchema();
        if (schema == null) {
            try {
                if (ft != null) {
                    schema = new URI(ft.getName().getNamespaceURI());
                } else {
                    schema = wfsResource.parent.getID().toURI();
                }
            } catch (URISyntaxException e) {
                schema = null;
            }
        }
        Set<String> tags = new TreeSet<String>();
        try {
            tags.addAll(resourceInfo.getKeywords());
        } catch (Throwable t) {
            WfsPlugin.trace("Could not retrieve keywords", t); //$NON-NLS-1$
            // no keywords for you
        }
        tags.addAll(Arrays.asList(new String[]{"wfs", wfsResource.typename})); //$NON-NLS-1$
View Full Code Here

    String title = serviceInfo.getTitle();
        String version = "1.0.0"; // only known entry at this time //$NON-NLS-1$
        URI source = serviceInfo.getSource();
        String get = source == null? "" : source.toString();
       
        ResourceInfo resourceInfo = wfs.getFeatureSource(typeName).getInfo();
        append( 4, out, "<SimpleFeatureType hidden=\""+ hidden +"\">" ); //$NON-NLS-1$ //$NON-NLS-2$
        append( 6, out,   "<Server service=\"OGC:WFS\" title=\""+title+"\" version=\""+version+"\">" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        append( 8, out,     "<OnlineResource method=\"GET\" xlink:href=\""+get+"\" xlink:type=\"simple\"/>" ); //$NON-NLS-1$ //$NON-NLS-2$
        append( 6, out,   "</Server>" ); //$NON-NLS-1$
        append( 6, out,   "<Name>"+typeName+"</Name>"); //$NON-NLS-1$ //$NON-NLS-2$
        append( 6, out,   "<Title>"+resourceInfo.getTitle()+"</Title>");     //$NON-NLS-1$ //$NON-NLS-2$
    //if( !Double.isNaN( layer.getMinScaleDenominator() ))
//        append( 6, out,   "<sld:MinScaleDenominator>"+layer.getMinScaleDenominator()+"</sld:MinScaleDenominator>");
//if( !Double.isNaN( layer.getMaxScaleDenominator() ))
//        append( 6, out,   "<sld:MinScaleDenominator>"+layer.getMaxScaleDenominator()+"</sld:MinScaleDenominator>");
        String SRS="EPSG:4326";
        CoordinateReferenceSystem crs = resourceInfo.getCRS();
        //TODO: anyone knows how to get the urn for the crs object?
    append( 6, out,   "<SRS>"+ SRS +"</SRS>"); //$NON-NLS-1$ //$NON-NLS-2$
        append( 4, out, "</SimpleFeatureType>" ); //$NON-NLS-1$
    }
View Full Code Here

    }
    @Override
    protected IGeoResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
        DataStore dataStore = getDataStore(monitor);
        FeatureSource<SimpleFeatureType, SimpleFeature> fs = dataStore.getFeatureSource(typename);
        ResourceInfo gtinfo = fs.getInfo();
        GeotoolsResourceInfoAdapter vectorInfo = new GeotoolsResourceInfoAdapter(gtinfo);

        // IResolveDelta delta = new ResolveDelta(this, IResolveDelta.Kind.CHANGED);
        // ((CatalogImpl) CatalogPlugin.getDefault().getLocalCatalog())
        // .fire(new ResolveChangeEvent(this, IResolveChangeEvent.Type.POST_CHANGE, delta));
View Full Code Here

    public void testStates() {
        Layer states = find("topp:states");
        assertNotNull(states);

        ResourceInfo info = wms.getInfo(states);
        assertNotNull(info);
        assertEquals(states.getTitle(), info.getTitle());

        ReferencedEnvelope bounds = info.getBounds();
        assertNotNull(bounds);
        assertFalse(bounds.isEmpty());
    }
View Full Code Here

    @Test
    public void testInfo() throws IOException {
        SimpleFeatureStore store1 = (SimpleFeatureStore) data.getFeatureSource(getRoadTypeName());
       
        ResourceInfo info = store1.getInfo();
      
        assertEquals("roads", info.getName());
        assertEquals("Generated from sfRoads", info.getDescription());
        assertTrue(info.getKeywords().contains("sfRoads roads"));
        assertEquals("roads_Type", info.getTitle());
        assertEquals("http://www.openplans.org/spearfish", info.getSchema().toString());
        assertEquals(589275.24, info.getBounds().getMinX(),0.01);
        assertEquals("EPSG:NAD27 / UTM zone 13N", info.getCRS().getName().toString());
    }
View Full Code Here

    public SimpleFeatureType getSchema() {
        return schema;
    }

    public ResourceInfo getInfo() {
        return new ResourceInfo(){
            final Set<String> words = new HashSet<String>();
            {
                words.add("features");
                words.add("view");
                words.add( DefaultView.this.getSchema().getTypeName() );
View Full Code Here

     * Subclasses should override to provide an explicit ResourceInfo
     * object for their content.
     * @return description of features contents
     */
    public ResourceInfo getInfo() {
        return new ResourceInfo(){
            final Set<String> words = new HashSet<String>();
            {
                words.add("features");
                words.add( ContentFeatureSource.this.getSchema().getTypeName() );
            }
View Full Code Here

     *
     * @return ResoruceInfo from the capabilities document
     * @see FeatureSource#getInfo()
     */
    public ResourceInfo getInfo() {
        return new ResourceInfo(){
            public ReferencedEnvelope getBounds() {
                try {
                    return ds.getBounds(new Query(fname));
                } catch (IOException e) {
                    return new ReferencedEnvelope();
View Full Code Here

        SimpleFeatureSource featureSource;
        featureSource = wfs.getFeatureSource(testType.FEATURETYPENAME);

        assertNotNull(featureSource);

        ResourceInfo info = featureSource.getInfo();
        assertNotNull(info.getCRS());

        ReferencedEnvelope bounds = info.getBounds();
        assertSame(info.getCRS(), bounds.getCoordinateReferenceSystem());

        assertEquals(testType.FEATURETYPENAME, info.getName());
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.ResourceInfo

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.