if (palette == null) {
if (Debug.debugging("etopo"))
Debug.output("ETOPOLayer: creating ETOPO Palette.");
palette = Box.createVerticalBox();
Box subbox0 = Box.createHorizontalBox();
Box subbox1 = Box.createHorizontalBox();
Box subbox2 = Box.createVerticalBox();
Box subbox3 = Box.createHorizontalBox();
// The ETOPO resolution selector
JPanel resPanel = PaletteHelper.createPaletteJPanel("Lat/Lon Spacing");
String[] resStrings = { "2 Minute", "5 Minute", "10 Minute",
"15 Minute" }; // ep-g
JComboBox resList = new JComboBox(resStrings);
resList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox jcb = (JComboBox) e.getSource();
int newRes = jcb.getSelectedIndex();
int curRes = minuteSpacing / 5; // ep-g
if (curRes != newRes)
spacingReset = true;
switch (newRes) {
case 0:
minuteSpacing = 2;
break; // ep-g
case 1:
minuteSpacing = 5;
break; // ep-g
case 2:
minuteSpacing = 10;
break; // ep-g
case 3:
minuteSpacing = 15;
break; // ep-g
}
}
});
resList.setSelectedIndex(minuteSpacing / 5); // ep-g
resPanel.add(resList);
// The ETOPO view selector
JPanel viewPanel = PaletteHelper.createPaletteJPanel("View Type");
String[] viewStrings = { "Grayscale Shading", "Color Shading" };
JComboBox viewList = new JComboBox(viewStrings);
viewList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox jcb = (JComboBox) e.getSource();
int newView = jcb.getSelectedIndex();
if (newView != viewType)
slopeReset = true;
switch (newView) {
case 0:
viewType = SLOPESHADING;
break;
case 1:
viewType = COLOREDSHADING;
break;
}
}
});
viewList.setSelectedIndex(viewType);
viewPanel.add(viewList);
// The ETOPO Contrast Adjuster
JPanel contrastPanel = PaletteHelper.createPaletteJPanel("Contrast Adjustment");
JSlider contrastSlide = new JSlider(JSlider.HORIZONTAL, 1/* min */, 5/* max */, 3/* inital */);
java.util.Hashtable dict = new java.util.Hashtable();
dict.put(new Integer(1), new JLabel("min"));
dict.put(new Integer(5), new JLabel("max"));
contrastSlide.setLabelTable(dict);
contrastSlide.setPaintLabels(true);
contrastSlide.setMajorTickSpacing(1);
contrastSlide.setPaintTicks(true);
contrastSlide.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
JSlider slider = (JSlider) ce.getSource();
if (slider.getValueIsAdjusting()) {
Debug.output("ETOPOLayer - Contrast Slider value = "
+ slider.getValue());
slopeAdjust = slider.getValue();
}
}
});
contrastPanel.add(contrastSlide);
// The ETOPO Opaqueness
JPanel opaquenessPanel = PaletteHelper.createPaletteJPanel("Opaqueness");
JSlider opaquenessSlide = new JSlider(JSlider.HORIZONTAL, 0/* min */, 255/* max */, opaqueness/* inital */);
opaquenessSlide.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
JSlider slider = (JSlider) ce.getSource();
if (slider.getValueIsAdjusting()) {
fireRequestInfoLine("ETOPOLayer - Opaqueness Slider value = "
+ slider.getValue());
opaqueness = slider.getValue();
}
}
});
opaquenessPanel.add(opaquenessSlide);
JButton redraw = new JButton("Redraw ETOPO Layer");
redraw.addActionListener(this);
redraw.setActionCommand(RedrawCmd);
subbox0.add(resPanel);
palette.add(subbox0);
subbox1.add(viewPanel);
palette.add(subbox1);
subbox2.add(contrastPanel);
subbox2.add(opaquenessPanel);
palette.add(subbox2);
subbox3.add(redraw);
palette.add(subbox3);
}
return palette;
}