Search in sources :

Example 21 with StyleXmlIO

use of org.geotoolkit.sld.xml.StyleXmlIO in project geotoolkit by Geomatys.

the class MapfileToSLDProcess method execute.

@Override
protected void execute() throws ProcessException {
    final File mapfile = inputParameters.getValue(IN_FILE);
    final File sldfile = inputParameters.getValue(IN_OUTPUT);
    final MapfileReader reader = new MapfileReader();
    reader.setInput(mapfile);
    try {
        mapfileFeature = reader.read();
        final MutableStyledLayerDescriptor sld = SLDF.createSLD();
        // convert it
        convert(sld, mapfileFeature);
        // avoid memory leak
        mapfileFeature = null;
        // write the sld
        final StyleXmlIO utils = new StyleXmlIO();
        utils.writeSLD(sldfile, sld, StyledLayerDescriptor.V_1_1_0);
    } catch (IOException ex) {
        throw new ProcessException(ex.getMessage(), this, ex);
    } catch (JAXBException ex) {
        throw new ProcessException(ex.getMessage(), this, ex);
    }
}
Also used : ProcessException(org.geotoolkit.process.ProcessException) JAXBException(javax.xml.bind.JAXBException) StyleXmlIO(org.geotoolkit.sld.xml.StyleXmlIO) IOException(java.io.IOException) File(java.io.File) MutableStyledLayerDescriptor(org.geotoolkit.sld.MutableStyledLayerDescriptor)

Aggregations

StyleXmlIO (org.geotoolkit.sld.xml.StyleXmlIO)21 Test (org.junit.Test)6 MutableStyle (org.geotoolkit.style.MutableStyle)5 Path (java.nio.file.Path)4 List (java.util.List)3 Expression (org.opengis.filter.Expression)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 ContentType (org.geotoolkit.owc.xml.v10.ContentType)2 StyleSetType (org.geotoolkit.owc.xml.v10.StyleSetType)2 UserStyle (org.geotoolkit.sld.xml.v110.UserStyle)2 BufferedImage (java.awt.image.BufferedImage)1 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 Icon (javax.swing.Icon)1 ImageIcon (javax.swing.ImageIcon)1 Envelope2D (org.apache.sis.geometry.Envelope2D)1 MapLayer (org.apache.sis.portrayal.MapLayer)1