| 368 | } |
| 369 | |
| 370 | static 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 | |
| 405 | static bool windowSelectCirclesBy2Points(Document_Interface* doc, QWidget* parent, QList<Plug_Entity*>& outSel) { |
no test coverage detected