class OSGSIM_EXPORT osgSim::ScalarBar

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

Inheritance:


Public Classes

[more]enum Orientation
ScalarBar orientation specification.
[more]struct OSGSIM_EXPORT 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.

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] META_Node(osgSim, ScalarBar)
[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 setPosition(const osg::Vec3& pos)
Set the position of scalar bar's lower left corner
[more]const osg::Vec3& getPosition() const
Get the position of scalar bar
[more]void setWidth(float width)
Set the width of the scalar bar
[more]float getWidth()
Get the width of the scalar bar
[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 setOrientation(ScalarBar::Orientation orientation)
Set the orientation of the ScalarBar.
[more]Orientation getOrientation() const
Get the orientation of the ScalarBar.
[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]void update()
force update the drawables used to render the scalar bar

Protected Fields

[more]int _numColors
[more]int _numLabels
[more]osg::ref_ptr<ScalarsToColors> _stc
[more]std::string _title
[more]osg::Vec3 _position
[more]float _width
[more]float _aspectRatio
[more]Orientation _orientation
[more]osg::ref_ptr<ScalarPrinter> _sp
[more]TextProperties _textProperties

Protected Methods

[more]virtual ~ScalarBar()
[more]void createDrawables()


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 OSGSIM_EXPORT 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

ofloat _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

o META_Node(osgSim, ScalarBar)

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 setPosition(const osg::Vec3& pos)
Set the position of scalar bar's lower left corner

oconst osg::Vec3& getPosition() const
Get the position of scalar bar

ovoid setWidth(float width)
Set the width of the scalar bar

ofloat getWidth()
Get the width of the scalar bar

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 setOrientation(ScalarBar::Orientation orientation)
Set the orientation of the ScalarBar. @see Orientation

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

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

ovoid update()
force update the drawables used to render the scalar bar

ovirtual ~ScalarBar()

oint _numColors

oint _numLabels

oosg::ref_ptr<ScalarsToColors> _stc

ostd::string _title

oosg::Vec3 _position

ofloat _width

ofloat _aspectRatio

oOrientation _orientation

oosg::ref_ptr<ScalarPrinter> _sp

oTextProperties _textProperties

ovoid createDrawables()


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



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