Issue #3016 Fix ColormappedImage and ColorMapper.
Change-Id: Ic4828f393ef628b16a2a29e78446f3569974cc5b Former-commit-id:825335ee95
[formerlyd2b4d70702
] [formerly2a68e875a5
] [formerly2a68e875a5
[formerly6e0147169f
]] [formerly825335ee95
[formerlyd2b4d70702
] [formerly2a68e875a5
] [formerly2a68e875a5
[formerly6e0147169f
]] [formerly9f085a0856
[formerly2a68e875a5
[formerly6e0147169f
] [formerly9f085a0856
[formerly f7d07544e07552c7fccf744c269ee4aa54dc745c]]]]] Former-commit-id:9f085a0856
Former-commit-id:006f36663d
[formerlyc263058e63
] [formerlya6fa60f40d
] [formerly 1c4b55c3a92c08aeec342837c4c4493d815effdc [formerly 4b1dcfa5f1e94d0867e4b137f8e3643f96ecc196] [formerlya6fa60f40d
[formerly4622ad9b8a
]]] Former-commit-id: 6a2a5aec0b8fd85048aca0d95b32ed89e39085b8 [formerly c311f1a789e254f3b8d8c63514a373eb8b409c06] [formerly072102dff0
[formerly56a1b8b682
]] Former-commit-id:072102dff0
Former-commit-id:861aaf0dfa
This commit is contained in:
parent
81f6502f3e
commit
cb037827eb
2 changed files with 18 additions and 5 deletions
|
@ -44,7 +44,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 16, 2011 mschenke Initial creation
|
||||
* Dec 16, 2011 mschenke Initial creation
|
||||
* Feb 27, 2013 #1532 bsteffen Delete uf.common.colormap.image
|
||||
* Nov 11, 2013 #2492 mschenke Added getDataUnti to IColormappedImage
|
||||
* Apr 15, 2014 #3016 randerso Fix null pointer during construction
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -107,7 +110,9 @@ public class ColormappedImage implements IColormappedImage,
|
|||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
image.dispose();
|
||||
if (image != null) {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
|
|||
* Aug 13, 2010 mschenke Initial creation
|
||||
* Feb 15, 2013 1638 mschenke Moved IndexColorModel creation to common.colormap utility
|
||||
* Nov 4, 2013 2492 mschenke Rewritten to model glsl equivalent
|
||||
* Apr 15, 2014 3016 randerso Check in Max's fix for getColorByIndex
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -241,7 +242,7 @@ public class Colormapper {
|
|||
rangeMin = rangeMax;
|
||||
rangeMax = tmp;
|
||||
}
|
||||
|
||||
|
||||
double index = 0.0;
|
||||
// Flag if min/max values are on opposite sides of zero
|
||||
boolean minMaxOpposite = (cmapMin < 0 && cmapMax > 0)
|
||||
|
@ -384,8 +385,15 @@ public class Colormapper {
|
|||
* high.getAlpha());
|
||||
return new Color(r, g, b, a);
|
||||
} else {
|
||||
return colorMap.getColors().get(
|
||||
(int) (index * (colorMap.getSize() - 1)));
|
||||
int colorIndex = (int) (index * colorMap.getSize());
|
||||
|
||||
if (colorIndex < 0) {
|
||||
colorIndex = 0;
|
||||
} else if (colorIndex >= colorMap.getSize()) {
|
||||
colorIndex = colorMap.getSize() - 1;
|
||||
}
|
||||
|
||||
return colorMap.getColors().get(colorIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue