| 118 | } |
| 119 | |
| 120 | double Plot2DCanvas::adaptPenScaling_(double ratio_data2pixel, double& pen_width) const |
| 121 | { |
| 122 | // is the coverage OK using current pen width? |
| 123 | bool has_low_pixel_coverage_withpen = ratio_data2pixel*pen_width < canvas_coverage_min_; |
| 124 | int merge_factor(1); |
| 125 | if (has_low_pixel_coverage_withpen) |
| 126 | { // scale up the sparse dimension until we reach the desired coverage (this will lead to overlap in the crowded dimension) |
| 127 | double scale_factor = canvas_coverage_min_ / ratio_data2pixel; |
| 128 | // however, within bounds (no need to check the pen_size_min_, because we can only exceed here, not underestimate) |
| 129 | scale_factor = std::min(pen_size_max_, scale_factor); |
| 130 | // The difference between the original pen_width vs. this scale |
| 131 | // gives the number of peaks to merge in the crowded dimension |
| 132 | merge_factor = scale_factor / pen_width; |
| 133 | // set pen width to the new scale |
| 134 | pen_width = scale_factor; |
| 135 | } |
| 136 | return merge_factor; |
| 137 | } |
| 138 | |
| 139 | |
| 140 | void Plot2DCanvas::intensityModeChange_() |