Search in sources :

Example 6 with StyleFactory

use of org.geotools.styling.StyleFactory in project hale by halestudio.

the class SLDStyleReader method execute.

/**
 * @see AbstractIOProvider#execute(ProgressIndicator, IOReporter)
 */
@Override
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException {
    progress.begin("Load styles from SLD", ProgressIndicator.UNKNOWN);
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
    InputStream in = getSource().getInput();
    try {
        SLDParser stylereader = new SLDParser(styleFactory, in);
        styles = stylereader.readXML();
        reporter.setSuccess(true);
    } catch (Exception e) {
        reporter.error(new IOMessageImpl("Loading styles from SLD failed.", e));
        reporter.setSuccess(false);
    } finally {
        in.close();
        progress.end();
    }
    return reporter;
}
Also used : StyleFactory(org.geotools.styling.StyleFactory) InputStream(java.io.InputStream) IOMessageImpl(eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl) SLDParser(org.geotools.styling.SLDParser) IOProviderConfigurationException(eu.esdihumboldt.hale.common.core.io.IOProviderConfigurationException) IOException(java.io.IOException)

Aggregations

StyleFactory (org.geotools.styling.StyleFactory)6 StyledLayerDescriptor (org.geotools.styling.StyledLayerDescriptor)5 ExternalGraphic (org.geotools.styling.ExternalGraphic)3 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)3 Graphic (org.geotools.styling.Graphic)3 NamedLayer (org.geotools.styling.NamedLayer)3 Rule (org.geotools.styling.Rule)3 SLDParser (org.geotools.styling.SLDParser)3 Style (org.geotools.styling.Style)3 StyleBuilder (org.geotools.styling.StyleBuilder)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 URL (java.net.URL)2 Stroke (org.geotools.styling.Stroke)2 IOProviderConfigurationException (eu.esdihumboldt.hale.common.core.io.IOProviderConfigurationException)1 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 MalformedURLException (java.net.MalformedURLException)1 Fill (org.geotools.styling.Fill)1 LineSymbolizer (org.geotools.styling.LineSymbolizer)1