MCPcopy Create free account
hub / github.com/KDE/labplot / updateDropLines

Method updateDropLines

src/backend/worksheet/plots/cartesian/XYCurve.cpp:1676–1751  ·  view source on GitHub ↗

! recalculates the painter path for the drop lines. Called each time when the type of the drop lines is changed. */

Source from the content-addressed store, hash-verified

1674 Called each time when the type of the drop lines is changed.
1675*/
1676void XYCurvePrivate::updateDropLines() {
1677 dropLinePath = QPainterPath();
1678 if (dropLine->dropLineType() == XYCurve::DropLineType::NoDropLine) {
1679 recalcShapeAndBoundingRect();
1680 return;
1681 }
1682
1683 // calculate the scene points to get the values for m_pointsVisible
1684 calculateScenePoints();
1685
1686 // calculate drop lines
1687 QVector<QLineF> dlines;
1688 auto cs = plot()->coordinateSystem(q->coordinateSystemIndex());
1689 const double xMin = plot()->range(Dimension::X, cs->index(Dimension::X)).start();
1690 const double yMin = plot()->range(Dimension::Y, cs->index(Dimension::Y)).start();
1691
1692 int i = 0;
1693 switch (dropLine->dropLineType()) {
1694 case XYCurve::DropLineType::NoDropLine:
1695 break;
1696 case XYCurve::DropLineType::X:
1697 for (const auto& point : std::as_const(m_logicalPoints)) {
1698 if (!m_pointVisible.at(i++))
1699 continue;
1700 dlines.append(QLineF(point, QPointF(point.x(), yMin)));
1701 }
1702 break;
1703 case XYCurve::DropLineType::Y:
1704 for (const auto& point : std::as_const(m_logicalPoints)) {
1705 if (!m_pointVisible.at(i++))
1706 continue;
1707 dlines.append(QLineF(point, QPointF(xMin, point.y())));
1708 }
1709 break;
1710 case XYCurve::DropLineType::XY:
1711 for (const auto& point : std::as_const(m_logicalPoints)) {
1712 if (!m_pointVisible.at(i++))
1713 continue;
1714 dlines.append(QLineF(point, QPointF(point.x(), yMin)));
1715 dlines.append(QLineF(point, QPointF(xMin, point.y())));
1716 }
1717 break;
1718 case XYCurve::DropLineType::XZeroBaseline:
1719 for (const auto& point : std::as_const(m_logicalPoints)) {
1720 if (!m_pointVisible.at(i++))
1721 continue;
1722 dlines.append(QLineF(point, QPointF(point.x(), 0)));
1723 }
1724 break;
1725 case XYCurve::DropLineType::XMinBaseline:
1726 for (const auto& point : std::as_const(m_logicalPoints)) {
1727 if (!m_pointVisible.at(i++))
1728 continue;
1729 dlines.append(QLineF(point, QPointF(point.x(), yColumn->minimum())));
1730 }
1731 break;
1732 case XYCurve::DropLineType::XMaxBaseline:
1733 for (const auto& point : std::as_const(m_logicalPoints)) {

Callers 1

initMethod · 0.80

Calls 12

coordinateSystemIndexMethod · 0.80
rangeMethod · 0.80
appendMethod · 0.80
xMethod · 0.80
mapLogicalToSceneMethod · 0.80
QPointFClass · 0.70
coordinateSystemMethod · 0.45
startMethod · 0.45
indexMethod · 0.45
yMethod · 0.45
minimumMethod · 0.45
maximumMethod · 0.45

Tested by

no test coverage detected