SciDAVis
1.D4
|
Draw images on a QwtPlot. More...
#include <PlotEnrichement.h>
Public Member Functions | |
double | bottom () |
virtual QwtDoubleRect | boundingRect () const |
Return bounding rectangle in plot coordinates. | |
QPoint | origin () const |
Return position in paint coordinates. | |
PlotEnrichement () | |
virtual QRect | rect () const |
Return bounding rectangle in paint coordinates. | |
double | right () |
virtual void | setBoundingRect (double left, double top, double right, double bottom) |
Set position (xValue() and yValue()), right and bottom values giving everything in plot coordinates. | |
void | setOrigin (const QPoint &p) |
Set QwtPlotMarker::value() in paint coordinates. | |
virtual void | setRect (int x, int y, int w, int h) |
Set value (position) and d_size, giving everything in paint coordinates. | |
void | setSize (const QSize &size) |
Set d_size. | |
QSize | size () |
Return d_size. | |
virtual void | updateBoundingRect () |
Private Member Functions | |
QRect | calculatePaintingRect () |
Private Attributes | |
QPoint | d_pos |
The position in paint coordiantes. | |
QSize | d_size |
The size (in paint coordinates). | |
double | d_x_right |
The right side position in scale coordinates. | |
double | d_y_bottom |
The bottom side position in scale coordinates. |
Draw images on a QwtPlot.
PlotEnrichement draws #d_pic at the position specified by d_pos, scaled to d_size. #d_file_name isn't used internally, but only provided to help Graph manage save/restore.
Add a QwtPlotItem subclass (PlotEnrichment ?) and make PlotEnrichement, Legend and ArrowMarker subclasses of that. These (usually) don't really mark a specific point in a plot and they don't use the symbol/label functionality of QwtPlotMarker. Instead, it would make sense to provide a unified move/resize (or even general affine transformations via QMatrix) interface and support for positioning them either at fixed plot coordinates (like QwtPlotMarker) or at a fixed drawing position within a QwtPlot (like a QWidget child); leaving the choice of positioning policy to the user. If PlotEnrichment (ideas for a better name?) inherits from both QWidget and QwtPlotItem (which is luckily no QObject) and provides a unified drawing framework, its instances could be added directly to MultiLayer without the need for a dummy Graph in between. Could also help to avoid the hack in MultiLayer::updateMarkersBoundingRect().
Following the above thoughts, it might help clarify the purpose of PlotEnrichement, Legend and ArrowMarker if they are renamed according to the new superclasse's name (e.g. ImageEnrichment, TextEnrichment and LineEnrichment).
See the documentation of SelectionMoveResizer for other advantages of this approach.
PlotEnrichement::PlotEnrichement | ( | ) |
|
inline |
Reimplemented in ImageMarker.
References d_y_bottom.
Referenced by Legend::boundingRect(), and setBoundingRect().
|
virtual |
Return bounding rectangle in plot coordinates.
Reimplemented in ArrowMarker, ImageMarker, and Legend.
References d_x_right, and d_y_bottom.
|
private |
References d_x_right, and d_y_bottom.
Referenced by setBoundingRect(), and setOrigin().
|
inline |
|
inlinevirtual |
Return bounding rectangle in paint coordinates.
Reimplemented in ArrowMarker, ImageMarker, and Legend.
|
inline |
Reimplemented in ImageMarker.
References d_x_right.
Referenced by Legend::boundingRect(), and setBoundingRect().
|
virtual |
Set position (xValue() and yValue()), right and bottom values giving everything in plot coordinates.
Reimplemented in ArrowMarker, and ImageMarker.
References bottom(), calculatePaintingRect(), d_pos, d_size, d_x_right, d_y_bottom, and right().
void PlotEnrichement::setOrigin | ( | const QPoint & | p | ) |
Set QwtPlotMarker::value() in paint coordinates.
Reimplemented in ImageMarker, and Legend.
References calculatePaintingRect(), d_pos, d_size, and updateBoundingRect().
|
virtual |
Set value (position) and d_size, giving everything in paint coordinates.
Reimplemented in ImageMarker.
References d_pos, d_size, and updateBoundingRect().
void PlotEnrichement::setSize | ( | const QSize & | size | ) |
Set d_size.
Reimplemented in ImageMarker.
|
inline |
Return d_size.
Reimplemented in ImageMarker.
References d_size.
Referenced by Legend::drawLegends(), and Legend::itemsHeight().
|
virtual |
Reimplemented in ArrowMarker, and ImageMarker.
References d_pos, d_size, d_x_right, and d_y_bottom.
Referenced by setOrigin(), and setRect().
|
private |
The position in paint coordiantes.
Reimplemented in Legend, and ImageMarker.
Referenced by origin(), rect(), setBoundingRect(), setOrigin(), setRect(), and updateBoundingRect().
|
private |
The size (in paint coordinates).
Reimplemented in ImageMarker.
Referenced by rect(), setBoundingRect(), setOrigin(), setRect(), size(), and updateBoundingRect().
|
private |
The right side position in scale coordinates.
Reimplemented in ImageMarker.
Referenced by boundingRect(), calculatePaintingRect(), right(), setBoundingRect(), and updateBoundingRect().
|
private |
The bottom side position in scale coordinates.
Reimplemented in ImageMarker.
Referenced by bottom(), boundingRect(), calculatePaintingRect(), setBoundingRect(), and updateBoundingRect().