Kaim::DisplayList Class Reference

Kaim::DisplayList Class Reference

#include <displaylist.h>

Class Description

DisplayList is used to push text, lines or shapes for rendering in the NavigationLab e.g.

{
DisplayList displayList(displayListManager); // you can GetDisplayListManager() from World, Bot, Database...
displayList->InitSingleFrameLifespan("MyDisplayList", "MyGroupOfDisplayLists");
DisplayShapeColor color(Kaim::Color::Red);
displayList->PushText(m_head, Kaim::Color::Red, "Error");
displayList->PushPoint(m_position, color);
} // Here the DisplayList is destroyed and committed to be sent to the NavigationLab and rendered.

In order to be able to easily find, sort and control DisplayList in the UI of the NavigationLab:

  • a name must be provided to be able to control manually the rendering of a DisplayList, so it will serve as a label for a check box inside the NavigationLab UI
  • a group identifier must be provided, it can be either a string or a WorldElement's VisualDebugId but it can't be both, if by mistake both would be provided the string will be ignored
    • If a WorldElement Id is given, the rendering of the displayList in the NavigationLab is configured within the element's display widget. This allows for example to render some bot custom information only for a selected Bot.
    • If it is a string, DisplayLists sharing this string will use it as a name for the display widget in the NavigationLab where all these DisplayLists will be gathered. In case of several DisplayList were sent with the same name and group identifier in the same frame, they will be controlled all together by the same widget labeled by their common name inside their common group widget in the NavigationLab UI.

DisplayList can per frame, i.e. the DisplayList is sent once and it is rendered only for the frame at which it is sent. But lifespan of rendering can be controlled by providing a unique identifier for the DisplayList. This identifier must be unique amongst all DisplayList, DisplayListManager::GenerateDisplayListId() must be used to get such ids. So, instead of sending a DisplayList each frame to see it over several frame whereas its content doesn't change, the DisplayList can be sent only when its content should change, thus a newly received DisplayList with an id will replace a previously received DisplayList and the end of the DisplayList can be triggered whenever you want.

