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
AddNodeCommand Class Reference

Records the creation of a SWMM node. More...

#include <mapundostack.h>

Inheritance diagram for AddNodeCommand:
Collaboration diagram for AddNodeCommand:

Public Member Functions

 AddNodeCommand (SWMMModelLayer *layer, QString name, int nodeType, double x, double y, MapCanvas *canvas, double invertElev=0.0, QUndoCommand *parent=nullptr)
 Creates an add-node command.
 
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 creation of a SWMM node.

redo() calls SWMMModelLayer::applyNodeAdd, which pushes the new node onto the end of the engine's node list and caches its geometry. undo() calls rollbackTailNodeAdd — the narrow "pop-last" helper that works only while the added node is still the most recent.

Consequence: AddNodeCommand cannot be undone after any subsequent add/remove has shifted it out of the tail position. The GUI guards against this by rejecting the undo and leaving the stack untouched (a clean no-op).

Constructor & Destructor Documentation

◆ AddNodeCommand()

AddNodeCommand::AddNodeCommand ( SWMMModelLayer layer,
QString  name,
int  nodeType,
double  x,
double  y,
MapCanvas canvas,
double  invertElev = 0.0,
QUndoCommand *  parent = nullptr 
)

Creates an add-node command.

Parameters
invertElevIf non-zero, written to the engine via swmm_node_set_invert_elev after the node is created. Defaults to 0.0 (engine default = no elevation override).

Member Function Documentation

◆ id()

int AddNodeCommand::id ( ) const
inlineoverride

◆ redo()

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

◆ undo()

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

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