DART  6.10.1
dart::gui::osg::GridVisual Class Reference

Attach this to a Viewer in order to visualize grid. More...

#include <GridVisual.hpp>

Inheritance diagram for dart::gui::osg::GridVisual:
dart::gui::osg::ViewerAttachment

Public Types

enum class  PlaneType : unsigned char { XY = 0u , YZ = 1u , ZX = 2u }
 

Public Member Functions

 GridVisual ()
 Default constructor. More...
 
void setNumCells (std::size_t cells)
 Sets the number of cells along each axis. More...
 
std::size_t getNumCells () const
 Returns the number of cells along each axis. More...
 
void setMinorLineStepSize (double size)
 Sets the step size of minor lines in meters. More...
 
double getMinorLineStepSize () const
 Returns the step size of minor lines in meters. More...
 
void setNumMinorLinesPerMajorLine (std::size_t size)
 Sets the number of minor lines per major line. More...
 
std::size_t getNumMinorLinesPerMajorLine () const
 Returns the number of minor lines per major line. More...
 
void setPlaneType (PlaneType type)
 Set the plane type among XY, YZ, ZX planes. More...
 
PlaneType getPlaneType () const
 Returns the plane type among XY, YZ, ZX planes. More...
 
void setOffset (const Eigen::Vector3d &offset)
 Changes the offset at which the grid is displayed. More...
 
const Eigen::Vector3d & getOffset () const
 Returns the elevation of display for the support polygon. More...
 
void display (bool display)
 Displays the support polygon. More...
 
bool isDisplayed () const
 Returns true if the support polygon is being displayed. More...
 
void setMajorLineColor (const Eigen::Vector4d &color)
 Sets the color of major lines. More...
 
Eigen::Vector4d getMajorLineColor () const
 Returns the color of major lines. More...
 
void setMinorLineColor (const Eigen::Vector4d &color)
 Sets the color of minor lines. More...
 
Eigen::Vector4d getMinorLineColor () const
 Returns the color of minor lines. More...
 
void setAxisLineWidth (float width)
 Sets line width for axis lines. More...
 
float getAxisLineWidth () const
 Returns line width for axis lines. More...
 
void setMajorLineWidth (float width)
 Sets line width for major lines. More...
 
float getMajorLineWidth () const
 Returns line width for major lines. More...
 
void setMinorLineWidth (float width)
 Sets line width for minor lines. More...
 
float getMinorLineWidth () const
 Returns line width for minor lines. More...
 
void refresh () override final
 Updates the support polygon visual. More...
 
ViewergetViewer ()
 
const ViewergetViewer () const
 

Protected Member Functions

void initialize ()
 Initializes the memory used by this visual. More...
 
virtual void customAttach (Viewer *newViewer)
 This function will be called by attach(Viewer*) so you can do customized setup when the Viewer changes. More...
 
virtual void attach (Viewer *newViewer)
 This function will get called when the visual is attached to a new Viewer. More...
 

Protected Attributes

PlaneType mPlaneType
 Plane type among XY, YZ, ZX planes. More...
 
std::size_t mNumCells
 Number of cells along each axis. More...
 
double mMinorLineStepSize
 Step size of minor lines in meters. More...
 
std::size_t mNumMinorLinesPerMajorLine
 Number of minor lines per major line. More...
 
Eigen::Vector3d mOffset
 Elevation that this visual should use. More...
 
bool mDisplayGrid
 Whether to display the grid. More...
 
::osg::ref_ptr<::osg::Vec4Array > mAxisLineColor
 Color for axis lines. More...
 
::osg::ref_ptr<::osg::Vec4Array > mMajorLineColor
 Color for major lines. More...
 
::osg::ref_ptr<::osg::Vec4Array > mMinorLineColor
 Color for minor lines. More...
 
::osg::ref_ptr<::osg::Geode > mGeode
 Geode to hold the grid. More...
 
