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

Method assignCurve

src/backend/worksheet/InfoElement.cpp:327–350  ·  view source on GitHub ↗

! * \brief assignCurve * Finds the curve with the path stored in the markerpoints and assigns the pointer to markerpoints * @param curves * \return true if all markerpoints are assigned with a curve, false if one or more markerpoints don't have a curve assigned */

Source from the content-addressed store, hash-verified

325 * \return true if all markerpoints are assigned with a curve, false if one or more markerpoints don't have a curve assigned
326 */
327bool InfoElement::assignCurve(const QVector<XYCurve*>& curves) {
328 bool success = true;
329 for (auto& mp : markerpoints) {
330 for (auto curve : curves) {
331 if (mp.curvePath == curve->path()) {
332 mp.curve = curve;
333 initCurveConnections(curve);
334 mp.customPoint->setCoordinateSystemIndex(curve->coordinateSystemIndex());
335 break;
336 }
337 }
338 }
339
340 // check if all markerpoints have a valid curve
341 // otherwise delete customPoint with no valid curve
342 for (int i = markerpoints.count() - 1; i >= 0; i--) {
343 if (markerpoints[i].curve == nullptr) {
344 removeChild(markerpoints[i].customPoint);
345 success = false;
346 }
347 }
348
349 return success;
350}
351
352void InfoElement::curveDeleted(const AbstractAspect* aspect) {
353 auto curve = dynamic_cast<const XYCurve*>(aspect);

Callers 1

restorePointersMethod · 0.80

Calls 4

coordinateSystemIndexMethod · 0.80
pathMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected