Package org.geotools.brewer.color

Examples of org.geotools.brewer.color.ColorBrewer


        paletteTable.setContentProvider(new IStructuredContentProvider() {
           
            public Object[] getElements(Object inputElement) {
                if (inputElement instanceof ColorBrewer) {
                    ColorBrewer brewer = (ColorBrewer) inputElement;
                    return brewer.getPalettes();
                } else {
                    return new Object[0];
                }
            }
View Full Code Here


            select(getPreferenceStore().getDefaultString(getPreferenceName()));
        }
    }

    private void select(String paletteName) {
        ColorBrewer brewer = PlatformGIS.getColorBrewer();
        if (paletteName == null || !brewer.hasPalette(paletteName))
            return;
        BrewerPalette palette = brewer.getPalette(paletteName);
        palettes.setSelection(new StructuredSelection(palette));
    }
View Full Code Here

    if (inputElement instanceof ArrayList) {
        ArrayList<Object> list = (ArrayList<Object>) inputElement;
        return list.toArray();
    } else
      if (inputElement instanceof ColorBrewer) {
          ColorBrewer brewer = (ColorBrewer) inputElement;
          int selection = this.styleThemePage.getCombo(StyleThemePage.COMBO_PALETTES).getSelectionIndex();
          if (selection == 0) {
                BrewerPalette[] palettes = brewer.getPalettes(ColorBrewer.ALL);
                return palettes;
            } else if (selection == 1) //Numerical
              return brewer.getPalettes(ColorBrewer.SUITABLE_RANGED);
          else if (selection == 2) //Sequential
              return brewer.getPalettes(ColorBrewer.SEQUENTIAL);
          else if (selection == 3) //Diverging
              return brewer.getPalettes(ColorBrewer.DIVERGING);
          else if (selection == 4) //Categorical
              return brewer.getPalettes(ColorBrewer.SUITABLE_UNIQUE);
          else
              return brewer.getPalettes();
      } else {
          return new Object[0];
      }
  }
View Full Code Here

    cmbPalette.setInput(inputs);
   
    /* reselect based on blackboard setting */
    String paletteName = (String) l.getStyleBlackboard().get("org.locationtech.udig.style.raster.palette"); //$NON-NLS-1$
    if (paletteName != null){
      ColorBrewer cb = getBrewer();
      BrewerPalette palette = cb.getPalette(paletteName);
      if (palette != null){
        cmbPalette.setSelection(new StructuredSelection(cb.getPalette(paletteName)));
      }else{
        PredefinedColorRule cm = colorRules.getPredefinedRule(paletteName);
        if (cm != null){
          cmbPalette.setSelection(new StructuredSelection(cm));
        }
View Full Code Here

}

void colorBrewerExample(SimpleFeatureCollection featureCollection) {
    // colorBrewerExample start
    // STEP 0 Set up Color Brewer
    ColorBrewer brewer = ColorBrewer.instance();
   
    // STEP 1 - call a classifier function to summarise your content
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    PropertyName propteryExpression = ff.property("height");
   
    // classify into five categories
    Function classify = ff.function("Quantile", propteryExpression, ff.literal(5));
    Classifier groups = (Classifier) classify.evaluate(featureCollection);
   
    // STEP 2 - look up a predefined palette from color brewer
    String paletteName = "GrBu";
    Color[] colors = brewer.getPalette(paletteName).getColors(5);
   
    // STEP 3 - ask StyleGenerator to make a set of rules for the Classifier
    // assigning features the correct color based on height
    FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
            groups,
View Full Code Here

TOP

Related Classes of org.geotools.brewer.color.ColorBrewer

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.