|
QCAD
Open Source 2D CAD
|
Go to the documentation of this file.
20 #ifndef RGRAPHICSVIEW_H
21 #define RGRAPHICSVIEW_H
27 #include <QSwipeGesture>
28 #include <QPanGesture>
29 #include <QPinchGesture>
46 #define RDEFAULT_MIN1 -1
70 void setViewportNumber(
int n);
72 return viewportNumber;
78 void setDisplayOnlyCurrentUcs(
bool on);
97 virtual RBox mapToView(
const RBox& box)
const;
111 virtual QList<RVector> mapCornersFromView()
const;
113 virtual RBox getBox()
const;
114 virtual RVector getMinimum()
const;
115 virtual RVector getMaximum()
const;
119 virtual void handleKeyPressEvent(QKeyEvent& event);
120 virtual void handleKeyReleaseEvent(QKeyEvent& event);
121 virtual void simulateMouseMoveEvent();
122 virtual void handleMouseMoveEvent(
RMouseEvent& event);
123 virtual void handleMousePressEvent(
RMouseEvent& event);
124 virtual void handleMouseReleaseEvent(
RMouseEvent& event);
125 virtual void handleMouseDoubleClickEvent(
RMouseEvent& event);
128 virtual void handleSwipeGestureEvent(QSwipeGesture& gesture);
129 virtual void handlePanGestureEvent(QPanGesture& gesture);
130 virtual void handlePinchGestureEvent(QPinchGesture& gesture);
138 virtual void viewportChangeEvent();
141 void restoreViewport();
144 void zoomIn(
const RVector& center,
double factor=1.2);
145 void zoomOut(
const RVector& center,
double factor=1.2);
146 virtual void zoom(
const RVector& center,
double factor);
147 virtual void zoomTo(
const RBox& window,
int margin = 0);
151 bool zoomToEntities(
const QSet<REntity::Id>& ids,
int margin =
RDEFAULT_MIN1);
153 virtual void centerToPoint(
const RVector& point);
154 virtual void centerToBox(
const RBox& box);
155 virtual void pan(
const RVector& delta,
bool regen=
true);
158 double getFactor(
bool includeStepFactor=
true)
const;
159 void setFactor(
double f,
bool regen=
true);
161 RVector getOffset(
bool includeStepOffset=
true)
const;
162 void setOffset(
const RVector& offset,
bool regen=
true);
173 virtual void regenerate(QSet<REntity::Id>& affectedEntities) {
174 Q_UNUSED(affectedEntities)
214 void setNavigationAction(
RAction* action);
236 void setGridVisible(
bool on);
237 bool isGridVisible()
const;
242 virtual QCursor
getCursor() {
return QCursor(Qt::ArrowCursor); }
246 RRefPoint getClosestReferencePoint(
const RVector& screenPosition,
int range);
248 REntity::Id getClosestEntity(
const RVector& screenPosition,
int range,
int strictRange,
bool includeLockedLayers=
true,
bool selectedOnly =
false);
251 virtual void setBackgroundColor(
const QColor& col);
252 QColor getBackgroundColor();
255 void setMargin(
int m);
257 void setExporting(
bool on);
258 bool isExporting()
const;
260 bool isPrintingOrExporting()
const;
262 void setPrinting(
bool on);
263 bool isPrinting()
const;
264 void setPrintPreview(
bool on);
265 bool isPrintPreview()
const;
266 void setPrintPointSize(
const RVector& s);
271 void setHairlineMode(
bool on);
272 bool getHairlineMode();
274 void setHairlineMinimumMode(
bool on);
275 bool getHairlineMinimumMode();
277 QList<RTextLabel> getTextLabels();
278 void clearTextLabels();
279 void addTextLabel(
const RTextLabel &textLabel);
282 return lastKnownModelPosition;
286 return currentStepScaleFactor;
290 currentStepScaleFactor = f;
294 return currentStepOffset;
298 currentStepOffset = s;
302 textHeightThresholdOverride = v;
306 return textHeightThresholdOverride;
309 void updateTextHeightThreshold();
313 void setAntialiasing(
bool val);
314 bool getAntialiasing()
const;
RVector previousOffset
Definition: RGraphicsView.h:372
bool printing
Definition: RGraphicsView.h:337
RVector printPointSize
Definition: RGraphicsView.h:339
virtual int getWidth() const =0
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RNonCopyable.h:32
virtual void setCursor(Qt::CursorShape)
Definition: RGraphicsView.h:243
RVector currentStepOffset
Definition: RGraphicsView.h:391
void getDocument()
Returns the current RDocument or undefined.
Definition: simple.js:59
virtual void regenerate(QSet< REntity::Id > &affectedEntities)
Definition: RGraphicsView.h:173
RVector getLastKnownMousePosition() const
Definition: RGraphicsView.h:281
virtual int isActive() const
Definition: RGraphicsView.h:202
RGrid * getGrid()
Definition: RGraphicsView.h:219
A mouse event for a graphics scene.
Definition: RMouseEvent.h:42
virtual void paintGridPoint(const RVector &)
Definition: RGraphicsView.h:239
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
virtual void giveFocus()=0
@ GrayScale
Definition: RGraphicsView.h:62
double previousFactor
Definition: RGraphicsView.h:373
int viewportNumber
Definition: RGraphicsView.h:404
QList< RTextLabel > textLabels
Internal list of text labels that were added to this view.
Definition: RGraphicsView.h:398
int margin
Definition: RGraphicsView.h:384
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
@ FullColor
Definition: RGraphicsView.h:61
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RTerminateEvent.h:34
double factor
Scale factor from model coordinates to view coordinates.
Definition: RGraphicsView.h:370
virtual bool getSignalsBlocked() const
Definition: RGraphicsView.h:206
virtual void removeFocus()=0
void clear()
Definition: RGraphicsView.h:75
virtual void repaintView()=0
Repaints the view (widget, etc..).
virtual bool hasFocus()=0
virtual void paintGridLine(const RLine &)
Definition: RGraphicsView.h:240
RGraphicsScene * scene
The scene this view is attached to.
Definition: RGraphicsView.h:348
A tablet event for a graphics scene.
Definition: RTabletEvent.h:43
Low-level mathematical representation of a line.
Definition: RLine.h:41
bool displayOnlyCurrentUcs
True to only display entities within the horizontal slice that is defined by the current UCS.
Definition: RGraphicsView.h:379
bool hairlineMode
Definition: RGraphicsView.h:342
double currentStepScaleFactor
Current scale factor caused by a pinch gesture.
Definition: RGraphicsView.h:389
RVector offset
Offset of the zero point from the lower left corner of the view in model coordinates.
Definition: RGraphicsView.h:365
int textHeightThresholdOverride
Definition: RGraphicsView.h:401
int textHeightThreshold
Definition: RGraphicsView.h:402
bool antialiasing
Definition: RGraphicsView.h:406
virtual QCursor getCursor()
Definition: RGraphicsView.h:242
virtual void regenerate(bool force=false)=0
Regenerates the view to show the visible parts of the underlying scene.
virtual double getDevicePixelRatio() const
Definition: RGraphicsView.h:316
virtual void setSignalsBlocked(bool on)
Definition: RGraphicsView.h:209
virtual void setCursor(const QCursor &)
Definition: RGraphicsView.h:244
Graphics view.
Definition: RGraphicsView.h:58
virtual double mapDistanceFromView(double d) const =0
Maps the given view distance in pixels to a model distance.
virtual int getHeight() const =0
void getDocumentInterface()
Returns the current RDocumentInterface or undefined.
Definition: simple.js:80
Q_DECLARE_METATYPE(RMath *)
RGrid * grid
Grid that is currently displayed by this view or NULL.
Definition: RGraphicsView.h:353
A mouse wheel event for a graphics scene.
Definition: RWheelEvent.h:41
Abstract base class for all action classes.
Definition: RAction.h:62
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RExplodable.h:30
int Id
Definition: RObject.h:66
virtual RVector mapToView(const RVector &v) const =0
Maps the given model coordinate to a view coordinate in pixels.
double getCurrentStepScaleFactor() const
Definition: RGraphicsView.h:285
bool autoScalePatterns
Definition: RGraphicsView.h:381
RVector lastKnownModelPosition
Definition: RGraphicsView.h:392
RVector lastKnownScreenPosition
Definition: RGraphicsView.h:393
RAction * navigationAction
The navigation action of this view or NULL if no navigation action has been set.
Definition: RGraphicsView.h:359
Extended painter path with a z-level and a pen.
Definition: RPainterPath.h:46
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
bool printPreview
Definition: RGraphicsView.h:338
virtual bool registerForFocus() const
Reimplementations may return true to register this view and allow it to be returned by RDocumentInter...
Definition: RGraphicsView.h:331
void autoZoom()
Auto zoom.
Definition: simple_view.js:7
Abstract base class for all graphics scenes.
Definition: RGraphicsScene.h:61
Text label.
Definition: RTextLabel.h:42
Abstract base class for grid implementations.
Definition: RGrid.h:39
virtual bool isShared() const
Reimplementations may return true to prevent this view from being deleted.
Definition: RGraphicsView.h:323
bool exporting
Definition: RGraphicsView.h:336
ColorMode
Definition: RGraphicsView.h:60
int gridVisible
Definition: RGraphicsView.h:409
QColor backgroundColor
Definition: RGraphicsView.h:383
int getTextHeightThresholdOverride() const
Definition: RGraphicsView.h:305
int getViewportNumber() const
Definition: RGraphicsView.h:71
virtual RVector mapFromView(const RVector &v, double z=0.0) const =0
Maps the given view coordinate in pixels to a model coordinate.
ColorMode colorMode
Definition: RGraphicsView.h:341
void setCurrentStepOffset(const RVector &s)
Definition: RGraphicsView.h:297
void setCurrentStepScaleFactor(double f)
Definition: RGraphicsView.h:289
Represents a box e.g.
Definition: RBox.h:43
RVector getCurrentStepOffset() const
Definition: RGraphicsView.h:293
bool hairlineMinimumMode
Definition: RGraphicsView.h:343
void setTextHeightThresholdOverride(int v)
Definition: RGraphicsView.h:301
virtual double mapDistanceToView(double d) const =0
Maps the given model distance to a screen distance in pixels.
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:85
#define QCADCORE_EXPORT
Definition: core_global.h:10
void setGrid(RGrid *g)
Sets the current grid.
Definition: RGraphicsView.h:228