::osg::ref_ptr<::osg::Geometry > mAxisLineGeom
 Geometry to describe axis lines. More...
 
::osg::ref_ptr<::osg::Geometry > mMajorLineGeom
 Geometry to describe minor lines. More...
 
::osg::ref_ptr<::osg::Geometry > mMinorLineGeom
 Geometry to describe major lines. More...
 
::osg::ref_ptr<::osg::Vec3Array > mMinorLineVertices
 Vertices of axis lines. More...
 
::osg::ref_ptr<::osg::Vec3Array > mMajorLineVertices
 Vertices of major lines. More...
 
::osg::ref_ptr<::osg::Vec3Array > mAxisLineVertices
 Vertices of minor lines. More...
 
::osg::ref_ptr<::osg::DrawElementsUInt > mAxis1PositiveFaces
 Faces of the first axis positive line. More...
 
::osg::ref_ptr<::osg::DrawElementsUInt > mAxis1NegativeFaces
 Faces of the first axis negative line. More...
 
::osg::ref_ptr<::osg::DrawElementsUInt > mAxis2PositiveFaces
 Faces of the second axis positive line. More...
 
::osg::ref_ptr<::osg::DrawElementsUInt > mAxis2NegativeFaces
 Faces of the second axis negative line. More...
 
::osg::ref_ptr<::osg::DrawElementsUInt > mMajorLineFaces
 Faces of major lines. More...
 
::osg::ref_ptr<::osg::DrawElementsUInt > mMinorLineFaces
 Faces of minor lines. More...
 
::osg::ref_ptr<::osg::LineWidth > mAxisLineWidth
 Line width for axis line. More...
 
::osg::ref_ptr<::osg::LineWidth > mMajorLineWidth
 Line width for major line. More...
 
::osg::ref_ptr<::osg::LineWidth > mMinorLineWidth
 Line width for minor line. More...
 
bool mNeedUpdate
 Dirty flag to notify this grid needs to be updated. More...
 

Private Attributes

ViewermViewer
 

Detailed Description

Attach this to a Viewer in order to visualize grid.

Member Enumeration Documentation

◆ PlaneType

enum dart::gui::osg::GridVisual::PlaneType : unsigned char
strong
Enumerator
XY 
YZ 
ZX 

Constructor & Destructor Documentation

◆ GridVisual()

dart::gui::osg::GridVisual::GridVisual ( )

Default constructor.

Member Function Documentation

◆ attach()

void dart::gui::osg::ViewerAttachment::attach ( Viewer newViewer)
protectedvirtualinherited

This function will get called when the visual is attached to a new Viewer.

It adds this node as a child to the root node of the Viewer so the refresh() function will be called at each update cycle. It will also call customAttach(Viewer*) so you can do customized setup.

◆ customAttach()

void dart::gui::osg::ViewerAttachment::customAttach ( Viewer newViewer)
protectedvirtualinherited

This function will be called by attach(Viewer*) so you can do customized setup when the Viewer changes.

By default this function does nothing, so overriding it is completely safe.

◆ display()

void dart::gui::osg::GridVisual::display ( bool  display)

Displays the support polygon.

◆ getAxisLineWidth()

float dart::gui::osg::GridVisual::getAxisLineWidth ( ) const

Returns line width for axis lines.

◆ getMajorLineColor()

Eigen::Vector4d dart::gui::osg::GridVisual::getMajorLineColor ( ) const

Returns the color of major lines.

◆ getMajorLineWidth()

float dart::gui::osg::GridVisual::getMajorLineWidth ( ) const

Returns line width for major lines.

◆ getMinorLineColor()

Eigen::Vector4d dart::gui::osg::GridVisual::getMinorLineColor ( ) const

Returns the color of minor lines.

◆ getMinorLineStepSize()

double dart::gui::osg::GridVisual::getMinorLineStepSize ( ) const

Returns the step size of minor lines in meters.

◆ getMinorLineWidth()

