Examples of SLDTransformer


Examples of org.geotools.styling.SLDTransformer

            String fileName = "point.sld";
            when(this.style.getFilename() ).thenReturn(fileName );
            when(this.style.getWorkspace() ).thenReturn( layerBuilder.workspaceBuilder.workspace );
            when(this.style.getFormat()).thenReturn("sld");
            ByteArrayOutputStream content = new ByteArrayOutputStream();
            SLDTransformer tx = new SLDTransformer();
            tx.setIndentation(2);
            try {
                tx.transform( style, content );
                resources.resource(Paths.path("workspaces",wsName,"styles",fileName), content.toString() );
            } catch (TransformerException e) {
                throw new RuntimeException(e);
            }
            return this;
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

    protected FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);

    protected void print(Object styleObject) {
        try {
            SLDTransformer tx = new SLDTransformer();
            tx.setIndentation(2);
            System.out.println(tx.transform(styleObject));
        } catch (Exception e) {
            throw new RuntimeException("An error occurred while printing the style", e);
        }
    }
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

  private void convertToSLD_1_0() {
    if (style == null) {
      JOptionPane.showMessageDialog(this, "Style not defined");
      return;
    }
    SLDTransformer aTransformer = new SLDTransformer();
    aTransformer.setIndentation(4);
    try {
      String document = aTransformer.transform(style);

      display(document, SLD_1_0);
    } catch (TransformerException e) {
      e.printStackTrace();
      return;
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

        UserLayer layer = sf.createUserLayer();
        layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});
        sld.addStyledLayer(layer);
        layer.addUserStyle(style);

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

Examples of org.geotools.styling.SLDTransformer

        UserLayer layer = sf.createUserLayer();
        layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});
        sld.addStyledLayer(layer);
        layer.addUserStyle(style);

        SLDTransformer styleTransform = new SLDTransformer();
        String xml = styleTransform.transform(sld);

        return xml;
    }
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

    JSONObject ruleSz = null;
    String xmlRule;
    XMLSerializer xmlS = new XMLSerializer();

    SLDTransformer transform = new SLDTransformer();
    transform.setIndentation(2);
    try {
      xmlRule = transform.transform(rule);
      xmlS.setRemoveNamespacePrefixFromElements(true);
      xmlS.setSkipNamespaces(true);
      ruleSz = (JSONObject) xmlS.read(xmlRule);
    } catch (TransformerException e) {
      e.printStackTrace();
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

    final StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
    sld.setStyledLayers(new StyledLayer[] {
      nl
    });
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final SLDTransformer writer = new SLDTransformer();
    try {
      writer.transform(
          sld,
          baos);
    }
    catch (final TransformerException e) {
      LOGGER.warn(
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

            scala.collection.Seq<org.geoscript.geocss.Rule> rules = CssParser.parse(css).get();
            Translator translator =
                new Translator(scala.Option.apply(styleDir.toURI().toURL()));
            Style style = translator.css2sld(rules);

            SLDTransformer tx = new org.geotools.styling.SLDTransformer();
            tx.setIndentation(2);
            StringWriter sldChars = new java.io.StringWriter();
            tx.transform(style, sldChars);
            return sldChars.toString();
        } catch (Exception e) {
            throw new WicketRuntimeException("Error while parsing stylesheet [" + css + "] : " + e);
        }
    }
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

    JSONObject ruleSz = null;
    String xmlRule;
    XMLSerializer xmlS = new XMLSerializer();

    SLDTransformer transform = new SLDTransformer();
    transform.setIndentation(2);
    try {
      xmlRule = transform.transform(rule);
      xmlS.setRemoveNamespacePrefixFromElements(true);
      xmlS.setSkipNamespaces(true);
      ruleSz = (JSONObject) xmlS.read(xmlRule);
    } catch (TransformerException e) {
      if (LOGGER.isLoggable(Level.FINE))
View Full Code Here

Examples of org.geotools.styling.SLDTransformer

    @Override
    public void write(Object value, OutputStream output, Operation operation) throws IOException,
            ServiceException {
        StyledLayerDescriptor sld = (StyledLayerDescriptor) value;

        SLDTransformer tx = new SLDTransformer();
        try {
            tx.setIndentation(4);
            tx.transform(sld, output);
        } catch (TransformerException e) {
            throw new ServiceException(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.