20#ifndef RDOCUMENTINTERFACE_H
21#define RDOCUMENTINTERFACE_H
35#define RDEFAULT_QLIST_QREAL QList<qreal>()
37#define RDEFAULT_MIN1 -1
40#ifndef RDEFAULT_QVARIANTMAP
41#define RDEFAULT_QVARIANTMAP QVariantMap()
127 IoErrorGeneralImportUrlError
138 QList<RGraphicsScene*> getGraphicsScenes();
144 void notifyCoordinateListeners();
148 void notifyLayerListeners(QList<RObject::Id>& layerIds);
156 void removeTransactionListener(
int key);
160 void clear(
bool beforeLoad=
false);
162 void deleteScriptHandler(
const QString& extension);
164 bool isScriptRunning();
166 void setDefaultAction(
RAction* action);
167 RAction* getDefaultAction()
const;
168 void setCurrentAction(
RAction* action);
169 void terminateCurrentAction();
170 void queueAction(
RAction* action);
171 void killAllActions();
174 bool hasCurrentAction()
const;
175 RAction* getCurrentStatefulAction();
176 bool hasCurrentStatefulAction()
const;
186 void keyPressEvent(QKeyEvent& event);
187 void keyReleaseEvent(QKeyEvent& event);
198 void swipeGestureEvent(QSwipeGesture& gesture);
199 void panGestureEvent(QPanGesture& gesture);
200 void pinchGestureEvent(QPinchGesture& gesture);
203 void ucsSetEvent(
const QString& ucsName);
206 void enableUpdates();
207 void disableUpdates();
209 void enableRegeneration();
210 void disableRegeneration();
212 void enableMouseTracking();
213 void disableMouseTracking();
215 void setAllowSnapInterruption(
bool on);
217 void updateAllEntities();
219 void regenerateScenes(
bool undone =
false,
bool invisible =
false);
221 void regenerateScenes(
RObject::Id entityId,
bool updateViews);
224 void updateSelectionStatus(
RObject::Id entityId,
bool updateViews);
226 void regenerateViews(
bool force=
false);
233 void setCursor(
const QCursor& cursor,
bool global =
true);
236 const QUrl& url,
const QString& nameFilter =
"",
bool notify =
true,
const QVariantMap& params =
RDEFAULT_QVARIANTMAP);
238 const QString& fileName,
const QString& nameFilter =
"",
bool notify =
true,
const QVariantMap& params =
RDEFAULT_QVARIANTMAP);
240 QString getCorrectedFileName(
const QString& fileName,
const QString& fileVersion);
241 bool exportFile(
const QString& fileName,
const QString& fileVersion =
"",
bool resetModified =
true);
243 void tagState(
const QString& tag =
"");
244 void undoToTag(
const QString& tag =
"");
247 void flushTransactions();
250 void setSnap(
RSnap* snap);
254 return lastSnapState;
265 double range,
double strictRange =
RMAXDOUBLE,
266 bool includeLockedLayers =
true,
267 bool selectedOnly =
false);
269 void highlightReferencePoint(
const RRefPoint& position);
270 int selectEntities(
const QSet<RObject::Id>& entityIds,
bool add =
false);
271 void selectEntity(
RObject::Id entityId,
bool add =
false);
272 int deselectEntities(
const QSet<RObject::Id>& entityIds);
274 void selectBoxXY(
const RBox& box,
bool add =
false);
277 void clearSelection();
280 void addZoomBoxToPreview(
const RBox& box);
281 void addShapeToPreview(
RShape& shape,
const RColor& color,
284 void addAuxShapeToPreview(
RShape& shape);
290 bool isPreviewEmpty();
293 void showPropertiesOf(
REntity& entity);
294 void clearProperties();
299 bool zoomToSelection();
300 void zoomTo(
const RBox& region,
int margin = 0);
308 RVector getRelativeZero()
const;
309 RVector getLastPosition()
const;
310 void setRelativeZero(
const RVector& p);
312 void lockRelativeZero();
313 void unlockRelativeZero();
314 bool isRelativeZeroLocked()
const;
318 void toggleSnapLock();
319 bool isSnapLocked()
const;
321 RVector getCursorPosition()
const;
322 void setCursorPosition(
const RVector& p);
323 void setCursorOverride(
bool on);
324 bool getCursorOverride()
const;
326 void deleteTerminatedActions();
344 void setCurrentBlock(
const RBlock& block);
345 void setCurrentBlock(
const QString& blockName);
348 void unsetCurrentViewport();
350 void setCurrentView(
const QString& viewName);
352 void setCurrentUcs(
const RUcs& ucs);
353 void setCurrentUcs(
const QString& ucsName);
354 RUcs getCurrentUcs();
355 QString getCurrentUcsName();
361 static void deleteClipboard();
363 return this==clipboard;
368 void setNotifyListeners(
bool on);
370 return notifyGlobalListeners;
377 QVariant eval(
const QString& ext,
const QString& script);
#define RDEFAULT_QLIST_QREAL
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RDocumentInterface.h:35
#define RDEFAULT_QVARIANTMAP
Definition RDocumentInterface.h:41
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RExplodable.h:30
Q_DECLARE_METATYPE(RMath *)
#define RMAXDOUBLE
Definition RMath.h:66
Abstract base class for all action classes.
Definition RAction.h:57
ClickMode
Current mouse click mode.
Definition RAction.h:62
Represents a block definition in a drawing.
Definition RBlock.h:42
Abstract base class for classes that are interested in being notified whenever a block has been added...
Definition RBlockListener.h:37
Represents a box e.g.
Definition RBox.h:46
Color.
Definition RColor.h:43
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RCommandEvent.h:34
Coordinate Event.
Definition RCoordinateEvent.h:39
Abstract base class for classes that are interested in the current coordinate of the mouse cursor.
Definition RCoordinateListener.h:38
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Interface for interaction between a graphics document and a user.
Definition RDocumentInterface.h:97
void regenerateViews(QSet< RObject::Id > &entityIds)
bool cursorOverride
Definition RDocumentInterface.h:424
static RDocumentInterface * clipboard
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RDocumentInterface.h:437
bool isDeleting() const
Definition RDocumentInterface.h:373
void regenerateScenes(QSet< RObject::Id > &entityIds, bool updateViews)
bool isSuspended()
Definition RDocumentInterface.h:365
QQueue< RAction * > queuedActions
Definition RDocumentInterface.h:399
RSnap::Status lastSnapState
Definition RDocumentInterface.h:408
QList< RCoordinateListener * > coordinateListeners
Definition RDocumentInterface.h:401
RVector lastPosition
Definition RDocumentInterface.h:410
RAction * defaultAction
Definition RDocumentInterface.h:397
bool snapLocked
Definition RDocumentInterface.h:413
bool notifyGlobalListeners
Definition RDocumentInterface.h:422
QList< RLayerListener * > layerListeners
Definition RDocumentInterface.h:402
bool deleting
Definition RDocumentInterface.h:423
bool isClipboard()
Definition RDocumentInterface.h:362
bool allowUpdate
Definition RDocumentInterface.h:419
bool keepPreviewOnce
Definition RDocumentInterface.h:426
bool suspended
Definition RDocumentInterface.h:417
QMap< QString, int > tags
Definition RDocumentInterface.h:430
QList< RBlockListener * > blockListeners
Definition RDocumentInterface.h:403
bool relativeZeroLocked
Definition RDocumentInterface.h:412
RSnap * currentSnap
Definition RDocumentInterface.h:406
QString currentUcsName
Definition RDocumentInterface.h:416
RSnapRestriction * currentSnapRestriction
Definition RDocumentInterface.h:407
RDocument * previewDocument
Definition RDocumentInterface.h:432
RGraphicsView * lastKnownViewWithFocus
Definition RDocumentInterface.h:394
RUcs currentUcs
Definition RDocumentInterface.h:415
IoErrorCode
Definition RDocumentInterface.h:99
@ IoErrorGeneralImportError
General import error, i.e.
Definition RDocumentInterface.h:123
@ IoErrorZeroSize
File size is zero bytes.
Definition RDocumentInterface.h:111
@ IoErrorNotFound
File not found.
Definition RDocumentInterface.h:115
@ IoErrorNoImporterFound
No suitable importer was found.
Definition RDocumentInterface.h:107
@ IoErrorPermission
No permissions to read file.
Definition RDocumentInterface.h:119
@ IoErrorNoError
No error occurred during import or export.
Definition RDocumentInterface.h:103
bool getNotifyListeners() const
Definition RDocumentInterface.h:369
RVector cursorPosition
Definition RDocumentInterface.h:414
void updateSelectionStatus(QSet< RObject::Id > &entityIds, bool updateViews)
QList< RGraphicsScene * > scenes
Definition RDocumentInterface.h:393
QMap< int, RTransactionListener * > transactionListeners
Definition RDocumentInterface.h:404
bool allowSnapInterruption
Definition RDocumentInterface.h:428
bool allowRegeneration
Definition RDocumentInterface.h:420
RDocument & document
Definition RDocumentInterface.h:392
QStack< RAction * > currentActions
Definition RDocumentInterface.h:398
QMap< QString, RScriptHandler * > scriptHandlers
Definition RDocumentInterface.h:395
RSnap::Status getSnapStatus() const
Definition RDocumentInterface.h:253
bool mouseTrackingEnabled
Definition RDocumentInterface.h:427
RVector relativeZero
Definition RDocumentInterface.h:411
Base class for all entity classes.
Definition REntity.h:63
Definition RGraphicsSceneDrawable.h:37
Abstract base class for all graphics scenes.
Definition RGraphicsScene.h:64
Graphics view.
Definition RGraphicsView.h:67
Represents a layer in a drawing.
Definition RLayer.h:45
Abstract base class for classes that are interested in being notified whenever a layer has been added...
Definition RLayerListener.h:39
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RLinetypePattern.h:42
Lineweight
Definition RLineweight.h:44
A mouse event for a graphics scene.
Definition RMouseEvent.h:42
Abstract base class for all objects.
Definition RObject.h:64
int Id
Definition RObject.h:69
This abstract class is an interface for all operation implementations.
Definition ROperation.h:45
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyEvent.h:40
Represents a reference point of an entity.
Definition RRefPoint.h:18
OrthoMode
Orthogonal mode, used for snap restrictions.
Definition RS.h:303
@ Orthogonal
Definition RS.h:306
Abstract base class for all script handlers.
Definition RScriptHandler.h:58
Interface for geometrical shape classes.
Definition RShape.h:72
Abstract base class for all grid and object snap implementations.
Definition RSnap.h:43
Status
Snap status, returned by snap tools (most importantly auto snap tool) to indicate what snap was used.
Definition RSnap.h:49
Abstract base class for all snap restriction implementations.
Definition RSnapRestriction.h:37
This is the abstract base class for all storage implementations.
Definition RStorage.h:67
A tablet event for a graphics scene.
Definition RTabletEvent.h:43
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RTerminateEvent.h:34
Transaction implementation.
Definition RTransaction.h:73
Abstract base class for classes that want to be notified on every transaction (objects added,...
Definition RTransactionListener.h:40
Represents a user coordinate system (UCS) in a drawing.
Definition RUcs.h:41
Represents a 3d vector (x/y/z).
Definition RVector.h:47
Viewport entity.
Definition RViewportEntity.h:38
A mouse wheel event for a graphics scene.
Definition RWheelEvent.h:41
#define QCADCORE_EXPORT
Definition core_global.h:10
void getDocument()
Returns the current RDocument or undefined.
Definition simple.js:63
void setCurrentLayer(void layerName)
Sets the current layer to the given layer.
Definition simple_create.js:127
void zoomTo(void p1, void p2, void p3, void p4, void p5)
Zooms to the given entity.
Definition simple_view.js:21
void setCurrentColor(void color)
Sets the current color for newly added entities.
Definition simple_create.js:36
void autoZoom()
Auto zoom.
Definition simple_view.js:27
void getClipboard()
Definition library.js:870