Issue #1328 Fixed bug in GFE time matcher when no grids are available for discrete type

Change-Id: I71f9f9b23573394e9f98895164be4aef659ec02a

Former-commit-id: f9f8c75b79 [formerly 5693e567ef] [formerly 032b0948a4] [formerly 2e1bb4f7c6 [formerly 032b0948a4 [formerly a4c781a6c57579f04413dc16a0b3937ac6ce72d4]]]
Former-commit-id: 2e1bb4f7c6
Former-commit-id: bdf52e73976551873e82686836572d9d03b9024c [formerly 2e51e024b8]
Former-commit-id: 8974e33edc
This commit is contained in:
Max Schenkelberg 2012-12-06 11:23:22 -06:00
parent 72f6a0ea90
commit 71d34ca33a
6 changed files with 28 additions and 82 deletions

View file

@ -180,6 +180,13 @@ public class GFETimeMatcher extends AbstractTimeMatcher {
// Fix Arrays.binarySearch returning -insertionIndex-1
currIdx = -currIdx - 1;
}
// Cap index to ensure within bounds of times
if (currIdx < 0) {
currIdx = 0;
} else if (currIdx >= descriptorTimes.length) {
currIdx = descriptorTimes.length - 1;
}
} else {
currIdx = 0;
}

View file

@ -194,28 +194,6 @@ public interface ISpatialDisplayManager {
public void removeSpatialEditorTimeChangedListener(
ISpatialEditorTimeChangedListener listener);
/**
* NOTE: This only works for continuous colormaps--otherwise returns null
*
* @param p
* the parm to check
* @return the color map parameters
*/
public ColorMapParameters getColorMapParameters(Parm p)
throws GFEOperationFailedException;
/**
* NOTE: This only works for continuous colormaps--otherwise returns null
*
* @param p
* the parm to check
* @param descriptor
* TODO
* @return the color map parameters
*/
public ColorMapParameters getColorMapParameters(Parm p,
IDescriptor descriptor) throws GFEOperationFailedException;
/**
* Add an edit tool to the display
*

View file

@ -349,48 +349,6 @@ public abstract class AbstractSpatialDisplayManager implements
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.gfe.core.ISpatialDisplayManager#getColorMapParameters
* (com.raytheon.viz.gfe.core.parm.Parm)
*/
@Override
public ColorMapParameters getColorMapParameters(Parm p)
throws GFEOperationFailedException {
for (IDescriptor descriptor : getDescriptors()) {
ColorMapParameters cmap = getColorMapParameters(p, descriptor);
if (cmap != null) {
return cmap;
}
}
return null;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.gfe.core.ISpatialDisplayManager#getColorMapParameters
* (com.raytheon .viz.gfe.core.parm.Parm)
*/
@Override
public ColorMapParameters getColorMapParameters(Parm p,
IDescriptor descriptor) throws GFEOperationFailedException {
List<GFEResource> resourceList = descriptor.getResourceList()
.getResourcesByTypeAsType(GFEResource.class);
for (GFEResource gfeRsc : resourceList) {
if (gfeRsc.getParm().equals(p)) {
return gfeRsc.getCapability(ColorMapCapability.class)
.getColorMapParameters();
}
}
return null;
}
/*
* (non-Javadoc)
*

View file

@ -119,15 +119,11 @@ public class ContinuousColorbar implements IColorBarDisplay {
ISpatialDisplayManager spatialDisplayManager = dManager
.getSpatialDisplayManager();
ColorMapParameters cmap = null;
try {
cmap = spatialDisplayManager.getColorMapParameters(parm,
colorbarResource.getDescriptor());
} catch (GFEOperationFailedException e) {
// spatial display manager may not be active.
// Log the exception in case it's something else
log.handle(Priority.DEBUG, "Error obtaining color map", e);
}
ResourcePair parmRsc = spatialDisplayManager.getResourcePair(parm);
ColorMapParameters cmap = parmRsc.getResource()
.getCapability(ColorMapCapability.class)
.getColorMapParameters();
if (cmap == null) {
log.debug("Cannot obtain color map, exiting paint()");

View file

@ -179,12 +179,11 @@ public class DiscreteColorbar implements IColorBarDisplay,
@Override
public void paint(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
if (parm == null) {
DataTime currentTime = paintProps.getDataTime();
if (parm == null || currentTime == null) {
return;
}
DataTime currentTime = paintProps.getDataTime();
IGridData gridData = parm.overlappingGrid(currentTime.getRefTime());
boolean currentIscMode = parm.getDataManager().getParmManager()
.iscMode();

View file

@ -49,8 +49,11 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.viz.gfe.GFEOperationFailedException;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.griddata.IGridData;
import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient;
@ -191,10 +194,15 @@ public class TemporalEditorNumericBar extends AbstractTemporalEditorBar
if (!parmList.contains(parm)) {
super.addParm(parm, ts);
try {
IColorMap colorMap = DataManager.getCurrentInstance()
.getSpatialDisplayManager().getColorMapParameters(parm)
.getColorMap();
IColorMap colorMap = null;
ResourcePair rsc = DataManagerUIFactory.getCurrentInstance()
.getSpatialDisplayManager().getResourcePair(parm);
if (rsc != null) {
colorMap = rsc.getResource()
.getCapability(ColorMapCapability.class)
.getColorMapParameters().getColorMap();
}
if (colorMap != null) {
List<Color> colorList = new ArrayList<Color>();
Display display = Display.getCurrent();
@ -207,11 +215,11 @@ public class TemporalEditorNumericBar extends AbstractTemporalEditorBar
}
parmColorMap.put(parm, colorList);
} catch (GFEOperationFailedException e) {
} else {
statusHandler.handle(
Priority.PROBLEM,
"Could not determine colormap for Parm["
+ parm.getFormattedString() + "]", e);
+ parm.getFormattedString() + "]");
}
scaleVisual.setParms(parmList);