From e6fa072bee10c5714df34cf6bf56204f66c9ed8f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 18 Jul 2025 23:00:23 +0200 Subject: [PATCH] Fixing 'tap' feature After introducing the "do not select shapes or instances if they overlap the viewport entirely" feature, 'tap' was not finding shapes which extended beyond the view's borders. This got fixed and for 'tap', such shapes are considered again. --- src/edt/edt/edtMainService.cc | 2 +- src/laybasic/laybasic/layFinder.cc | 11 ++++++----- src/laybasic/laybasic/layFinder.h | 12 +++++++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/edt/edt/edtMainService.cc b/src/edt/edt/edtMainService.cc index 0ed378fcd..d582e9af0 100644 --- a/src/edt/edt/edtMainService.cc +++ b/src/edt/edt/edtMainService.cc @@ -2364,7 +2364,7 @@ MainService::cm_tap () return; } - lay::ShapeFinder finder (true /*point mode*/, false /*all hierarchy levels*/, db::ShapeIterator::All, 0); + lay::ShapeFinder finder (true /*point mode*/, false /*all hierarchy levels*/, db::ShapeIterator::All, 0, true /*capture all shapes*/); // capture all objects in point mode (default: capture one only) finder.set_catch_all (true); diff --git a/src/laybasic/laybasic/layFinder.cc b/src/laybasic/laybasic/layFinder.cc index dbbbe6143..6564e5f7e 100644 --- a/src/laybasic/laybasic/layFinder.cc +++ b/src/laybasic/laybasic/layFinder.cc @@ -256,12 +256,13 @@ Finder::do_find (const db::Cell &cell, int level, const db::DCplxTrans &vp, cons // ------------------------------------------------------------- // ShapeFinder implementation -ShapeFinder::ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator::flags_type flags, const std::set *excludes) +ShapeFinder::ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator::flags_type flags, const std::set *excludes, bool capture_all_shapes) : Finder (point_mode, top_level_sel), mp_excludes ((excludes && !excludes->empty ()) ? excludes : 0), m_flags (flags), m_cv_index (0), m_topcell (0), mp_text_info (0), - mp_prop_sel (0), m_inv_prop_sel (false), mp_progress (0) + mp_prop_sel (0), m_inv_prop_sel (false), mp_progress (0), + m_capture_all_shapes (capture_all_shapes) { m_tries = point_sel_tests; } @@ -579,7 +580,7 @@ ShapeFinder::visit_cell (const db::Cell &cell, const db::Box &hit_box, const db: // in point mode, test the edges and use a "closest" criterion if (shape->is_polygon ()) { - bool any_valid_edge = false; + bool any_valid_edge = m_capture_all_shapes; for (db::Shape::polygon_edge_iterator e = shape->begin_edge (); ! e.at_end (); ++e) { if ((*e).clipped (viewport_box).first) { any_valid_edge = true; @@ -595,7 +596,7 @@ ShapeFinder::visit_cell (const db::Cell &cell, const db::Box &hit_box, const db: } else if (shape->is_path ()) { - bool any_valid_edge = false; + bool any_valid_edge = m_capture_all_shapes; // test the "spine" db::Shape::point_iterator pt = shape->begin_point (); @@ -644,7 +645,7 @@ ShapeFinder::visit_cell (const db::Cell &cell, const db::Box &hit_box, const db: match = true; } else { - bool any_valid_edge = false; + bool any_valid_edge = m_capture_all_shapes; // convert to polygon and test those edges db::Polygon poly (box); diff --git a/src/laybasic/laybasic/layFinder.h b/src/laybasic/laybasic/layFinder.h index 6fcb2dc65..d02aaa09a 100644 --- a/src/laybasic/laybasic/layFinder.h +++ b/src/laybasic/laybasic/layFinder.h @@ -236,7 +236,16 @@ public: typedef std::vector founds_vector_type; typedef founds_vector_type::const_iterator iterator; - ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator::flags_type flags, const std::set *excludes = 0); + /** + * @brief Creates a shape finder object + * + * @param point_mode If true, selects "point mode", where shapes are found relative to the (point-like) bounding box + * @param top_level_sel If true, selects only top level objects + * @param flags The shape types to look for + * @param excludes Objects (by instance path) to exclude + * @param capture_all_shapes Only valid in point mode. If true, all shapes are found. Otherwise only those which are not overlapping the view port entirely. + */ + ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator::flags_type flags, const std::set *excludes = 0, bool capture_all_shapes = false); bool find (LayoutViewBase *view, const lay::LayerProperties &lprops, const db::DBox ®ion_mu); bool find (LayoutViewBase *view, const db::DBox ®ion_mu); @@ -313,6 +322,7 @@ private: tl::AbsoluteProgress *mp_progress; std::vector m_context_layers; std::map m_cells_with_context; + bool m_capture_all_shapes; }; /**