Package org.geotools.styling

Examples of org.geotools.styling.SLDParser$EmptyIcon


    private Style getStyle(final String styleName) {
        Style style = STYLES.get(styleName);
        if (style == null) {
            StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(GeoTools
                    .getDefaultHints());
            SLDParser parser = new SLDParser(styleFactory);
            try {
                parser.setInput(getClass().getResource(styleName));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            StyledLayerDescriptor sld = parser.parseSLD();
            UserLayer layer = (UserLayer) sld.getStyledLayers()[0];
            style = layer.getUserStyles()[0];
            STYLES.put(styleName, style);
        }
        return style;
View Full Code Here


    /**
     * Parses an sld document.
     */
    private StyledLayerDescriptor parseSld(InputStream input) {
        SLDParser parser = new SLDParser(styleFactory, input);

        return parser.parseSLD();
    }
View Full Code Here

            javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();

            InputSource input = new InputSource(xml);
            org.w3c.dom.Document dom = db.parse(input);

            SLDParser sldParser = new SLDParser(styleFactory);

            Node rootNode = dom.getDocumentElement();

            // we have the SLD component, now we get all the GetMAp components
            // step a  -- attribute "version"
            Node nodeGetMap = rootNode;

            if (!(nodeNameEqual(nodeGetMap, "getmap"))) {
                if (nodeNameEqual(nodeGetMap, "StyledLayerDescriptor")) //oopsy!!  its a SLD POST with get parameters!
                 {
                    if (validateSchema) {
                        validateSchemaSLD(temp, getMapRequest);
                    }

                    handlePostGet(rootNode, sldParser, getMapRequest);

                    return;
                }

                throw new Exception(
                    "GetMap XML parser - start node isnt 'GetMap' or 'StyledLayerDescriptor' tag");
            }

            if (validateSchema) {
                validateSchemaGETMAP(temp, getMapRequest);
            }

            NamedNodeMap atts = nodeGetMap.getAttributes();
            Node wmsVersion = atts.getNamedItem("version");

            if (wmsVersion == null) {
                throw new Exception(
                    "GetMap XML parser - couldnt find attribute 'version' in GetMap tag");
            }

            getMapRequest.setVersion(wmsVersion.getNodeValue());

            //ignore the OWSType since we know its supposed to be WMS
            //step b -bounding box
            parseBBox(getMapRequest, nodeGetMap);

            // for SLD we already have it (from above) (which we'll handle as layers later)
            StyledLayerDescriptor sld = sldParser.parseDescriptor(getNode(rootNode,
                        "StyledLayerDescriptor"));
            processStyles(getMapRequest, sld);

            //step c - "Output"
            parseXMLOutput(nodeGetMap, getMapRequest); //make this function easier to read
View Full Code Here

            throw new IllegalArgumentException( "request must be not null" );
        }
       
        GetMapRequest getMap = (GetMapRequest) request;
        StyledLayerDescriptor sld =
            new SLDParser( styleFactory, reader ).parseSLD();
       
        //process the sld
        GetMapKvpRequestReader.processStandaloneSld(getMap, sld);
   
        return getMap;
View Full Code Here

        fakeFilePath = realMapDescDirectoryPath + styleSource;
        file = new File(PathUtil.fakePathToReal(fakeFilePath));
      }
      if (file.exists() && file.isFile()) {
        StyleFactory styleFactory = new StyleFactoryImpl();
        SLDParser sldParser = new SLDParser(styleFactory, file);
        Style[] styles = sldParser.readXML();
        style = styles[0];
      }
    }

    return style;
View Full Code Here

        result = defaultFeatureStyles.get(key);
      } else {
        InputStream stream = DefaultStyleManager.class
            .getResourceAsStream(key + ".sld");
        StyleFactory styleFactory = new StyleFactoryImpl();
        SLDParser sldParser = new SLDParser(styleFactory, stream);
        Style[] styles = sldParser.readXML();
        result = styles[0];
        defaultFeatureStyles.put(key, result);
      }
    }
View Full Code Here

        BufferedReader reader = null;
        final Style[] styles;
        try {
            reader = charSource.openBufferedStream();

            final SLDParser sldParser = new SLDParser(CommonFactoryFinder.getStyleFactory());
            sldParser.setInput(reader);
            styles = sldParser.readXML();

        } catch (Throwable e) {
            return Optional.absent();
        } finally {
            Closeables.close(reader, true);
View Full Code Here

     */
    protected static Style loadStyle(Object loader, String sldFilename) throws IOException {
        StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);

        java.net.URL surl = TestData.getResource(loader, sldFilename);
        SLDParser stylereader = new SLDParser(factory, surl);

        Style style = stylereader.readXML()[0];
        return style;
    }
View Full Code Here

    //
    // Test using an SLD file
    //
    ////
    final URL sldURL = TestData.url(this, "colormap.sld");
    final SLDParser stylereader = new SLDParser(sf, sldURL);
    final StyledLayerDescriptor sld = stylereader.parseSLD();

    // get a coverage
    GeneralEnvelope envelope = new GeneralEnvelope(new double[] { -180,-90 },new double[] { 180,90 });
    envelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
          GridCoverage2D gc = CoverageFactoryFinder
View Full Code Here

                //
                // Test using an SLD file
                //
                ////
                final URL sldURL = TestData.url(this, "colormap.sld");
                final SLDParser stylereader = new SLDParser(sf, sldURL);
                final StyledLayerDescriptor sld = stylereader.parseSLD();

                // get a coverage
                GridCoverage2D gc = CoverageFactoryFinder
                                .getGridCoverageFactory(null)
                                .create(
View Full Code Here

TOP

Related Classes of org.geotools.styling.SLDParser$EmptyIcon

Copyright © 2018 www.massapicom. 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.