LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lc::operation::AddBlock Class Reference

#include <blockops.h>

Inheritance diagram for lc::operation::AddBlock:
Collaboration diagram for lc::operation::AddBlock:

Public Member Functions

 AddBlock (const Document_SPtr &document, const Block_CSPtr &block)
 
virtual void undo () const override
 Undo a given operation. More...
 
virtual void redo () const override
 Redo a given operation. More...
 
- Public Member Functions inherited from lc::operation::DocumentOperation
 DocumentOperation (Document_SPtr document, const std::string &description)
 
Document_SPtr document () const
 
virtual void execute ()
 execute this operation More...
 
virtual ~DocumentOperation ()
 
- Public Member Functions inherited from lc::operation::Undoable
 Undoable (const std::string &text)
 Name of this operartion. More...
 
virtual ~Undoable ()
 
virtual std::string text ()
 Name of the operation. More...
 

Protected Member Functions

virtual void processInternal () override
 

Private Attributes

Block_CSPtr _block
 

Detailed Description

Definition at line 9 of file blockops.h.

Constructor & Destructor Documentation

AddBlock::AddBlock ( const Document_SPtr &  document,
const Block_CSPtr &  block 
)

Definition at line 6 of file blockops.cpp.

6  :
7  DocumentOperation(document, "AddBlock"),
8  _block(block) {
9 
10 }
DocumentOperation(Document_SPtr document, const std::string &description)
Block_CSPtr _block
Definition: blockops.h:20

Member Function Documentation

void AddBlock::processInternal ( )
overrideprotectedvirtual

This function gets called when an operation starts and when the document is locked for you so you can do your work

Implements lc::operation::DocumentOperation.

Definition at line 20 of file blockops.cpp.

20  {
21  document()->addDocumentMetaType(_block);
22 }
Block_CSPtr _block
Definition: blockops.h:20
void AddBlock::redo ( ) const
overridevirtual

Redo a given operation.

This can get called if we want to redo a operation. Redo is usually called after an undo operation. If in the undo operation entities where removed, it needs to get added again. it doesn't have to do any re.calculation but just remember what entities have been added or removed.

Implements lc::operation::Undoable.

Definition at line 16 of file blockops.cpp.

16  {
17  document()->addDocumentMetaType(_block);
18 }
Block_CSPtr _block
Definition: blockops.h:20
void AddBlock::undo ( ) const
overridevirtual

Undo a given operation.

For any operation that means for example when it added entities to the document it now needs to remove all created entities on the document. When the operation added a layer or block, it will call functions to remove that block

Implements lc::operation::Undoable.

Definition at line 12 of file blockops.cpp.

12  {
13  document()->removeDocumentMetaType(_block);
14 }
Block_CSPtr _block
Definition: blockops.h:20

Member Data Documentation

Block_CSPtr lc::operation::AddBlock::_block
private

Definition at line 20 of file blockops.h.


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