{
class MyObject
{
public:
Kaim::DisplayListManager* m_displayListManager
KyUInt32 m_displayListId;
MyObject(Kaim::DisplayListManager* displayListManager)
: m_displayListManager(displayListManager)
, m_displayListId(KyUInt32MAXVal)
{}
~MyObject()
{
// destroy the DisplayList into the NavigationLab
m_displayListManager->RemoveDisplayList(m_displayListId);
}
void OnChange()
{
// some relevant changes are done when needed and not each frame
// hence display list can be sent only on this event
// it will be replaced in the NavigationLab
SendVisualdebug()
}
void SendVisualdebug()
{
DisplayList displayList(displayListManager);
// Following line use the id to replace the previous DisplayList if any by this newly constructed one.
// On first call since m_displayListId == KyUInt32MAXVal,
// it will assign m_displayListId with the result of m_displayListManager->GenerateDisplayListId();
m_displayListId = displayList->InitUserControlledLifespan("MyDisplayList", "MyGroupOfDisplayLists", m_displayListId);
// ... use displayList as usual
}
}

With KY_CONFIG_RELEASE defined, this class is still present but replaced by a fully inlined emptied version.

+ Examples:

Constructors

 DisplayList ()
 Construct a DisplayList, then, you must call one of the InitSingleFrameLifespan function in order to classify the DisplayList in the NavigationLab. More...
 
 DisplayList (DisplayListManager *manager, DisplayListActivation activation=DisplayList_Enable)
 
 ~DisplayList ()
 

Init for DisplayList stored only in the frame it was sent

void InitSingleFrameLifespan (const char listName[64], const char groupName[64])
 A name and a group identifier are mandatory. More...
 
void InitSingleFrameLifespan (const char listName[64], KyUInt32 worldElementId)
 associate the displayList to the given world element and so the list can then be turned on/off under the section of the world element type More...
 
void InitSingleFrameLifespan (const char listName[64], const char groupName[64], KyUInt32 worldElementId)
 associate the displayList to the given world element and so the list can then be turned on/off under the section of the world element type More...
 

Do not call these functions, use DisplayListManager::MakeMultiFrame() instead

KyUInt32 InitUserControlledLifespan (const char listName[64], const char groupName[64], KyUInt32 displayListId)
 
KyUInt32 InitUserControlledLifespan (const char listName[64], KyUInt32 worldElementId, KyUInt32 displayListId)
 
KyUInt32 InitUserControlledLifespan (const char listName[64], const char groupName[64], KyUInt32 worldElementId, KyUInt32 displayListId)
 
void InitUserControlledLifespan (const char listName[64], const char groupName[64])
 
void InitUserControlledLifespan_AssociateWithWorldElement (const char listName[64], const char groupName[64], KyUInt32 worldElementId)
 

Optional post-Init functions

void ShowInLabWhenSelected (bool showInLabWhenSelected)
 Makes the NavigationLab display or hide the displayList when the corresponding Element (Bot, obstacle...) is selected. More...
 
void ShowInLabWhenNotSelected (bool showInLabWhenNotSelected)
 Makes the NavigationLab display or hide the displayList when the corresponding Element (Bot, obstacle...) is NOT selected. More...
 
void ShowInLab (bool showInLab)
 Makes the NavigationLab hide the displayList whether it's selected or NOT selected. The NavigationLab UI allows to override this. More...
 

Text

void PushTextVarg (const Vec3f &pos, const Color &color, const char *textFmt,...)
 Pushes text. More...
 
void PushText (const Vec3f &pos, const Color &color, const char *text, KyUInt32 textLength=0)
 when text = "abc", textLength = 3 More...
 
void PushText (const Vec3f &pos, const Color &color, const StringSpan &s)
 

Point

void PushPoint (const Vec3f &P, const ShapeColor &shapeColor, Flags flags)
 
void PushPoint (const Vec3f &P, const ShapeColor &shapeColor, Style::Enum style=Style::LineCross3d)
 
void PushPointLine3d (const Vec3f &P, Color color)
 
void PushPointLine2d (const Vec3f &P, Color color)
 
void PushPointFlag (const Vec3f &P, const ShapeColor &shapeColor)
 
void PushPoint (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor, Flags flags)
 
void PushPoint (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor, Style::Enum style=Style::LineCross3d)
 
void PushPointLine3d (const Vec3f &P, KyFloat32 radius, Color color)
 
void PushPointLine2d (const Vec3f &P, KyFloat32 radius, Color color)
 
void PushDiagonalCross2d (const Vec3f &P, KyFloat32 radius, Color color)
 
void PushQuad2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushQuadAndCross2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushQuadAndDiagonalCross2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushDiamond2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushDiamondAndCross2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushPentagon2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushHexagon2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushOctogon2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushOctogonAndCross2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushArrowCross2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushPointBox (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushPointPyramidInv (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushDisk (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor, Precision::Enum p=DefaultPrecision)
 
void PushDiskAndCross2d (const Vec3f &P, KyFloat32 radius, const ShapeColor &shapeColor, Precision::Enum p=DefaultPrecision)
 

Segment

void PushSegment (const Vec3f &P, const Vec3f &Q, const ShapeColor &shapeColor, Flags flags)
 
void PushSegment (const Vec3f &P, const Vec3f &Q, const ShapeColor &shapeColor, Style::Enum style)
 
void PushLine (const Vec3f &P, const Vec3f &Q, const Color &color)
 
void PushArrow2d5 (const Vec3f &P, const Vec3f &Q, const Color &color)
 
void PushArrow2d5_Double (const Vec3f &P, const Vec3f &Q, const Color &color)
 
void PushArrowPyramid (const Vec3f &P, const Vec3f &Q, const ShapeColor &shapeColor)
 
void PushArrowPyramid_Double (const Vec3f &P, const Vec3f &Q, const ShapeColor &shapeColor)
 

SegmentRadius

void PushSegment (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor, Flags flags)
 
void PushSegment (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor, Style::Enum style, DisplayFaces::Enum faces=DisplayFaces::All)
 
void PushSegmentPyramid (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushSegmentTriangleCross (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushSegmentBox (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor, DisplayFaces::Enum faces=DisplayFaces::All)
 
void PushSegmentSquareTube (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushSegmentTriangle2d5 (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushSegmentQuad2d5 (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushSegmentCapsule2d5 (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor, Precision::Enum p=DefaultPrecision)
 
void PushArrowTube (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushArrowTube_Double (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushLadder (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const Color &color)
 
void PushArrow (const Vec3f &P, const Vec3f &Q, KyFloat32 radius, const ShapeColor &shapeColor, KyFloat32, KyFloat32)
 

SegmentHeight

void PushSegmentHeight (const Vec3f &P, const Vec3f &Q, KyFloat32 height, const ShapeColor &shapeColor, Flags flags)
 
void PushSegmentHeight (const Vec3f &P, const Vec3f &Q, KyFloat32 height, const ShapeColor &shapeColor, Style::Enum style)
 
void PushParabola (const Vec3f &P, const Vec3f &Q, KyFloat32 height, const Color &color)
 

SegmentHeightRadius

void PushSegmentHeightRadius (const Vec3f &P, const Vec3f &Q, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, Flags flags)
 
void PushSegmentHeightRadius (const Vec3f &P, const Vec3f &Q, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, Style::Enum style, DisplayFaces::Enum faces=DisplayFaces::All)
 
void PushShearedBox (const Vec3f &P, const Vec3f &Q, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, DisplayFaces::Enum faces=DisplayFaces::All)
 

PointHeight (VerticalSegment)

void PushVerticalSegment (const Vec3f &P, KyFloat32 height, const ShapeColor &shapeColor, Flags flags)
 
void PushVerticalSegment (const Vec3f &P, KyFloat32 height, const ShapeColor &shapeColor, Style::Enum style)
 
void PushVerticalLine (const Vec3f &P, KyFloat32 height, Color color)
 

PointHeightRadius (VerticalSegment)

void PushVerticalSegment (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, Flags flags)
 
void PushVerticalSegment (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, Style::Enum style, DisplayFaces::Enum faces=DisplayFaces::All)
 
void PushVerticalPyramid (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalPyramidInv (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalBox (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, DisplayFaces::Enum faces=DisplayFaces::All)
 
void PushVerticalTriangleCross (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalTriangleCrossInv (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalPentagon (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalHexagon (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalOctogon (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 
void PushVerticalCylinder (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor, Precision::Enum precision=DefaultPrecision, DisplayFaces::Enum faces=DisplayFaces::All)
 
void PushVerticalFlag (const Vec3f &P, KyFloat32 height, KyFloat32 radius, const ShapeColor &shapeColor)
 

Triangle, Quad, Box

void PushTriangle (const Vec3f &A, const Vec3f &B, const Vec3f &C, const ShapeColor &shapeColor)
 
void PushTriangle (const Triangle3f &triangle, const ShapeColor &shapeColor)
 
void PushQuad (const Vec3f &A, const Vec3f &B, const Vec3f &C, const Vec3f &D, const ShapeColor &shapeColor)
 
void PushBox (const Box3f &box, const ShapeColor &shapeColor, DisplayFaces::Enum faces=DisplayFaces::All)
 

Other shapes

void PushDonut (const Vec3f &P, KyFloat32 innerRadius, KyFloat32 outerRadius, const ShapeColor &shapeColor, Precision::Enum precision=DefaultPrecision)
 
void PushSegmentVerticalQuad (const Vec3f &P, const Vec3f &Q, KyFloat32 above, KyFloat32 below, const ShapeColor &shapeColor)
 
void PushOrientedBox (const Transform &transform, const Box3f &box, const ShapeColor &shapeColor)
 
void PushOrientedBox2d (const OrientedBox2d &orientedBox2d, const ShapeColor &shapeColor)
 
void PushDiskSector (const Vec3f &P, KyFloat32 radius, const Vec3f &startPos, const Vec3f &endPos, const RotationDirection rotDir, const ShapeColor &shapeColor, Precision::Enum precision=DefaultPrecision)
 
void PushCellBox (const Box2i &cellBox, const KyFloat32 altitudeMinMax[], const DatabaseGenMetrics &genMetrics, const ShapeColor &shapeColor)
 

For internal use only

DisplayListManagerm_displayListManager
 
DisplayListData * m_displayListData
 

Constructor & Destructor Documentation

Kaim::DisplayList::DisplayList ( )
inline

Construct a DisplayList, then, you must call one of the InitSingleFrameLifespan function in order to classify the DisplayList in the NavigationLab.

Lifespan of a DisplayList is determined by the Init function, the DisplayList will be either available one single frame so you have to send it over several frames in order to see it several frames, or you can control its lifetime by assigning it an id, that must be provided by the DisplayListManager. DisplayList with same name and same group will have their display control together under one section and one label in the NavigationLab. however, lifespan remains individual.

Member Function Documentation

void Kaim::DisplayList::InitSingleFrameLifespan ( const char  listName[64],
const char  groupName[64] 
)

A name and a group identifier are mandatory.

They allow to sort display lists in the NavigationLab UI and turning their display on/off. A group identifier is either a name or a worldElementID. This DisplayList will be only available the frame it is sent group all displayLists with the same groupName under the same label

+ Examples:
void Kaim::DisplayList::InitSingleFrameLifespan ( const char  listName[64],
KyUInt32  worldElementId 
)

associate the displayList to the given world element and so the list can then be turned on/off under the section of the world element type

void Kaim::DisplayList::InitSingleFrameLifespan ( const char  listName[64],
const char  groupName[64],
KyUInt32  worldElementId 
)

associate the displayList to the given world element and so the list can then be turned on/off under the section of the world element type

void Kaim::DisplayList::PushText ( const Vec3f pos,
const Color color,
const char *  text,
KyUInt32  textLength = 0 
)

when text = "abc", textLength = 3

void Kaim::DisplayList::PushTextVarg ( const Vec3f pos,
const Color color,
const char *  textFmt,
  ... 
)

Pushes text.

+ Examples:
void Kaim::DisplayList::ShowInLab ( bool  showInLab)

Makes the NavigationLab hide the displayList whether it's selected or NOT selected. The NavigationLab UI allows to override this.

void Kaim::DisplayList::ShowInLabWhenNotSelected ( bool  showInLabWhenNotSelected)

Makes the NavigationLab display or hide the displayList when the corresponding Element (Bot, obstacle...) is NOT selected.

The NavigationLab UI allows to override this. showInLabWhenNotSelected is true by default.

void Kaim::DisplayList::ShowInLabWhenSelected ( bool  showInLabWhenSelected)

Makes the NavigationLab display or hide the displayList when the corresponding Element (Bot, obstacle...) is selected.

The NavigationLab UI allows to override this. showInLabWhenSelected is true by default.


The documentation for this class was generated from the following files:
  • gwnavruntime/visualsystem/displaylist.h
  • gwnavruntime/visualsystem/displaylist.cpp