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  entityTypeFilter(entityTypeFilter),
54  transactionGroup(-1) {
55  RDebug::incCounter("ROperation");
56  }
57 
58  virtual ~ROperation() {
59  RDebug::decCounter("ROperation");
60  }
61 
69  virtual RTransaction apply(RDocument& document, bool preview = false) const = 0;
70 
72  return entityTypeFilter;
73  }
74 
75  void setRecordAffectedObjects(bool on) {
76  recordAffectedObjects = on;
77  }
78 
79  void setSpatialIndexDisabled(bool on) {
80  spatialIndexDisabled = on;
81  }
82 
83  void setAllowInvisible(bool on) {
84  allowInvisible = on;
85  }
86 
87  void setTransactionGroup(int g) {
88  transactionGroup = g;
89  }
90 
91  void setText(const QString& t) {
92  text = t;
93  }
94 
95 protected:
96  bool undoable;
102  QString text;
103 };
104 
106 
107 #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:75
virtual ~ROperation()
Definition: ROperation.h:58
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RNonCopyable.h:32
#define QCADCORE_EXPORT
Definition: core_global.h:10
int transactionGroup
Definition: ROperation.h:101
bool allowInvisible
Definition: ROperation.h:99
Transaction implementation.
Definition: RTransaction.h:70
void setSpatialIndexDisabled(bool on)
Definition: ROperation.h:79
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
Q_DECLARE_METATYPE(RMath *)
static void decCounter(const QString &id=RDEFAULT_QSTRING)
Definition: RDebug.cpp:104
void setRecordAffectedObjects(bool on)
Definition: ROperation.h:75
bool recordAffectedObjects
Definition: ROperation.h:97
QString text
Definition: ROperation.h:102
void setAllowInvisible(bool on)
Definition: ROperation.h:83
bool spatialIndexDisabled
Definition: ROperation.h:98
All entities (for filters)
Definition: RS.h:76
RS::EntityType getEntityTypeFilter() const
Definition: ROperation.h:71
static void incCounter(const QString &id=RDEFAULT_QSTRING)
Definition: RDebug.cpp:96
Abstract base class for exporters.
Definition: RExporter.h:63
void setText(const QString &t)
Definition: ROperation.h:91
void setTransactionGroup(int g)
Definition: ROperation.h:87
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RRequireHeap.h:30
bool undoable
Definition: ROperation.h:96
ROperation(bool undoable=true, RS::EntityType entityTypeFilter=RS::EntityAll)
Definition: ROperation.h:46
RS::EntityType entityTypeFilter
Definition: ROperation.h:100