Examples of FeatureTypeStyle


Examples of org.geotools.styling.FeatureTypeStyle

    private int getExpandSizeFromStyle( Style style ) {
        MetaBufferEstimator rbe = new MetaBufferEstimator();
        FeatureTypeStyle[] styles = style.getFeatureTypeStyles();
        for (int t=0; t<styles.length; t++) {
            final FeatureTypeStyle lfts = styles[t];
            Rule[] rules = lfts.getRules();
            for (int j = 0; j < rules.length; j++) {
                rbe.visit(rules[j]);
            }
        }
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

  private static ColorMap findColorMap(FeatureTypeStyle[] style){
    if (style == null){
      return null;
    }
    for (int i = 0; i < style.length; i ++){
      FeatureTypeStyle fstyle = style[i]
      List<Rule> rules = fstyle.rules();
      if (rules == null){
        continue;
      }
     
      for (Rule rule : rules){
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

        Style linestyle = sb.createStyle();

        LineSymbolizer line = sb.createLineSymbolizer(color);
        linestyle.addFeatureTypeStyle(sb.createFeatureTypeStyle(line));

        FeatureTypeStyle fts = linestyle.getFeatureTypeStyles()[0];
        fts.setName(Messages.Styling_name); //tag as simple
        fts.setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
        fts.setSemanticTypeIdentifiers(new String[] {"generic:geometry", "simple"}); //$NON-NLS-1$ //$NON-NLS-2$

        return linestyle;
    }
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

        if (parentElement instanceof Style) {
            Style style = (Style) parentElement;
            Rule[] rule = SLDs.rules(style);
            return rule; // return rules
        } else if (parentElement instanceof FeatureTypeStyle) {
            FeatureTypeStyle fts = (FeatureTypeStyle) parentElement;
            List<Rule> rules = fts.rules();
            Rule[] rulesArray = (Rule[]) rules.toArray(new Rule[rules.size()]);
            return rulesArray;
        }
        return EMPTY_ARRAY;
    }
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

        /*
         * This first section should really be handled by a containing shell or some such
         * thing that will allow multiple rules, and handle the rule-level options  such as
         * max/min scale denominator and filter.
         */
        FeatureTypeStyle defaultStyle = null;
        for(FeatureTypeStyle typeStyle : getStyle().featureTypeStyles()) {
            if(typeStyle.getName().equals("Default Styler")) {
                defaultStyle = typeStyle;
                break;
            }
        }
        if(defaultStyle == null)
            return;
       
        Rule rule = defaultStyle.rules().get(0);
        // Find the first PointSymbolizer in the rule
        PointSymbolizer sym = null;
        for(Symbolizer symbolizer : rule.symbolizers()) {
            if(symbolizer instanceof PointSymbolizer) {
                sym = (PointSymbolizer)symbolizer;
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

    /**
     * @return the first rule in the default feature type style.
     */
    public Rule getDefaultRule( Style style ) {
        FeatureTypeStyle ftStyle = getDefaultFeatureTypeStyle(style);
        if (ftStyle.getRules() == null || ftStyle.getRules().length == 0) {
            // create an empty rule
            Rule rule = styleBuilder.createRule(new Symbolizer[]{});
            ftStyle.addRule(rule);
            return rule;
        }

        return ftStyle.getRules()[0];
    }
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

    public FeatureTypeStyle getDefaultFeatureTypeStyle( Style style ) {
        List< ? extends org.opengis.style.FeatureTypeStyle> fts = style.featureTypeStyles();
        FeatureTypeStyle[] styles = style.getFeatureTypeStyles();
        if (styles == null || styles.length == 0 || styles[0].getRules().length == 0) {
            // create a feature type style
            FeatureTypeStyle ftStyle = styleBuilder.createFeatureTypeStyle("default", new Rule[]{}); //$NON-NLS-1$
            style.addFeatureTypeStyle(ftStyle);
            return ftStyle;
        }

        return styles[0];
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

        reverseButton.setText(Messages.StyleEditor_theme_reverse);
        reverseButton.addSelectionListener(new SelectionListener() {

            public void widgetSelected( SelectionEvent e ) {
                reverseColours = !reverseColours; //used by generateTheme to get things half right
                FeatureTypeStyle fts = getFTS();
                List<Rule> ruleList = fts.rules();
                for (int i = 0; i < (ruleList.size() / 2); i++) {
                    swapColours(ruleList.get(i), ruleList.get(ruleList.size()-i-1));
                }
                treeViewer.refresh();
            }
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

        FeatureTypeStyle[] featureTypeStyles = style.getFeatureTypeStyles();
        if( featureTypeStyles == null ){
            return false;
        }
        for( int i=0; i<featureTypeStyles.length; i++ ){
            FeatureTypeStyle featureTypeStyle = featureTypeStyles[i];
            if( featureTypeStyle == null ) continue;
            boolean removed = featureTypeStyle.rules().remove( rule );
            if( removed ){
                return true;
            }
        }
        return false;
View Full Code Here

Examples of org.geotools.styling.FeatureTypeStyle

                } else {
                    opac = 1;
                }
                Color borderColor = BorderColorComboListener.getBorder(getCombo(COMBO_BORDER_COLOR));
               
                FeatureTypeStyle newFTS = null;
                try {
                    newFTS = StyleGenerator.createFeatureTypeStyle(classifier, (org.opengis.filter.expression.Expression) expr, colors, semanticTypeIdentifier, getSelectedLayer().getSchema().getGeometryDescriptor(), elsemode, opac, null);
                    applyExistingRulesProperties(newFTS, opac, borderColor);
                } catch (IllegalFilterException e) {
                    newFTS = null;
                    SLDPlugin.log("sg.createFeatureTypeStyle() failed", e); //$NON-NLS-1$
                } catch (NullPointerException e) {
                    newFTS = null;
                    SLDPlugin.log("sg.createFeatureTypeStyle() failed", e); //$NON-NLS-1$
                }
                if (newFTS == null) {
                    ErrorManager.get().displayError(Messages.StyleEditor_error, Messages.StyleEditor_theme_failure);
                    return;
                } 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$
                   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.