![]() |
Fréchet View
1.6.0
A Tool for Exploring Fréchet Distance Algorithms
|
base class for view widgets.
Each view widgets displays a QGraphicsScene (curves, or freespace diagram). It has controls for zooming, rotation, scrolling. Supports zooming with the mouse wheel and with gestures.
Definition at line 79 of file baseview.h.
#include <baseview.h>
Inherits QFrame.
Inherited by frechet::view::CurveView, and frechet::view::FreeSpaceView.
Public Slots | |
void | zoomIn (int level=-1) |
zoom in; connected to the zomm controls More... | |
void | zoomOut (int level=-1) |
connected to the zomm controls More... | |
virtual void | saveSettings (QSettings &settings, QString group) |
store view settings to application prefs More... | |
virtual void | restoreSettings (QSettings &settings, QString group) |
load view settings to application prefs More... | |
void | flipVertical (bool flip) |
flip graphics scene vertically More... | |
void | mouseMoveEvent (QMouseEvent *event) |
handles a mouse move event and detects mouse sensitve polygon segments More... | |
QPoint | mapSceneToGlobal (QPointF p) const |
map scene coordinates to window coordinate More... | |
Public Member Functions | |
BaseView (QWidget *parent=0, QString title="", bool showRotate=true) | |
constructore with parent and title More... | |
QGraphicsView * | view () const |
virtual void | segmentSelected (GraphicsHoverLineItem *item) |
called when the mouse hovers over a polygon segment; implemented by derived classes. More... | |
Protected Slots | |
void | resetView () |
reset zoom to default More... | |
void | setResetButtonEnabled () |
enabled reset button More... | |
void | setupMatrix () |
set up transformation matrix to account for zoom,rotate,scroll More... | |
void | print () |
print the contents of the graphics scene More... | |
void | saveAs () |
save the contents of the graphics scene to disk (as PDF, or SVG) More... | |
void | rotateLeft (double angle=10) |
rotate the scene to the left More... | |
void | rotateRight (double angle=10) |
rotate the scene to the right More... | |
int | rotation () const |
void | setRotation (double angle) |
update rotation angle More... | |
Protected Member Functions | |
void | resizeEvent (QResizeEvent *) override |
handles window resizes; adjusts controls to new window size More... | |
void | saveAsPdf (QString file) |
save content of scene to a PDF file More... | |
void | saveAsSvg (QString file) |
save content of scene to an SVG file More... | |
virtual void | dropUnusedItems () |
clean up graphics scene items after free-space is modified implemented by FreeSpaceView. More... | |
virtual void | render (QPainter *painter, QRectF target=QRectF()) |
render the scene into a QPainter used for printing and saving to disk More... | |
QMatrix | baseMatrix () |
Static Protected Member Functions | |
static void | setPenWidth (QGraphicsItem *item, double width) |
update the pen width of a graphics item More... | |
static void | addLine (QPainterPath &ppath, const QLineF &line) |
add a line segment to a QPainterPath More... | |
static void | addPolygon (QPainterPath &ppath, const QPolygonF &poly) |
add a polygon curve segment to a QPainterPath More... | |
static void | addPoint (QPainterPath &ppath, const QPointF &point, double diameter=1.0) |
add a dot to a QPainterPath More... | |
Protected Attributes | |
QGraphicsView * | graphicsView |
the embedded QGraphicsView More... | |
QGraphicsScene * | scene |
scene that is displayed by graphicsView More... | |
bool | isFlipped |
true if the scene should be flipped vertically More... | |
int | zoomStepMouse |
zoom step for mouse wheel More... | |
int | zoomStepDefault |
default zoom step More... | |
QToolButton * | resetButton |
the reset button More... | |
QSlider * | zoomSlider |
the slider control for zoom More... | |
QSlider * | rotateSlider |
the slider control for rotate More... | |
GraphicsHoverLineItem * | selected_item |
the currently selected mouse sensitve polyon segment (or nullptr) More... | |
Static Protected Attributes | |
static const QPen | PEN_SELECT |
pen for drawing selected polygon segment More... | |
static const int | ROTATE_DEFAULT_VALUE = 0 |
what this? More... | |
static const QStringList | OUTPUT_FILTERS |
file name filters for save dialog More... | |
Friends | |
class | GraphicsView |
BaseView::BaseView | ( | QWidget * | parent = 0 , |
QString | title = "" , |
||
bool | showRotate = true |
||
) |
constructore with parent and title
parent | parent widget (optional) |
title | window title (optional) |
showRotate | show rotation control ? |
Definition at line 170 of file baseview.cpp.
|
staticprotected |
add a line segment to a QPainterPath
ppath | painter path |
line | a line segment |
Definition at line 608 of file baseview.cpp.
|
staticprotected |
add a dot to a QPainterPath
ppath | painter path |
point | location |
diameter | diameter of dot |
Definition at line 638 of file baseview.cpp.
|
staticprotected |
add a polygon curve segment to a QPainterPath
ppath | painter path |
poly | a polygon curve |
Definition at line 622 of file baseview.cpp.
|
protected |
Definition at line 386 of file baseview.cpp.
|
inlineprotectedvirtual |
clean up graphics scene items after free-space is modified implemented by FreeSpaceView.
Reimplemented in frechet::view::FreeSpaceView.
Definition at line 203 of file baseview.h.
|
slot |
flip graphics scene vertically
flip | true, if scene should be flipped |
Definition at line 322 of file baseview.cpp.
|
slot |
map scene coordinates to window coordinate
p | a point in graphics scene coordinates |
Definition at line 360 of file baseview.cpp.
|
slot |
handles a mouse move event and detects mouse sensitve polygon segments
event | a mouse event |
Dispatch Mouse Hover Events
Note that QGraphicsScene can dispatch hover events, too. But it is quite unreliable with overlapping items, so we have to do it ourselves. Besides, we can influence the sensitivity.
Definition at line 334 of file baseview.cpp.
|
protectedslot |
print the contents of the graphics scene
Definition at line 400 of file baseview.cpp.
|
protectedvirtual |
render the scene into a QPainter used for printing and saving to disk
painter | a graphics environment that saves data to disk, or sends it to a printer |
target | target frame, should enclose the scene |
Definition at line 479 of file baseview.cpp.
|
protectedslot |
reset zoom to default
Definition at line 307 of file baseview.cpp.
|
overrideprotected |
handles window resizes; adjusts controls to new window size
Definition at line 368 of file baseview.cpp.
|
virtualslot |
load view settings to application prefs
settings | application preferences container |
group | section in preferences |
Reimplemented in frechet::view::CurveView.
Definition at line 533 of file baseview.cpp.
|
protectedslot |
rotate the scene to the left
angle | in degrees |
Definition at line 556 of file baseview.cpp.
|
protectedslot |
rotate the scene to the right
angle | in degrees |
Definition at line 561 of file baseview.cpp.
|
protectedslot |
Definition at line 566 of file baseview.cpp.
|
protectedslot |
save the contents of the graphics scene to disk (as PDF, or SVG)
Definition at line 413 of file baseview.cpp.
|
protected |
save content of scene to a PDF file
file | name of pdf file |
Definition at line 445 of file baseview.cpp.
|
protected |
save content of scene to an SVG file
file | name of svg file |
Note: sadly, clipping seems not to work with QSvgGenerator. Also, the scene size is not accurate.
Definition at line 461 of file baseview.cpp.
|
virtualslot |
store view settings to application prefs
settings | application preferences container |
group | section in preferences |
Reimplemented in frechet::view::CurveView.
Definition at line 512 of file baseview.cpp.
|
inlinevirtual |
called when the mouse hovers over a polygon segment; implemented by derived classes.
item | a mouse sensitive polygonal segement |
Reimplemented in frechet::view::FreeSpaceView, and frechet::view::CurveView.
Definition at line 97 of file baseview.h.
|
staticprotected |
update the pen width of a graphics item
item | a graphics item |
width | new pen width |
Definition at line 579 of file baseview.cpp.
|
protectedslot |
enabled reset button
Definition at line 317 of file baseview.cpp.
|
protectedslot |
|
protectedslot |
set up transformation matrix to account for zoom,rotate,scroll
Definition at line 374 of file baseview.cpp.
QGraphicsView * BaseView::view | ( | ) | const |
Definition at line 302 of file baseview.cpp.
|
slot |
zoom in; connected to the zomm controls
level | zoom step (-1==default) |
Definition at line 500 of file baseview.cpp.
|
slot |
connected to the zomm controls
level | zoom step (-1==default) |
Definition at line 506 of file baseview.cpp.
|
friend |
Definition at line 165 of file baseview.h.
|
protected |
the embedded QGraphicsView
Definition at line 172 of file baseview.h.
|
protected |
true if the scene should be flipped vertically
Definition at line 176 of file baseview.h.
|
staticprotected |
file name filters for save dialog
Graphics scene can be stored as:
Definition at line 170 of file baseview.h.
|
staticprotected |
pen for drawing selected polygon segment
Definition at line 163 of file baseview.h.
|
protected |
the reset button
Definition at line 183 of file baseview.h.
|
staticprotected |
what this?
Definition at line 168 of file baseview.h.
|
protected |
the slider control for rotate
Definition at line 187 of file baseview.h.
|
protected |
scene that is displayed by graphicsView
Definition at line 174 of file baseview.h.
|
protected |
the currently selected mouse sensitve polyon segment (or nullptr)
Definition at line 189 of file baseview.h.
|
protected |
the slider control for zoom
Definition at line 185 of file baseview.h.
|
protected |
default zoom step
Definition at line 180 of file baseview.h.
|
protected |
zoom step for mouse wheel
Definition at line 178 of file baseview.h.