Fixed issue #1281 (Layout diff should ignore shape or instance duplicates)

A new option in the diff tool and strmcmp has been added
(-1|--ignore-duplicates in strcmp).
In RBA/pya, the "IgnoreDuplicates" flag has been added.
This commit is contained in:
Matthias Koefferlein
2023-06-10 09:11:39 +02:00
parent 5bcb9e0207
commit 7f8eeb3a09
6 changed files with 360 additions and 92 deletions
@@ -1,76 +1,73 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DiffToolDialog</class>
<widget class="QDialog" name="DiffToolDialog" >
<property name="geometry" >
<widget class="QDialog" name="DiffToolDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>498</width>
<width>503</width>
<height>404</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Diff Tool</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin" stdset="0">
<number>9</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Input</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="margin" stdset="0">
<number>9</number>
</property>
<property name="spacing" >
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Layout A </string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Layout B</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="layouta" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<item row="0" column="1">
<widget class="lay::CellViewSelectionComboBox" name="layouta">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy" >
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="lay::CellViewSelectionComboBox" name="layoutb" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<item row="1" column="1">
<widget class="lay::CellViewSelectionComboBox" name="layoutb">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy" >
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
</widget>
@@ -79,77 +76,84 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Options</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin" stdset="0">
<number>9</number>
</property>
<item>
<widget class="QCheckBox" name="smart_cbx" >
<property name="text" >
<widget class="QCheckBox" name="smart_cbx">
<property name="text">
<string>Don't use names to match cells (use geometrical properties)</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="xor_cbx" >
<property name="text" >
<widget class="QCheckBox" name="xor_cbx">
<property name="text">
<string>Run XOR on differences</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="summarize_cbx" >
<property name="text" >
<widget class="QCheckBox" name="summarize_cbx">
<property name="text">
<string>Summarize missing layers</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="detailed_cbx" >
<property name="text" >
<widget class="QCheckBox" name="detailed_cbx">
<property name="text">
<string>Detailed information</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="expand_cell_arrays_cbx" >
<property name="text" >
<widget class="QCheckBox" name="expand_cell_arrays_cbx">
<property name="text">
<string>Expand cell arrays (compare single instance by instance)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="exact_cbx" >
<property name="text" >
<widget class="QCheckBox" name="exact_cbx">
<property name="text">
<string>Exact compare (includes properties, text orientation and similar)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ignore_duplicates_cbx">
<property name="text">
<string>Ignore duplicate instances and shapes</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>472</width>
<height>16</height>
@@ -158,12 +162,12 @@
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@@ -187,11 +191,11 @@
<receiver>DiffToolDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
@@ -203,11 +207,11 @@
<receiver>DiffToolDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
@@ -46,6 +46,7 @@ std::string cfg_diff_smart ("diff-smart");
std::string cfg_diff_summarize ("diff-summarize");
std::string cfg_diff_expand_cell_arrays ("diff-expand-cell-arrays");
std::string cfg_diff_exact ("diff-exact");
std::string cfg_diff_ignore_duplicates ("diff-ignore-duplicates");
// ------------------------------------------------------------------------------
// RdbDifferenceReceiver definition
@@ -650,6 +651,9 @@ DiffToolDialog::exec_dialog (lay::LayoutViewBase *view)
if (config_root->config_get (cfg_diff_exact, f)) {
mp_ui->exact_cbx->setChecked (f);
}
if (config_root->config_get (cfg_diff_ignore_duplicates, f)) {
mp_ui->ignore_duplicates_cbx->setChecked (f);
}
update ();
@@ -686,6 +690,7 @@ BEGIN_PROTECTED
config_root->config_set (cfg_diff_summarize, mp_ui->summarize_cbx->isChecked ());
config_root->config_set (cfg_diff_expand_cell_arrays, mp_ui->expand_cell_arrays_cbx->isChecked ());
config_root->config_set (cfg_diff_exact, mp_ui->exact_cbx->isChecked ());
config_root->config_set (cfg_diff_ignore_duplicates, mp_ui->ignore_duplicates_cbx->isChecked ());
config_root->config_end ();
QDialog::accept ();
@@ -712,6 +717,7 @@ DiffToolDialog::run_diff ()
bool summarize = !run_xor && mp_ui->summarize_cbx->isChecked ();
bool expand_cell_arrays = !run_xor && mp_ui->expand_cell_arrays_cbx->isChecked ();
bool exact = !run_xor && mp_ui->exact_cbx->isChecked ();
bool ignore_duplicates = mp_ui->ignore_duplicates_cbx->isChecked ();
int cv_index_a = mp_ui->layouta->current_cv_index ();
int cv_index_b = mp_ui->layoutb->current_cv_index ();
@@ -740,6 +746,9 @@ DiffToolDialog::run_diff ()
if (smart) {
flags |= db::layout_diff::f_smart_cell_mapping;
}
if (ignore_duplicates) {
flags |= db::layout_diff::f_ignore_duplicates;
}
// TODO: make an parameter
db::Coord tolerance = 0;