52 class QPLayerItem :
public QwtPlotItem {
53 friend class QPCanvas;
54 friend class QPLayeredCanvas;
55 friend class QPDrawThread;
62 virtual ~QPLayerItem();
66 #if QWT_VERSION >= 0x060000
67 virtual void draw(QPainter* p,
const QwtScaleMap& xMap,
68 const QwtScaleMap& yMap,
const QRectF& canvasRect)
const;
70 virtual void draw(QPainter* p,
const QwtScaleMap& xMap,
71 const QwtScaleMap& yMap,
const QRect& canvasRect)
const;
75 virtual unsigned int itemDrawSegments(
unsigned int segmentThreshold)
const;
82 virtual void itemChanged() = 0;
87 virtual bool shouldDraw()
const = 0;
90 virtual unsigned int itemDrawCount()
const = 0;
100 #if QWT_VERSION >= 0x060000
101 virtual void draw_(QPainter* p,
const QwtScaleMap& xMap,
102 const QwtScaleMap& yMap,
const QRectF& drawRect,
103 unsigned int drawIndex,
unsigned int drawCount)
const = 0;
105 virtual void draw_(QPainter* p,
const QwtScaleMap& xMap,
106 const QwtScaleMap& yMap,
const QRect& drawRect,
107 unsigned int drawIndex,
unsigned int drawCount)
const = 0;
114 class QPPlotItem :
public virtual PlotItem,
public QPLayerItem {
115 friend class QPCanvas;
116 friend class QPDrawThread;
124 using QPLayerItem::draw;
133 static QPPlotItem* cloneItem(
const PlotItemPtr item,
bool* wasCloned=NULL);
137 static bool sameType(QPPlotItem* item1, QPPlotItem* item2);
141 static bool isPlot(QPPlotItem* item);
150 virtual ~QPPlotItem();
156 PlotCanvas* canvas()
const;
165 virtual bool isQWidget()
const {
return false; }
184 virtual void itemChanged();
187 virtual bool shouldDraw()
const {
return isValid(); }
190 unsigned int itemDrawCount()
const{
return shouldDraw()? drawCount() : 0; }
203 const QwtText& qwtTitle()
const {
return QwtPlotItem::title(); }
204 void setQwtTitle(
const QwtText& text) { QwtPlotItem::setTitle(text); }
205 QwtPlot::Axis qwtXAxis()
const{
return QwtPlot::Axis(QwtPlotItem::xAxis());}
206 QwtPlot::Axis qwtYAxis()
const{
return QwtPlot::Axis(QwtPlotItem::yAxis());}
215 virtual QwtDoubleRect boundingRect()
const = 0;
217 #if QWT_VERSION < 0x060000
220 virtual QWidget* legendItem()
const = 0;
229 bool m_loggedCreation;
246 void logDestruction();
268 class QPDrawThread :
public QThread {
278 static const unsigned int DEFAULT_SEGMENT_THRESHOLD;
282 static bool itemSortByZ(
const QPLayerItem* item1,
const QPLayerItem* item2);
289 static void drawItem(
const QPLayerItem* item, QPainter* painter,
290 const QRect& rect,
const QwtScaleMap maps[QwtPlot::axisCnt]);
291 static void drawItem(
const QPLayerItem* item, QPainter* painter,
292 const QRect& rect,
const QwtScaleMap maps[QwtPlot::axisCnt],
293 unsigned int drawIndex,
unsigned int drawCount);
294 static void drawItems(
const QList<const QPLayerItem*>& items,
295 QPainter* painter,
const QRect& rect,
296 const QwtScaleMap maps[QwtPlot::axisCnt],
298 unsigned int currentSegment = 0,
unsigned int totalSegments = 0,
299 unsigned int segmentThreshold =
300 QPDrawThread::DEFAULT_SEGMENT_THRESHOLD);
301 static void drawItems(
const QList<const QPPlotItem*>& items,
302 QPainter* painter,
const QRect& rect,
303 const QwtScaleMap maps[QwtPlot::axisCnt],
305 unsigned int currentSegment = 0,
unsigned int totalSegments = 0,
306 unsigned int segmentThreshold =
307 QPDrawThread::DEFAULT_SEGMENT_THRESHOLD);
316 QPDrawThread(
const QList<const QPPlotItem*>& items,
317 const QwtScaleMap maps[QwtPlot::axisCnt], QSize imageSize,
318 unsigned int segmentTreshold = DEFAULT_SEGMENT_THRESHOLD);
325 unsigned int totalSegments()
const;
335 QPImageCache drawResult(
PlotCanvasLayer layer,
bool clearResult =
true);
351 QList<const QPPlotItem*> m_items;
354 QwtScaleMap m_axesMaps[QwtPlot::axisCnt];
357 QHash<PlotCanvasLayer, QPImageCache*> m_images;
360 unsigned int m_segmentThreshold;
virtual void attach(PlotCanvas *canvas)
Overrides PlotTool::attach().
PlotAxis
Enum for the four plot axes.
casacore::CountedPtr< PlotLogger > PlotLoggerPtr
casacore::CountedPtr< PlotItem > PlotItemPtr
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...
virtual void detach()
Overrides PlotTool::detach().