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 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); }
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); }
// Write AxisBlock keywords bool UChromaSession::writeAxisBlock(LineParser& parser, Axes& axes, int axis) { parser.writeLineF(" %s %i\n", UChromaSession::viewPaneKeyword(UChromaSession::AxisBlockKeyword), axis); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::AutoScaleKeyword), Axes::autoScaleMethod(axes.autoScale(axis))); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::AutoTicksKeyword), stringBool(axes.autoTicks(axis))); parser.writeLineF(" %s %f\n", UChromaSession::axisKeyword(UChromaSession::FirstTickKeyword), axes.tickFirst(axis)); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::FractionalPositioningKeyword), stringBool(axes.positionIsFractional(axis))); parser.writeLineF(" %s %s %s %s\n", UChromaSession::axisKeyword(UChromaSession::GridLinesKeyword), stringBool(axes.gridLinesMajor(axis)), stringBool(axes.gridLinesMinor(axis)), stringBool(axes.gridLinesFull(axis))); LineStyle style = axes.gridLineMajorStyle(axis); parser.writeLineF(" %s %f '%s' %f %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::GridLineMajorStyleKeyword), style.width(), LineStipple::stipple[style.stipple()].name, style.colour().redF(), style.colour().greenF(), style.colour().blueF(), style.colour().alphaF()); style = axes.gridLineMinorStyle(axis); parser.writeLineF(" %s %f '%s' %f %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::GridLineMinorStyleKeyword), style.width(), LineStipple::stipple[style.stipple()].name, style.colour().redF(), style.colour().greenF(), style.colour().blueF(), style.colour().alphaF()); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::InvertKeyword), stringBool(axes.inverted(axis))); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::LabelAnchorKeyword), TextPrimitive::textAnchor(axes.labelAnchor(axis))); parser.writeLineF(" %s %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::LabelOrientationKeyword), axes.labelOrientation(axis).x, axes.labelOrientation(axis).y, axes.labelOrientation(axis).z); parser.writeLineF(" %s %f %f\n", UChromaSession::axisKeyword(UChromaSession::LimitsKeyword), axes.min(axis), axes.max(axis)); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::LogarithmicKeyword), stringBool(axes.logarithmic(axis))); parser.writeLineF(" %s %i\n", UChromaSession::axisKeyword(UChromaSession::MinorTicksKeyword), axes.minorTicks(axis)); NumberFormat fmt = axes.numberFormat(axis); parser.writeLineF(" %s '%s' %i %s %s\n", UChromaSession::axisKeyword(UChromaSession::NumberFormatKeyword), NumberFormat::formatType(fmt.type()), fmt.nDecimals(), stringBool(fmt.useUpperCaseExponent()), stringBool(fmt.forcePrecedingPlus())); parser.writeLineF(" %s %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::PositionFractionalKeyword), axes.positionFractional(axis).x, axes.positionFractional(axis).y, axes.positionFractional(axis).z); parser.writeLineF(" %s %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::PositionRealKeyword), axes.positionReal(axis).x, axes.positionReal(axis).y, axes.positionReal(axis).z); parser.writeLineF(" %s %f\n", UChromaSession::axisKeyword(UChromaSession::StretchKeyword), axes.stretch(axis)); parser.writeLineF(" %s %f\n", UChromaSession::axisKeyword(UChromaSession::TickDeltaKeyword), axes.tickDelta(axis)); parser.writeLineF(" %s %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::TickDirectionKeyword), axes.tickDirection(axis).x, axes.tickDirection(axis).y, axes.tickDirection(axis).z); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::TitleAnchorKeyword), TextPrimitive::textAnchor(axes.titleAnchor(axis))); parser.writeLine(QString(" ")+UChromaSession::axisKeyword(UChromaSession::TitleKeyword)+" '"+axes.title(axis)+"'\n"); parser.writeLineF(" %s %f %f %f %f\n", UChromaSession::axisKeyword(UChromaSession::TitleOrientationKeyword), axes.titleOrientation(axis).x, axes.titleOrientation(axis).y, axes.titleOrientation(axis).z, axes.titleOrientation(axis).w); parser.writeLineF(" %s %s\n", UChromaSession::axisKeyword(UChromaSession::VisibleAxisKeyword), stringBool(axes.visible(axis))); parser.writeLineF(" %s\n", UChromaSession::axisKeyword(UChromaSession::EndAxisKeyword)); return true; }
LineStyle::LineStyle (const LineStyle &other) : m_width (other.width ()), m_paletteColor (other.paletteColor()), m_curveConnectAs (other.curveConnectAs()) { }