The Legend module has been provided as a means to draw a color/transparency bar which diagrams the mapping of field values to color and transparency as represented by the Levels, ColorMap and TransMap objects.
*vis_LevelsBegin - create an instance of a Levels object vis_LevelsEnd - destroy an instance of a Levels object vis_LevelsError - return Levels object error flag vis_LevelsCopy - make a copy of a Levels object
vis_LevelsDef - define suggested number of levels and scaling Inq - inquire suggested number of levels and scaling vis_LevelsFindOne - determine level given field value vis_LevelsFindOneBound - determine bounding levels given field value vis_LevelsFindScales - determine scales given field values vis_LevelsGenerate - compute field values at all levels vis_LevelsGetNumLevels - get actual number of generated levels vis_LevelsSetIndex - set map index at a specific level GetIndex - get map index at a specific level vis_LevelsSetLabel - set text label at a specific level GetLabel - get text label at a specific level vis_LevelsSetMinMax - set field value extremes GetMinMax - get field value extremes vis_LevelsSetValue - set field value at a specific level GetValue - get field value at a specific level
An example of a Levels object is represented schematically in Figure 3-1. The object was generated using the following code fragment.
levels = vis_LevelsBegin (); vis_LevelsDef (levels,LEVELS_LINEAR,3); vis_LevelsSetMinMax (levels,0.,1.); vis_LevelsGenerate (levels,LEVELS_PADENDS); vis_LevelsSetIndex (levels,0,5);If this Levels object is set as an attribute to a Contour object and discrete contour lines are generated, then up to 3 contour lines are created at field values .25, .50 and .75 . The associated map indices, 1, 2 and 3, are used to specify colors or transparencies in a ColorMap or TransMap object. If color filled fringes are requested, then up to 5 color filled regions are generated. Note that any region falling below the field value of level 1 (.25) is colored with map index 5.
*vis_LevelsBegin - create an instance of a Levels object
vis_Levels *vis_LevelsBegin ()
None
Destroy an instance of a Levels object using
void vis_LevelsEnd (vis_Levels *levels)
Return the current value of a Levels object error flag using
Vint vis_LevelsError (vis_Levels *levels)
Make a copy of a Levels object. The private data from the fromlevels object is copied to the levels object. Any previous private data in levels is lost.
void vgl_LevelsCopy (vgl_Levels *levels, vgl_Levels *fromlevels)
vis_LevelsDef - define suggested number of levels and spacing
void vis_LevelsDef (vis_Levels *levels, Vint type, Vint nlevels)
levels Pointer to Levels object. type Method used to scale field values =LEVELS_LINEAR Scale field values linearly. =LEVELS_LOG Scale field values logarithmically. nlevels Suggested number of levels. 1 <= nlevels < LEVELS_MAX.
None
In general, the actual number of levels is set equal to the suggested number of levels. The actual number of levels changes only if using vis_LevelsGenerate to generate levels automatically using a "round" spacing method or with the minimum and maximum values specified using vis_LevelsSetMinMax set equal to one another. The defined constant LEVELS_MAX is currently set to 256 to reflect the maximum number of levels, ie 1 <= nlevels < LEVELS_MAX
Inquire of defined type and nlevels as output arguments using
void vis_LevelsInq (vis_Levels *levels, Vint *type, Vint *nlevels)
vis_LevelsFindOne - determine level given field value
void vis_LevelsFindOne (vis_Levels *levels, Vfloat value, Vint *ilevel)
levels Pointer to Levels object. value Field value
ilevel Level number
vis_LevelsFindOneBound - determine bounding levels given field value
void vis_LevelsFindOneBound (vis_Levels *levels, Vfloat value, Vint *ilevello, Vint *ilevelhi, Vfloat *w)
levels Pointer to Levels object. value Field value
ilevello Low bound level number ilevelhi High bound level number w Relative interval position, 0. <= w <= 1.
vis_LevelsFindScales - determine scales given field values
void vis_LevelsFindScales (vis_Levels *levels, Vint nvals, Vfloat values[], Vfloat scales[])
levels Pointer to Levels object. nvals Number of field values values Field values
scales Scale factors in the interval [0.,1.]
vis_LevelsGenerate - generate field values at all levels
void vis_LevelsGenerate (vis_Levels *levels, Vint method)
levels Pointer to Levels object. method Method used to space field values =LEVELS_PADNONE Include the field value extremes. =LEVELS_PADENDS Exclude the field value extremes. =LEVELS_PADTOP Exclude the field value maximum. =LEVELS_ROUND Round numbers within field value extremes. =LEVELS_ROUNDSPAN Round numbers span field value extremes.
None
vis_LevelsGetNumLevels - get actual number of levels
void vis_LevelsGetNumLevels (vis_Levels *levels, Vint *numlevels)
levels Pointer to Levels object.
numlevels Actual number of levels
vis_LevelsSetIndex - set map index at level
void vis_LevelsSetIndex (vis_Levels *levels, Vint ilevel, Vint index)
levels Pointer to Levels object. ilevel Level number, 0 <= ilevel <= LEVELS_MAX index Map index >= 0 at level ilevel
None
Get index as an output argument using
void vis_LevelsGetIndex (vis_Levels *levels, Vint ilevel, Vint *index)
vis_LevelsSetLabel - set text label at a specific level
void vis_LevelsSetLabel (vis_Levels *levels, Vint ilevel, Vchar *label) void vis_LevelsSetLabeltv (vis_Levels *levels, Vint ilevel, Vtchar *label)
levels Pointer to Levels object. ilevel Level number label Text label at ilevel
None
Get label as an output argument using
void vis_LevelsGetLabel (vis_Levels *levels, Vint ilevel, Vchar label[]) void vis_LevelsGetLabeltv (vis_Levels *levels, Vint ilevel, Vtchar label[])
vis_LevelsSetMinMax - set field value extremes
void vis_LevelsSetMinMax (vis_Levels *levels, Vfloat min, Vfloat max)
levels Pointer to Levels object. min Field value minimum max Field value maximum
None
Get min and max as output arguments using
void vis_LevelsGetMinMax (vis_Levels *levels, Vfloat *min, Vfloat *max)
vis_LevelsSetValue - set field value at level
void vis_LevelsSetValue (vis_Levels *levels, Vint ilevel, Vfloat value)
levels Pointer to Levels object. ilevel Level number value Field value at level ilevel
None
Get value as an output argument using
void vis_LevelsGetValue (vis_Levels *levels, Vint ilevel, Vfloat *value)
*vis_ColorMapBegin - create an instance of a ColorMap object vis_ColorMapEnd - destroy an instance of a ColorMap object vis_ColorMapError - return ColorMap object error flag vis_ColorMapCopy - make a copy of a ColorMap object
vis_ColorMapInterpolate - generate color map by interpolation vis_ColorMapLevelsGetColors - compute spectrum of RGB triples vis_ColorMapRamp - generate one of several built-in color maps vis_ColorMapSetGamma - set gamma correction factor GetGamma - get gamma correction factor vis_ColorMapSetIndex - set pseudocolor index at map index GetIndex - get pseudocolor index at map index vis_ColorMapSetRGB - set truecolor RGB triple at map index GetRGB - get truecolor RGB triple at map index vis_ColorMapGetRGBBound - get truecolor RGB triple bounded by indices vis_ColorMapSetHSL - set truecolor HSL triple at map index GetHSL - get truecolor HSL triple at map index vis_ColorMapSetType - set pseudocolor or true color color map type GetType - get pseudocolor or true color color map type vis_ColorMapValueDrawFun - apply color
colormap = vis_ColorMapBegin (); vis_ColorMapSetType (colormap,COLORMAP_TRUECOLOR); vis_ColorMapRamp (colormap,3,1,COLORMAP_MAGENTA,1.); c[0] = .5; c[1] = .5; c[2] = .5; vis_ColorMapSetRGB (colormap,1,5,(Vfloat(*)[3],c);A simple magenta spectrum is set at map indices 1, 2 and 3. A 50 percent gray is placed at map index 5. The colormap is a truecolor colormap. If this ColorMap object were set as an attribute to a Contour object with the Levels object in Figure 3-1, and discrete contour lines are generated, then up to 3 contour lines are created with the RGB colors (1.,0.,1.), (1.,0.,.5), (1.,0.,0.) respectively. If color filled fringes are requested, then up to 4 color filled regions are generated. Note that any region falling below the lowest contour line is given the RGB color (.5,.5,.5).
*vis_ColorMapBegin - create an instance of a ColorMap object
vis_ColorMap *vis_ColorMapBegin ()
None
Destroy an instance of a ColorMap object using
void vis_ColorMapEnd (vis_ColorMap *colormap)
Return the current value of a ColorMap object error flag using
Vint vis_ColorMapError (vis_ColorMap *colormap)
Make a copy of a ColorMap object. The private data from the fromcolormap object is copied to the colormap object. Any previous private data in colormap is lost.
void vis_ColorMapCopy (vis_ColorMap *colormap, vis_ColorMap *fromcolormap)
vis_ColorMapInterpolate - generate color map by interpolation
void vis_ColorMapInterpolate (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vint colorspace, Vint npts, Vfloat w[], Vfloat c[][3])
colormap Pointer to ColorMap object. nmapindex Number of truecolor RGB or HSL triples to set imapindex Starting map index colorspace Color space of input colors =COLORMAP_HSL Hue, saturation and lightness =COLORMAP_RGB Red, green and blue npts Number of parametric coordinates with associated color triple w Vector of npts parametric coordinates in the interval [0.,1.] for the input colors. c Array of npts truecolor RGB or HSL triples at parametric coordinates w.
None
If RGB colors are input, the individual red, green and blue components are normalized in the interval [0.,1.]. If HSL colors are input, the hue varies in the interval [0.,360.], saturation and lightness in [0.,1.]. Note that maximum saturation occurs at a lightness of .5.
vis_ColorMapLevelsGetColors - compute spectrum of RGB triples
void vis_ColorMapLevelsGetColors (vis_ColorMap *colormap, vis_Levels *levels, Vint type, Vint ncolors, Vfloat c[][3])
colormap Pointer to ColorMap object. levels Pointer to Levels object. type Type of color spectrum to compute =COLORMAP_FRINGE Constant color between levels. =COLORMAP_TONE Continuous color between levels. ncolors Number of colors to compute in spectrum 1 <= ncolors c Array of ncolors truecolor RGB triples.
None
Each color computed in the spectrum is the color computed assuming that the field values vary linearly from the minimum to the maximum field values set in the levels object (see vis_LevelsSetMinMax). The first RGB triple, c[0], is computed at the minimum field value, the last RGB triple, c[ncolors-1] is computed at the maximum field value. Intermediate RGB triples are computed assuming the linear variation mentioned above.
The computed spectrum may be used as a texture if performing contouring using texture mapping (see Contour module). In this case there are probable constraints on the value of ncolors. Normally ncolors must be a power of 2 or a multiple of 16, etc. A value of 256 is a safe choice. Other uses include displaying the spectrum as part of a "contour" legend.
vis_ColorMapRamp - generate one of several built-in color maps
void vis_ColorMapRamp (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vint ramp)
colormap Pointer to ColorMap object. nmapindex Number of truecolor RGB triples to generate imapindex Starting map index ramp Type of color map to generate =COLORMAP_TEMPERATURE Set a temperature like spectrum =COLORMAP_MAGENTA Set evenly spaced fully saturated hues from magenta to red counterclockwise in HSL color space. =COLORMAP_GRAYSCALE Set shades of gray ranging from nearly black to nearly white. =COLORMAP_HUE Set evenly spaced hues from magentared to red in HSL color space with full saturation and lightness. =COLORMAP_HUESCALE Set evenly spaced hues from magentared to red in HSL color space. Saturation and lightness also vary evenly from zero saturation and lightness to full saturation and lightness. =COLORMAP_ABAQUS Set an ABAQUS like spectrum with unevenly spaced hues from blue to red. This spectrum is similar to the ANSYS like spectrum with no restrictions on nmapindex. =COLORMAP_ANSYS Set an ANSYS like spectrum with evenly spaced hues from blue to red. This spectrum should be set with nmapindex = 12. =COLORMAP_PATRAN Set a PATRAN like spectrum. This spectrum should be set with nmapindex = 16. =COLORMAP_RAINBOW Set colors approximating the sequence of colors in a rainbow. =COLORMAP_SET Set a standard set of 29 colors This spectrum should be set with nmapindex = 29. =COLORMAP_4BAND Set a simple set of 4 colors, blue, green, yellow, red. This spectrum should be set with nmapindex = 4.
None
The COLORMAP_SET ramp defines 29 colors consisting of white and black, and light and dark shades of red, green, blue, magenta, cyan and yellow as well as several shades of gray. The color map index for each color is given by the following defined constants. It is guaranteed to be the case that the values for each defined constant are incremented in the order in which they are listed below. This means, for example, that COLORMAP_SET_BLUE is the same as COLORMAP_SET_RED+2 .
COLORMAP_SET_RED - red COLORMAP_SET_GREEN - green COLORMAP_SET_BLUE - blue COLORMAP_SET_YELLOW - yellow COLORMAP_SET_CYAN - cyan COLORMAP_SET_MAGENTA - magenta COLORMAP_SET_REDLITE - light red COLORMAP_SET_GREENLITE - light green COLORMAP_SET_BLUELITE - light blue COLORMAP_SET_YELLOWLITE - light yellow COLORMAP_SET_CYANLITE - light cyan COLORMAP_SET_MAGENTALITE - light magenta COLORMAP_SET_REDDARK - dark red COLORMAP_SET_GREENDARK - dark green COLORMAP_SET_BLUEDARK - dark blue COLORMAP_SET_YELLOWDARK - dark yellow COLORMAP_SET_CYANDARK - dark cyan COLORMAP_SET_MAGENTADARK - dark magenta COLORMAP_SET_BLACK - black COLORMAP_SET_WHITE - white COLORMAP_SET_GRAY10 - 10 percent gray (very dark gray) COLORMAP_SET_GRAY20 - 20 percent gray COLORMAP_SET_GRAY30 - 30 percent gray COLORMAP_SET_GRAY40 - 40 percent gray COLORMAP_SET_GRAY50 - 50 percent gray COLORMAP_SET_GRAY60 - 60 percent gray COLORMAP_SET_GRAY70 - 70 percent gray COLORMAP_SET_GRAY80 - 80 percent gray COLORMAP_SET_GRAY90 - 90 percent gray (very light gray)
vis_ColorMapSetGamma - set gamma correction factor
void vis_ColorMapSetGamma (vis_ColorMap *colormap, Vfloat gamma)
colormap Pointer to ColorMap object. gamma Gamma correction factor.
None
Get gamma as an output argument using
void vis_ColorMapGetGamma (vis_ColorMap *colormap, Vfloat *gamma)
vis_ColorMapSetIndex - set pseudocolor indices in color map
void vis_ColorMapSetIndex (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vint index[])
colormap Pointer to ColorMap object. nmapindex Number of pseudocolor indices to set imapindex Starting map index index Array of nmapindex pseudocolor indices
None
Get index as an output argument using
void vis_ColorMapGetIndex (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vint index[])
vis_ColorMapSetRGB,vis_ColorMapSetHSL - set RGB or HSL triples in color map
void vis_ColorMapSetRGB (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vfloat c[][3]) void vis_ColorMapSetHSL (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vfloat c[][3])
colormap Pointer to ColorMap object. nmapindex Number truecolor RGB triples to set imapindex Starting map index c Array of nmapindex truecolor RGB or HSL triples
None
Get truecolor RGB triples c as an output argument using
void vis_ColorMapGetRGB (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vfloat c[][3])
Get truecolor HSL triples c as an output argument using
void vis_ColorMapGetHSL (vis_ColorMap *colormap, Vint nmapindex, Vint imapindex, Vfloat c[][3])
vis_ColorMapGetRGBBound - get truecolor RGB triple bounded by indices
void vis_ColorMapGetRGBBound (vis_ColorMap *colormap, Vint imaplo, Vint imaphi, Vfloat w, Vfloat c[3])
colormap Pointer to ColorMap object. imaplo Low bound map index imaphi High bound map index w Relative interval position, 0. <= w <= 1.
c Truecolor RGB triple
vis_ColorMapSetType - set color map type as pseudocolor or truecolor
void vis_ColorMapSetType (vis_ColorMap *colormap, Vint type)
colormap Pointer to ColorMap object. type Color map type =COLORMAP_PSEUDOCOLOR Set pseudocolor color map =COLORMAP_TRUECOLOR Set truecolor color map
None
Get type as an output argument using
void vis_ColorMapGetType (vis_ColorMap *colormap, Vint *type)
vis_ColorMapValueDrawFun - apply color
void vis_ColorMapValueDrawFun (vis_ColorMap *colormap, vgl_DrawFun *drawfun, Vint mapindex)
colormap Pointer to ColorMap object. drawfun Pointer to DrawFun object. mapindex Map index
None
*vis_TransMapBegin - create an instance of a TransMap object vis_TransMapEnd - destroy an instance of a TransMap object vis_TransMapError - return TransMap object error flag vis_TransMapCopy - make a copy of a TransMap object
vis_TransMapInterpolate - generate transparency map by interpolation vis_TransMapRamp - generate a built-in transparency map vis_TransMapSetDecay - set decay exponent GetDecay - get decay exponent vis_TransMapSetIndex - set transparency index at map index GetIndex - get transparency index at map index vis_TransMapSetTrans - set transparency factor at map index GetTrans - get transparency factor at map index vis_TransMapSetType - set index or factor transparency map GetType - get index or factor transparency map vis_TransMapValueDrawFun - apply transparency
An example of a TransMap object is represented schematically in Figure 3-3. The object was generated using the following code fragment.
transmap = vis_TransMapBegin (); vis_TransMapSetType (transmap,TRANSMAP_FACTOR); vis_TransMapRamp (transmap,5,0,TRANSMAP_UP); vis_TransMapSetTrans (transmap,1,5,1.);Evenly spaced transparency factors are set at map indices 0 through 4. A single transparency factor of 1. is placed at map index 5. The transmap is a factor transparency map. If this TransMap object were set as an attribute to a Contour object with the Levels object in Figure 3-1, and color filled fringes are requested, then up to 4 color filled regions are generated. Note that any region falling below the lowest contour line is given the transparency factor 1.
*vis_TransMapBegin - create an instance of a TransMap object
vis_TransMap *vis_TransMapBegin ()
None
Destroy an instance of a TransMap object using
void vis_TransMapEnd (vis_TransMap *transmap)
Return the current value of a TransMap object error flag using
Vint vis_TransMapError (vis_TransMap *transmap)
Make a copy of a TransMap object. The private data from the fromtransmap object is copied to the transmap object. Any previous private data in transmap is lost.
void vis_TransMapCopy (vis_TransMap *transmap, vis_TransMap *fromtransmap)
vis_TransMapInterpolate - generate transparency map by interpolation
void vis_TransMapInterpolate (vis_TransMap *transmap, Vint nmapindex, Vint imapindex, Vint npts, Vfloat w[], Vfloat t[])
transmap Pointer to TransMap object. nmapindex Number of transparency factors to generate imapindex Starting map index npts Number of parametric coordinates with associated transparency factor. w Vector of npts parametric coordinates in the interval [0.,1.] for the input transparencies. t Vector of npts transparency factors at parametric coordinates w.
None
vis_TransMapRamp - generate one of several built-in transparency maps
void vis_TransMapRamp (vis_TransMap *transmap, Vint nmapindex, Vint imapindex, Vint ramp)
transmap Pointer to TransMap object. nmapindex Number of transparency factors to generate imapindex Starting map index ramp Type of transparency map to generate =TRANSMAP_UP Set evenly spaced monotonically increasing transparency factors. =TRANSMAP_DOWN Set evenly spaced monotonically decreasing transparency factors. =TRANSMAP_SET Set a standard set of 11 factors This map should be set with nmapindex = 11.
None
The TRANSMAP_SET ramp defines 11 transparency factors consisting of opaque and clear and several intermediate transparencies. The transparency map index for each factor is given by the following defined constants. It is guaranteed to be the case that the values for each defined constant are incremented in the order in which they are listed below. This means that TRANSMAP_SET_FILL10 is the same as TRANSMAP_SET_OPAQUE+2 .
TRANSMAP_SET_OPAQUE - not transparent TRANSMAP_SET_CLEAR - completely transparent TRANSMAP_SET_FILL10 - 10 percent opaque, 90 percent transparent TRANSMAP_SET_FILL20 - 20 percent opaque TRANSMAP_SET_FILL30 - 30 percent opaque TRANSMAP_SET_FILL40 - 40 percent opaque TRANSMAP_SET_FILL50 - 50 percent opaque TRANSMAP_SET_FILL60 - 60 percent opaque TRANSMAP_SET_FILL70 - 70 percent opaque TRANSMAP_SET_FILL80 - 80 percent opaque TRANSMAP_SET_FILL90 - 90 percent opaque, 10 percent transparent
vis_TransMapSetDecay - set decay exponent
void vis_TransMapSetDecay (vis_TransMap *transmap, Vfloat decay)
transmap Pointer to TransMap object. decay Decay exponent
None
Get decay as an output argument using
void vis_TransMapGetDecay (vis_TransMap *transmap, Vfloat *decay)
vis_TransMapSetIndex - set transparency indices in transparency map
void vis_TransMapSetIndex (vis_TransMap *transmap, Vint nmapindex, Vint imapindex, Vint index[])
transmap Pointer to TransMap object. nmapindex Number of transparency indices to set imapindex Starting map index index Array of nmapindex transparency indices
None
Get index as an output argument using
void vis_TransMapGetIndex (vis_TransMap *transmap, Vint nmapindex, Vint imapindex, Vint index[])
vis_TransMapSetTrans - set transparency factors in transparency map
void vis_TransMapSetTrans (vis_TransMap *transmap, Vint nmapindex, Vint imapindex, Vfloat t[])
transmap Pointer to TransMap object. nmapindex Number transparency factors to set imapindex Starting map index t Array of nmapindex transparency factors
None
Get t as an output argument using
void vis_TransMapGetTrans (vis_TransMap *transmap, Vint nmapindex, Vint imapindex, Vfloat t[])
vis_TransMapSetType - set transparency map type as index or factor
void vis_TransMapSetType (vis_TransMap *transmap, Vint type)
transmap Pointer to TransMap object. type Transparency map type =TRANSMAP_INDEX Set index type transparency map =TRANSMAP_FACTOR Set factor type transparency map
None
Get type as an output argument using
void vis_TransMapGetType (vis_TransMap *transmap, Vint *type)
vis_TransMapValueDrawFun - apply transparency
void vis_TransMapValueDrawFun (vis_TransMap *transmap, vgl_DrawFun *drawfun, Vint mapindex)
transmap Pointer to TransMap object. drawfun Pointer to DrawFun object. mapindex Map index
None
*vis_LegendBegin - create an instance of a Legend object vis_LegendEnd - destroy an instance of a Legend object vis_LegendError - return Legend object error flag
vis_LegendDraw - draw a legend diagram vis_LegendSetObject - set pointers to attribute objects. GetObject - get pointers to attribute objects. vis_LegendSetParami - set display parameters
The legend display is parameterized in part by the parameters set using vis_LegendSetParami. The user may choose between a vertical or horizontal layout by setting the parameter type LEGEND_LAYOUT to LEGEND_VERTICAL or LEGEND_HORIZONTAL respectively. The vertical layout draws the levels in order, (minimum to maximum), from bottom to top. By default the labels are drawn left justified to the right of the color bar. An option is available to draw the labels right justified to the left of the color bar. The horizontal layout draws the levels in order, (minimum to maximum), from left to right. The labels are drawn below the color bar.
The color icon at each level may be drawn as a line or a filled rectangle. The representation may be set to correspond to the IsoValType used when performing contour or isosurface plotting. The parameter type LEGEND_SPECTRUM may be set to LEGEND_LINE for a line, LEGEND_FRINGE for a constant color filled rectangle, LEGEND_TONE for a continuous color filled rectangle or LEGEND_TEXTURE for a texture mapped filled rectangle.
The use of a stroked font as opposed to a raster font for drawing labels may be toggled on or off using the parameter LEGEND_STROKEFONT. A border may be toggled on or off using the parameter LEGEND_BORDER. The display of a filled rectangle for level 0 or the maximum level may be toggled on or off using the parameters LEGEND_PADBOTTOM and LEGEND_PADTOP respectively. Labels may be registered to the "fill" region above a level by enabling the LEGEND_LABELALIGNFILL parameter.
The labels may be drawn using the text labels contained in the Levels attribute object by enabling the LEGEND_LABELUSELEVELS parameter. In this case, if a text label has been defined in the Levels attribute object at a particular level it will replace the normal value label drawn for that level.
The result of drawing a legend with a vertical layout, a fringe spectrum type, a raster font, top padding and border is illustrated in Figure 3-4. Accents are enabled and drawn in black.
The VisContext attribute object is required for all drawing. The following VisContext components are used.
*vis_LegendBegin - create an instance of a Legend object
vis_Legend *vis_LegendBegin ()
None
Destroy an instance of a Legend object using
void vis_LegendEnd (vis_Legend *legend)
Return the current value of a Legend object error flag using
Vint vis_LegendError (vis_Legend *legend)
vis_LegendDraw - draw a legend diagram
void vis_LegendDraw (vis_Legend *legend, Vfloat x[3])
legend Pointer to Legend object. x Origin of legend diagram.
None
vis_LegendSetObject - set pointers to attribute objects
void vis_LegendSetObject (vis_Legend *legend, Vint objecttype, Vobject *object)
legend Pointer to Legend object. objecttype The name of the object type to be set. =VGL_DRAWFUN DrawFun object =VIS_COLORMAP ColorMap object =VIS_LEVELS Levels object =VIS_TRANSMAP TransMap object =VIS_VISCONTEXT VisContext object object Pointer to the object to be set.
None
Get object as an output argument using
void vis_LegendGetObject (vis_Legend *legend, Vint objecttype, Vobject **object)
vis_LegendSetParami - set display parameters
void vis_LegendSetParami (vis_Legend *legend, Vint type, Vint iparam)
legend Pointer to Legend object. type Type of display parameter to set =LEGEND_BORDER Toggle border display. =LEGEND_LABELALIGNFILL Toggle labels fill alignment. =LEGEND_LABELUSELEVELS Toggle Levels labels. =LEGEND_LABELLEFT Toggle labels drawn on left =LEGEND_LAYOUT Specify legend layout. =LEGEND_PADBOTTOM Toggle padding bottom of legend =LEGEND_PADTOP Toggle padding top of legend =LEGEND_SPECTRUM Specify level color display; line, constant color fill or continuous color fill. =LEGEND_STROKEFONT Toggle use of stroked font labels. iparam Specifies the integer value that type will be set to. =VIS_ON Enable =VIS_OFF Disable =LEGEND_VERTICAL Vertical legend layout =LEGEND_HORIZONTAL Horizontal legend layout =LEGEND_LINE Levels line. =LEGEND_FRINGE Levels constant color fill. =LEGEND_TEXTURE Levels texture mapped color fill. =LEGEND_TONE Levels continuous color fill.
None
The labels may be drawn using the text labels contained in the Levels attribute object by enabling the LEGEND_LABELUSELEVELS parameter. Labels may be registered to the "fill" region above a level by enabling the LEGEND_LABELALIGNFILL parameter. By default LEGEND_LABELUSELEVELS and LEGEND_LABELALIGNFILL are set to VIS_OFF.
Toggle the drawing of the labels to the right or left of a vertical legend using LEGEND_LABELLEFT. If the labels are drawn to the right of the color bar, they are drawn left justified. If the labels are drawn to the left of the color bar, they are drawn right justified. The proper right justification of labels placed to the left of the color bar is dependent upon the TextBox visualization context component set using vis_VisContextSetTextBox. Label positioning can be finely tuned using the DeviceOffset visualization context component set using vis_VisContextSetDeviceOffset. This option is ignored for a horizontal legend layout. By default LEGEND_LABELLEFT is set to VIS_OFF.
Specify the legend layout. By default LEGEND_LAYOUT is set to LEGEND_VERTICAL.
Toggle the padding of the bottom of the legend. if the spectrum type is fringe or tone, then level 0 fill is drawn in a constant color. By default LEGEND_PADBOTTOM is set to VIS_OFF.
Toggle the padding of the top of the legend. If the spectrum type is fringe or tone, then the maximum level fill is drawn in a constant color. By default LEGEND_PADTOP is set to VIS_OFF.
Specify the legend spectrum type. If the spectrum type, LEGEND_SPECTRUM is set to LEGEND_LINE, then a line is drawn for each level, if set to LEGEND_FRINGE, then a constant color filled rectangle is drawn for each level, if set to LEGEND_TONE, then a continuous color filled rectangle is drawn for each level representing the color variation between levels. if set to LEGEND_TEXTURE, then a texture mapped color filled rectangle is drawn for each level representing the texture mapped color variation between levels.
Toggle the use of a stroked font as opposed to a raster font for drawing labels. By default LEGEND_STROKEFONT is set to VIS_OFF.