Package org.geotools.styling

Examples of org.geotools.styling.SLDParser.readXML()


        StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
        URL styleURL = TestData.getResource(this, "raster-cmalpha.sld");

        SLDParser stylereader = new SLDParser(factory, styleURL);

        Style style = stylereader.readXML()[0];

        OpacityFinder opacityFinder = new OpacityFinder(new Class[] { RasterSymbolizer.class });

        style.accept(opacityFinder);
View Full Code Here


    Style style(String name) throws Exception {
        // return RendererBaseTest.loadStyle(this, "test-data/obstacles/" + name + ".sld");
        SLDParser p = new SLDParser(CommonFactoryFinder.getStyleFactory(null), getClass()
                .getResourceAsStream("test-data/obstacles/" + name + ".sld"));
        return p.readXML()[0];
    }

    Style[] styles(String... names) throws Exception {
        List<Style> styles = new ArrayList();
        for (String name : names) {
View Full Code Here

        final Style style;
        if ( sld != null )
        {
            final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory( null );
            final SLDParser stylereader = new SLDParser( styleFactory, sld );
            final Style[] styles = stylereader.readXML();

            style = styles[ 0 ];
        }
        else
        {
View Full Code Here

        com.vividsolutions.jts.geom.Envelope env = fs.getBounds();
        myMapPane.setMapArea( env );
        StyleFactory factory = CommonFactoryFinder.getStyleFactory( null );

        SLDParser stylereader = new SLDParser( factory, sld );
        org.geotools.styling.Style[] style = stylereader.readXML();

        CoordinateReferenceSystem crs = fs.getSchema().getDefaultGeometry().getCoordinateSystem();
        if ( crs == null )
        {
            crs = DefaultGeographicCRS.WGS84;
View Full Code Here

        com.vividsolutions.jts.geom.Envelope env = fs.getBounds();
        myMapPane.setMapArea( env );
        StyleFactory factory = CommonFactoryFinder.getStyleFactory( null );

        SLDParser stylereader = new SLDParser( factory, sld );
        org.geotools.styling.Style[] style = stylereader.readXML();

        CoordinateReferenceSystem crs = fs.getSchema().getDefaultGeometry().getCoordinateSystem();
        if ( crs == null )
        {
            crs = DefaultGeographicCRS.WGS84;
View Full Code Here

    StyleFactory factory = CommonFactoryFinder.getStyleFactory();

    StringReader reader = new StringReader(text.getText());
    SLDParser sldParser = new SLDParser(factory, reader);

    Style[] parsed = sldParser.readXML();
    if (parsed != null && parsed.length > 0) {
      style = parsed[0];
    }
  }
View Full Code Here

     * @return the created {@link Style} or <code>null</code>.
     */
    public static Style createFromSLD( File sld ) {
        try {
            SLDParser stylereader = new SLDParser(styleFactory, sld.toURI().toURL());
            Style[] style = stylereader.readXML();
            return style[0];

        } catch (Exception e) {
            ExceptionMonitor.show(null, e, "Problem creating style");
        }
View Full Code Here

    private Style[] parseSld(Reader xmlIn) throws ServiceException {
        SLDParser parser = new SLDParser(styleFactory, xmlIn);
        Style[] styles = null;

        try {
            styles = parser.readXML();
        } catch (RuntimeException e) {
            throw new ServiceException(e);
        }

        if ((styles == null) || (styles.length == 0)) {
View Full Code Here

                if(obj instanceof File) {
                  parser.setInput(new FileReader((File)obj));
                }else{
                  parser.setInput(new StringReader(obj.toString()));
                }
                  Style[] styles = parser.readXML();
          result = styles[0];
              }
              catch (Exception e) {
                  System.err.println("Error loading style '"+obj+"': "+e.getMessage());
                  e.printStackTrace(System.err);
View Full Code Here

     * Create a Style object from a definition in a SLD document
     */
    private Style createStyleFromSLD(String sldFile) {
        try {
            SLDParser stylereader = new SLDParser(styleFactory, new File(sldFile).toURI().toURL());
            Style[] style = stylereader.readXML();
            return style[0];
        } catch (Exception e) {
      System.err.println("Failed to read style from '" + sldFile + "': " + e.getMessage());
        }
        return null;
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.