Package org.geotools.styling

Examples of org.geotools.styling.Style


                } else {
                    //set the FeatureTypeName to the current layer name
                    newFTS.featureTypeNames().clear();
                    newFTS.featureTypeNames().add( new NameImpl( SLDs.GENERIC_FEATURE_TYPENAME ));
                    //get the style
                    Style style = getStyle();
                    //ensure the style has an SLD
                    if (style == null) throw new RuntimeException("Style is null"); //$NON-NLS-1$
                   
                    StyledLayerDescriptor sld = null; //SLDs.styledLayerDescriptor(style);
                    if (sld == null) {
View Full Code Here


     * @param newFTS the new style to tweak.
     * @param opac an opacity value to apply to the fill.
     * @param borderColor
     */
    private void applyExistingRulesProperties( FeatureTypeStyle newFTS, double opac, Color borderColor ) {
        Style style = getStyle();
        Symbolizer[] symbolizers = SLDs.symbolizers(style);
        if (symbolizers.length > 0) {
            Symbolizer symbolizer = symbolizers[0];
            if (symbolizer instanceof PointSymbolizer) {
                PointSymbolizer previousSymbolizer = (PointSymbolizer) symbolizer;
View Full Code Here

     * Iterates through the style blackboard style and returns the ColorBrewer FeatureTypeStyle.
     *
     * @return the ColorBrewer {@link FeatureTypeStyle} or null if none found.
     */
    FeatureTypeStyle getFTS() {
        Style style = getStyle();
        List<FeatureTypeStyle> featureTypeStyles = style.featureTypeStyles();
        for( FeatureTypeStyle featureTypeStyle : featureTypeStyles ) {
            if (SLDs.isSemanticTypeMatch(featureTypeStyle, "colorbrewer:.*")) { //$NON-NLS-1$
                return featureTypeStyle;
            }
        }
View Full Code Here

        RasterSymbolizer rasterSym = sf.createRasterSymbolizer();
              
        ColorMap colorMap = getCurrentSelection().getColorMap();
        rasterSym.setColorMap(colorMap);

        Style newStyle = SLD.wrapSymbolizers(rasterSym);
        newStyle.setName(((Layer)getSelectedLayer()).getName() );
        StyleBlackboard styleBlackboard = getSelectedLayer().getStyleBlackboard();

        // put style back on blackboard
        styleBlackboard.put(SLDContent.ID, newStyle);
        styleBlackboard.setSelected(new String[]{SLDContent.ID});
View Full Code Here

      colorRules.dispose();
      colorRules = null;
    }
    colorRules = new PredefinedColorRules(getGridCoverageReader(), this.noDataValues);
   
    Style style = (Style) l.getStyleBlackboard().get(SLDContent.ID);
   
    RasterSymbolizer symbolizer = SLD.rasterSymbolizer(style);
    if (symbolizer == null || symbolizer.getColorMap() == null){
      //no symbolizer
     
View Full Code Here

              //
              AffineTransform worldToScreen = null; // we are leting the GridCoverageRenderer sort that out
             
              //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

            }
        }
        // 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

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.