Selectability follows visibility

This commit is contained in:
Matthias Koefferlein 2025-10-20 22:57:03 +02:00
parent 6746dad08a
commit a1d6ff9a3c
3 changed files with 37 additions and 10 deletions

View File

@ -1159,6 +1159,8 @@ Service::transient_select (const db::DPoint &pos)
if (m_cell_inst_service) {
lay::InstFinder finder (true, view ()->is_editable () && m_top_level_sel, view ()->is_editable () /*full arrays in editable mode*/, true /*enclose instances*/, &m_previous_selection, true /*visible layers only*/);
finder.consider_ghost_cells (view ()->ghost_cells_visible ());
finder.consider_normal_cells (view ()->cell_box_visible ());
// go through all transform variants
std::set< std::pair<db::DCplxTrans, int> > variants = view ()->cv_transform_variants_with_empty ();
@ -1493,6 +1495,8 @@ Service::select (const db::DBox &box, lay::Editable::SelectionMode mode)
} else if (m_cell_inst_service) {
lay::InstFinder finder (box.is_point (), view ()->is_editable () && m_top_level_sel, view ()->is_editable () /*full arrays in editable mode*/, true /*enclose_inst*/, exclude, true /*only visible layers*/);
finder.consider_ghost_cells (view ()->ghost_cells_visible ());
finder.consider_normal_cells (view ()->cell_box_visible ());
// go through all cell views
std::set< std::pair<db::DCplxTrans, int> > variants = view ()->cv_transform_variants_with_empty ();

View File

@ -721,6 +721,8 @@ InstFinder::InstFinder (bool point_mode, bool top_level_sel, bool full_arrays, b
m_full_arrays (full_arrays),
m_enclose_insts (enclose_inst),
m_visible_layers (visible_layers),
m_consider_ghost_cells (true),
m_consider_normal_cells (true),
mp_view (0),
mp_progress (0)
{
@ -805,6 +807,12 @@ InstFinder::checkpoint ()
}
}
bool
InstFinder::consider_cell (const db::Cell &cell) const
{
return cell.is_ghost_cell () ? m_consider_ghost_cells : m_consider_normal_cells;
}
void
InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const db::Box & /*scan_box*/, const db::DCplxTrans &vp, const db::ICplxTrans &t, int level)
{
@ -818,15 +826,18 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
++*mp_progress;
// look for instances to check here ..
db::Cell::touching_iterator inst = cell.begin_touching (search_box);
while (! inst.at_end ()) {
for (db::Cell::touching_iterator inst = cell.begin_touching (search_box); ! inst.at_end (); ++inst) {
const db::CellInstArray &cell_inst = inst->cell_inst ();
const db::Cell &inst_cell = layout ().cell (cell_inst.object ().cell_index ());
++*mp_progress;
// just consider the instances exactly at the last level of
if (! consider_cell (inst_cell)) {
continue;
}
// just consider the instances exactly at the last level of
// hierarchy (this is where the boxes are drawn) or of cells that
// are hidden.
if (level == max_level () - 1 || inst_cell.is_proxy () || inst_cell.is_ghost_cell () || mp_view->is_cell_hidden (inst_cell.cell_index (), m_cv_index)) {
@ -887,21 +898,22 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
}
++inst;
}
} else {
// look for instances to check here ..
db::Cell::touching_iterator inst = cell.begin_touching (search_box);
while (! inst.at_end ()) {
for (db::Cell::touching_iterator inst = cell.begin_touching (search_box); ! inst.at_end (); ++inst) {
checkpoint ();
const db::CellInstArray &cell_inst = inst->cell_inst ();
const db::Cell &inst_cell = layout ().cell (cell_inst.object ().cell_index ());
if (! consider_cell (inst_cell)) {
continue;
}
// just consider the instances exactly at the last level of
// hierarchy (this is where the boxes are drawn) or if of cells that
// are hidden.
@ -909,7 +921,7 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
db::box_convert <db::CellInst, false> bc (layout ());
for (db::CellInstArray::iterator p = cell_inst.begin_touching (search_box, bc); ! p.at_end (); ++p) {
checkpoint ();
bool match = false;
@ -1000,8 +1012,6 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
}
++inst;
}
}

View File

@ -343,7 +343,17 @@ public:
bool find (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans, const db::DBox &region_mu);
bool find (LayoutViewBase *view, const db::DBox &region_mu);
void consider_ghost_cells (bool f)
{
m_consider_ghost_cells = f;
}
void consider_normal_cells (bool f)
{
m_consider_normal_cells = f;
}
iterator begin () const
{
return m_founds.begin ();
@ -360,6 +370,7 @@ private:
virtual void visit_cell (const db::Cell &cell, const db::Box &hit_box, const db::Box &scan_box, const db::DCplxTrans &vp, const db::ICplxTrans &t, int level);
bool find_internal (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox &region_mu);
bool consider_cell (const db::Cell &cell) const;
unsigned int m_cv_index;
db::cell_index_type m_topcell;
@ -369,6 +380,8 @@ private:
bool m_full_arrays;
bool m_enclose_insts;
bool m_visible_layers;
bool m_consider_ghost_cells;
bool m_consider_normal_cells;
std::vector<int> m_visible_layer_indexes;
LayoutViewBase *mp_view;
tl::AbsoluteProgress *mp_progress;