| 1255 | } |
| 1256 | |
| 1257 | void Plot1DCanvas::paintGridLines_(QPainter& painter) |
| 1258 | { |
| 1259 | if (!show_grid_ || !spectrum_widget_) |
| 1260 | { |
| 1261 | return; |
| 1262 | } |
| 1263 | QPen p1(QColor(130, 130, 130)); |
| 1264 | p1.setStyle(Qt::DashLine); |
| 1265 | QPen p2(QColor(170, 170, 170)); |
| 1266 | p2.setStyle(Qt::DotLine); |
| 1267 | |
| 1268 | painter.save(); |
| 1269 | |
| 1270 | unsigned int xl, xh, yl, yh; //width/height of the diagram area, x, y coordinates of lo/hi x,y values |
| 1271 | |
| 1272 | xl = 0; |
| 1273 | xh = width(); |
| 1274 | |
| 1275 | yl = height(); |
| 1276 | yh = 0; |
| 1277 | |
| 1278 | // drawing of grid lines and associated text |
| 1279 | for (Size j = 0; j != spectrum_widget_->xAxis()->gridLines().size(); j++) |
| 1280 | { |
| 1281 | // style definitions |
| 1282 | switch (j) |
| 1283 | { |
| 1284 | case 0: // style settings for big intervals |
| 1285 | painter.setPen(p1); |
| 1286 | break; |
| 1287 | |
| 1288 | case 1: // style settings for small intervals |
| 1289 | painter.setPen(p2); |
| 1290 | break; |
| 1291 | |
| 1292 | default: |
| 1293 | std::cout << "empty vertical grid line vector error!" << std::endl; |
| 1294 | painter.setPen(QPen(QColor(0, 0, 0))); |
| 1295 | break; |
| 1296 | } |
| 1297 | |
| 1298 | for (const auto& line : spectrum_widget_->xAxis()->gridLines()[j]) |
| 1299 | { |
| 1300 | int x = static_cast<int>(Math::intervalTransformation(line, spectrum_widget_->xAxis()->getAxisMinimum(), spectrum_widget_->xAxis()->getAxisMaximum(), xl, xh)); |
| 1301 | painter.drawLine(x, yl, x, yh); |
| 1302 | } |
| 1303 | } |
| 1304 | |
| 1305 | for (Size j = 0; j != spectrum_widget_->yAxis()->gridLines().size(); j++) |
| 1306 | { |
| 1307 | |
| 1308 | // style definitions |
| 1309 | switch (j) |
| 1310 | { |
| 1311 | case 0: // style settings for big intervals |
| 1312 | painter.setPen(p1); |
| 1313 | break; |
| 1314 |
nothing calls this directly
no test coverage detected