Package org.geotools.styling

Examples of org.geotools.styling.StyleFactory


    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
    StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) uctx.unmarshalDocument(getClass()
        .getResourceAsStream("samples/example-sld.xml"), null);

    // pipe to geotools parser
    StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
    PipedOutputStream pos = new PipedOutputStream();
    PipedInputStream pii = new PipedInputStream(pos);

    final SLDParser parser = new SLDParser(factory, pii);
View Full Code Here


     * The type name that can be used in an SLD in the featuretypestyle that matches all feature types.
     */
    public static final String GENERIC_FEATURE_TYPENAME = "Feature";

    public static StyledLayerDescriptor parseSLD(File file) throws IOException {
        StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
     // try SLD 1.1 first
        SLDConfiguration config = new SLDConfiguration();
        Reader reader = null;
        try {
            Parser parser = new Parser( config );
View Full Code Here

            if( input != null){
                input.close();
            }
        }
        // The SLD 1.0 parser is far more forgiving
        StyleFactory factory = CommonFactoryFinder.getStyleFactory(GeoTools.getDefaultHints());
        SLDParser styleReader = new SLDParser(factory, url);
        Style style = styleReader.readXML()[0];
        return style;
    }
View Full Code Here

        Style style = styleReader.readXML()[0];
        return style;
    }
   
    public static Style praseStyle(File file) throws IOException {
        StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
        // try SLD 1.1 first
        SLDConfiguration config = new SLDConfiguration();
        Reader reader = null;
        try {
            Parser parser = new Parser( config );
View Full Code Here

    }

   
    public Style createDefaultStyle() {
       
        StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(GeoTools.getDefaultHints());
        StyleBuilder styleBuilder = new StyleBuilder(styleFactory);
       
        RasterSymbolizer rasterSymbolizer = styleFactory.createRasterSymbolizer();
        Rule rule = styleFactory.createRule();
        rule.setSymbolizers(new Symbolizer[]{ rasterSymbolizer });
       
        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);
        sldContentManager.addSymbolizer(rasterSymbolizer);
View Full Code Here

    }

    public Style createDefaultStyle() {

        StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(GeoTools.getDefaultHints());
        StyleBuilder styleBuilder = new StyleBuilder(styleFactory);

        RasterSymbolizer rasterSymbolizer = styleFactory.createRasterSymbolizer();
        Rule rule = styleFactory.createRule();
        rule.setSymbolizers(new Symbolizer[]{rasterSymbolizer});

        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);
        sldContentManager.addSymbolizer(rasterSymbolizer);
View Full Code Here

  public Style style( IProgressMonitor monitor ) {
        URL url = service.getIdentifier();
        File file = URLUtils.urlToFile(url);
        String mapFile = file.getAbsolutePath();

        StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(GeoTools.getDefaultHints());

        // strip off the extension and check for sld
        int lastdot = mapFile.lastIndexOf('.');
        String sld = mapFile.substring(0, lastdot) + ".sld"; //$NON-NLS-1$
        File f = new File(sld);
View Full Code Here

        return XMLtoSLD(xml, "UTF-8"); //$NON-NLS-1$
    }
   
    private StyledLayerDescriptor XMLtoSLD(String xml, String encoding) {
        //save changes to style object
        StyleFactory factory = StyleFactoryFinder.createStyleFactory();
        InputStream is = getXMLasInputStream(xml, encoding);
        if (is == null) return null;
        SLDParser stylereader = new SLDParser(factory, is);
        StyledLayerDescriptor sld = stylereader.parseSLD();
        return sld;
View Full Code Here

        try {
            coverage = getContext().getGeoResource().resolve(GridCoverage.class, null);

            RasterSymbolizer rasterSymbolizer;

            StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
            rasterSymbolizer = factory.createRasterSymbolizer();

            renderer.paint(graphics, (GridCoverage2D) coverage, rasterSymbolizer);
        } catch (IOException e) {
            // TODO Handle IOException
            throw (RuntimeException) new RuntimeException().initCause(e);
View Full Code Here

        try {
            coverage = getContext().getGeoResource().resolve(GridCoverage.class, null);

            RasterSymbolizer rasterSymbolizer;

            StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
            rasterSymbolizer = factory.createRasterSymbolizer();

            renderer.paint(graphics, (GridCoverage2D) coverage, rasterSymbolizer);
        } catch (IOException e) {
            // TODO Handle IOException
            throw (RuntimeException) new RuntimeException().initCause(e);
View Full Code Here

TOP

Related Classes of org.geotools.styling.StyleFactory

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.