float dart::gui::osg::GridVisual::getMinorLineWidth ( ) const

Returns line width for minor lines.

◆ getNumCells()

std::size_t dart::gui::osg::GridVisual::getNumCells ( ) const

Returns the number of cells along each axis.

◆ getNumMinorLinesPerMajorLine()

std::size_t dart::gui::osg::GridVisual::getNumMinorLinesPerMajorLine ( ) const

Returns the number of minor lines per major line.

◆ getOffset()

const Eigen::Vector3d & dart::gui::osg::GridVisual::getOffset ( ) const

Returns the elevation of display for the support polygon.

◆ getPlaneType()

GridVisual::PlaneType dart::gui::osg::GridVisual::getPlaneType ( ) const

Returns the plane type among XY, YZ, ZX planes.

◆ getViewer() [1/2]

Viewer * dart::gui::osg::ViewerAttachment::getViewer ( )
inherited

◆ getViewer() [2/2]

const Viewer * dart::gui::osg::ViewerAttachment::getViewer ( ) const
inherited

◆ initialize()

void dart::gui::osg::GridVisual::initialize ( )
protected

Initializes the memory used by this visual.

◆ isDisplayed()

bool dart::gui::osg::GridVisual::isDisplayed ( ) const

Returns true if the support polygon is being displayed.

◆ refresh()

void dart::gui::osg::GridVisual::refresh ( )
finaloverridevirtual

Updates the support polygon visual.

Implements dart::gui::osg::ViewerAttachment.

◆ setAxisLineWidth()

void dart::gui::osg::GridVisual::setAxisLineWidth ( float  width)

Sets line width for axis lines.

◆ setMajorLineColor()

void dart::gui::osg::GridVisual::setMajorLineColor ( const Eigen::Vector4d &  color)

Sets the color of major lines.

◆ setMajorLineWidth()

void dart::gui::osg::GridVisual::setMajorLineWidth ( float  width)

Sets line width for major lines.

◆ setMinorLineColor()

void dart::gui::osg::GridVisual::setMinorLineColor ( const Eigen::Vector4d &  color)

Sets the color of minor lines.

◆ setMinorLineStepSize()

void dart::gui::osg::GridVisual::setMinorLineStepSize ( double  size)

Sets the step size of minor lines in meters.

◆ setMinorLineWidth()

void dart::gui::osg::GridVisual::setMinorLineWidth ( float  width)

Sets line width for minor lines.

◆ setNumCells()

void dart::gui::osg::GridVisual::setNumCells ( std::size_t  cells)

Sets the number of cells along each axis.

◆ setNumMinorLinesPerMajorLine()

void dart::gui::osg::GridVisual::setNumMinorLinesPerMajorLine ( std::size_t  size)

Sets the number of minor lines per major line.

◆ setOffset()

void dart::gui::osg::GridVisual::setOffset ( const Eigen::Vector3d &  offset)

Changes the offset at which the grid is displayed.

◆ setPlaneType()

void dart::gui::osg::GridVisual::setPlaneType ( GridVisual::PlaneType  type)

Set the plane type among XY, YZ, ZX planes.

Member Data Documentation

◆ mAxis1NegativeFaces

::osg::ref_ptr<::osg::DrawElementsUInt> dart::gui::osg::GridVisual::mAxis1NegativeFaces
protected

Faces of the first axis negative line.

◆ mAxis1PositiveFaces

::osg::ref_ptr<::osg::DrawElementsUInt> dart::gui::osg::GridVisual::mAxis1PositiveFaces
protected

Faces of the first axis positive line.

◆ mAxis2NegativeFaces

::osg::ref_ptr<::osg::DrawElementsUInt> dart::gui::osg::GridVisual::mAxis2NegativeFaces
protected

Faces of the second axis negative line.

◆ mAxis2PositiveFaces

::osg::ref_ptr<::osg::DrawElementsUInt> dart::gui::osg::GridVisual::mAxis2PositiveFaces
protected

