MCPcopy Create free account
hub / github.com/LibreCAD/LibreCAD / countMatchedOnTargetLayer

Function countMatchedOnTargetLayer

plugins/circletools/circletools.cpp:370–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370static int countMatchedOnTargetLayer(Document_Interface* doc,
371 const QSet<QString>& matchedGeomKeys,
372 const QString& targetLayer) {
373 if (!doc || matchedGeomKeys.isEmpty()) return 0;
374
375 QList<Plug_Entity*> all;
376 if (!doc->getAllEntities(&all, false)) return 0;
377
378 int count = 0;
379 const QString tgt = targetLayer.trimmed();
380
381 for (Plug_Entity* e : all) {
382 if (!e) continue;
383
384 QHash<int, QVariant> data;
385 e->getData(&data);
386
387 if (data.value(DPI::ETYPE).toInt() != static_cast<int>(DPI::CIRCLE)) continue;
388
389 // ignore invisible entities (undo/redo history)
390 const int vis = data.contains(DPI::VISIBLE) ? data.value(DPI::VISIBLE).toInt() : 1;
391 if (vis != 1) continue;
392
393 const QString gk = circleGeomKey(data);
394 if (!matchedGeomKeys.contains(gk)) continue;
395
396 const QString lay = data.value(DPI::LAYER).toString().trimmed();
397 if (lay == tgt) count++;
398 }
399
400 qDeleteAll(all);
401 return count;
402}
403
404
405static bool windowSelectCirclesBy2Points(Document_Interface* doc, QWidget* parent, QList<Plug_Entity*>& outSel) {

Callers 1

opFindMoveToLayerMethod · 0.85

Calls 7

circleGeomKeyFunction · 0.85
isEmptyMethod · 0.80
getAllEntitiesMethod · 0.80
toStringMethod · 0.80
getDataMethod · 0.45
toIntMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected