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

Undoable write of one per-vertex attribute across a set of vertices. More...

#include <meshcommands.h>

Inheritance diagram for MeshSetVertexAttributeCommand:
Collaboration diagram for MeshSetVertexAttributeCommand:

Public Member Functions

 MeshSetVertexAttributeCommand (SWMM2DMeshLayer *layer, QByteArray key, QVector< int > vertices, QVector< mesh::MeshVertex > newAttrs, QVector< mesh::MeshVertex > oldAttrs, const QString &text, MapCanvas *canvas, QUndoCommand *parent=nullptr)
 
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

Undoable write of one per-vertex attribute across a set of vertices.

Stores a snapshot of every touched vertex's editable attribute set (z / tag / coupledNode / couplingCd / couplingArea) on both sides of the edit rather than the single changed field. That is what makes undo faithful for the interdependent ones: clearing a coupling also resets Cd and Area to the engine defaults, so restoring the node id alone would silently drop the user's coefficients.

The snapshot is applied field-by-field through the layer's apply* helpers, in an order that respects their preconditions (coupledNode before Cd/Area, which are rejected on an uncoupled vertex). Fields that did not move are no-ops inside the helpers.

Constructor & Destructor Documentation

◆ MeshSetVertexAttributeCommand()

MeshSetVertexAttributeCommand::MeshSetVertexAttributeCommand ( SWMM2DMeshLayer layer,
QByteArray  key,
QVector< int >  vertices,
QVector< mesh::MeshVertex newAttrs,
QVector< mesh::MeshVertex oldAttrs,
const QString &  text,
MapCanvas canvas,
QUndoCommand *  parent = nullptr 
)
Parameters
layerMesh layer that owns the vertices.
keyAttribute key ("z", "tag", "coupledNode", "couplingCd", "couplingArea") — used for labelling only; the snapshots carry the values.
verticesVertex indices to write.
newAttrsParallel to vertices: post-edit attribute snapshot.
oldAttrsParallel to vertices: pre-edit attribute snapshot.

Member Function Documentation

◆ id()

int MeshSetVertexAttributeCommand::id ( ) const
inlineoverride

◆ redo()

void MeshSetVertexAttributeCommand::redo ( )
override

◆ undo()

void MeshSetVertexAttributeCommand::undo ( )
override

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