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

Method loadBackground

src/backend/datasources/projects/OriginProjectParser.cpp:2491–2565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2489}
2490
2491void OriginProjectParser::loadBackground(const Origin::GraphCurve& originCurve, Background* background) const {
2492 DEBUG(Q_FUNC_INFO << ", fill area? " << originCurve.fillArea)
2493 // fillArea option not used in histogram and bar/column plot
2494 auto type = originCurve.type;
2495 if (!originCurve.fillArea && type != Origin::GraphCurve::Histogram && type != Origin::GraphCurve::Bar && type != Origin::GraphCurve::Column
2496 && type != Origin::GraphCurve::BarStack && type != Origin::GraphCurve::ColumnStack) {
2497 background->setPosition(Background::Position::No);
2498 return;
2499 }
2500 // TODO: handle unsigned char fillAreaType;
2501 // with 'fillAreaType'=0x10 the area between the curve and the x-axis is filled
2502 // with 'fillAreaType'=0x14 the area included inside the curve is filled. First and last curve points are joined by a line to close the otherwise open
2503 // area. with 'fillAreaType'=0x12 the area excluded outside the curve is filled. The inverse of fillAreaType=0x14 is filled. At the moment we only
2504 // support the first type, so set it to XYCurve::FillingBelow
2505 background->setPosition(Background::Position::Below);
2506
2507 if (originCurve.fillAreaPattern == 0) {
2508 background->setType(Background::Type::Color);
2509 } else {
2510 background->setType(Background::Type::Pattern);
2511
2512 // map different patterns in originCurve.fillAreaPattern (has the values of Origin::FillPattern) to Qt::BrushStyle;
2513 switch (originCurve.fillAreaPattern) {
2514 case 0:
2515 background->setBrushStyle(Qt::NoBrush);
2516 break;
2517 case 1:
2518 case 2:
2519 case 3:
2520 background->setBrushStyle(Qt::BDiagPattern);
2521 break;
2522 case 4:
2523 case 5:
2524 case 6:
2525 background->setBrushStyle(Qt::FDiagPattern);
2526 break;
2527 case 7:
2528 case 8:
2529 case 9:
2530 background->setBrushStyle(Qt::DiagCrossPattern);
2531 break;
2532 case 10:
2533 case 11:
2534 case 12:
2535 background->setBrushStyle(Qt::HorPattern);
2536 break;
2537 case 13:
2538 case 14:
2539 case 15:
2540 background->setBrushStyle(Qt::VerPattern);
2541 break;
2542 case 16:
2543 case 17:
2544 case 18:
2545 background->setBrushStyle(Qt::CrossPattern);
2546 break;
2547 }
2548 }

Callers

nothing calls this directly

Calls 5

setBrushStyleMethod · 0.80
setFirstColorMethod · 0.80
setPositionMethod · 0.45
setTypeMethod · 0.45
setOpacityMethod · 0.45

Tested by

no test coverage detected