SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
AddAnnotationCommand Class Reference

Records the placement of a single text annotation. More...

#include <mapundostack.h>

Inheritance diagram for AddAnnotationCommand:
Collaboration diagram for AddAnnotationCommand:

Public Member Functions

 AddAnnotationCommand (OpenSWMMVisAnnotationLayer *layer, AnnotationTextItem *item, MapCanvas *canvas, QUndoCommand *parent=nullptr)
 
 ~AddAnnotationCommand () override
 
void undo () override
 
void redo () override
 
int id () const override
 
- Public Member Functions inherited from MapCommand
 MapCommand (const QString &text, MapCanvas *canvas, QUndoCommand *parent=nullptr)
 Constructs a map command with a human-readable text.
 
MapCanvascanvas () const
 

Additional Inherited Members

- Protected Attributes inherited from MapCommand
MapCanvasm_canvas
 

Detailed Description

Records the placement of a single text annotation.

The command owns the AnnotationTextItem while it is detached from the layer (undo state). On redo, the item is moved into the layer (which takes QObject parent ownership). On undo, the layer detaches the item via takeAnnotation, returning it to the command. This pattern keeps the item's id stable across redo/undo cycles so any side-channel references survive.

Constructor & Destructor Documentation

◆ AddAnnotationCommand()

AddAnnotationCommand::AddAnnotationCommand ( OpenSWMMVisAnnotationLayer layer,
AnnotationTextItem item,
MapCanvas canvas,
QUndoCommand *  parent = nullptr 
)
Parameters
itemNewly-created annotation. The command takes ownership; it transfers to the layer on each redo and back to the command on undo.

◆ ~AddAnnotationCommand()

AddAnnotationCommand::~AddAnnotationCommand ( )
override

Member Function Documentation

◆ id()

int AddAnnotationCommand::id ( ) const
inlineoverride

◆ redo()

void AddAnnotationCommand::redo ( )
override
Here is the call graph for this function:

◆ undo()

void AddAnnotationCommand::undo ( )
override
Here is the call graph for this function:

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