| 313 | } |
| 314 | |
| 315 | void PlotCanvas::paintGridLines_(QPainter& painter) |
| 316 | { |
| 317 | if (!show_grid_ || !spectrum_widget_) |
| 318 | { |
| 319 | return; |
| 320 | } |
| 321 | |
| 322 | QPen p1(QColor(130, 130, 130)); |
| 323 | p1.setStyle(Qt::DashLine); |
| 324 | QPen p2(QColor(170, 170, 170)); |
| 325 | p2.setStyle(Qt::DotLine); |
| 326 | |
| 327 | painter.save(); |
| 328 | |
| 329 | unsigned int xl, xh, yl, yh; // width/height of the diagram area, x, y coordinates of lo/hi x,y values |
| 330 | |
| 331 | xl = 0; |
| 332 | xh = width(); |
| 333 | |
| 334 | yl = height(); |
| 335 | yh = 0; |
| 336 | |
| 337 | // drawing of grid lines and associated text |
| 338 | for (Size j = 0; j != spectrum_widget_->xAxis()->gridLines().size(); j++) |
| 339 | { |
| 340 | // style definitions |
| 341 | switch (j) |
| 342 | { |
| 343 | case 0: // style settings for big intervals |
| 344 | painter.setPen(p1); |
| 345 | break; |
| 346 | |
| 347 | case 1: // style settings for small intervals |
| 348 | painter.setPen(p2); |
| 349 | break; |
| 350 | |
| 351 | default: |
| 352 | std::cout << "empty vertical grid line vector error!" << std::endl; |
| 353 | painter.setPen(QPen(QColor(0, 0, 0))); |
| 354 | break; |
| 355 | } |
| 356 | |
| 357 | for (std::vector<double>::const_iterator it = spectrum_widget_->xAxis()->gridLines()[j].begin(); it != spectrum_widget_->xAxis()->gridLines()[j].end(); ++it) |
| 358 | { |
| 359 | int x = static_cast<int>(Math::intervalTransformation(*it, spectrum_widget_->xAxis()->getAxisMinimum(), spectrum_widget_->xAxis()->getAxisMaximum(), xl, xh)); |
| 360 | painter.drawLine(x, yl, x, yh); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | for (Size j = 0; j != spectrum_widget_->yAxis()->gridLines().size(); j++) |
| 365 | { |
| 366 | // style definitions |
| 367 | switch (j) |
| 368 | { |
| 369 | case 0: // style settings for big intervals |
| 370 | painter.setPen(p1); |
| 371 | break; |
| 372 |
nothing calls this directly
no test coverage detected