QCAD
Open Source 2D CAD
ROperation.h
Go to the documentation of this file.
1 
20 #ifndef ROPERATION_H
21 #define ROPERATION_H
22 
23 #include "core_global.h"
24 
25 #include "RNonCopyable.h"
26 #include "RRequireHeap.h"
27 #include "RS.h"
28 #include "RTransaction.h"
29 
30 class RDocument;
31 class RExporter;
32 
33 
34 
45 public:
47  bool undoable=true,
48  RS::EntityType entityTypeFilter = RS::EntityAll
49  ) : undoable(undoable),
50  recordAffectedObjects(true),
51  spatialIndexDisabled(false),
52  allowInvisible(false),
53  allowAll(false),
54  entityTypeFilter(entityTypeFilter),
55  transactionGroup(-1) {
56  RDebug::incCounter("ROperation");
57  }
58 
59  virtual ~ROperation() {
60  RDebug::decCounter("ROperation");
61  }
62 
70  virtual RTransaction apply(RDocument& document, bool preview = false) = 0;
71 
73  return entityTypeFilter;
74  }
75 
76  void setRecordAffectedObjects(bool on) {
77  recordAffectedObjects = on;
78  }
79 
80  void setSpatialIndexDisabled(bool on) {
81  spatialIndexDisabled = on;
82  }
83 
84  void setAllowInvisible(bool on) {
85  allowInvisible = on;
86  }
87 
88  void setAllowAll(bool on) {
89  allowAll = on;
90  }
91 
92  void setTransactionGroup(int g) {
93  transactionGroup = g;
94  }
95 
96  int getTransactionGroup() const {
97  return transactionGroup;
98  }
99 
100  void setText(const QString& t) {
101  text = t;
102  }
103 
104  QString getText() const {
105  return text;
106  }
107 
108 protected:
109  bool undoable;
113  bool allowAll;
116  QString text;
117 };
118 
120 
121 #endif
ROperation::recordAffectedObjects
bool recordAffectedObjects
Definition: ROperation.h:110
RNonCopyable
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RNonCopyable.h:32
RDebug::incCounter
static void incCounter(const QString &id=RDEFAULT_QSTRING)
Definition: RDebug.cpp:97
RRequireHeap.h
ROperation::transactionGroup
int transactionGroup
Definition: ROperation.h:115
ROperation::undoable
bool undoable
Definition: ROperation.h:109
RTransaction.h
RDebug::decCounter
static void decCounter(const QString &id=RDEFAULT_QSTRING)
Definition: RDebug.cpp:105
ROperation::text
QString text
Definition: ROperation.h:116
ROperation::getEntityTypeFilter
RS::EntityType getEntityTypeFilter() const
Definition: ROperation.h:72
ROperation::entityTypeFilter
RS::EntityType entityTypeFilter
Definition: ROperation.h:114
ROperation::spatialIndexDisabled
bool spatialIndexDisabled
Definition: ROperation.h:111
RS::EntityType
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:125
RS.h
ROperation::setAllowAll
void setAllowAll(bool on)
Definition: ROperation.h:88
ROperation::apply
virtual RTransaction apply(RDocument &document, bool preview=false)=0
Applies this operation to selection in the given document.
ROperation::setText
void setText(const QString &t)
Definition: ROperation.h:100
ROperation::setRecordAffectedObjects
void setRecordAffectedObjects(bool on)
Definition: ROperation.h:76
RNonCopyable.h
ROperation::setAllowInvisible
void setAllowInvisible(bool on)
Definition: ROperation.h:84
ROperation::allowInvisible
bool allowInvisible
Definition: ROperation.h:112
ROperation::getTransactionGroup
int getTransactionGroup() const
Definition: ROperation.h:96
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RS::EntityAll
@ EntityAll
All entities (for filters)
Definition: RS.h:138
core_global.h
RExporter
Abstract base class for exporters.
Definition: RExporter.h:72
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:68
ROperation::~ROperation
virtual ~ROperation()
Definition: ROperation.h:59
ROperation::setTransactionGroup
void setTransactionGroup(int g)
Definition: ROperation.h:92
ROperation::ROperation
ROperation(bool undoable=true, RS::EntityType entityTypeFilter=RS::EntityAll)
Definition: ROperation.h:46
ROperation
This abstract class is an interface for all operation implementations.
Definition: ROperation.h:44
RRequireHeap
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RRequireHeap.h:30
RTransaction
Transaction implementation.
Definition: RTransaction.h:74
ROperation::setSpatialIndexDisabled
void setSpatialIndexDisabled(bool on)
Definition: ROperation.h:80
ROperation::allowAll
bool allowAll
Definition: ROperation.h:113
ROperation::getText
QString getText() const
Definition: ROperation.h:104
QCADCORE_EXPORT
#define QCADCORE_EXPORT
Definition: core_global.h:10