Class ColorMap
- java.lang.Object
-
- org.eclipse.nebula.visualization.widgets.datadefinition.ColorMap
-
public class ColorMap extends java.lang.ObjectColor Map data type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classColorMap.PredefinedColorMap
-
Field Summary
Fields Modifier and Type Field Description private booleanautoScaleprivate java.util.LinkedHashMap<java.lang.Double,org.eclipse.swt.graphics.RGB>colorMapprivate doublecolorMapMaxprivate doublecolorMapMinprivate org.eclipse.swt.graphics.RGB[]colorsLookupTableprivate booleaninterpolateprivate org.eclipse.swt.graphics.PaletteDatapaletteprivate int[]pixelLookupTableprivate ColorMap.PredefinedColorMappredefinedColorMap
-
Constructor Summary
Constructors Constructor Description ColorMap()ColorMap(ColorMap.PredefinedColorMap predefinedColorMap, boolean autoScale, boolean interpolate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.graphics.ImageDatadrawImage(double[] dataArray, int dataWidth, int dataHeight, double max, double min)Calculate the image data from source data based on the color map.org.eclipse.swt.graphics.ImageDatadrawImage(IPrimaryArrayWrapper dataArray, int dataWidth, int dataHeight, double max, double min, org.eclipse.swt.graphics.ImageData imageData, boolean shrink)Calculate the image data from source data based on the color map.org.eclipse.swt.graphics.RGB[]getColorsLookupTable()Get a colors lookup table from 0 to 255.private org.eclipse.swt.graphics.RGBgetInterpolateRGB(ColorTuple start, ColorTuple end, double value)java.util.LinkedHashMap<java.lang.Double,org.eclipse.swt.graphics.RGB>getMap()org.eclipse.swt.graphics.PaletteDatagetPalette()ColorMap.PredefinedColorMapgetPredefinedColorMap()org.eclipse.swt.graphics.RGBgetValueRGB(ColorTuple[] colorTupleArray, double[] keyArray, double value)booleanisAutoScale()booleanisInterpolate()voidsetAutoScale(boolean autoScale)voidsetColorMap(java.util.LinkedHashMap<java.lang.Double,org.eclipse.swt.graphics.RGB> colorMap)Set a new map.voidsetInterpolate(boolean interpolate)voidsetPredefinedColorMap(ColorMap.PredefinedColorMap predefinedColorMap)java.lang.StringtoString()
-
-
-
Field Detail
-
colorMap
private java.util.LinkedHashMap<java.lang.Double,org.eclipse.swt.graphics.RGB> colorMap
-
predefinedColorMap
private ColorMap.PredefinedColorMap predefinedColorMap
-
autoScale
private boolean autoScale
-
interpolate
private boolean interpolate
-
colorsLookupTable
private org.eclipse.swt.graphics.RGB[] colorsLookupTable
-
pixelLookupTable
private int[] pixelLookupTable
-
palette
private org.eclipse.swt.graphics.PaletteData palette
-
colorMapMin
private double colorMapMin
-
colorMapMax
private double colorMapMax
-
-
Constructor Detail
-
ColorMap
public ColorMap()
-
ColorMap
public ColorMap(ColorMap.PredefinedColorMap predefinedColorMap, boolean autoScale, boolean interpolate)
-
-
Method Detail
-
getMap
public java.util.LinkedHashMap<java.lang.Double,org.eclipse.swt.graphics.RGB> getMap()
- Returns:
- the map which back up the ColorMap
-
setColorMap
public void setColorMap(java.util.LinkedHashMap<java.lang.Double,org.eclipse.swt.graphics.RGB> colorMap)
Set a new map.- Parameters:
colorMap- the new map.
-
setAutoScale
public void setAutoScale(boolean autoScale)
- Parameters:
autoScale- the autoScale to set
-
isAutoScale
public boolean isAutoScale()
- Returns:
- the autoScale
-
setInterpolate
public void setInterpolate(boolean interpolate)
- Parameters:
interpolate- the interpolate to set
-
isInterpolate
public boolean isInterpolate()
- Returns:
- the interpolate
-
setPredefinedColorMap
public void setPredefinedColorMap(ColorMap.PredefinedColorMap predefinedColorMap)
- Parameters:
predefinedColorMap- the predefinedColorMap to set
-
getPredefinedColorMap
public ColorMap.PredefinedColorMap getPredefinedColorMap()
- Returns:
- the predefinedColorMap
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
drawImage
public org.eclipse.swt.graphics.ImageData drawImage(IPrimaryArrayWrapper dataArray, int dataWidth, int dataHeight, double max, double min, org.eclipse.swt.graphics.ImageData imageData, boolean shrink)
Calculate the image data from source data based on the color map.- Parameters:
dataArray- the source datadataWidth- number of columns of dataArray; This will be the width of image data.dataHeight- number of rows of dataArray; This will be the height of image data.max- the upper limit of the data in dataArraymin- the lower limit of the data in dataArrayimageData- the imageData to be filled. null if a new instance should be created.shrink- true if area size of image data is smaller than dataWidth*dataHeight. If this is true, it will use the nearest neighbor iamge scaling algorithm as described at http://tech-algorithm.com/articles/nearest-neighbor-image-scaling/.- Returns:
- the image data. null if dataWidth or dataHeight is less than 1.
-
drawImage
public org.eclipse.swt.graphics.ImageData drawImage(double[] dataArray, int dataWidth, int dataHeight, double max, double min)Calculate the image data from source data based on the color map.- Parameters:
dataArray- the source datadataWidth- number of columns of dataArray; This will be the width of image data.dataHeight- number of rows of dataArray; This will be the height of image data.max- the upper limit of the data in dataArraymin- the lower limit of the data in dataArrayimageData- the imageData to be filled. null if a new instance should be created.- Returns:
- the image data. null if dataWidth or dataHeight is less than 1.
-
getValueRGB
public org.eclipse.swt.graphics.RGB getValueRGB(ColorTuple[] colorTupleArray, double[] keyArray, double value)
- Parameters:
colorTupleArray-keyArray-value- the value which has been scaled or not based on the autoScale flag.min-max-- Returns:
-
getInterpolateRGB
private org.eclipse.swt.graphics.RGB getInterpolateRGB(ColorTuple start, ColorTuple end, double value)
-
getColorsLookupTable
public org.eclipse.swt.graphics.RGB[] getColorsLookupTable()
Get a colors lookup table from 0 to 255. This only works for autoScale is true;- Returns:
- the colorsLookupTable a array of 256 colors corresponding to the value from min to max
-
getPalette
public org.eclipse.swt.graphics.PaletteData getPalette()
-
-