void Plot::drawItems (QPainter *painter, const QRect &rect, const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const { painter->save(); painter->setRenderHint(QPainter::Antialiasing); for (int i=0; i<QwtPlot::axisCnt; i++){ if (!axisEnabled(i)) continue; drawBreak(painter, rect, map[i], i); } painter->restore(); for (int i=0; i<QwtPlot::axisCnt; i++){ if (!axisEnabled(i)) continue; ScaleEngine *sc_engine = (ScaleEngine *)axisScaleEngine(i); if (!sc_engine->hasBreak()) continue; QwtScaleMap m = map[i]; int lb = m.transform(sc_engine->axisBreakLeft()); int rb = m.transform(sc_engine->axisBreakRight()); int start = lb, end = rb; if (sc_engine->testAttribute(QwtScaleEngine::Inverted)){ end = lb; start = rb; } QRegion cr(rect); if (i == QwtPlot::xBottom || i == QwtPlot::xTop) painter->setClipRegion(cr.subtracted(QRegion(start, rect.y(), abs(end - start), rect.height())), Qt::IntersectClip); else if (i == QwtPlot::yLeft || i == QwtPlot::yRight) painter->setClipRegion(cr.subtracted(QRegion(rect.x(), end, rect.width(), abs(end - start))), Qt::IntersectClip); } QwtPlot::drawItems(painter, rect, map, pfilter); for (int i=0; i<QwtPlot::axisCnt; i++){ if (!axisEnabled(i)) continue; ScaleDraw *sd = (ScaleDraw *) axisScaleDraw (i); int majorTicksType = sd->majorTicksStyle(); int minorTicksType = sd->minorTicksStyle(); bool min = (minorTicksType == ScaleDraw::In || minorTicksType == ScaleDraw::Both); bool maj = (majorTicksType == ScaleDraw::In || majorTicksType == ScaleDraw::Both); if (min || maj) drawInwardTicks(painter, rect, map[i], i, min, maj); } }
QValueList <int> Plot::getMinorTicksType() { QValueList <int> minorTicksType; for (int axis=0; axis<QwtPlot::axisCnt; axis++) { if (axisEnabled(axis)) { ScaleDraw *sd = (ScaleDraw *) axisScaleDraw (axis); minorTicksType << sd->minorTicksStyle(); } else minorTicksType << ScaleDraw::Out; } return minorTicksType; }
void Plot::drawItems (QPainter *painter, const QRect &rect, const QwtArray< QwtScaleMap > &map, const QwtPlotPrintFilter &pfilter) const { QwtPlot::drawItems(painter, rect, map, pfilter); for (int i=0; i<QwtPlot::axisCnt; i++) { if (!axisEnabled(i)) continue; ScaleDraw *sd = (ScaleDraw *) axisScaleDraw (i); int majorTicksType = sd->majorTicksStyle(); int minorTicksType = sd->minorTicksStyle(); bool min = (minorTicksType == ScaleDraw::In || minorTicksType == ScaleDraw::Both); bool maj = (majorTicksType == ScaleDraw::In || majorTicksType == ScaleDraw::Both); if (min || maj) drawInwardTicks(painter, rect, map[i], i, min, maj); } }