SILICON
Loading...
Searching...
No Matches
WireTopologyCommand Class Reference

#include <undoCommands.hpp>

Inheritance diagram for WireTopologyCommand:
Collaboration diagram for WireTopologyCommand:

Classes

struct  Snapshot

Public Types

enum class  Operation { Add , Remove }

Public Member Functions

 WireTopologyCommand (DiagramScene *scene, const std::vector< GraphicalWireSegment * > &segments, Operation operation, bool skipInitialRedo=true, QUndoCommand *parent=nullptr)
 Captures segments for undoing or redoing wire addition or removal.
void undo () override
 Reverses the captured wire addition or removal.
void redo () override
 Reapplies the operation, optionally skipping the first invocation.

Private Member Functions

void apply (bool restore)
 Restores captured segments or removes them from their original document.

Private Attributes

DiagramScene * scene
std::string documentPath
std::vector< Snapshot > snapshots
Operation operation
bool skipInitialRedo

Detailed Description

Definition at line 44 of file undoCommands.hpp.

Member Enumeration Documentation

◆ Operation

enum class Operation
strong
Enumerator
Add 
Remove 

Definition at line 46 of file undoCommands.hpp.

Constructor & Destructor Documentation

◆ WireTopologyCommand()

WireTopologyCommand ( DiagramScene * scene,
const std::vector< GraphicalWireSegment * > & segments,
Operation operation,
bool skipInitialRedo = true,
QUndoCommand * parent = nullptr )

Captures segments for undoing or redoing wire addition or removal.

Parameters
sceneScene containing the segments.
segmentsSegments whose geometry, identifiers, and buses are captured.
operationWhether the original action adds or removes segments.
skipInitialRedoWhether the action was already applied before pushing the command.
parentOptional parent undo command.

Definition at line 80 of file undoCommands.cpp.

Member Function Documentation

◆ apply()

void apply ( bool restore)
private

Restores captured segments or removes them from their original document.

Parameters
restoreTrue restores the snapshots; false removes their scene items.

Definition at line 97 of file undoCommands.cpp.

◆ redo()

void redo ( )
override

Reapplies the operation, optionally skipping the first invocation.

Definition at line 145 of file undoCommands.cpp.

◆ undo()

void undo ( )
override

Reverses the captured wire addition or removal.

Definition at line 140 of file undoCommands.cpp.

Member Data Documentation

◆ documentPath

std::string documentPath
private

Definition at line 78 of file undoCommands.hpp.

◆ operation

Operation operation
private

Definition at line 80 of file undoCommands.hpp.

◆ scene

DiagramScene* scene
private

Definition at line 77 of file undoCommands.hpp.

◆ skipInitialRedo

bool skipInitialRedo
private

Definition at line 81 of file undoCommands.hpp.

◆ snapshots

std::vector<Snapshot> snapshots
private

Definition at line 79 of file undoCommands.hpp.


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