23 #ifndef MAPPERFUNCTIONBASE_H
24 #define MAPPERFUNCTIONBASE_H
25 #define MAXCONTROLPOINTS 50
27 #include <vapor/ExpatParseMgr.h>
28 #include <vapor/OpacityMapBase.h>
29 #include <vapor/ColorMapBase.h>
30 #include <vapor/tfinterpolator.h>
49 float opacityValue(
float point);
50 void hsvValue(
float point,
float* h,
float* sat,
float* val);
59 void makeLut(
float* clut);
81 virtual void setVarNum(
int var) { colorVarNum = var; opacVarNum = var;}
88 virtual OpacityMapBase* createOpacityMap(
89 OpacityMapBase::Type type=OpacityMapBase::CONTROL_POINT
91 virtual OpacityMapBase* getOpacityMap(
int index)
const;
92 void deleteOpacityMap(OpacityMapBase *omap);
116 virtual ColorMapBase* getColormap()
const;
121 static void hsvToRgb(
float* hsv,
float* rgb);
122 static void rgbToHsv(
float* rgb,
float* hsv);
127 static int mapPosition(
float x,
float minValue,
float maxValue,
int hSize);
139 int indx = mapPosition(point,
140 getMinColorMapValue(),
141 getMaxColorMapValue(), numEntries-1);
142 if (indx < 0) indx = 0;
143 if (indx > numEntries-1) indx = numEntries-1;
149 return (
float)(getMinColorMapValue() +
150 ((float)indx)*(float)(getMaxColorMapValue()-
151 getMinColorMapValue())/
152 (
float)(numEntries-1));
157 int indx = mapPosition(point,
158 getMinOpacMapValue(),
159 getMaxOpacMapValue(), numEntries-1);
160 if (indx < 0) indx = 0;
161 if (indx > numEntries-1) indx = numEntries-1;
167 return (
float)(getMinOpacMapValue() +
168 ((float)indx)*(float)(getMaxOpacMapValue()-
169 getMinOpacMapValue())/
170 (
float)(numEntries-1));
186 std::string&,
const char **);
188 virtual bool elementEndHandler(
ExpatParseMgr*,
int, std::string&);
195 if (_colormap)
return _colormap->interpType();
196 return TFInterpolator::linear;
199 if (_colormap) _colormap->interpType(t);
275 #endif //MAPPERFUNCTIONBASE_H
float mapOpacIndexToFloat(int indx)
float getMinColorMapValue()
CompositionType getOpacityComposition()
A Params subclass for managing parameters used by Renderers.
virtual void setColorVarNum(int var)
int getNumOpacityMaps() const
void setMinColorMapValue(float val)
static const string _rightColorBoundAttr
Nodes with state in Xml tree representation.
int mapFloatToColorIndex(float point)
float getMinOpacMapValue()
virtual void setOpacVarNum(int var)
float mapColorIndexToFloat(int indx)
vector< OpacityMapBase * > _opacityMaps
static const string _rightColorBoundTag
static const string _colorControlPointTag
static const string _hsvAttr
float getOpacityScaleFactor()
static const string _leftOpacityBoundAttr
TFInterpolator::type colorInterpType()
int mapFloatToOpacIndex(float point)
static const string _leftOpacityBoundTag
virtual void setVarNum(int var)
void setOpacityScaleFactor(float val)
static const string _positionAttr
float getMaxOpacMapValue()
static const string _leftColorBoundTag
CompositionType _compType
static const string _rightOpacityBoundTag
void setMaxOpacMapValue(float val)
void setMinOpacMapValue(float val)
static const string _opacityCompositionTag
void setColorInterpType(TFInterpolator::type t)
static const string _rightOpacityBoundAttr
void setNumEntries(int val)
static const string _opacityCompositionAttr
void setMaxColorMapValue(float val)
static const string _opacityAttr
static const string _leftColorBoundAttr
float getMaxColorMapValue()
static const string _rgbAttr
static const string _opacityControlPointTag
static const string _mapperFunctionTag
void setOpacityComposition(CompositionType t)