Package org.geotools.styling

Examples of org.geotools.styling.Style


              if( CRS.getHorizontalCRS(destinationCRS) == null ){
                  destinationCRS = coverage.getCoordinateReferenceSystem2D();
              }
              //draw
              try {
                  Style style = grabStyle();
                  Rule rule = SLDs.getRasterSymbolizerRule(style);
                 
                  final double currentScale = currentContext.getViewportModel().getScaleDenominator();               
                  double minScale = rule.getMinScaleDenominator();
                  double maxScale = rule.getMaxScaleDenominator();
View Full Code Here


    private Style grabStyle() {
        // check for style information on the blackboard
        StyleBlackboard styleBlackboard = (StyleBlackboard) getContext()
                .getLayer().getStyleBlackboard();
       
        Style style = (Style) styleBlackboard.lookup(Style.class);
       
        return style;
    }
View Full Code Here

    /**
     * Extract symbolizer parameters from the style blackboard
     */
    public static GridCoverageRenderState getRenderState( IRenderContext context ) {
        StyleBlackboard styleBlackboard = (StyleBlackboard) context.getLayer().getStyleBlackboard();
        Style style = (Style) styleBlackboard.lookup(Style.class);
        double minScale = Double.MIN_VALUE;
        double maxScale = Double.MAX_VALUE;
        float opacity = 1.0f;
        if (style != null) {
            try {
                FeatureTypeStyle featureStyle = style.featureTypeStyles().get(0);               
                Rule rule = featureStyle.rules().get(0);
                minScale = rule.getMinScaleDenominator();
                maxScale = rule.getMaxScaleDenominator();
                if (rule.getSymbolizers()[0] instanceof RasterSymbolizer) {
                    RasterSymbolizer rs = (RasterSymbolizer) rule.getSymbolizers()[0];
View Full Code Here

            }
           
            if( BasicWMSRenderer2.findRequestCRS(owsLayers, context.getCRS(), context.getMap())==null )
                return false;
           
            Style style = (Style) previousLayer.getStyleBlackboard().get(SLDContent.ID);
            if (style != null) {
                opacity = SLDs.rasterOpacity(SLDs.rasterSymbolizer(style));
            }
        }
               
        Style style = (Style) layer.getStyleBlackboard().get(SLDContent.ID);
        if (style == null && Double.isNaN(opacity)) {
            return true;
        }       
       
        double result = SLDs.rasterOpacity(SLDs.rasterSymbolizer(style));
View Full Code Here

    private void doDefaults() {
            StyleLayer layer = styleEditorDialog.selectedLayer;
            layer.getStyleBlackboard().clear();
            SetDefaultStyleProcessor p = new SetDefaultStyleProcessor(layer.getGeoResource(), layer);
            p.run();
            Style style = (Style) layer.getStyleBlackboard().get(SLDContent.ID);
            StyledLayerDescriptor oldSLD=null;
            if(style!=null){
                oldSLD = this.styleEditorDialog.getSLD();
            }
            this.styleEditorDialog.selectedLayer.apply();
View Full Code Here

                mb.open();
                throw (RuntimeException) new RuntimeException().initCause(e1);
            }
        }
        if (sld != null) {
            Style newStyle = SLDs.getDefaultStyle(sld);
            // TODO: assert there is only 1 style
            this.styleEditorDialog.setStyle(newStyle);
            //refresh the page (there's a new SLD in town)
            this.styleEditorDialog.getCurrentPage().refresh();
        }
View Full Code Here

            }
        }
        // although we expect SLDContent; we are willing to work with any Style
        //
        if( value != null && value instanceof Style){             
            Style style = (Style) value;
            return SLDs.rasterSymbolizer( style ) != null;
        }
        return false;
    }
View Full Code Here

        Object value = context.getLayer().getStyleBlackboard().get(SLDContent.ID);
        if( value == null ) {
            return new HashSet<Range<Double>>();
        }
        if( value instanceof Style ){
            Style style = (Style) value;
            return MinMaxScaleCalculator.getValidScaleRanges(style);
        }
        else {
            System.out.println("Unexpected "+value.getClass()+" for "+SLDContent.ID+":"+value);           
            return new HashSet<Range<Double>>();
View Full Code Here

                double minScale = 0;
                double maxScale = Double.MAX_VALUE;
                layer = ilayer.getResource(org.geotools.data.ows.Layer.class, null);
                // check if there are min/max scale rules
                StyleBlackboard sb = (StyleBlackboard) ilayer.getStyleBlackboard();
                Style style = (Style) sb.lookup(Style.class);
                if (style != null) {
                    Rule rule = style.getFeatureTypeStyles()[0].getRules()[0];
                    minScale = rule.getMinScaleDenominator();
                    maxScale = rule.getMaxScaleDenominator();
                }

                if (currScale >= minScale && currScale <= maxScale) {
View Full Code Here

                LayerGroupInfo group = wms.getLayerGroupByName(layerName);
                LayerInfo layer = wms.getLayerByName(layerName);
                if(group != null) {
                    // nothing to do, groups have no style
                } else if(layer != null) {
                    Style style = layer.getDefaultStyle().getStyle();
                    // add the default style first
                    style = cloneStyle(style);
                    style.setDefault(true);
                    style.setName(layer.getDefaultStyle().getName());
                    namedLayer.styles().add(style);
                    // add alternate styles
                    for(StyleInfo si : layer.getStyles()) {
                        style = cloneStyle(si.getStyle());
                        style.setName(si.getName());
                        namedLayer.styles().add(style);
                    }
                } else {
                    // we should really add a code and a locator...
                    throw new WmsException("Unknown layer " + layerName);
View Full Code Here

TOP

Related Classes of org.geotools.styling.Style

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.