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