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) const = 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  void setText(const QString& t) {
97  text = t;
98  }
99 
100 protected:
101  bool undoable;
105  bool allowAll;
108  QString text;
109 };
110 
112 
113 #endif
This abstract class is an interface for all operation implementations.
Definition: ROperation.h:44
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
virtual ~ROperation()
Definition: ROperation.h:59
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RNonCopyable.h:32
#define QCADCORE_EXPORT
Definition: core_global.h:10
int transactionGroup
Definition: ROperation.h:107
bool allowInvisible
Definition: ROperation.h:104
Transaction implementation.
Definition: RTransaction.h:74
bool allowAll
Definition: ROperation.h:105
void setSpatialIndexDisabled(bool on)
Definition: ROperation.h:80
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
static void decCounter(const QString &id=RDEFAULT_QSTRING)
Definition: RDebug.cpp:105
void setRecordAffectedObjects(bool on)
Definition: ROperation.h:76
bool recordAffectedObjects
Definition: ROperation.h:102
QString text
Definition: ROperation.h:108
void setAllowInvisible(bool on)
Definition: ROperation.h:84
bool spatialIndexDisabled
Definition: ROperation.h:103
All entities (for filters)
Definition: RS.h:88
RS::EntityType getEntityTypeFilter() const
Definition: ROperation.h:72
static void incCounter(const QString &id=RDEFAULT_QSTRING)
Definition: RDebug.cpp:97
Abstract base class for exporters.
Definition: RExporter.h:71
void setAllowAll(bool on)
Definition: ROperation.h:88
void setText(const QString &t)
Definition: ROperation.h:96
void setTransactionGroup(int g)
Definition: ROperation.h:92
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RRequireHeap.h:30
bool undoable
Definition: ROperation.h:101
ROperation(bool undoable=true, RS::EntityType entityTypeFilter=RS::EntityAll)
Definition: ROperation.h:46
RS::EntityType entityTypeFilter
Definition: ROperation.h:106