|
QCAD
Open Source 2D CAD
|
Go to the documentation of this file.
20 #ifndef RDOCUMENTINTERFACE_H
21 #define RDOCUMENTINTERFACE_H
29 #include <QSharedPointer>
32 #include <QSwipeGesture>
33 #include <QPanGesture>
34 #include <QPinchGesture>
49 #define RDEFAULT_QLIST_QREAL QList<qreal>()
51 #define RDEFAULT_MIN1 -1
115 IoErrorGeneralImportUrlError
126 QList<RGraphicsScene*> getGraphicsScenes();
131 void notifyCoordinateListeners();
135 void notifyLayerListeners(QList<RLayer::Id>& layerIds);
138 void removeTransactionListener(
int key);
142 void clear(
bool beforeLoad=
false);
145 bool isScriptRunning();
147 void setDefaultAction(
RAction* action);
148 RAction* getDefaultAction()
const;
149 void setCurrentAction(
RAction* action);
150 void terminateCurrentAction();
151 void queueAction(
RAction* action);
152 void killAllActions();
155 bool hasCurrentAction()
const;
156 RAction* getCurrentStatefulAction();
157 bool hasCurrentStatefulAction()
const;
167 void keyPressEvent(QKeyEvent& event);
168 void keyReleaseEvent(QKeyEvent& event);
179 void swipeGestureEvent(QSwipeGesture& gesture);
180 void panGestureEvent(QPanGesture& gesture);
181 void pinchGestureEvent(QPinchGesture& gesture);
184 void ucsSetEvent(
const QString& ucsName);
187 void enableUpdates();
188 void disableUpdates();
190 void enableRegeneration();
191 void disableRegeneration();
193 void enableMouseTracking();
194 void disableMouseTracking();
196 void updateAllEntities();
198 void regenerateScenes(
bool undone =
false);
199 void regenerateScenes(QSet<REntity::Id>& entityIds,
bool updateViews);
200 void regenerateScenes(
REntity::Id entityId,
bool updateViews);
202 void updateSelectionStatus(QSet<REntity::Id>& entityIds,
bool updateViews);
203 void updateSelectionStatus(
REntity::Id entityId,
bool updateViews);
205 void regenerateViews(
bool force=
false);
206 void regenerateViews(QSet<REntity::Id>& entityIds);
212 void setCursor(
const QCursor& cursor,
bool global =
true);
215 const QUrl& url,
const QString& nameFilter =
"",
bool notify =
true);
217 const QString& fileName,
const QString& nameFilter =
"",
bool notify =
true);
219 QString getCorrectedFileName(
const QString& fileName,
const QString& fileVersion);
220 bool exportFile(
const QString& fileName,
const QString& fileVersion =
"",
bool resetModified =
true);
222 void tagState(
const QString& tag =
"");
223 void undoToTag(
const QString& tag =
"");
226 void flushTransactions();
229 void setSnap(
RSnap* snap);
240 double range,
double strictRange =
RMAXDOUBLE,
241 bool includeLockedLayers =
true,
242 bool selectedOnly =
false);
244 void highlightReferencePoint(
const RRefPoint& position);
245 int selectEntities(
const QSet<REntity::Id>& entityIds,
bool add =
false);
246 void selectEntity(
REntity::Id entityId,
bool add =
false);
247 int deselectEntities(
const QSet<REntity::Id>& entityIds);
249 void selectBoxXY(
const RBox& box,
bool add =
false);
252 void clearSelection();
255 void addZoomBoxToPreview(
const RBox& box);
256 void addShapeToPreview(
RShape& shape,
const RColor& color,
259 void addAuxShapeToPreview(
RShape& shape);
260 void addEntityToPreview(
REntity& entity);
265 bool isPreviewEmpty();
268 void showPropertiesOf(
REntity& entity);
269 void clearProperties();
274 bool zoomToSelection();
275 void zoomTo(
const RBox& region,
int margin = 0);
283 RVector getRelativeZero()
const;
284 RVector getLastPosition()
const;
285 void setRelativeZero(
const RVector& p);
287 void lockRelativeZero();
288 void unlockRelativeZero();
289 bool isRelativeZeroLocked()
const;
293 void toggleSnapLock();
294 bool isSnapLocked()
const;
296 RVector getCursorPosition()
const;
297 void setCursorPosition(
const RVector& p);
298 void setCursorOverride(
bool on);
299 bool getCursorOverride()
const;
301 void deleteTerminatedActions();
319 void setCurrentBlock(
const RBlock& block);
320 void setCurrentBlock(
const QString& blockName);
323 void unsetCurrentViewport();
325 void setCurrentView(
const QString& viewName);
327 void setCurrentUcs(
const RUcs& ucs);
328 void setCurrentUcs(
const QString& ucsName);
329 RUcs getCurrentUcs();
330 QString getCurrentUcsName();
336 static void deleteClipboard();
338 return this==clipboard;
344 notifyGlobalListeners = on;
347 return notifyGlobalListeners;
354 QVariant eval(
const QString& ext,
const QString& script);
QMap< int, RTransactionListener * > transactionListeners
Definition: RDocumentInterface.h:380
bool getNotifyListeners() const
Definition: RDocumentInterface.h:346
RUcs currentUcs
Definition: RDocumentInterface.h:390
void getDocument()
Returns the current RDocument or undefined.
Definition: simple.js:59
static RDocumentInterface * clipboard
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RDocumentInterface.h:409
#define RDEFAULT_QLIST_QREAL
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RDocumentInterface.h:49
RDocument & document
Definition: RDocumentInterface.h:369
QList< RCoordinateListener * > coordinateListeners
Definition: RDocumentInterface.h:378
@ IoErrorNoImporterFound
No suitable importer was found.
Definition: RDocumentInterface.h:95
QMap< QString, int > tags
Definition: RDocumentInterface.h:404
void setCurrentColor(void color)
Sets the current color for newly added entities.
Definition: simple_create.js:190
A mouse event for a graphics scene.
Definition: RMouseEvent.h:42
bool allowUpdate
Definition: RDocumentInterface.h:394
RAction * defaultAction
Definition: RDocumentInterface.h:374
void zoomTo(void p1, void p2, void p3, void p4, void p5)
Zooms to the given entity.
Definition: simple_view.js:27
Represents a reference point of an entity.
Definition: RRefPoint.h:18
Abstract base class for classes that are interested in being notified whenever a layer has been added...
Definition: RLayerListener.h:39
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RTerminateEvent.h:34
RVector relativeZero
Definition: RDocumentInterface.h:386
Represents a user coordinate system (UCS) in a drawing.
Definition: RUcs.h:41
bool suspended
Definition: RDocumentInterface.h:392
void setCurrentLayer(void layerName)
Sets the current layer to the given layer.
Definition: simple_create.js:56
OrthoMode
Orthogonal mode, used for snap restrictions.
Definition: RS.h:195
bool relativeZeroLocked
Definition: RDocumentInterface.h:387
void getClipboard()
Definition: library.js:259
@ IoErrorGeneralImportError
General import error, i.e.
Definition: RDocumentInterface.h:111
bool deleting
Definition: RDocumentInterface.h:398
A tablet event for a graphics scene.
Definition: RTabletEvent.h:43
Represents a layer in a drawing.
Definition: RLayer.h:48
IoErrorCode
Definition: RDocumentInterface.h:87
@ IoErrorPermission
No permissions to read file.
Definition: RDocumentInterface.h:107
bool mouseTrackingEnabled
Definition: RDocumentInterface.h:402
bool notifyGlobalListeners
Definition: RDocumentInterface.h:397
Interface for geometrical shape classes.
Definition: RShape.h:72
Abstract base class for all snap restriction implementations.
Definition: RSnapRestriction.h:37
bool isClipboard()
Definition: RDocumentInterface.h:337
Graphics view.
Definition: RGraphicsView.h:58
Base class for all entity classes.
Definition: REntity.h:65
QStack< RAction * > currentActions
Definition: RDocumentInterface.h:375
Q_DECLARE_METATYPE(RMath *)
QQueue< RAction * > queuedActions
Definition: RDocumentInterface.h:376
QMap< QString, RScriptHandler * > scriptHandlers
Definition: RDocumentInterface.h:372
ClickMode
Current mouse click mode.
Definition: RAction.h:67
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RCommandEvent.h:31
bool allowRegeneration
Definition: RDocumentInterface.h:395
A mouse wheel event for a graphics scene.
Definition: RWheelEvent.h:41
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyEvent.h:40
@ IoErrorNotFound
File not found.
Definition: RDocumentInterface.h:103
Abstract base class for all grid and object snap implementations.
Definition: RSnap.h:44
void setNotifyListeners(bool on)
Definition: RDocumentInterface.h:343
Abstract base class for all action classes.
Definition: RAction.h:62
RGraphicsView * lastKnownViewWithFocus
Definition: RDocumentInterface.h:371
@ IoErrorNoError
No error occurred during import or export.
Definition: RDocumentInterface.h:91
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RExplodable.h:30
int Id
Definition: RObject.h:66
@ Orthogonal
Definition: RS.h:198
bool cursorOverride
Definition: RDocumentInterface.h:399
RVector lastPosition
Definition: RDocumentInterface.h:385
Coordinate Event.
Definition: RCoordinateEvent.h:37
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RLinetypePattern.h:45
Represents a block definition in a drawing.
Definition: RBlock.h:44
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RSnap * currentSnap
Definition: RDocumentInterface.h:382
void autoZoom()
Auto zoom.
Definition: simple_view.js:7
#define RMAXDOUBLE
Definition: RMath.h:63
Abstract base class for all graphics scenes.
Definition: RGraphicsScene.h:61
@ IoErrorZeroSize
File size is zero bytes.
Definition: RDocumentInterface.h:99
Abstract base class for all script handlers.
Definition: RScriptHandler.h:53
Viewport entity.
Definition: RViewportEntity.h:38
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RGraphicsSceneDrawable.h:33
bool isDeleting() const
Definition: RDocumentInterface.h:350
RSnapRestriction * currentSnapRestriction
Definition: RDocumentInterface.h:383
Lineweight
Definition: RLineweight.h:46
This is the abstract base class for all storage implementations.
Definition: RStorage.h:64
bool isSuspended()
Definition: RDocumentInterface.h:340
This abstract class is an interface for all operation implementations.
Definition: ROperation.h:44
bool keepPreviewOnce
Definition: RDocumentInterface.h:401
QString currentUcsName
Definition: RDocumentInterface.h:391
QList< RGraphicsScene * > scenes
Definition: RDocumentInterface.h:370
Transaction implementation.
Definition: RTransaction.h:74
QList< RLayerListener * > layerListeners
Definition: RDocumentInterface.h:379
bool snapLocked
Definition: RDocumentInterface.h:388
RVector cursorPosition
Definition: RDocumentInterface.h:389
Represents a box e.g.
Definition: RBox.h:43
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:85
#define QCADCORE_EXPORT
Definition: core_global.h:10
Abstract base class for classes that want to be notified on every transaction (objects added,...
Definition: RTransactionListener.h:38
Abstract base class for classes that are interested in the current coordinate of the mouse cursor.
Definition: RCoordinateListener.h:38
Color.
Definition: RColor.h:44