From 93a6f2baa79896fd1aef785a5984a6676d094159 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 11 Apr 2021 09:40:27 +0200 Subject: [PATCH] Warning for non-orthogonal array vectors; important bugfix: editing array vectors wasn't working properly in absolute coordinate mode --- src/edt/edt/InstPropertiesPage.ui | 536 ++++++++++----------------- src/edt/edt/edtInstPropertiesPage.cc | 16 +- src/edt/edt/edtPropertiesPageUtils.h | 14 + 3 files changed, 223 insertions(+), 343 deletions(-) diff --git a/src/edt/edt/InstPropertiesPage.ui b/src/edt/edt/InstPropertiesPage.ui index e02041b6d..eafa2d192 100644 --- a/src/edt/edt/InstPropertiesPage.ui +++ b/src/edt/edt/InstPropertiesPage.ui @@ -456,21 +456,38 @@ 6 - - - - Column vector (x,y) + + + + QFrame::NoFrame - - - - - - x = - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + QFrame::Raised + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 1 + 0 + + + + + @@ -483,104 +500,6 @@ - - - - y = - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - x = - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Row vector (x,y) - - - - - - - Rows/Columns - - - - - - - columns = - - - - - - - - 1 - 0 - - - - - - - - rows = - - - - - - - - 1 - 0 - - - - - - - - This is instance [r,c] of array with - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <b>Warning</b>: although row and column vectors can be arbitrary combination, some design systems and mask makers only accept orthogonal (rectangular) arrays. Set the gray fields to 0 in this case. - - - true - - - @@ -615,6 +534,80 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + y = + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Rows/Columns + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 1 + 0 + + + + + + + + + + + + 1 + 0 + + + + @@ -649,98 +642,75 @@ - - - - - - - - - 136 - 138 - 133 - - - - - - - 238 - 238 - 236 - - - - - - - 136 - 138 - 133 - - - - - - - - - 136 - 138 - 133 - - - - - - - 238 - 238 - 236 - - - - - - - 136 - 138 - 133 - - - - - - - - - 190 - 190 - 190 - - - - - - - 239 - 239 - 239 - - - - - - - 0 - 0 - 0 - - - - - + + + + Column vector (x,y) + + + + + + + x = + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + x = + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + This is instance [r,c] of array with + + + + + + + + 1 + 0 + + + + + + + + columns = + + + + + + + rows = + + + + + + + Row vector (x,y) + + + + + + + false QFrame::NoFrame @@ -748,151 +718,33 @@ QFrame::Raised - - - 0 - - - 0 - - - 0 - - - 0 - + - + - - 1 + + 0 0 + + + + + :/warn.png + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + - - - - - - - - - - - - 136 - 138 - 133 - - - - - - - 238 - 238 - 236 - - - - - - - 136 - 138 - 133 - - - - - - - - - 136 - 138 - 133 - - - - - - - 238 - 238 - 236 - - - - - - - 136 - 138 - 133 - - - - - - - - - 190 - 190 - 190 - - - - - - - 239 - 239 - 239 - - - - - - - 0 - 0 - 0 - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - 0 - + + + Although row and column vectors can be arbitrary combination, some design systems and mask makers only accept arrays where row and column vectors are orthogonal and parallel to x and y axes. + + + true @@ -1046,6 +898,8 @@ sel_pb inst_pb - + + + diff --git a/src/edt/edt/edtInstPropertiesPage.cc b/src/edt/edt/edtInstPropertiesPage.cc index 4034061fe..3ba054717 100644 --- a/src/edt/edt/edtInstPropertiesPage.cc +++ b/src/edt/edt/edtInstPropertiesPage.cc @@ -45,6 +45,12 @@ namespace edt // ------------------------------------------------------------------------- // InstPropertiesPage implementation +static bool is_orthogonal (const db::DVector &rv, const db::DVector &cv) +{ + return (db::coord_traits::equal (rv.x (), 0) && db::coord_traits::equal (cv.y (), 0)) || + (db::coord_traits::equal (rv.y (), 0) && db::coord_traits::equal (cv.x (), 0)); +} + InstPropertiesPage::InstPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent) : lay::PropertiesPage (parent, manager, service), mp_service (service), m_enable_cb_callback (true), mp_pcell_parameters (0) { @@ -323,6 +329,8 @@ InstPropertiesPage::update () } + ortho_warning_frame->setEnabled (! is_orthogonal (db::CplxTrans (dbu) * rowv, db::CplxTrans (dbu) * columnv)); + } else { array_grp->setChecked (false); @@ -334,6 +342,8 @@ InstPropertiesPage::update () column_y_le->setText (QString ()); inst_lbl->setText (QString ()); + ortho_warning_frame->setEnabled (false); + } pos_x_le->setText (tl::to_qstring (coord_to_string ((gt * db::ICplxTrans (t)).disp ().x (), dbu, du))); @@ -562,8 +572,10 @@ InstPropertiesPage::create_applicator (db::Cell & /*cell*/, const db::Instance & has_error = true; } - db::DVector rv = db::DVector (dpoint_from_dpoint (db::DPoint (rx, ry), dbu, du, t)); - db::DVector cv = db::DVector (dpoint_from_dpoint (db::DPoint (cx, cy), dbu, du, t)); + db::DVector rv = dvector_from_dvector (db::DVector (rx, ry), dbu, du, t); + db::DVector cv = dvector_from_dvector (db::DVector (cx, cy), dbu, du, t); + + ortho_warning_frame->setEnabled (! is_orthogonal (rv, cv)); bool set_a = (! rv.equal (a_org * dbu) || ! is_array_org); bool set_na = (rows != na_org || ! is_array_org); diff --git a/src/edt/edt/edtPropertiesPageUtils.h b/src/edt/edt/edtPropertiesPageUtils.h index e2fcb3a72..dc173b3b1 100644 --- a/src/edt/edt/edtPropertiesPageUtils.h +++ b/src/edt/edt/edtPropertiesPageUtils.h @@ -438,6 +438,20 @@ db::DCoord dcoord_from_dcoord (double d, double dbu, bool du, const db::CplxTran */ db::DPoint dpoint_from_dpoint (const db::DPoint &dp, double dbu, bool du, const db::DCplxTrans &t); +/** + * @brief Converts a micron or DBU vector to a micron point + * + * @param dp The point to convert + * @param dbu The database unit + * @param du A flag indicating whether the input point is given in database units (du = true) or micron (du = false) + * @param t A transformation (in DBU space) to apply to the point + * @return The micron-unit point + * + * The transformation is intended to be a global-to-local transformation so the output value is + * a point in local-cell micron units. + */ +db::DVector dvector_from_dvector (const db::DVector &dp, double dbu, bool du, const db::DCplxTrans &t); + /** * @brief Gets a dimension value from a string *