ImageMarker Class Reference

#include <ImageMarker.h>

Inheritance diagram for ImageMarker:

PlotEnrichement

List of all members.


Detailed Description

Draw images on a QwtPlot.

ImageMarker 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.

Future Plans

Add a QwtPlotItem subclass (PlotEnrichment ?) and make ImageMarker, 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 ImageMarker, 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.

See also:
Legend, ArrowMarker

Public Member Functions

double bottom ()
virtual QwtDoubleRect boundingRect () const
 Return bounding rectangle in plot coordinates.
QString fileName ()
 Return d_file_name.
 ImageMarker (const QString &fn)
 Construct an image marker from a file name.
QPoint origin () const
 Return position in paint coordinates.
QPixmap pixmap () const
 Return the pixmap to be drawn, d_pic.
QRect rect () const
 Return bounding rectangle in paint coordinates.
double right ()
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 setFileName (const QString &fn)
 Set d_file_name.
void setOrigin (int x, int y)
 Set QwtPlotMarker::value() in paint coordinates. Convenience function.
void setOrigin (const QPoint &p)
 Set QwtPlotMarker::value() in paint coordinates.
void setRect (int x, int y, int w, int h)
 Set value (position) and d_size, giving everything in paint coordinates.
void setSize (int w, int h)
 Set d_size. Provided for convenience in scripts.
void setSize (const QSize &size)
 Set d_size.
QSize size ()
 Return d_size.
void updateBoundingRect ()

Private Member Functions

void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &r) const
 Does the actual drawing; see QwtPlotItem::draw.

Private Attributes

QString d_file_name
 The file from which the image was loaded.
QPixmap d_pic
 The pixmap to be drawn.
QPoint d_pos
 The position in paint coordiantes.
QSize d_size
 The size (in paint coordinates) to which d_pic will be scaled in draw().
double d_x_right
 The right side position in scale coordinates.
double d_y_bottom
 The bottom side position in scale coordinates.

Constructor & Destructor Documentation

ImageMarker::ImageMarker ( const QString &  fn  ) 

Construct an image marker from a file name.

References d_file_name, d_pic, and d_size.


Member Function Documentation

double ImageMarker::bottom (  )  [inline]

Reimplemented from PlotEnrichement.

References d_y_bottom.

Referenced by Graph::addImage(), and Graph::saveMarkers().

QwtDoubleRect ImageMarker::boundingRect (  )  const [virtual]

Return bounding rectangle in plot coordinates.

Reimplemented from PlotEnrichement.

References d_x_right, and d_y_bottom.

void ImageMarker::draw ( QPainter *  p,
const QwtScaleMap &  xMap,
const QwtScaleMap &  yMap,
const QRect &  r 
) const [private]

Does the actual drawing; see QwtPlotItem::draw.

References d_pic, d_x_right, and d_y_bottom.

QString ImageMarker::fileName (  )  [inline]

QPoint ImageMarker::origin (  )  const [inline]

Return position in paint coordinates.

Reimplemented from PlotEnrichement.

References rect().

Referenced by LineProfileTool::calculateLineProfile(), and ApplicationWindow::showImageDialog().

QPixmap ImageMarker::pixmap (  )  const [inline]

Return the pixmap to be drawn, d_pic.

References d_pic.

Referenced by Graph::addImage(), and LineProfileTool::calculateLineProfile().

QRect ImageMarker::rect (  )  const [virtual]

Return bounding rectangle in paint coordinates.

Reimplemented from PlotEnrichement.

References d_x_right, and d_y_bottom.

Referenced by LineProfileTool::calculateLineProfile(), SelectionMoveResizer::operateOnTargets(), origin(), CanvasPicker::selectMarker(), setBoundingRect(), and size().

double ImageMarker::right (  )  [inline]

Reimplemented from PlotEnrichement.

References d_x_right.

Referenced by Graph::addImage(), and Graph::saveMarkers().

void ImageMarker::setBoundingRect ( double  left,
double  top,
double  right,
double  bottom 
) [virtual]

Set position (xValue() and yValue()), right and bottom values giving everything in plot coordinates.

Reimplemented from PlotEnrichement.

References d_pos, d_size, d_x_right, d_y_bottom, and rect().

Referenced by Graph::addImage(), ImportOPJ::importGraphs(), and Graph::insertImageMarker().

void ImageMarker::setFileName ( const QString &  fn  )  [inline]

Set d_file_name.

References d_file_name.

void ImageMarker::setOrigin ( int  x,
int  y 
) [inline]

Set QwtPlotMarker::value() in paint coordinates. Convenience function.

References setOrigin().

void ImageMarker::setOrigin ( const QPoint &  p  ) 

Set QwtPlotMarker::value() in paint coordinates.

Reimplemented from PlotEnrichement.

References d_pos, d_size, size(), and updateBoundingRect().

Referenced by Graph::insertImageMarker(), SelectionMoveResizer::operateOnTargets(), and setOrigin().

void ImageMarker::setRect ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Set value (position) and d_size, giving everything in paint coordinates.

Reimplemented from PlotEnrichement.

References d_pos, d_size, and updateBoundingRect().

Referenced by ApplicationWindow::pasteSelection().

void ImageMarker::setSize ( int  w,
int  h 
) [inline]

Set d_size. Provided for convenience in scripts.

References setSize().

void ImageMarker::setSize ( const QSize &  size  ) 

QSize ImageMarker::size (  )  [inline]

void ImageMarker::updateBoundingRect (  )  [virtual]

Reimplemented from PlotEnrichement.

References d_pos, d_size, d_x_right, and d_y_bottom.

Referenced by setOrigin(), setRect(), and setSize().


Member Data Documentation

QString ImageMarker::d_file_name [private]

The file from which the image was loaded.

Referenced by fileName(), ImageMarker(), and setFileName().

QPixmap ImageMarker::d_pic [private]

The pixmap to be drawn.

Referenced by draw(), ImageMarker(), and pixmap().

QPoint ImageMarker::d_pos [private]

The position in paint coordiantes.

Reimplemented from PlotEnrichement.

Referenced by setBoundingRect(), setOrigin(), setRect(), and updateBoundingRect().

QSize ImageMarker::d_size [private]

The size (in paint coordinates) to which d_pic will be scaled in draw().

Reimplemented from PlotEnrichement.

Referenced by ImageMarker(), setBoundingRect(), setOrigin(), setRect(), setSize(), and updateBoundingRect().

double ImageMarker::d_x_right [private]

The right side position in scale coordinates.

Reimplemented from PlotEnrichement.

Referenced by boundingRect(), draw(), rect(), right(), setBoundingRect(), and updateBoundingRect().

double ImageMarker::d_y_bottom [private]

The bottom side position in scale coordinates.

Reimplemented from PlotEnrichement.

Referenced by bottom(), boundingRect(), draw(), rect(), setBoundingRect(), and updateBoundingRect().


The documentation for this class was generated from the following files:

Generated on Tue Jun 17 08:36:16 2008 for QtiPlot by  doxygen 1.5.5