Package org.geotools.styling

Examples of org.geotools.styling.SLDTransformer.transform()


        sld.addStyledLayer(layer);
        layer.addUserStyle(style);

        SLDTransformer aTransformer = new SLDTransformer();
        aTransformer.setIndentation(4);
        String xml = aTransformer.transform(sld);
        return xml;
    }

    public Style getStyle() {
        return style;
View Full Code Here


        sld.addStyledLayer(layer);
        layer.addUserStyle(style);

        SLDTransformer aTransformer = new SLDTransformer();
        aTransformer.setIndentation(4);
        String xml = aTransformer.transform(sld);
        return xml;
    }

    /**
     * Generates a style based on a graphic.
View Full Code Here

        // serialize out the style objects
        SLDTransformer sldWriter = new SLDTransformer();
        String out = ""; //$NON-NLS-1$
        try {
            out = sldWriter.transform(style);
        } catch (TransformerException e) {
            SLDPlugin.log("SLDTransformer failed", e); //$NON-NLS-1$
            e.printStackTrace();
        } catch (Exception e) {
            SLDPlugin.log("SLDTransformer failed", e); //$NON-NLS-1$
View Full Code Here

        SLDTransformer aTransformer = new SLDTransformer();
        aTransformer.setIndentation(StyleEditor.INDENT);
        String xml = ""; //$NON-NLS-1$
        if (target instanceof StyledLayerDescriptor) {
            StyledLayerDescriptor sld = (StyledLayerDescriptor) target;
            xml = aTransformer.transform(sld);
        } else {
            SLDPlugin.log("StyledLayerDescriptor not found", null); //$NON-NLS-1$
            throw (IOException) new IOException("SLD not found"); //$NON-NLS-1$
        }
        FileWriter w = new FileWriter(file);
View Full Code Here

   
    public static String styleToXML(StyledLayerDescriptor sld) {
        SLDTransformer aTransformer = new SLDTransformer();
        aTransformer.setIndentation(StyleEditor.INDENT);
        try {
            return aTransformer.transform(sld);
        } catch (TransformerException e) {
            e.printStackTrace();
            return null;
        }
    }
View Full Code Here

    if (id.isFile()) {
      try {
        File file = id.toFile();
        SLDTransformer aTransformer = new SLDTransformer();
        aTransformer.setIndentation(StyleEditor.INDENT);
        String xml = aTransformer.transform(getSLD());
        File newFile = new File(file.getParent(), FilenameUtils
            .getBaseName(file.getAbsolutePath())
            + SLD_EXTENSION);
        FileUtils.writeStringToFile(newFile, xml);
        MessageDialog.openInformation(getShell(), Messages.SingleBandEditorPage_ExportOkDialogTitle, Messages.SingleBandEditorPage_ExportOkDialogMessage);
View Full Code Here

        SLDTransformer writer = new SLDTransformer();
        if (prettyPrint) {
            writer.setIndentation(2);
        }
        try {
            writer.transform( sld, out );
        }
        catch (TransformerException e) {
            throw (IOException) new IOException().initCause(e);
        }
    }
View Full Code Here

                SLDTransformer tx = new SLDTransformer();
                if (format) {
                    tx.setIndentation(2);
                }
                try {
                    tx.transform( style, out );
                }
                catch (TransformerException e) {
                    throw (IOException) new IOException("Error writing style").initCause(e);
                }
                clear(info);
View Full Code Here

        StyledLayerDescriptor sld = (StyledLayerDescriptor) value;

        SLDTransformer tx = new SLDTransformer();
        try {
            tx.setIndentation(4);
            tx.transform(sld, output);
        } catch (TransformerException e) {
            throw new WmsException(e);
        }
    }
View Full Code Here

                            final UserLayer userLayer = styleFactory.createUserLayer();
                            userLayer.addUserStyle(style.get());
                            final StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
                            sld.addStyledLayer(userLayer);
                            if (LOGGER.isDebugEnabled()) {
                                LOGGER.debug("Loaded style from: \n\n '" + styleString + "': \n\n" + transformer.transform(sld));
                            }
                        } catch (Exception e) {
                            LOGGER.debug("Loaded style from: \n\n '" + styleString + "' \n\n<Unable to transform it to xml>: " + e, e);
                        }
                    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.