! remove unneeded lines belonging to segments that just finished in the previous column. */
| 137 | remove unneeded lines belonging to segments that just finished in the previous column. |
| 138 | */ |
| 139 | void Segments::removeUnneededLines(Segment** lastSegment, Segment** currSegment, int height) { |
| 140 | Segment* segLast = nullptr; |
| 141 | for (int yLast = 0; yLast < height; ++yLast) { |
| 142 | if (lastSegment[yLast] && (lastSegment[yLast] != segLast)) { |
| 143 | segLast = lastSegment[yLast]; |
| 144 | |
| 145 | bool found = false; |
| 146 | for (int yCur = 0; yCur < height; ++yCur) |
| 147 | if (segLast == currSegment[yCur]) { |
| 148 | found = true; |
| 149 | break; |
| 150 | } |
| 151 | |
| 152 | if (!found) { |
| 153 | if (segLast->length < m_image->minSegmentLength()) { |
| 154 | // remove whole segment since it is too short |
| 155 | m_image->scene()->removeItem(segLast->graphicsItem()); |
| 156 | segments.removeOne(segLast); |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /*! |
| 164 | initialize one column of segment pointers |
nothing calls this directly
no test coverage detected