|
AGXDynamics
2.31.1.0
|
Class that represents a linear scalar color map that converts a scalar interval to a specified color range. More...
#include <ScalarColorMap.h>
Inheritance diagram for agxOSG::ScalarColorMap:Public Types | |
| enum | ColorRangePreset { RAINBOW, COOLWARM, VIRIDIS, INFERNO, PLASMA, GRAYSCALE, BLUE_WHITE_RED, CIVIDIS, BONE, COPPER, AFMHOT } |
| Enum representation of predefined color ranges than can be set in the class. More... | |
Public Member Functions | |
| ScalarColorMap () | |
| Default constructor. More... | |
| ScalarColorMap (const agxRender::ColorVector &colorVector, agx::Real minScalar, agx::Real maxScalar) | |
| Constructor. More... | |
| ScalarColorMap (ColorRangePreset preset, agx::Real minScalar, agx::Real maxScalar) | |
| Constructor. More... | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| agx::Vec4f | getColor (agx::Real scalar, bool modifyAlpha=false) const |
| Get an agx representation of a color value in the map given a scalar inside the interval. More... | |
| osg::Vec4 | getColorOSG (agx::Real scalar, bool modifyAlpha=false) const |
| Get an osg representation of a color value in the map given a scalar inside the interval. More... | |
| agxRender::ColorVector | getColors () const |
| agx::Real | getMaxScalar () const |
| agx::Real | getMinScalar () const |
| osg::ref_ptr< osgSim::ColorRange > | getOsgColorRange () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| void | setColors (const agxRender::ColorVector &colorVector) |
| void | setColorsFromPreset (ColorRangePreset colorRangePreset) |
| Set a range of colors from an available color range preset in the class. More... | |
| void | setMaxScalar (agx::Real maxScalar) |
| Set the maximum scalar of the interval. More... | |
| void | setMinScalar (agx::Real minScalar) |
| Set the min scalar of the interval. More... | |
| void | setScalarInterval (agx::Real minScalar, agx::Real maxScalar) |
| Set the scalars of the interval used in the color interpolation. More... | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
Static Public Member Functions | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~ScalarColorMap () |
| void | allocateObserverVector () const |
| void | correctScalarInterval () |
| void | deleteUsingDeleteHandler () const |
| agxRender::ColorVector | getColorsFromPreset (ColorRangePreset preset) |
| void | initColorRange (const std::vector< osg::Vec4 > &osgColors) |
| void | updateColorRange () |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| osg::ref_ptr< osgSim::ColorRange > | m_colorRange |
| agx::Real | m_maxScalar |
| agx::Real | m_minScalar |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
| float | m_rScaling |
Class that represents a linear scalar color map that converts a scalar interval to a specified color range.
This wraps the osgSim::ColorRange object with a layer of convenience functionality.
Definition at line 37 of file ScalarColorMap.h.
Enum representation of predefined color ranges than can be set in the class.
| Enumerator | |
|---|---|
| RAINBOW | |
| COOLWARM | |
| VIRIDIS | |
| INFERNO | |
| PLASMA | |
| GRAYSCALE | |
| BLUE_WHITE_RED | |
| CIVIDIS | |
| BONE | |
| COPPER | |
| AFMHOT | |
Definition at line 44 of file ScalarColorMap.h.
| agxOSG::ScalarColorMap::ScalarColorMap | ( | ) |
Default constructor.
| agxOSG::ScalarColorMap::ScalarColorMap | ( | const agxRender::ColorVector & | colorVector, |
| agx::Real | minScalar, | ||
| agx::Real | maxScalar | ||
| ) |
Constructor.
| colorVector | - the specific color range to be used in scalar map, which is mapped to the scalar interval. |
| minScalar | - The minimum value of the scalar interval that is mapped to the color range. |
| maxScalar | - The maximum value of the scalar interval that is mapped to the color range. |
| agxOSG::ScalarColorMap::ScalarColorMap | ( | ColorRangePreset | preset, |
| agx::Real | minScalar, | ||
| agx::Real | maxScalar | ||
| ) |
Constructor.
| preset | - preset enum for one of the predefined color ranges that exist in the class that can be chosen to initialize the colors in the map. |
| minScalar | - The minimum value of the scalar interval that is mapped to the color range. |
| maxScalar | - The maximum value of the scalar interval that is mapped to the color range. |
|
protectedvirtual |
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
protected |
|
protectedinherited |
| agx::Vec4f agxOSG::ScalarColorMap::getColor | ( | agx::Real | scalar, |
| bool | modifyAlpha = false |
||
| ) | const |
Get an agx representation of a color value in the map given a scalar inside the interval.
| scalar | - a specified scalar that is used to interpolate a color in the given range. |
| modifyAlpha | - true if the alpha value of the color should be modified, false otherwise. |
| osg::Vec4 agxOSG::ScalarColorMap::getColorOSG | ( | agx::Real | scalar, |
| bool | modifyAlpha = false |
||
| ) | const |
Get an osg representation of a color value in the map given a scalar inside the interval.
| scalar | - a specified scalar that is used to interpolate a color in the given range. |
| modifyAlpha | - true if the alpha value of the color should be modified, false otherwise. |
| agxRender::ColorVector agxOSG::ScalarColorMap::getColors | ( | ) | const |
|
protected |
|
staticprotectedinherited |
| agx::Real agxOSG::ScalarColorMap::getMaxScalar | ( | ) | const |
| agx::Real agxOSG::ScalarColorMap::getMinScalar | ( | ) | const |
| osg::ref_ptr< osgSim::ColorRange > agxOSG::ScalarColorMap::getOsgColorRange | ( | ) | const |
|
inherited |
|
protected |
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::Buffer::getElement(), and agx::Object::getResource().
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
Referenced by agxData::Val< UInt >::Val().
| void agxOSG::ScalarColorMap::setColors | ( | const agxRender::ColorVector & | colorVector | ) |
| void agxOSG::ScalarColorMap::setColorsFromPreset | ( | ColorRangePreset | colorRangePreset | ) |
Set a range of colors from an available color range preset in the class.
| colorRangePreset | - the specified preset enum that is used to construct the color range. |
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
Set the maximum scalar of the interval.
| maxScalar | - the maximum scalar value in the interval. |
Set the min scalar of the interval.
| minScalar | - the minimum scalar value in the interval. |
Set the scalars of the interval used in the color interpolation.
| minScalar | - the minimum scalar value in the interval. |
| maxScalar | - the maximum scalar value in the interval. |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
|
protected |
|
staticinherited |
|
protected |
Definition at line 175 of file ScalarColorMap.h.
|
protected |
Definition at line 173 of file ScalarColorMap.h.
|
protected |
Definition at line 172 of file ScalarColorMap.h.
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
protected |
Definition at line 174 of file ScalarColorMap.h.