void GraphicsLinesForCurve::updateFinish (const LineStyle &lineStyle) { LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurve::updateFinish"; // Apply line style QPen pen = QPen (QBrush (ColorPaletteToQColor (lineStyle.paletteColor())), lineStyle.width()); setPen (pen); updateGraphicsLinesToMatchGraphicsPoints (lineStyle); }
void GraphicsLinesForCurve::lineMembershipPurge (const LineStyle &lineStyle) { LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurve::lineMembershipPurge" << " curve=" << m_curveName.toLatin1().data(); OrdinalToGraphicsPoint::iterator itr, itrNext; for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr = itrNext) { itrNext = itr; ++itrNext; GraphicsPoint *point = *itr; if (!point->wanted ()) { double ordinal = itr.key (); delete point; m_graphicsPoints.remove (ordinal); } } // Apply line style QPen pen; if (lineStyle.paletteColor() == COLOR_PALETTE_TRANSPARENT) { pen = QPen (Qt::NoPen); } else { pen = QPen (QBrush (ColorPaletteToQColor (lineStyle.paletteColor())), lineStyle.width()); } setPen (pen); updateGraphicsLinesToMatchGraphicsPoints (lineStyle); }
void DlgSettingsCurveProperties::drawLine (bool isRelation, const LineStyle &lineStyle) { const double Z_LINE = -1.0; // Looks nicer if line goes under the points, so points are unobscured // Line between points. Start with function connection QPainterPath path; QPointF p0 (POS_LEFT), p1 (POS_CENTER), p2 (POS_RIGHT); if (isRelation) { // Relation connection p1 = POS_RIGHT; p2 = POS_CENTER; } // Draw straight or smooth if (lineStyle.curveConnectAs() == CONNECT_AS_FUNCTION_SMOOTH || lineStyle.curveConnectAs() == CONNECT_AS_RELATION_SMOOTH) { vector<double> t; vector<SplinePair> xy; t.push_back(0); t.push_back(1); t.push_back(2); xy.push_back (SplinePair (p0.x(), p0.y())); xy.push_back (SplinePair (p1.x(), p1.y())); xy.push_back (SplinePair (p2.x(), p2.y())); Spline spline (t, xy); path.moveTo (p0); path.cubicTo (QPointF (spline.p1(0).x(), spline.p1(0).y()), QPointF (spline.p2(0).x(), spline.p2(0).y()), p1); path.cubicTo (QPointF (spline.p1(1).x(), spline.p1(1).y()), QPointF (spline.p2(1).x(), spline.p2(1).y()), p2); } else { path.moveTo (p0); path.lineTo (p1); path.lineTo (p2); } QGraphicsPathItem *line = new QGraphicsPathItem (path); line->setPen (QPen (QBrush (ColorPaletteToQColor (lineStyle.paletteColor())), lineStyle.width())); line->setZValue (Z_LINE); m_scenePreview->addItem (line); }
LineStyle::LineStyle (const LineStyle &other) : m_width (other.width ()), m_paletteColor (other.paletteColor()), m_curveConnectAs (other.curveConnectAs()) { }