private void init() throws VisADException, RemoteException { HydraDataSource source = (HydraDataSource) dataChoice.getDataSource(); // TODO revisit this, may want to move method up to base class HydraDataSource if (source instanceof SuomiNPPDataSource) { data = ((SuomiNPPDataSource) source).getMultiSpectralData(dataChoice); } if (source instanceof MultiSpectralDataSource) { data = ((MultiSpectralDataSource) source).getMultiSpectralData(dataChoice); } waveNumber = data.init_wavenumber; try { spectrum = data.getSpectrum(new int[] {1, 1}); } catch (Exception e) { LogUtil.logException("MultiSpectralDisplay.init", e); } domainSet = (Gridded1DSet) spectrum.getDomainSet(); initialRangeX = getXRange(domainSet); initialRangeY = data.getDataRange(); domainType = getDomainType(spectrum); rangeType = getRangeType(spectrum); master = new XYDisplay(DISP_NAME, domainType, rangeType); setDisplayMasterAttributes(master); // set up the x- and y-axis xmap = new ScalarMap(domainType, Display.XAxis); ymap = new ScalarMap(rangeType, Display.YAxis); xmap.setRange(initialRangeX[0], initialRangeX[1]); ymap.setRange(initialRangeY[0], initialRangeY[1]); display = master.getDisplay(); display.addMap(xmap); display.addMap(ymap); display.addDisplayListener(this); new RubberBandBox(this, xmap, ymap); if (displayControl == null) { // - add in a ref for the default spectrum, ie no DisplayControl DataReferenceImpl spectrumRef = new DataReferenceImpl(hashCode() + "_spectrumRef"); spectrumRef.setData(spectrum); addRef(spectrumRef, Color.WHITE); } if (data.hasBandNames()) { bandSelectComboBox = new JComboBox(data.getBandNames().toArray()); bandSelectComboBox.setSelectedItem(data.init_bandName); bandSelectComboBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String bandName = (String) bandSelectComboBox.getSelectedItem(); if (bandName == null) return; HashMap<String, Float> bandMap = data.getBandNameMap(); if (bandMap == null) return; if (!bandMap.containsKey(bandName)) return; setWaveNumber(bandMap.get(bandName)); } }); } }