27 #ifndef QPLAYEREDCANVAS_QO_H_
28 #define QPLAYEREDCANVAS_QO_H_
56 virtual void clearImage()
const;
60 virtual void initializeImage(
const QSize&
size,
61 unsigned int fillValue = Qt::transparent)
const;
65 virtual bool hasItemsToDraw()
const;
69 virtual unsigned int itemDrawCount()
const;
73 virtual unsigned int itemDrawSegments(
unsigned int threshold =
74 QPDrawThread::DEFAULT_SEGMENT_THRESHOLD)
const;
79 virtual void drawItems(QPainter* painter,
const QRect& canvasRect,
80 const QwtScaleMap maps[QwtPlot::axisCnt],
82 unsigned int currentSegment = 0,
83 unsigned int totalSegments = 0,
84 unsigned int segmentThreshold =
85 QPDrawThread::DEFAULT_SEGMENT_THRESHOLD)
const;
90 virtual void cacheItems(
const QRect& canvasRect,
91 const QwtScaleMap maps[QwtPlot::axisCnt],
93 unsigned int currentSegment = 0,
94 unsigned int totalSegments = 0,
95 unsigned int segmentThreshold =
96 QPDrawThread::DEFAULT_SEGMENT_THRESHOLD)
const;
99 virtual void drawCache(QPainter* painter,
const QRect& rect)
const;
103 QPImageCache& cachedImage();
104 const QPImageCache& cachedImage()
const;
112 virtual QList<QPLayerItem*> items() = 0;
113 virtual QList<const QPLayerItem*> items()
const = 0;
118 QPImageCache m_cachedImage;
123 class QPCanvasLayer :
public QPLayer {
134 void addItem(QPPlotItem* item);
135 void removeItem(QPPlotItem* item);
139 bool containsItem(QPPlotItem* item);
143 QList<QPPlotItem*> canvasItems() {
return m_items; }
144 QList<const QPPlotItem*> canvasItems()
const;
150 QList<QPLayerItem*> items();
151 QList<const QPLayerItem*> items()
const;
156 QList<QPPlotItem*> m_items;
161 class QPBaseLayer :
public QPLayer {
172 void addItem(QPBaseItem* item);
173 void removeItem(QPBaseItem* item);
177 bool containsItem(QPBaseItem* item);
181 QList<QPBaseItem*> canvasItems() {
return m_items; }
182 QList<const QPBaseItem*> canvasItems()
const;
188 QList<QPLayerItem*> items();
189 QList<const QPLayerItem*> items()
const;
194 QList<QPBaseItem*> m_items;
201 class QPLayeredCanvas :
public QwtPlot {
204 friend class QPAxesCache;
205 friend class QPCanvas;
207 friend class QPPlotItem;
208 friend class QPBaseItem;
209 friend class QPLegendHolder;
217 QPLayeredCanvas(QPCanvas* parent, QWidget* parentWidget = NULL);
221 QPLayeredCanvas(
const QwtText& title, QPCanvas* parent,
222 QWidget* parentWidget = NULL);
229 using QwtPlot::replot;
235 QList<const QPPlotItem*> allAttachedItems()
const {
240 QList<const QPPlotItem*> allLayerItems(
int layersFlag)
const;
243 QRect canvasDrawRect()
const;
249 #if QWT_VERSION >= 0x060000
250 void print(QPainter* painter,
const QRect& rect);
251 void print(QPaintDevice& paintDev);
253 using QwtPlot::print;
254 void print(QPainter* painter,
const QRect& rect,
255 const QwtPlotPrintFilter&
filter = QwtPlotPrintFilter())
const;
259 virtual bool isDrawing();
265 bool eventFilter(QObject* watched, QEvent* event);
271 void attachLayeredItem(QPPlotItem* item);
274 void detachLayeredItem(QPPlotItem* item);
284 void drawItems(QPainter* painter,
const QRect& rect,
285 const QwtScaleMap maps[axisCnt]);
286 void printItems(QPainter* painter,
const QRect& rect,
287 const QwtScaleMap maps[axisCnt]);
289 #if QWT_VERSION < 0x060000
291 void drawItems(QPainter* painter,
const QRect& rect,
292 const QwtScaleMap maps[axisCnt],
293 const QwtPlotPrintFilter& );
297 void printItems(QPainter* painter,
const QRect& rect,
298 const QwtScaleMap maps[axisCnt],
299 const QwtPlotPrintFilter& ) {
300 printItems(painter, rect, maps);
313 bool drawingIsHeld()
const;
315 void releaseDrawing();
326 void setLayersChanged(
int layersFlag);
327 void setAllLayersChanged() {
335 bool anyChangedLayer()
const;
339 int changedLayersFlag()
const;
346 const QPGrid& grid()
const;
352 const QHash<PlotAxis, QPCartesianAxis*>& cartesianAxes()
const;
353 QHash<PlotAxis, QPCartesianAxis*>& cartesianAxes();
357 bool cartesianAxisShown(
PlotAxis axis)
const;
367 void installLegendFilter(QWidget* legendFrame);
375 QPBaseLayer m_layerBase;
378 QMap<PlotCanvasLayer, QPCanvasLayer*> m_layers;
381 QHash<PlotCanvasLayer, bool> m_changedLayers;
391 QList<QPainter*> m_printPainters;
394 mutable QPDrawThread* m_drawThread;
397 bool m_redrawWaiting;
404 QHash<PlotAxis, QPCartesianAxis*> m_cartAxes;
408 QWidget* m_legendFrame;
416 void itemDrawingFinished();
static int allLayersFlag()
Returns the or'ed value of all PlotCanvasLayer enum values.
void show(const variant &v)
PlotAxis
Enum for the four plot axes.
std::set< ScanKey > filter(const std::set< ScanKey > scans, const ArrayKey &arrayKey)
given a set of scan keys, return the subset that matches the given array key
casacore::CountedPtr< PlotOperation > PlotOperationPtr
String: the storage and methods of handling collections of characters.
PlotCanvasLayer
The canvas is composed of multiple layers, where changing/adding items from one layer will not affect...