|
| LineEntity (const sf::Vector2f &origin, const sf::Vector2f &scale, const sf::Vector2f &start, const sf::Vector2f &end, bool withArrow=false) |
| Construct a line entity between two points.
|
virtual | ~LineEntity ()=default |
| Virtual destructor.
|
void | setColor (sf::Color color) |
| Sets the color of the line and arrowhead.
|
void | setThickness (float thickness) |
| Sets the thickness of the line.
|
float | getThickness () const |
| Returns the current thickness of the line.
|
void | setLineStyle (wEngine::LineStyleComponent::LineStyle style) |
| Sets the visual style of the line.
|
void | setDashLength (float dashLength) |
| Sets the dash length for dashed lines.
|
void | setGapLength (float gapLength) |
| Sets the gap length between dashes or dots.
|
sf::Vector2f | getStartPoint () const |
| Returns the starting point of the line.
|
sf::Vector2f | getEndPoint () const |
| Returns the ending point of the line.
|
bool | hasArrow () const |
| Checks if the line has an arrowhead.
|
float | getArrowSize () const |
| Returns the arrowhead size factor.
|
void | setArrowSize (float arrowSize) |
| Sets the arrowhead size factor.
|
void | render (sf::RenderWindow &window) |
| Renders the line (and optional arrowhead).
|
| 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.
|
Entity representing a straight line segment with optional arrowhead.
This entity provides configurable line rendering within the plot area:
- Supports Solid, Dashed, and Dotted styles (via LineStyleComponent).
- Customizable color, thickness, dash length, and gap length.
- Optional arrowhead at the end (useful for axes or vectors).
Coordinates are expressed in logical units and transformed by the entity’s origin and scale before being rendered.
- See also
- wEngine::LineDrawer for the rendering implementation
-
wEngine::LineStyleComponent for style configuration
- Author
- Wilfried Koch
- Copyright
- © 2025 Wilfried Koch. All rights reserved.