wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wPlot2D::NotchEntity Class Reference

Represents a single tick mark ("notch") on a 2D axis. More...

#include <wNotchEntity.hpp>

Inheritance diagram for wPlot2D::NotchEntity:
Inheritance graph

Public Member Functions

 NotchEntity (AxisType type)
 Constructs a NotchEntity aligned to a given axis.
virtual ~NotchEntity ()=default
 Virtual destructor.
void render (sf::RenderWindow &window)
 Renders the notch using SFML.
Public Member Functions inherited from wEngine::Entity
 Entity ()
virtual ~Entity ()
unsigned int getEntityID () const
 Returns the unique ID associated with this entity.
void clearComponents ()
 Removes all components currently attached to the entity.
template<typename T, typename... Args>
std::shared_ptr< T > addComponent (Args &&... args)
 Adds a new component of type T to the entity.
template<typename T>
void removeComponent ()
 Removes the component of type T from the entity.
template<typename T>
bool hasComponent () const noexcept
 Checks whether the entity has a component of type T.
template<typename T>
std::shared_ptr< T > getComponent () const
 Retrieves the component of type T attached to the entity.
template<typename T>
std::shared_ptr< T > requireComponent (const std::string &context="") const
 Retrieves the component of type T and throws if it's missing.
template<typename Interface>
std::shared_ptr< Interface > getInterfaceComponent () const
 Returns the first component that implements the specified interface.

Additional Inherited Members

Static Public Member Functions inherited from wEngine::Entity
static void resetEntityIDCounter ()
 Resets the global entity ID counter to zero.

Detailed Description

Represents a single tick mark ("notch") on a 2D axis.

A NotchEntity is a visual element used to mark intervals along a coordinate axis, helping users interpret scale in a plot. It is rendered as a small filled rectangle, oriented perpendicularly to its associated axis (X_AXIS or Y_AXIS).

Components required:

  • PositionComponent: specifies the top-left pixel position.
  • ColorComponent: defines the notch color.
  • ThicknessComponent: defines the thickness (along the axis).
  • LengthComponent: defines the length (perpendicular to the axis).

Orientation:

The actual rendering logic is handled internally using sf::RectangleShape.

Note
Components must be added externally (typically by AxisEntity::addNotches( )).
See also
AxisEntity, AxisType, PositionComponent, LengthComponent, ThicknessComponent
Author
Wilfried Koch

Constructor & Destructor Documentation

◆ NotchEntity()

wPlot2D::NotchEntity::NotchEntity ( AxisType type)

Constructs a NotchEntity aligned to a given axis.

Parameters
typeThe axis type (X or Y) which determines notch orientation.

◆ ~NotchEntity()

virtual wPlot2D::NotchEntity::~NotchEntity ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ render()

void wPlot2D::NotchEntity::render ( sf::RenderWindow & window)

Renders the notch using SFML.

Builds a rectangle from ECS components (position, thickness, length, color) and draws it in the render window.

Exceptions
std::runtime_errorif any required component is missing.
Parameters
windowThe render window to draw onto.

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