MCPcopy Create free account
hub / github.com/KDE/labplot / removeUnneededLines

Method removeUnneededLines

src/backend/datapicker/Segments.cpp:139–161  ·  view source on GitHub ↗

! remove unneeded lines belonging to segments that just finished in the previous column. */

Source from the content-addressed store, hash-verified

137 remove unneeded lines belonging to segments that just finished in the previous column.
138*/
139void 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

Callers

nothing calls this directly

Calls 2

sceneMethod · 0.45
graphicsItemMethod · 0.45

Tested by

no test coverage detected