| 428 | } |
| 429 | |
| 430 | void Plot2DCanvas::paintEvent(QPaintEvent * e) |
| 431 | { |
| 432 | //Only fill background if no layer is present |
| 433 | if (getLayerCount() == 0) |
| 434 | { |
| 435 | QPainter painter; |
| 436 | painter.begin(this); |
| 437 | painter.fillRect(0, 0, this->width(), this->height(), QColor(String(param_.getValue("background_color").toString()).toQString())); |
| 438 | painter.end(); |
| 439 | e->accept(); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | #ifdef DEBUG_TOPPVIEW |
| 444 | cout << "BEGIN " << OPENMS_PRETTY_FUNCTION << endl; |
| 445 | cout << " Visible area -- m/z: " << visible_area_.minX() << " - " << visible_area_.maxX() << " rt: " << visible_area_.minY() << " - " << visible_area_.maxY() << endl; |
| 446 | cout << " Overall area -- m/z: " << overall_data_range_.minPosition()[0] << " - " << overall_data_range_.maxPosition()[0] << " rt: " << overall_data_range_.minPosition()[1] << " - " << overall_data_range_.maxPosition()[1] << endl; |
| 447 | #endif |
| 448 | |
| 449 | //timing |
| 450 | QElapsedTimer overall_timer; |
| 451 | if (show_timing_) |
| 452 | { |
| 453 | overall_timer.start(); |
| 454 | if (update_buffer_) |
| 455 | { |
| 456 | cout << "Updating buffer:" << endl; |
| 457 | } |
| 458 | else |
| 459 | { |
| 460 | cout << "Copying buffer:" << endl; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | QPainter painter; |
| 465 | if (update_buffer_) |
| 466 | { |
| 467 | update_buffer_ = false; |
| 468 | |
| 469 | // recalculate snap factor |
| 470 | recalculateSnapFactor_(); |
| 471 | |
| 472 | buffer_.fill(QColor(String(param_.getValue("background_color").toString()).toQString()).rgb()); |
| 473 | painter.begin(&buffer_); |
| 474 | QElapsedTimer layer_timer; |
| 475 | |
| 476 | for (Size i = 0; i < getLayerCount(); i++) |
| 477 | { |
| 478 | // timing |
| 479 | if (show_timing_) |
| 480 | { |
| 481 | layer_timer.start(); |
| 482 | } |
| 483 | if (getLayer(i).visible) |
| 484 | { |
| 485 | // update factors (snap and percentage) |
| 486 | percentage_factor_ = 1.0; |
| 487 | if (intensity_mode_ == IM_PERCENTAGE) |
nothing calls this directly
no test coverage detected