Package org.geotools.styling

Examples of org.geotools.styling.DefaultResourceLocator


    protected static Style loadSEStyle(Object loader, String sldFilename) throws IOException {
        try {
            final java.net.URL surl = TestData.getResource(loader, sldFilename);
            SLDConfiguration configuration = new SLDConfiguration() {
                protected void configureContext(org.picocontainer.MutablePicoContainer container) {
                    DefaultResourceLocator locator = new DefaultResourceLocator();
                    locator.setSourceUrl(surl);
                    container.registerComponentInstance(ResourceLocator.class, locator);
                };
            };
            Parser parser = new Parser(configuration);
View Full Code Here


    @Override
    protected void configureContext(MutablePicoContainer container) {
        super.configureContext(container);
       
        container.registerComponentImplementation(StyleFactory.class, StyleFactoryImpl.class);
        container.registerComponentInstance(ResourceLocator.class, new DefaultResourceLocator());
    }
View Full Code Here

     */
    protected void configureContext(MutablePicoContainer container) {
        super.configureContext(container);

        container.registerComponentImplementation(StyleFactory.class, StyleFactoryImpl.class);
        container.registerComponentInstance(ResourceLocator.class, new DefaultResourceLocator());
    }
View Full Code Here

    protected @Nonnull Style parsedStyleResources(StyleInfo s) throws IOException {
        final Resource styleResource = style(s);
        if ( styleResource.getType() == Type.UNDEFINED ){
            throw new IOException( "No such resource: " + s.getFilename());
        }
        final DefaultResourceLocator locator = new DefaultResourceLocator();
        locator.setSourceUrl(resourceToUrl(styleResource));
        StyledLayerDescriptor sld =
            Styles.handler(s.getFormat()).parse(styleResource, s.getFormatVersion(), locator, null);
        final Style style = Styles.style(sld);
        assert style!=null;
        return style;
View Full Code Here

        if ( styleResource.getType() == Type.UNDEFINED ){
            throw new IOException( "No such resource: " + s.getFilename());
        }
        File input = styleResource.file();

        DefaultResourceLocator locator = new DefaultResourceLocator() {
           
            @Override
            public URL locateResource(String uri) {
                URL url = super.locateResource(uri);
                if(url.getProtocol().equalsIgnoreCase("resource")) {
                    return fileToUrlPreservingCqlTemplates(urlToResource(url).file());
                } else {
                    return url;
                }
            }
           
        };
        locator.setSourceUrl(resourceToUrl(styleResource));
        final StyledLayerDescriptor sld =
            Styles.handler(s.getFormat()).parse(input, s.getFormatVersion(), locator, null);
        final Style style = Styles.style(sld);
       
        assert style!=null;
View Full Code Here

TOP

Related Classes of org.geotools.styling.DefaultResourceLocator

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.