20#ifndef RGRAPHICSVIEW_H
21#define RGRAPHICSVIEW_H
55#define RDEFAULT_MIN1 -1
79 void setViewportNumber(
int n);
81 return viewportNumber;
87 void setDisplayOnlyCurrentUcs(
bool on);
106 virtual RBox mapToView(
const RBox& box)
const;
120 virtual QList<RVector> mapCornersFromView()
const;
122 virtual RBox getBox()
const;
123 virtual RVector getMinimum()
const;
124 virtual RVector getMaximum()
const;
128 virtual void handleKeyPressEvent(QKeyEvent& event);
129 virtual void handleKeyReleaseEvent(QKeyEvent& event);
130 virtual void simulateMouseMoveEvent();
131 virtual void handleMouseMoveEvent(
RMouseEvent& event);
132 virtual void handleMousePressEvent(
RMouseEvent& event);
133 virtual void handleMouseReleaseEvent(
RMouseEvent& event);
134 virtual void handleMouseDoubleClickEvent(
RMouseEvent& event);
137 virtual void handleSwipeGestureEvent(QSwipeGesture& gesture);
138 virtual void handlePanGestureEvent(QPanGesture& gesture);
139 virtual void handlePinchGestureEvent(QPinchGesture& gesture);
147 virtual void viewportChangeEvent();
150 void restoreViewport();
153 void zoomIn(
const RVector& center,
double factor=1.2);
154 void zoomOut(
const RVector& center,
double factor=1.2);
155 virtual void zoom(
const RVector& center,
double factor);
156 virtual void zoomTo(
const RBox& window,
int margin = 0);
160 bool zoomToEntities(
const QSet<RObject::Id>& ids,
int margin =
RDEFAULT_MIN1);
162 virtual void centerToPoint(
const RVector& point);
163 virtual void centerToBox(
const RBox& box);
164 virtual void pan(
const RVector& delta,
bool regen=
true);
167 double getFactor(
bool includeStepFactor=
true)
const;
168 void setFactor(
double f,
bool regen=
true);
170 RVector getOffset(
bool includeStepOffset=
true)
const;
171 void setOffset(
const RVector& offset,
bool regen=
true);
182 virtual void regenerate(QSet<RObject::Id>& affectedEntities) {
183 Q_UNUSED(affectedEntities)
223 void setNavigationAction(
RAction* action);
232 void setGrid(
RGrid* g);
234 void setGridVisible(
bool on);
235 bool isGridVisible()
const;
237 virtual void paintGridPoints(
const QVector<double>& ucsPositionX,
const QVector<double>& ucsPositionY);
242 virtual QCursor
getCursor() {
return QCursor(Qt::ArrowCursor); }
246 RRefPoint getClosestReferencePoint(
const RVector& screenPosition,
int range);
248 RObject::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;
310 forceTextHeightThreshold = on;
314 return forceTextHeightThreshold;
317 void updateTextHeightThreshold();
321 void setAntialiasing(
bool val);
322 bool getAntialiasing()
const;
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RExplodable.h:30
Q_DECLARE_METATYPE(RMath *)
Abstract base class for all action classes.
Definition RAction.h:57
Represents a box e.g.
Definition RBox.h:46
Color.
Definition RColor.h:43
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
Abstract base class for all graphics scenes.
Definition RGraphicsScene.h:64
Graphics view.
Definition RGraphicsView.h:67
bool printing
Definition RGraphicsView.h:353
bool displayOnlyCurrentUcs
True to only display entities within the horizontal slice that is defined by the current UCS.
Definition RGraphicsView.h:395
RVector getCurrentStepOffset() const
Definition RGraphicsView.h:293
RGraphicsScene * scene
The scene this view is attached to.
Definition RGraphicsView.h:364
double getCurrentStepScaleFactor() const
Definition RGraphicsView.h:285
virtual double mapDistanceFromView(double d) const =0
Maps the given view distance in pixels to a model distance.
RVector lastKnownModelPosition
Definition RGraphicsView.h:408
void setCurrentStepScaleFactor(double f)
Definition RGraphicsView.h:289
virtual double getDevicePixelRatio() const
Definition RGraphicsView.h:324
ColorMode colorMode
Definition RGraphicsView.h:357
RGrid * grid
Grid that is currently displayed by this view or NULL.
Definition RGraphicsView.h:369
virtual int isActive() const
Definition RGraphicsView.h:211
virtual void setCursor(Qt::CursorShape)
Definition RGraphicsView.h:243
bool exporting
Definition RGraphicsView.h:352
int textHeightThresholdOverride
Definition RGraphicsView.h:417
bool hairlineMinimumMode
Definition RGraphicsView.h:359
QWidget * widget
Definition RGraphicsView.h:432
QList< RTextLabel > textLabels
Internal list of text labels that were added to this view.
Definition RGraphicsView.h:414
RVector offset
Offset of the zero point from the lower left corner of the view in model coordinates.
Definition RGraphicsView.h:381
virtual void paintCursorLine(const RLine &)
Definition RGraphicsView.h:240
virtual RVector mapToView(const RVector &v) const =0
Maps the given model coordinate to a view coordinate in pixels.
virtual bool isShared() const
Reimplementations may return true to prevent this view from being deleted.
Definition RGraphicsView.h:331
virtual void setSignalsBlocked(bool on)
Definition RGraphicsView.h:218
virtual bool hasFocus()=0
double factor
Scale factor from model coordinates to view coordinates.
Definition RGraphicsView.h:386
int textHeightThreshold
Definition RGraphicsView.h:418
QColor backgroundColor
Definition RGraphicsView.h:399
QWidget * getWidget() const
Definition RGraphicsView.h:347
RVector currentStepOffset
Definition RGraphicsView.h:407
void setTextHeightThresholdOverride(int v)
Definition RGraphicsView.h:301
bool getForceTextHeightThreshold() const
Definition RGraphicsView.h:313
virtual int getHeight() const =0
bool hairlineMode
Definition RGraphicsView.h:358
virtual void repaintView()=0
Repaints the view (widget, etc..).
virtual void removeFocus()=0
double currentStepScaleFactor
Current scale factor caused by a pinch gesture.
Definition RGraphicsView.h:405
RVector printPointSize
Definition RGraphicsView.h:355
int getTextHeightThresholdOverride() const
Definition RGraphicsView.h:305
bool forceTextHeightThreshold
Definition RGraphicsView.h:419
virtual void setCursor(const QCursor &)
Definition RGraphicsView.h:244
RAction * navigationAction
The navigation action of this view or NULL if no navigation action has been set.
Definition RGraphicsView.h:375
bool antialiasing
Definition RGraphicsView.h:423
void setForceTextHeightThreshold(bool on)
Definition RGraphicsView.h:309
void setWidget(QWidget *w)
Definition RGraphicsView.h:343
double previousFactor
Definition RGraphicsView.h:389
virtual double mapDistanceToView(double d) const =0
Maps the given model distance to a screen distance in pixels.
int gridVisible
Definition RGraphicsView.h:426
virtual int getWidth() const =0
virtual void paintGridPoint(const RVector &)
Definition RGraphicsView.h:238
RVector getLastKnownMousePosition() const
Definition RGraphicsView.h:281
RGrid * getGrid()
Definition RGraphicsView.h:228
virtual RVector mapFromView(const RVector &v, double z=0.0) const =0
Maps the given view coordinate in pixels to a model coordinate.
void setCurrentStepOffset(const RVector &s)
Definition RGraphicsView.h:297
virtual void regenerate(bool force=false)=0
Regenerates the view to show the visible parts of the underlying scene.
RVector previousOffset
Definition RGraphicsView.h:388
RVector lastKnownScreenPosition
Definition RGraphicsView.h:409
bool autoScalePatterns
Definition RGraphicsView.h:397
bool printPreview
Definition RGraphicsView.h:354
virtual QCursor getCursor()
Definition RGraphicsView.h:242
virtual bool getSignalsBlocked() const
Definition RGraphicsView.h:215
virtual bool registerForFocus() const
Reimplementations may return true to register this view and allow it to be returned by RDocumentInter...
Definition RGraphicsView.h:339
int getViewportNumber() const
Definition RGraphicsView.h:80
void clear()
Definition RGraphicsView.h:84
ColorMode
Definition RGraphicsView.h:69
@ GrayScale
Definition RGraphicsView.h:71
@ FullColor
Definition RGraphicsView.h:70
int margin
Definition RGraphicsView.h:400
virtual void regenerate(QSet< RObject::Id > &affectedEntities)
Definition RGraphicsView.h:182
int viewportNumber
Definition RGraphicsView.h:421
virtual void paintGridLine(const RLine &)
Definition RGraphicsView.h:239
virtual void giveFocus()=0
Abstract base class for grid implementations.
Definition RGrid.h:41
Low-level mathematical representation of a line.
Definition RLine.h:41
A mouse event for a graphics scene.
Definition RMouseEvent.h:42
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RNonCopyable.h:32
int Id
Definition RObject.h:69
Extended painter path with a z-level and a pen.
Definition RPainterPath.h:48
Represents a reference point of an entity.
Definition RRefPoint.h:18
Interface for geometrical shape classes.
Definition RShape.h:72
A tablet event for a graphics scene.
Definition RTabletEvent.h:43
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RTerminateEvent.h:34
Text label.
Definition RTextLabel.h:44
Represents a 3d vector (x/y/z).
Definition RVector.h:47
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 zoomTo(void p1, void p2, void p3, void p4, void p5)
Zooms to the given entity.
Definition simple_view.js:21
void autoZoom()
Auto zoom.
Definition simple_view.js:27
void getDocumentInterface()
Returns the current RDocumentInterface or undefined.
Definition simple.js:69
char s
Definition opennurbs_string.cpp:32
#define NULL
Definition opennurbs_system.h:256