Faces of the second axis positive line.

◆ mAxisLineColor

::osg::ref_ptr<::osg::Vec4Array> dart::gui::osg::GridVisual::mAxisLineColor
protected

Color for axis lines.

◆ mAxisLineGeom

::osg::ref_ptr<::osg::Geometry> dart::gui::osg::GridVisual::mAxisLineGeom
protected

Geometry to describe axis lines.

◆ mAxisLineVertices

::osg::ref_ptr<::osg::Vec3Array> dart::gui::osg::GridVisual::mAxisLineVertices
protected

Vertices of minor lines.

◆ mAxisLineWidth

::osg::ref_ptr<::osg::LineWidth> dart::gui::osg::GridVisual::mAxisLineWidth
protected

Line width for axis line.

◆ mDisplayGrid

bool dart::gui::osg::GridVisual::mDisplayGrid
protected

Whether to display the grid.

◆ mGeode

::osg::ref_ptr<::osg::Geode> dart::gui::osg::GridVisual::mGeode
protected

Geode to hold the grid.

◆ mMajorLineColor

::osg::ref_ptr<::osg::Vec4Array> dart::gui::osg::GridVisual::mMajorLineColor
protected

Color for major lines.

◆ mMajorLineFaces

::osg::ref_ptr<::osg::DrawElementsUInt> dart::gui::osg::GridVisual::mMajorLineFaces
protected

Faces of major lines.

◆ mMajorLineGeom

::osg::ref_ptr<::osg::Geometry> dart::gui::osg::GridVisual::mMajorLineGeom
protected

Geometry to describe minor lines.

◆ mMajorLineVertices

::osg::ref_ptr<::osg::Vec3Array> dart::gui::osg::GridVisual::mMajorLineVertices
protected

Vertices of major lines.

◆ mMajorLineWidth

::osg::ref_ptr<::osg::LineWidth> dart::gui::osg::GridVisual::mMajorLineWidth
protected

Line width for major line.

◆ mMinorLineColor

::osg::ref_ptr<::osg::Vec4Array> dart::gui::osg::GridVisual::mMinorLineColor
protected

Color for minor lines.

◆ mMinorLineFaces

::osg::ref_ptr<::osg::DrawElementsUInt> dart::gui::osg::GridVisual::mMinorLineFaces
protected

Faces of minor lines.

◆ mMinorLineGeom

::osg::ref_ptr<::osg::Geometry> dart::gui::osg::GridVisual::mMinorLineGeom
protected

Geometry to describe major lines.

◆ mMinorLineStepSize

double dart::gui::osg::GridVisual::mMinorLineStepSize
protected

Step size of minor lines in meters.

◆ mMinorLineVertices

::osg::ref_ptr<::osg::Vec3Array> dart::gui::osg::GridVisual::mMinorLineVertices
protected

Vertices of axis lines.

◆ mMinorLineWidth

::osg::ref_ptr<::osg::LineWidth> dart::gui::osg::GridVisual::mMinorLineWidth
protected

Line width for minor line.

◆ mNeedUpdate

bool dart::gui::osg::GridVisual::mNeedUpdate
protected

Dirty flag to notify this grid needs to be updated.

◆ mNumCells

std::size_t dart::gui::osg::GridVisual::mNumCells
protected

Number of cells along each axis.

◆ mNumMinorLinesPerMajorLine

std::size_t dart::gui::osg::GridVisual::mNumMinorLinesPerMajorLine
protected

Number of minor lines per major line.

◆ mOffset

Eigen::Vector3d dart::gui::osg::GridVisual::mOffset
protected

Elevation that this visual should use.

◆ mPlaneType

PlaneType dart::gui::osg::GridVisual::mPlaneType
protected

Plane type among XY, YZ, ZX planes.

◆ mViewer

Viewer* dart::gui::osg::ViewerAttachment::mViewer
privateinherited