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

#include <linepatternops.h>

Inheritance diagram for lc::operation::RemoveLinePattern:
Collaboration diagram for lc::operation::RemoveLinePattern:

Public Member Functions

 RemoveLinePattern (Document_SPtr document, const DxfLinePattern_CSPtr LinePattern)
 
virtual void undo () const
 Undo a given operation. More...
 
virtual void redo () const
 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 ()
 

Private Attributes

DxfLinePattern_CSPtr _LinePattern
 
std::vector
< entity::CADEntity_CSPtr > 
_entities
 

Detailed Description

Remove DxfLinePattern from document

Definition at line 37 of file linepatternops.h.

Constructor & Destructor Documentation

RemoveLinePattern::RemoveLinePattern ( Document_SPtr  document,
const DxfLinePattern_CSPtr  LinePattern 
)

RemoveLinePattern

Definition at line 34 of file linepatternops.cpp.

34  :
35  DocumentOperation(document, "RemoveLinePattern"),
36  _LinePattern(LinePattern) {
37 }
DocumentOperation(Document_SPtr document, const std::string &description)
DxfLinePattern_CSPtr _LinePattern

Member Function Documentation

void RemoveLinePattern::processInternal ( )
protectedvirtual

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 39 of file linepatternops.cpp.

39  {
40  document()->removeDocumentMetaType(_LinePattern);
41 }
DxfLinePattern_CSPtr _LinePattern
void RemoveLinePattern::redo ( ) const
virtual

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 47 of file linepatternops.cpp.

47  {
48  for (auto i : _entities) {
49  document()->removeEntity(i);
50  }
51 
52  document()->removeDocumentMetaType(_LinePattern);
53 }
std::vector< entity::CADEntity_CSPtr > _entities
DxfLinePattern_CSPtr _LinePattern
void RemoveLinePattern::undo ( ) const
virtual

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 43 of file linepatternops.cpp.

43  {
44  document()->addDocumentMetaType(_LinePattern);
45 }
DxfLinePattern_CSPtr _LinePattern

Member Data Documentation

std::vector<entity::CADEntity_CSPtr> lc::operation::RemoveLinePattern::_entities
private

Definition at line 49 of file linepatternops.h.

DxfLinePattern_CSPtr lc::operation::RemoveLinePattern::_LinePattern
private

Definition at line 48 of file linepatternops.h.


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