Package org.geotools.styling

Examples of org.geotools.styling.RasterSymbolizer


        if (arg0 instanceof TextSymbolizer) {
            TextSymbolizer ps = (TextSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof RasterSymbolizer) {
            RasterSymbolizer ps = (RasterSymbolizer) arg0;
            ps.accept(this);
        }
    }
View Full Code Here


                // draw

                AffineTransform worldToScreen = RendererUtilities.worldToScreenTransform(envelope, screenSize, destinationCRS);
                final GridCoverageRenderer paint = new GridCoverageRenderer(destinationCRS, envelope, screenSize, worldToScreen,
                        hints);
                RasterSymbolizer rasterSymbolizer = CommonFactoryFinder.getStyleFactory(null).createRasterSymbolizer();

                paint.paint(g2d, coverage, rasterSymbolizer);

                tempCache.flush();
View Full Code Here

     * @param sym
     */
    public void set( RasterSymbolizer sym2 ){
        listen( false ); // don't sync when setting up
        try {
            RasterSymbolizer sym=sym2;
            this.enabled = (sym != null);
           
            if( sym==null ){
                StyleBuilder builder=new StyleBuilder();
                sym=builder.createRasterSymbolizer();
                sym.setOpacity((Expression) CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()).literal(1.0));
            }
            this.opacity = SLD.rasterOpacity(sym);
            String text = MessageFormat.format( "{0,number,#0%}", this.opacity); //$NON-NLS-1$
            this.percent.setText(text);
            this.percent.select(this.percent.indexOf(text));
View Full Code Here

    /**
     * TODO summary sentence for apply ...
     */
    public void apply() {
        RasterSymbolizer symbolizer = (RasterSymbolizer) getContent();
        StyleBuilder styleBuilder = getStyleBuilder();

        double opacity = ((double) opacityScale.getSelection()) / 100;
        symbolizer.setOpacity(styleBuilder.literalExpression(opacity));
    }
View Full Code Here

    }

    @Override
    protected void refresh() {
        Style style = getStyle();
        RasterSymbolizer sym = SLD.rasterSymbolizer(style);
       
        Rule r = style.getFeatureTypeStyles()[0].getRules()[0];
        double minScaleDen=r.getMinScaleDenominator();
        double maxScaleDen=r.getMaxScaleDenominator();
        this.minScale.setScale(minScaleDen, Math.round(getLayer().getMap().getViewportModel().getScaleDenominator()));           
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);
View Full Code Here

                }
              }
              if (!canStyle){return;}
             
                Style style = getStyle();
                RasterSymbolizer sym = SLD.rasterSymbolizer(style);

                // set opacity
                opacity.set(sym);

                // channel selection - setup band selection
View Full Code Here

     
        // get the style off the blackboard and add/modify it
        Style s = (Style) getLayer().getStyleBlackboard().get(SLDContent.ID);

        // get raster symbolizer
        RasterSymbolizer rs = SLD.rasterSymbolizer(s);

        // setup scale
        Rule r = (SLD.rules(s))[0];
        if (minScale.isEnabled()) {
            r.setMinScaleDenominator(minScale.getScale());
View Full Code Here

                styleBlackboard.setSelected(new String[]{SLDContent.ID});
            }
            style.setName(layer.getName());
            ArrayList<CoverageRule> listOfRules = new ArrayList<CoverageRule>();
            // Rule ruleToUpdate = SLDs.getRasterSymbolizerRule(style);
            RasterSymbolizer rasterSymbolizer = SLDs.rasterSymbolizer(style);

            ColorMap colorMap = rasterSymbolizer.getColorMap();
            ColorMapEntry[] colorMapEntries = colorMap.getColorMapEntries();
            for( int i = 0; i < colorMapEntries.length - 1; i = i + 2 ) {
                double fromQuantity = getQuantity(colorMapEntries[i]);
                java.awt.Color f = getColor(colorMapEntries[i]);
                double fromOpacity = getOpacity(colorMapEntries[i]);

                double toQuantity = getQuantity(colorMapEntries[i + 1]);
                java.awt.Color t = getColor(colorMapEntries[i + 1]);
                // double toOpacity = getOpacity(colorMapEntries[i + 1]);

                Color fromColor = new Color(Display.getDefault(), f.getRed(), f.getGreen(), f.getBlue());
                Color toColor = new Color(Display.getDefault(), t.getRed(), t.getGreen(), t.getBlue());
                CoverageRule rule = new CoverageRule(new double[]{fromQuantity, toQuantity}, fromColor, toColor, fromOpacity,
                        true);
                listOfRules.add(rule);
            }

            colorRulesEditor.setLayer(layer);

            Double globalOpacity = rasterSymbolizer.getOpacity().evaluate(null, Double.class);
            if (globalOpacity != null) {
                colorRulesEditor.setAlphaValue((int) (globalOpacity * 100.0));
            } else {
                colorRulesEditor.setAlphaValue(100);
            }
View Full Code Here

        }
        return null; // there is no good Style default for this resource type
    }

    private Style createDefaultGridCoverageStyle( IGeoResource resource, Color colour ) {
        RasterSymbolizer rasterSymbolizer = styleFactory.createRasterSymbolizer();
       
        Style style = styleBuilder.createStyle();
        SLDContentManager sldContentManager = new SLDContentManager(styleBuilder, style);
        sldContentManager.addSymbolizer(rasterSymbolizer);
       
View Full Code Here

TOP

Related Classes of org.geotools.styling.RasterSymbolizer

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.