package sgtplot.util;

import java.util.*;
import java.awt.*;


public class IndexedColorMap {
	String mParamName;
	double mMinVal;
	double mMaxVal;
	double[] mVals = null;
	Color[] mColors = null;
	int mNumColors;
	ColorMap mColorMap;
	
	public IndexedColorMap(ColorMap inCM, int numColors) {
		mNumColors = numColors;
		mColorMap = inCM;
		mVals = new double[mNumColors];
		mColors = new Color[mNumColors];
		
		// initialize the indexed colormap
		mMinVal = mColorMap.getMinValue();
		mMaxVal = mColorMap.getMaxValue();
		mParamName = new String(mColorMap.getParamName());
		
		double delta = (mMaxVal - mMinVal)/(double)mNumColors;
		
		for (int i=0; i= mNumColors)
			return mColors[mNumColors-1];
		else
			return mColors[index];
	}
	
	public Color[] getColors() {
		return mColors;
	}
	
	public String getParamName() {
		return mParamName;
	}
}
 

Ads help maintain this website.