Canvas.h header
#include <ew/core/Canvas.h>
Namespace ew::core
Canvas class
class ew::core::Canvas
A research canvas: a freeform board of cards, each referencing another content object (a note, media asset, entity, ...) placed at an arbitrary position. Lets a writer arrange sources, notes, and references spatially (a mood board / research wall).
Members
ew::core::Canvas::Canvas(ContentId id, QString title)
Creates an empty canvas with identity id and title.
const QString & ew::core::Canvas::title() const
The canvas title.
void ew::core::Canvas::setTitle(QString title)
Sets the canvas title.
const std::vector< CanvasCard > & ew::core::Canvas::cards() const
The cards on the canvas, in insertion order.
void ew::core::Canvas::setCard(ContentId objectId, double x, double y)
Places objectId at (x, y), adding a card or moving the existing one.
void ew::core::Canvas::insertCard(std::size_t index, ContentId objectId, double x, double y)
Inserts a card for objectId at position index (clamped to the card count) at (x, y). If a card for objectId already exists it is moved instead, leaving the order unchanged. Used to restore a removed card at its original slot on undo.
bool ew::core::Canvas::removeCard(ContentId objectId)
Removes the card referencing objectId; returns true if one was removed. Any connections touching the card are left intact (they simply have no endpoint to draw until the card returns); callers that want them removed do so explicitly.
const std::vector< CanvasConnection > & ew::core::Canvas::connections() const
The connections between cards, in insertion order.
bool ew::core::Canvas::addConnection(ContentId a, ContentId b)
Links the cards for a and b (undirected). Returns false – adding nothing – when the endpoints are equal or null, either is not a placed card, or the pair is already connected.
bool ew::core::Canvas::insertConnection(std::size_t index, ContentId a, ContentId b)
Inserts a connection between a and b at position index (clamped to the connection count), with the same validity rules as addConnection. Used to restore a removed connection at its original slot on undo. Returns false – adding nothing – when the connection is invalid or already present.
bool ew::core::Canvas::removeConnection(ContentId a, ContentId b)
Removes the connection between a and b (in either order); returns true if one was removed.
CanvasCard struct
struct ew::core::CanvasCard
One card on a research canvas: a reference to another content object placed at a free position (top-left corner, in scene coordinates).
Members
ContentId ew::core::CanvasCard::objectId
The object shown on the card.
double ew::core::CanvasCard::x = 0.0
The card's x position on the canvas.
double ew::core::CanvasCard::y = 0.0
The card's y position on the canvas.
CanvasConnection struct
struct ew::core::CanvasConnection
An undirected link between two cards on a research canvas, drawn as a line joining them.
Members
ContentId ew::core::CanvasConnection::a
One endpoint card's object.
ContentId ew::core::CanvasConnection::b
The other endpoint card's object.