VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::Annotation Class Reference

#include <framework/script/annotation.h>

Inheritance diagram for visutwin::canvas::Annotation:
[legend]

Public Member Functions

void activate ()
Entityentity () const
const std::string & label () const
void setLabel (const std::string &value)
void setText (const std::string &value)
void setTitle (const std::string &value)
const std::string & text () const
const std::string & title () const
Public Member Functions inherited from visutwin::canvas::Script
bool enabled () const
virtual void fixedUpdate (float fixedDt)
virtual void initialize ()
virtual void postInitialize ()
virtual void postUpdate (float dt)
virtual void update (float dt)
Public Member Functions inherited from visutwin::canvas::EventHandler
template<typename... Args>
EventHandlerfire (const std::string &name, Args &&... args)
bool hasEvent (const std::string &name) const
void initEventHandler ()
template<typename Callback>
requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>)
EventHandleroff (const std::string &name, Callback &&callback, void *scope=nullptr)
EventHandleroff (const std::string &name="", const HandleEventCallback &callback=HandleEventCallback(), void *scope=nullptr)
EventHandleroffByHandle (EventHandle *handle)
template<typename Callback>
requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>)
EventHandleon (const std::string &name, Callback &&callback, void *scope=nullptr)
EventHandleon (const std::string &name, HandleEventCallback callback, void *scope=nullptr)
template<typename Callback>
requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>)
EventHandleonce (const std::string &name, Callback &&callback, void *scope=nullptr)
EventHandleonce (const std::string &name, HandleEventCallback callback, void *scope=nullptr)
virtual ~EventHandler ()=default

Static Public Member Functions

static constexpr const char * scriptName ()

Additional Inherited Members

Protected Member Functions inherited from visutwin::canvas::Script
Entityentity () const
Protected Member Functions inherited from visutwin::canvas::EventHandler
EventHandleaddCallback (const std::string &name, HandleEventCallback callback, void *scope=nullptr, bool once=false)

Detailed Description

A lightweight data script for creating interactive 3D annotations in a scene. This script only holds the annotation data (label, title, text) — all rendering and interaction is handled by an AnnotationManager listening for engine events.

Fires the following engine-level events:

  • annotation:add — when the annotation initializes
  • annotation:remove — when the annotation is destroyed

Fires the following script-level events (listened to by AnnotationManager):

  • label:set — when label changes
  • title:set — when title changes
  • text:set — when text changes
  • hover — when hover state changes
  • show — when tooltip is shown
  • hide — when tooltip is hidden

Definition at line 33 of file annotation.h.

Member Function Documentation

◆ activate()

void visutwin::canvas::Annotation::activate ( )

Call after setting label/title/text to register with the AnnotationManager. Must be called explicitly because properties need to be set before registration (the hotspot texture is generated from the label at registration time).

Definition at line 12 of file annotation.cpp.

References visutwin::canvas::Entity::engine(), and entity().

◆ entity()

Definition at line 71 of file script.h.

Referenced by activate(), and scriptName().

◆ label()

const std::string & visutwin::canvas::Annotation::label ( ) const
inline

Definition at line 41 of file annotation.h.

References label().

Referenced by label().

◆ scriptName()

constexpr const char * visutwin::canvas::Annotation::scriptName ( )
inlinestaticconstexpr

Definition at line 36 of file annotation.h.

References entity().

◆ setLabel()

void visutwin::canvas::Annotation::setLabel ( const std::string & value)
inline

Definition at line 42 of file annotation.h.

References visutwin::canvas::EventHandler::fire().

◆ setText()

void visutwin::canvas::Annotation::setText ( const std::string & value)
inline

Definition at line 56 of file annotation.h.

References visutwin::canvas::EventHandler::fire().

◆ setTitle()

void visutwin::canvas::Annotation::setTitle ( const std::string & value)
inline

Definition at line 49 of file annotation.h.

References visutwin::canvas::EventHandler::fire().

◆ text()

const std::string & visutwin::canvas::Annotation::text ( ) const
inline

Definition at line 55 of file annotation.h.

Referenced by visutwin::canvas::AnnotationManager::handleClick().

◆ title()

const std::string & visutwin::canvas::Annotation::title ( ) const
inline

Definition at line 48 of file annotation.h.

Referenced by visutwin::canvas::AnnotationManager::handleClick().


The documentation for this class was generated from the following files: