Bug Summary

File:librecad/src/ui/dock_widgets/entity_info/lc_quickinfopointsdata.cpp
Warning:line 160, column 17
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name lc_quickinfopointsdata.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/runner/work/LibreCAD/LibreCAD/librecad/src -fcoverage-compilation-dir=/home/runner/work/LibreCAD/LibreCAD/librecad/src -resource-dir /usr/lib/llvm-18/lib/clang/18 -D _REENTRANT -D DWGSUPPORT -D MUPARSER_STATIC -D QC_APPDIR="librecad" -D LC_VERSION=2.2.2_alpha1-607-g330d41cec -D LC_PRERELEASE=true; -D QT_NO_DEBUG -D QT_SVG_LIB -D QT_PRINTSUPPORT_LIB -D QT_WIDGETS_LIB -D QT_GUI_LIB -D QT_NETWORK_LIB -D QT_CORE_LIB -I . -I /usr/include -I ../../libraries/lciconengine -I ../../libraries/libdxfrw/src -I ../../libraries/jwwlib/src -I ../../libraries/shapelib/src -I cmd -I lib/actions -I lib/actions/visual_snap -I lib/actions/options -I lib/creation -I lib/debug -I lib/engine -I lib/engine/document -I lib/engine/document/blocks -I lib/engine/document/container -I lib/engine/document/dimstyles -I lib/engine/document/entities -I lib/engine/document/entities/support -I lib/engine/document/fonts -I lib/engine/document/io -I lib/engine/document/layers -I lib/engine/document/patterns -I lib/engine/document/selection -I lib/engine/document/textstyles -I lib/engine/document/ucs -I lib/engine/document/variables -I lib/engine/document/views -I lib/engine/clipboard -I lib/engine/overlays -I lib/engine/overlays/angles_base -I lib/engine/overlays/highlight -I lib/engine/overlays/preview -I lib/engine/overlays/references -I lib/engine/overlays/crosshair -I lib/engine/overlays/info_cursor -I lib/engine/overlays/overlay_box -I lib/engine/overlays/ucs_mark -I lib/engine/undo -I lib/engine/utils -I lib/engine/settings -I lib/fileio -I lib/filters -I lib/generators -I lib/generators/makercamsvg -I lib/generators/layers -I lib/generators/image -I lib/gui -I lib/gui/grid -I lib/gui/render -I lib/gui/render/headless -I lib/gui/render/widget -I lib/information -I lib/math -I lib/modification -I lib/selection -I lib/selection/metaentity -I lib/selection/metaentity/entities -I lib/printing -I lib/properties -I actions -I actions/dock_widgets -I actions/dock_widgets/block -I actions/dock_widgets/entity_info -I actions/dock_widgets/layer -I actions/dock_widgets/library -I actions/dock_widgets/ucs_list -I actions/drawing -I actions/drawing/draw -I actions/drawing/draw/arc -I actions/drawing/draw/circle -I actions/drawing/draw/curve -I actions/drawing/draw/spline -I actions/drawing/draw/dimensions -I actions/drawing/draw/ellipse -I actions/drawing/draw/hatch -I actions/drawing/draw/image -I actions/drawing/draw/line -I actions/drawing/draw/point -I actions/drawing/draw/rect -I actions/drawing/draw/polygon -I actions/drawing/draw/misc -I actions/drawing/draw/line/shapes -I actions/drawing/draw/line/misc -I actions/drawing/draw/line/shapes/rect -I actions/drawing/draw/line/shapes/polygon -I actions/drawing/draw/polyline -I actions/drawing/draw/text -I actions/drawing/edit -I actions/drawing/info -I actions/drawing/pick -I actions/drawing/modify -I actions/drawing/pen -I actions/drawing/rel_zero -I actions/drawing/selection -I actions/drawing/snap -I actions/drawing/zoom -I actions/file -I actions/options -I actions/print_preview -I ui -I ui/action_options -I ui/action_options/circle -I ui/action_options/curve -I ui/action_options/spline -I ui/action_options/dimensions -I ui/action_options/edit -I ui/action_options/image -I ui/action_options/info -I ui/action_options/insert -I ui/action_options/line -I ui/action_options/rect -I ui/action_options/polygon -I ui/action_options/misc -I ui/action_options/modify -I ui/action_options/ellipse -I ui/action_options/other -I ui/action_options/polyline -I ui/action_options/point -I ui/action_options/print_preview -I ui/action_options/selection -I ui/action_options/snap -I ui/action_options/text -I ui/actions -I ui/components -I ui/components/relative_position_assistant -I ui/components/comboboxes -I ui/components/containers -I ui/components/creators -I ui/components/layouts -I ui/components/pen -I ui/components/status_bar -I ui/components/toolbars -I ui/components/utils -I ui/dialogs -I ui/dialogs/actions -I ui/dialogs/actions/modify -I ui/dialogs/actions/quick_selection -I ui/dialogs/modify -I ui/dialogs/entity -I ui/dialogs/creators -I ui/dialogs/file -I ui/dialogs/file/export -I ui/dialogs/file/export/layers -I ui/dialogs/file/export/image -I ui/dialogs/file/export/makercam -I ui/dialogs/main -I ui/dialogs/settings -I ui/dialogs/settings/dimstyles -I ui/dialogs/settings/dimstyles/dimstyle_manager -I ui/dialogs/settings/dimstyles/dimstyle_manager/support -I ui/dialogs/settings/options_device -I ui/dialogs/settings/options_drawing -I ui/dialogs/settings/options_general -I ui/dialogs/settings/options_widget -I ui/dialogs/settings/shortcuts -I ui/dock_widgets -I ui/dock_widgets/block_widget -I ui/dock_widgets/command_line -I ui/dock_widgets/entity_info -I ui/dock_widgets/layer_widget -I ui/dock_widgets/layers_tree -I ui/dock_widgets/library_widget -I ui/dock_widgets/pen_palette -I ui/dock_widgets/pen_wizard -I ui/dock_widgets/property_sheet -I ui/dock_widgets/property_sheet/lib -I ui/dock_widgets/property_sheet/lib/properties -I ui/dock_widgets/property_sheet/lib/view -I ui/dock_widgets/property_sheet/lib/view/edit -I ui/dock_widgets/property_sheet/lib/widgets -I ui/dock_widgets/property_sheet/lib/widgets/sheet -I ui/dock_widgets/property_sheet/metaentity -I ui/dock_widgets/property_sheet/metaentity/entities -I ui/dock_widgets/property_sheet/metaentity/entities/document -I ui/dock_widgets/property_sheet/properties -I ui/dock_widgets/property_sheet/properties/action -I ui/dock_widgets/property_sheet/properties/bool -I ui/dock_widgets/property_sheet/properties/color -I ui/dock_widgets/property_sheet/properties/double -I ui/dock_widgets/property_sheet/properties/enum -I ui/dock_widgets/property_sheet/properties/int -I ui/dock_widgets/property_sheet/properties/layer -I ui/dock_widgets/property_sheet/properties/linetype -I ui/dock_widgets/property_sheet/properties/linewidth -I ui/dock_widgets/property_sheet/properties/rect -I ui/dock_widgets/property_sheet/properties/rsvector -I ui/dock_widgets/property_sheet/properties/string -I ui/dock_widgets/views_list -I ui/dock_widgets/ucs_list -I ui/dock_widgets/workspaces -I ui/dock_widgets/cad -I ui/main -I ui/main/init -I ui/main/persistence -I ui/main/release_check -I ui/main/support -I ui/main/fontviewer -I ui/main/workspaces -I ui/view -I main -I main/console_dxf2pdf -I test -I plugins -I ../res -I ../res/arrows -I ../res/controls -I ../res/dxf -I ../res/gdt -I ../res/icons -I ../res/images -I ../../../Qt/6.9.0/gcc_64/include -I ../../../Qt/6.9.0/gcc_64/include/QtSvg -I ../../../Qt/6.9.0/gcc_64/include/QtPrintSupport -I ../../../Qt/6.9.0/gcc_64/include/QtWidgets -I ../../../Qt/6.9.0/gcc_64/include/QtGui -I ../../../Qt/6.9.0/gcc_64/include/QtNetwork -I ../../../Qt/6.9.0/gcc_64/include/QtCore -I ../../generated/librecad/moc -I ../../generated/librecad/ui -I ../../../Qt/6.9.0/gcc_64/mkspecs/linux-g++ -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -std=gnu++1z -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/runner/work/LibreCAD/LibreCAD/out/2026-08-04-154929-5069-1 -x c++ ui/dock_widgets/entity_info/lc_quickinfopointsdata.cpp
1/****************************************************************************
2 *
3* Class that holds the list of collected coordinates
4
5Copyright (C) 2024 LibreCAD.org
6Copyright (C) 2024 sand1024
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21**********************************************************************/
22
23#include "lc_quickinfopointsdata.h"
24
25#include "lc_graphicviewport.h"
26
27LC_QuickInfoPointsData::LC_QuickInfoPointsData() = default;
28
29LC_QuickInfoPointsData::~LC_QuickInfoPointsData(){
30 LC_QuickInfoPointsData::clear();
31}
32
33/**
34 * Check whether there are some coordinates
35 * @return
36 */
37bool LC_QuickInfoPointsData::hasData() const{
38 return !m_collectedPoints.isEmpty();
39}
40
41/**
42 * Removes coordinate with given index
43 * @param index
44 * @return
45 */
46bool LC_QuickInfoPointsData::removeCoordinate(const int index){
47 const int size = m_collectedPoints.size();
48 if (index >= 0 && index < size){
49 m_collectedPoints.remove(index);
50 doUpdatePointsAttributes();
51 return true;
52 }
53 return false;
54}
55
56/**
57 * Adds coordinate to the list, taking into consideration coordinates view mode
58 * @param wcsPoint
59 */
60void LC_QuickInfoPointsData::processCoordinate(const RS_Vector &wcsPoint){
61
62 const int pointsCount = m_collectedPoints.size();
63 PointInfo *pointInfo = nullptr;
1
'pointInfo' initialized to a null pointer value
64 const int index = pointsCount + 1;
65 QString idxValue;
66 idxValue.setNum(index);
67
68 const RS_Vector relZero = getRelativeZero();
69
70 switch (m_coordinatesMode){
2
Control jumps to the 'default' case at line 116
71 case COORD_ABSOLUTE:
72 // just use the vector itself
73 pointInfo = createPointInfo(wcsPoint, wcsPoint, idxValue, false);
74 break;
75 case COORD_RELATIVE:{
76 // check relative zero position
77 if (relZero.valid){
78 // calculate relative vector
79 const RS_Vector wcsRelative = wcsPoint - relZero;
80 pointInfo = createPointInfo(wcsPoint, wcsRelative, idxValue, true);
81 }
82 else{
83 pointInfo = createPointInfo(wcsPoint, wcsPoint, idxValue, false);
84 }
85 break;
86 }
87 case COORD_RELATIVE_TO_FIRST:{
88 if (pointsCount == 0){
89 // for first item, use zero at view
90 const RS_Vector dummyWCSZero = m_viewport->toWorld(RS_Vector(0, 0, 0));
91 pointInfo = createPointInfo(wcsPoint, dummyWCSZero, idxValue, false);
92 }
93 else{
94 // get first vector
95 const RS_Vector firstPoint = m_collectedPoints.at(0)->data;
96 // calculate relative vector from this vector to the first vector in the list
97 const RS_Vector wcsRelative = wcsPoint - firstPoint;
98 pointInfo = createPointInfo(wcsPoint, wcsRelative, idxValue, true);
99 }
100 break;
101 }
102 case COORD_RELATIVE_TO_PREVIOUS:{
103 if (pointsCount == 0){
104 const RS_Vector dummyWCSZero = m_viewport->toWorld(RS_Vector(0, 0, 0));
105 pointInfo = createPointInfo(wcsPoint, dummyWCSZero, idxValue, false);
106 }
107 else{
108 // get previous vector in the list
109 const RS_Vector prevPoint = m_collectedPoints.at(pointsCount - 1)->data;
110 // calculate relative vector
111 const RS_Vector wcsRelative = wcsPoint - prevPoint;
112 pointInfo = createPointInfo(wcsPoint, wcsRelative, idxValue, true);
113 }
114 break;
115 }
116 default:
117 Q_ASSERT(false)static_cast<void>(false && (false)); // should not be there, it means that an additional type of coordinates were added!
118 }
119
120 // check where we should add point
121 if (m_collectedPointsInsertionIndex < 0){
3
Assuming field 'm_collectedPointsInsertionIndex' is < 0
4
Taking true branch
122 // just add to the end of the list
123 m_collectedPoints << pointInfo;
124 }
125 else{
126 // insert into specified index
127 m_collectedPoints.insert(m_collectedPointsInsertionIndex, pointInfo);
128 m_collectedPointsInsertionIndex++;
129 }
130
131 // if insertion is not at the end of the list, it's necessary to update indexes for collected points.
132 // and also distance and angle if coordinates are relative to previous point.
133 // so doing cleanup pass
134 if (m_collectedPointsInsertionIndex >= 0){
5
Assuming field 'm_collectedPointsInsertionIndex' is >= 0
6
Taking true branch
135 const int size = m_collectedPoints.size();
136 for (int i = 0; i < size; i++) {
7
Assuming 'i' is < 'size'
8
Loop condition is true. Entering loop body
137 PointInfo *info = m_collectedPoints.at(i);
138 const int pointIndex = i + 1;
139 QString indexValue;
140 indexValue.setNum(pointIndex);
141 info->label = indexValue;
142 if (m_coordinatesMode == COORD_RELATIVE_TO_PREVIOUS){
9
Assuming field 'm_coordinatesMode' is equal to COORD_RELATIVE_TO_PREVIOUS
10
Taking true branch
143 QString angleValue;
144 QString lengthValue;
145 if (i
10.1
'i' is equal to 0
== 0){
11
Taking true branch
146 angleValue.clear();
147 lengthValue.clear();
148 }
149 else{
150 RS_Vector prevPoint = m_collectedPoints.at(i - 1)->data;
151 RS_Vector ucsViewCoordinate; // vector used for visual presentation of coordinate
152 ucsViewCoordinate = wcsPoint - prevPoint;
153 ucsViewCoordinate = m_viewport->toUCSDelta(ucsViewCoordinate);
154 const double ucsAngleToPrevious = ucsViewCoordinate.angle();
155 const double lenToPrevious = ucsViewCoordinate.magnitude();
156
157 angleValue = formatUCSAngle(ucsAngleToPrevious);
158 lengthValue = formatLinear(lenToPrevious);
159 }
160 pointInfo->angle = angleValue;
12
Called C++ object pointer is null
161 pointInfo->distance = lengthValue;
162 }
163 }
164 }
165}
166
167LC_QuickInfoPointsData::PointInfo* LC_QuickInfoPointsData::createPointInfo(const RS_Vector &point, const RS_Vector &viewCoordinate, const QString &idxValue, const bool relative) const {
168 QString value;
169 RS_Vector viewCoord;
170 QString angleVal;
171 if (relative){
172 viewCoord = m_viewport->toUCSDelta(viewCoordinate);
173 value = formatWCSDeltaVector(viewCoordinate);
174 const double ucsAngle = viewCoord.angle();
175 angleVal = formatUCSAngle(ucsAngle);
176 }
177 else{
178 viewCoord = viewCoordinate;
179 value = formatWCSVector(viewCoordinate);
180 const double angle = viewCoord.angle();
181 angleVal = formatWCSAngle(angle);
182 }
183
184 // hold information about vector
185 auto* pointInfo = new PointInfo(point, idxValue, value);
186
187 const double len = viewCoord.magnitude();
188
189 const QString lengthVal = formatLinear(len);
190
191 pointInfo->angle = angleVal;
192 pointInfo->distance = lengthVal;
193 return pointInfo;
194}
195
196/**
197 * Create HTML that contains information about collected coordinates.
198 * @param showDistanceAndAngle
199 * @param forceUpdate
200 * @return
201 */
202QString LC_QuickInfoPointsData::generateView(const bool showDistanceAndAngle, const bool forceUpdate){
203
204 const int pointsCount = m_collectedPoints.size();
205 QString data = "<body>";
206 if (pointsCount > 0){
207 if (forceUpdate){
208 doUpdatePointsAttributes();
209 }
210 // first, include information about point that is used as zero
211 const PointInfo *firstPoint = m_collectedPoints.at(0);
212 const auto zero = RS_Vector(0,0,0);
213 switch (m_coordinatesMode) {
214 case COORD_ABSOLUTE:{
215 data.append(tr("Zero")).append(": <b>").append(formatUCSVector(zero)).append("</b><hr>");
216 break;
217 }
218 case COORD_RELATIVE:{
219 const RS_Vector wcsRelZero = getRelativeZero();
220 QString vectorStr;
221 if (wcsRelZero.valid) {
222 vectorStr = formatWCSVector(wcsRelZero);
223 } else {
224 vectorStr = formatUCSVector(zero);
225 }
226 data.append(tr("Relative Zero")).append(": <b>").append(vectorStr).append("</b><hr>");
227 break;
228 }
229 case COORD_RELATIVE_TO_FIRST:
230 case COORD_RELATIVE_TO_PREVIOUS: {
231 const QString label = tr("First point").append(": ");
232 const QString value = formatWCSVector(firstPoint->data);
233 createLink(data, "zero", 0, tr("Set Relative Zero"), label);
234 data.append(" <b>");
235 createLink(data, "coord", 0, tr("To Cmd"), value);
236 data.append(" </b>");
237 data.append("<hr>");
238 break;
239 }
240 default:
241 break;
242 }
243 // total distance of points path
244 double totalDistance = 0.0;
245
246 // iterate over all collected coordinates
247 RS_Vector prevPoint = firstPoint->data;
248 for (int i = 0; i < pointsCount; i++){
249 const PointInfo* pointInfo = m_collectedPoints.at(i);
250 createLink(data, "zero", i, tr("Set Relative Zero"), pointInfo->label);
251 data.append(" | &nbsp;");
252 createLink(data, "coord", i, tr("To Cmd"), pointInfo->value);
253 if (showDistanceAndAngle){ // show them based on options
254 data.append(" | &nbsp;");
255 data.append(pointInfo->distance).append(", &lt; ").append(pointInfo->angle);
256 }
257
258 if (i < (pointsCount-1)){
259 data.append("<br>");
260 }
261 RS_Vector coord = pointInfo->data;
262 // update distance
263 const double distance = coord.distanceTo(prevPoint);
264 totalDistance += distance;
265
266 prevPoint = coord;
267
268 }
269 // Output total length for points path
270 data.append(" <hr>").append(tr("Points Path Distance:")).append(" <b>").append(formatLinear(totalDistance)).append("</b>");
271
272 }
273 else{
274 data = tr("No data - select coordinates first...");
275 }
276 data.append("</body>");
277 return data;
278}
279
280/**
281 * Update points for provided coordinates mode
282 * @param mode mode
283 * @return true if view should be updated
284 */
285bool LC_QuickInfoPointsData::updateForCoordinateViewMode(const int mode){
286 if (m_coordinatesMode != mode){
287 m_coordinatesMode = mode;
288 doUpdatePointsAttributes();
289 return true;
290 }
291 return false;
292}
293
294/**
295 * Recalculates points view labels
296 */
297void LC_QuickInfoPointsData::doUpdatePointsAttributes() const {
298 int pointsCount = m_collectedPoints.size();
299
300 RS_Vector relZero = getRelativeZero();
301
302 QString value;
303 QString angleVal;
304 QString lengthVal;
305
306 for (int i = 0; i < pointsCount; i++) {
307 PointInfo *pointInfo = m_collectedPoints.at(i);
308 RS_Vector &wcsPoint = pointInfo->data;
309 switch (m_coordinatesMode) {
310 case COORD_ABSOLUTE:{
311 value = formatWCSVector(wcsPoint);
312 angleVal = formatWCSAngle(wcsPoint.angle());
313 lengthVal = formatLinear(wcsPoint.magnitude());
314 break;
315 }
316 case COORD_RELATIVE: {
317 if (relZero.valid){
318 RS_Vector wcsRelative = wcsPoint - relZero;
319 RS_Vector viewCoord = m_viewport->toUCSDelta(wcsRelative);
320 value = formatWCSDeltaVector(viewCoord);
321 double ucsAngle = viewCoord.angle();
322 angleVal = formatUCSAngle(ucsAngle);
323 lengthVal = formatLinear(viewCoord.magnitude());
324 } else {
325 value = formatWCSVector(wcsPoint);
326 angleVal = formatWCSAngle(wcsPoint.angle());
327 lengthVal = formatLinear(wcsPoint.magnitude());
328 }
329 break;
330 }
331 case COORD_RELATIVE_TO_FIRST: {
332 if (pointsCount == 0){
333 value = formatUCSVector(RS_Vector(0, 0, 0));
334 angleVal.clear();
335 lengthVal.clear();
336 } else {
337 RS_Vector firstPoint = m_collectedPoints.at(0)->data;
338 RS_Vector wcsRelative = wcsPoint - firstPoint;
339 RS_Vector viewCoord = m_viewport->toUCSDelta(wcsRelative);
340 value = formatWCSDeltaVector(viewCoord);
341 double ucsAngle = viewCoord.angle();
342 angleVal = formatUCSAngle(ucsAngle);
343 lengthVal = formatLinear(viewCoord.magnitude());
344 }
345 break;
346 }
347 case COORD_RELATIVE_TO_PREVIOUS: {
348 if (i == 0){
349 value = formatUCSVector(RS_Vector(0, 0, 0));
350 angleVal.clear();
351 lengthVal.clear();
352 } else {
353 RS_Vector prevPoint = m_collectedPoints.at(i - 1)->data;
354 RS_Vector wcsRelative = wcsPoint - prevPoint;
355 RS_Vector viewCoord = m_viewport->toUCSDelta(wcsRelative);
356 value = formatWCSDeltaVector(viewCoord);
357 double ucsAngle = viewCoord.angle();
358 angleVal = formatUCSAngle(ucsAngle);
359 lengthVal = formatLinear(viewCoord.magnitude());
360 }
361 break;
362 }
363 default:
364 break;
365 }
366
367 pointInfo->value = value;
368 pointInfo->distance = lengthVal;
369 pointInfo->angle = angleVal;
370
371 QString index;
372 index.setNum(i+1);
373 pointInfo->label = index;
374 }
375}
376
377/**
378 * Return vector for given index
379 * @param index
380 * @return
381 */
382RS_Vector LC_QuickInfoPointsData::getVectorForIndex(const int index) const{
383 auto result = RS_Vector(false);
384 if (index < m_collectedPoints.size()){
385 result = m_collectedPoints.at(index)->data;
386 }
387 return result;
388}
389
390/**
391 * Cleanup
392 */
393void LC_QuickInfoPointsData::clear(){
394 qDeleteAll(m_collectedPoints.begin(), m_collectedPoints.end());
395 m_collectedPoints.clear();
396}