001    /*
002     * This file is part of McIDAS-V
003     *
004     * Copyright 2007-2013
005     * Space Science and Engineering Center (SSEC)
006     * University of Wisconsin - Madison
007     * 1225 W. Dayton Street, Madison, WI 53706, USA
008     * https://www.ssec.wisc.edu/mcidas
009     * 
010     * All Rights Reserved
011     * 
012     * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
013     * some McIDAS-V source code is based on IDV and VisAD source code.  
014     * 
015     * McIDAS-V is free software; you can redistribute it and/or modify
016     * it under the terms of the GNU Lesser Public License as published by
017     * the Free Software Foundation; either version 3 of the License, or
018     * (at your option) any later version.
019     * 
020     * McIDAS-V is distributed in the hope that it will be useful,
021     * but WITHOUT ANY WARRANTY; without even the implied warranty of
022     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023     * GNU Lesser Public License for more details.
024     * 
025     * You should have received a copy of the GNU Lesser Public License
026     * along with this program.  If not, see http://www.gnu.org/licenses.
027     */
028    
029    package edu.wisc.ssec.mcidasv.control;
030    
031    import edu.wisc.ssec.mcidasv.display.hydra.MultiSpectralDisplay;
032    import ucar.unidata.idv.control.DisplayControlImpl;
033    import ucar.unidata.idv.control.SelectRangeWidget;
034    import ucar.visad.display.ColorScale;
035    import ucar.unidata.util.Range;
036    import ucar.unidata.util.LogUtil;
037    
038    public abstract class HydraControl extends DisplayControlImpl {
039    
040    //    public abstract boolean init(DataChoice dataChoice) throws VisADException, RemoteException;
041    //    
042    //    public abstract void initDone();
043    //    
044    //    public abstract MapProjection getDataProjection();
045    
046        public void updateRange(Range range) {
047            if (ctw != null)
048              ctw.setRange(range);
049    
050            try {
051                SelectRangeWidget srw = getSelectRangeWidget(range);
052                if (srw != null) {
053                    srw.setRange(range);
054                }
055            } catch (Exception e) {
056                LogUtil.logException("Error updating select range widget", e);
057            }
058    
059            if (colorScales != null) {
060                ColorScale scale = (ColorScale) colorScales.get(0);
061                try {
062                    scale.setRangeForColor(range.getMin(), range.getMax());
063                }
064                catch (Exception exc) {
065                    LogUtil.logException("Error updating display ColorScale range", exc);
066                }
067            }
068        }
069    
070        public void handleChannelChange(final float newChan) {
071            return;
072        }
073    
074        protected abstract MultiSpectralDisplay getMultiSpectralDisplay();
075    }