class OSGSIM_EXPORT osgSim::ScalarBar

A ScalarBar is an osg::Geode to render a colored bar representing a range of scalars.

Inheritance:


Public Methods

[more] ScalarBar()
Default constructor.
[more] ScalarBar(int numColors, int numLabels, ScalarsToColors* stc, const std::string& title, Orientation orientation = HORIZONTAL, float aspectRatio=0.25, ScalarPrinter* sp=new ScalarPrinter)
Construct a ScalarBar with the supplied parameters.
[more] ScalarBar(const ScalarBar& rhs, const osg::CopyOp& co)
Copy constructor
[more]void setNumColors(int numColors)
Set the number of distinct colours on the ScalarBar.
[more]int getNumColors() const
Get the number of distinct colours on the ScalarBar.
[more]void setNumLabels(int numLabels)
Set the number of labels to display along the ScalarBar.
[more]int getNumLabels() const
Get the number of labels displayed along the ScalarBar.
[more]void setScalarsToColors(ScalarsToColors* stc)
Set the ScalarsToColors mapping object for the ScalarBar.
[more]const ScalarsToColors* getScalarsToColors() const
Get the ScalarsToColors mapping object from the ScalarBar.
[more]void setTitle(const std::string& title)
Set the title for the ScalarBar, set "" for no title.
[more]std::string getTitle() const
Get the title for the ScalarBar.
[more]void setOrientation(ScalarBar::Orientation orientation)
Set the orientation of the ScalarBar.
[more]Orientation getOrientation() const
Get the orientation of the ScalarBar.
[more]void setAspectRatio(float aspectRatio)
Set the aspect ration (y/x) for the displayed bar.
[more]float getAspectRatio() const
Get the aspect ration (y/x) for the displayed bar.
[more]void setScalarPrinter(ScalarPrinter* sp)
Set a ScalarPrinter object for the ScalarBar.
[more]const ScalarPrinter* getScalarPrinter() const
Get the ScalarPrinter object
[more]void setTextProperties(const TextProperties& tp)
Set the TextProperties for the labels & title.
[more]const TextProperties& getTextProperties() const
Get the TextProperties for the labels & title.
[more] META_Node(osgSim, ScalarBar)

Public Members

[more]enum Orientation
ScalarBar orientation specification.
[more]struct ScalarPrinter: public osg::Referenced
Users may provide their own ScalarPrinter by deriving from this base class and overriding the printScalar() method.
[more]struct TextProperties
TextProperties allows users to specify a number of properties for the text used to display the labels & title on the ScalarBar.


Documentation

A ScalarBar is an osg::Geode to render a colored bar representing a range of scalars. The scalar/color ranges are specified by an instance of ScalarsToColors. There are a number of configurable properties on the ScalarBar, such as the orientation, the number of labels to be displayed across the range, the number of distinct colors to use when rendering the bar, text details etc.

In summary, the main configurables on the ScalarBar are:

-# The range of scalars represented by the bar, and the colors corresponding to this range - these are specified by the ScalarsToColors object. -# The number of colors used when rendering the bar geometry - this may be thought of as the bar 'density'. -# The number of text labels to be used when displaying the bar.

The other configurables should be self-explanatory.

oenum Orientation
ScalarBar orientation specification.

o HORIZONTAL

o VERTICAL
< a horizontally ascending scalar bar (x-axis)

ostruct ScalarPrinter: public osg::Referenced
Users may provide their own ScalarPrinter by deriving from this base class and overriding the printScalar() method. Users may map the scalar float passed in to any string they wish.

ovirtual std::string printScalar(float scalar)

ostruct TextProperties
TextProperties allows users to specify a number of properties for the text used to display the labels & title on the ScalarBar. Specifiying a character size of 0 will cause the ScalarBar to estimate an appropriate size. Note that the attributes are public, and may be set directly.

ostd::string _fontFile

ostd::pair<int,int> _fontResolution

oint _characterSize

oosg::Vec4 _color

o TextProperties()

o ScalarBar()
Default constructor.

o ScalarBar(int numColors, int numLabels, ScalarsToColors* stc, const std::string& title, Orientation orientation = HORIZONTAL, float aspectRatio=0.25, ScalarPrinter* sp=new ScalarPrinter)
Construct a ScalarBar with the supplied parameters.
Parameters:
numColors - Specify the number of colors in the scalar bar. Color interpolation occurs where necessary.
stc - The ScalarsToColors defining the range of scalars and the colors they map to.
title - The title to be used when displaying the ScalarBar. Specify "" for no title.
orientation - The orientation of the ScalarBar. @see Orientation.
apectRatio - The aspect ration (y/x) for the displayed bar. Bear in mind you may want to change this if you change the orientation.
sp - A ScalarPrinter object for the ScalarBar. For every displayed ScalarBar label, the scalar value will be passed to the ScalarPrinter object to turn it into a string. Users may override the default ScalarPrinter object to map scalars to whatever strings they wish. @see ScalarPrinter

o ScalarBar(const ScalarBar& rhs, const osg::CopyOp& co)
Copy constructor

ovoid setNumColors(int numColors)
Set the number of distinct colours on the ScalarBar.

oint getNumColors() const
Get the number of distinct colours on the ScalarBar.

ovoid setNumLabels(int numLabels)
Set the number of labels to display along the ScalarBar. There will be one label at each end point, and evenly distributed labels in between.

oint getNumLabels() const
Get the number of labels displayed along the ScalarBar.

ovoid setScalarsToColors(ScalarsToColors* stc)
Set the ScalarsToColors mapping object for the ScalarBar.

oconst ScalarsToColors* getScalarsToColors() const
Get the ScalarsToColors mapping object from the ScalarBar.

ovoid setTitle(const std::string& title)
Set the title for the ScalarBar, set "" for no title.

ostd::string getTitle() const
Get the title for the ScalarBar.

ovoid setOrientation(ScalarBar::Orientation orientation)
Set the orientation of the ScalarBar. @see Orientation

oOrientation getOrientation() const
Get the orientation of the ScalarBar. @see Orientation

ovoid setAspectRatio(float aspectRatio)
Set the aspect ration (y/x) for the displayed bar. Bear in mind you may want to change this if you change the orientation.

ofloat getAspectRatio() const
Get the aspect ration (y/x) for the displayed bar.

ovoid setScalarPrinter(ScalarPrinter* sp)
Set a ScalarPrinter object for the ScalarBar. For every displayed ScalarBar label, the scalar value will be passed to the ScalarPrinter object to turn it into a string. Users may override the default ScalarPrinter object to map scalars to whatever strings they wish. @see ScalarPrinter

oconst ScalarPrinter* getScalarPrinter() const
Get the ScalarPrinter object

ovoid setTextProperties(const TextProperties& tp)
Set the TextProperties for the labels & title. @see TextProperties

oconst TextProperties& getTextProperties() const
Get the TextProperties for the labels & title. @see TextProperties

o META_Node(osgSim, ScalarBar)


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.