mirror of https://github.com/KLayout/klayout.git
[consider merging] Bugfix: do not stop finder iterations when there are too many founds during text search
This commit is contained in:
parent
11701a300e
commit
2c65bf85e4
|
|
@ -91,6 +91,8 @@ Finder::start (lay::LayoutViewBase *view, unsigned int cv_index, const std::vect
|
|||
{
|
||||
const lay::CellView &cv = view->cellview (cv_index);
|
||||
|
||||
reset_counter ();
|
||||
|
||||
m_layers = layers;
|
||||
mp_layout = &cv->layout ();
|
||||
mp_view = view;
|
||||
|
|
@ -265,7 +267,7 @@ ShapeFinder::ShapeFinder (bool point_mode, bool top_level_sel, db::ShapeIterator
|
|||
mp_prop_sel (0), m_inv_prop_sel (false), mp_progress (0),
|
||||
m_capture_all_shapes (capture_all_shapes)
|
||||
{
|
||||
m_tries = point_sel_tests;
|
||||
m_try_counter = m_tries = point_sel_tests;
|
||||
}
|
||||
|
||||
struct LPContextEqualOp
|
||||
|
|
@ -440,20 +442,29 @@ ShapeFinder::find_internal (lay::LayoutViewBase *view, unsigned int cv_index, co
|
|||
|
||||
auto flags_saved = m_flags;
|
||||
|
||||
try {
|
||||
if ((m_flags & db::ShapeIterator::Texts) != 0 && mp_text_info && ! mp_text_info->point_mode ()) {
|
||||
|
||||
if ((m_flags & db::ShapeIterator::Texts) != 0 && mp_text_info && ! mp_text_info->point_mode ()) {
|
||||
m_flags = db::ShapeIterator::Texts;
|
||||
|
||||
m_flags = db::ShapeIterator::Texts;
|
||||
try {
|
||||
|
||||
// for catching all labels we search the whole view area
|
||||
db::DBox scan_region_mu = view->viewport ().box ();
|
||||
start (view, m_cv_index, trans_mu, region_mu, scan_region_mu, min_level, max_level, layers);
|
||||
|
||||
m_flags = db::ShapeIterator::flags_type (flags_saved - db::ShapeIterator::Texts);
|
||||
|
||||
} catch (StopException) {
|
||||
// ...
|
||||
} catch (...) {
|
||||
m_flags = flags_saved;
|
||||
throw;
|
||||
}
|
||||
|
||||
m_flags = db::ShapeIterator::flags_type (flags_saved - db::ShapeIterator::Texts);
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// another pass with tight search box and without texts
|
||||
start (view, m_cv_index, trans_mu, region_mu, region_mu, min_level, max_level, layers);
|
||||
|
||||
|
|
@ -476,12 +487,18 @@ ShapeFinder::checkpoint ()
|
|||
if (! point_mode ()) {
|
||||
++*mp_progress;
|
||||
} else {
|
||||
if (--m_tries < 0) {
|
||||
if (--m_try_counter < 0) {
|
||||
throw StopException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShapeFinder::reset_counter ()
|
||||
{
|
||||
m_try_counter = m_tries;
|
||||
}
|
||||
|
||||
void
|
||||
ShapeFinder::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*/)
|
||||
{
|
||||
|
|
@ -814,12 +831,18 @@ InstFinder::checkpoint ()
|
|||
if (! point_mode ()) {
|
||||
++*mp_progress;
|
||||
} else {
|
||||
if (--m_tries < 0) {
|
||||
if (--m_try_counter < 0) {
|
||||
throw StopException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InstFinder::reset_counter ()
|
||||
{
|
||||
m_try_counter = m_tries;
|
||||
}
|
||||
|
||||
bool
|
||||
InstFinder::consider_cell (const db::Cell &cell) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -213,6 +213,11 @@ protected:
|
|||
*/
|
||||
virtual void checkpoint () = 0;
|
||||
|
||||
/**
|
||||
* @brief Is called to reset a try counter that stops on "checkpoint"
|
||||
*/
|
||||
virtual void reset_counter () = 0;
|
||||
|
||||
private:
|
||||
void do_find (const db::Cell &cell, int level, const db::DCplxTrans &vp, const db::ICplxTrans &t);
|
||||
|
||||
|
|
@ -317,6 +322,7 @@ protected:
|
|||
}
|
||||
|
||||
virtual void checkpoint ();
|
||||
virtual void reset_counter ();
|
||||
|
||||
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);
|
||||
|
|
@ -338,7 +344,7 @@ private:
|
|||
const lay::TextInfo *mp_text_info;
|
||||
const std::set<db::properties_id_type> *mp_prop_sel;
|
||||
bool m_inv_prop_sel;
|
||||
int m_tries;
|
||||
int m_tries, m_try_counter;
|
||||
tl::AbsoluteProgress *mp_progress;
|
||||
std::vector<int> m_context_layers;
|
||||
std::map<db::cell_index_type, bool> m_cells_with_context;
|
||||
|
|
@ -385,6 +391,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void checkpoint ();
|
||||
virtual void reset_counter ();
|
||||
|
||||
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);
|
||||
|
|
@ -396,7 +403,7 @@ private:
|
|||
db::cell_index_type m_topcell;
|
||||
const std::set<lay::ObjectInstPath> *mp_excludes;
|
||||
std::vector<lay::ObjectInstPath> m_founds;
|
||||
int m_tries;
|
||||
int m_tries, m_try_counter;
|
||||
bool m_full_arrays;
|
||||
bool m_enclose_insts;
|
||||
bool m_visible_layers;
|
||||
|
|
|
|||
Loading…
Reference in New Issue