*/
this.map = thisMap;
numberOfLayers = this.map.getLayersInternal().size();
mapPalette = map.getColorPalette();
mapScheme = new ColourScheme(map.getColourScheme().getColourPalette(), map.getColourScheme().getSizePalette());
//workaround for non-saving (need to correct number of colours)
if (mapScheme.getSizePalette() < numberOfLayers) {
mapScheme.setSizePalette(numberOfLayers);
}
scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
composite = new Composite(scrolledComposite, SWT.NONE);
scrolledComposite.setContent(composite);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 4;
composite.setLayout(gridLayout);
// title at top of panel
Label titleLabel = new Label(composite, SWT.NONE);
titleLabel.setText(Messages.PaletteDefaultChooserPanel_title);
GridData data = new GridData();
data.horizontalSpan = 4;
titleLabel.setLayoutData(data);
//map background color label
Label backgroundColor = new Label(composite, SWT.NONE);
backgroundColor.setText(Messages.PaletteDefaultChooserPanel_MapBackgroundColor);
data = new GridData();
data.horizontalSpan = 1;
backgroundColor.setLayoutData(data);
colorEditor = new ColorEditor(composite);
Color bgColor = (Color)thisMap.getBlackboard().get(ProjectBlackboardConstants.MAP__BACKGROUND_COLOR);
if (backgroundColor != null)
colorEditor.setColorValue(new RGB(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue()));
//spacer
Composite colorc = new Composite(composite, SWT.NONE);
data = new GridData();
data.horizontalSpan = 2;
colorc.setLayoutData(data);
// palette label
Label paletteLabel = new Label(composite, SWT.NONE);
paletteLabel.setText(Messages.PaletteDefaultChooserPanel_palette);
data = new GridData();
data.horizontalSpan = 1;
paletteLabel.setLayoutData(data);
// palette colourLetterCombo box
paletteSelectionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
String[] names = PlatformGIS.getColorBrewer().getPaletteNames();
paletteSelectionCombo.setItems(names);
// find out index number for selection
int index = 0;
for( int i = 0; i < names.length; i++ ) {
if ((names[i]).equalsIgnoreCase(mapPalette.getName())) {
index = i;
break;
}
}
paletteSelectionCombo.addSelectionListener(new SelectionListener(){
public void widgetSelected( SelectionEvent e ) {
/*
* When a new palette is selected: get the palette String and then we want to
* repaint all paletteCombos to have new colours
*/
int index = paletteSelectionCombo.getSelectionIndex();
String name = paletteSelectionCombo.getItem(index);
BrewerPalette palette = PlatformGIS.getColorBrewer().getPalette(name);
//ColourScheme scheme = map.getColourScheme();
//scheme.setColourPalette(palette);
//map.setColorPalette(palette);
//map.setColourScheme(scheme);
mapScheme = new ColourScheme(palette, Integer.parseInt(quantityCombo.getItem(quantityCombo.getSelectionIndex())) );
updateLayerDisplay();
}
public void widgetDefaultSelected( SelectionEvent e ) {
}