! * \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 */
| 325 | * \return true if all markerpoints are assigned with a curve, false if one or more markerpoints don't have a curve assigned |
| 326 | */ |
| 327 | bool 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 | |
| 352 | void InfoElement::curveDeleted(const AbstractAspect* aspect) { |
| 353 | auto curve = dynamic_cast<const XYCurve*>(aspect); |
no test coverage detected