MCPcopy Create free account
hub / github.com/KLayout/klayout / draw_array_simplified

Function draw_array_simplified

src/laybasic/laybasic/layRedrawThreadWorker.cc:1722–1792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1720
1721template <class Array>
1722bool draw_array_simplified (lay::Renderer *r, const db::Shape &array_shape, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, const db::CplxTrans &trans)
1723{
1724 typename Array::tag tag;
1725 const Array *array = array_shape.basic_ptr (tag);
1726
1727 db::Vector a, b;
1728 unsigned long na = 0, nb = 0;
1729 bool is_regular = array->is_regular_array (a, b, na, nb);
1730 size_t n = array->size ();
1731
1732 if (n >= 2) {
1733
1734 db::box_convert <typename Array::object_type> bc;
1735
1736 db::DBox shape_box_trans = trans * bc (array->object ());
1737 if (shape_box_trans.width () < 1.5 && shape_box_trans.height () < 1.5) {
1738
1739 if (is_regular &&
1740 ((a.x () == 0 && b.y () == 0) || (a.y () == 0 && b.x () == 0)) &&
1741 (na <= 1 || trans.ctrans (a.length ()) < 1.5) &&
1742 (nb <= 1 || trans.ctrans (b.length ()) < 1.5)) {
1743
1744 db::Box array_box = array_shape.bbox ();
1745 r->draw (array_box, trans, frame, frame, 0, 0);
1746 r->draw (array_box, trans, vertex, vertex, 0, 0);
1747 return true;
1748
1749 } else if (is_regular &&
1750 (a.x () == 0 || a.y () == 0) &&
1751 na > 1 && trans.ctrans (a.length ()) < 1.5) {
1752
1753 Array a1 (array->object (), array->front (), a, db::Vector (0, 0), na, 1);
1754 db::Box abox = a1.bbox (bc);
1755 for (unsigned long i = 0; i < nb; ++i) {
1756 r->draw (abox, trans, frame, frame, 0, 0);
1757 r->draw (abox, trans, vertex, vertex, 0, 0);
1758 abox.move (b);
1759 }
1760 return true;
1761
1762 } else if (is_regular &&
1763 (b.x () == 0 || b.y () == 0) &&
1764 nb > 1 && trans.ctrans (b.length ()) < 1.5) {
1765
1766 Array a1 (array->object (), array->front (), db::Vector (0, 0), b, 1, nb);
1767 db::Box abox = a1.bbox (bc);
1768 for (unsigned long i = 0; i < na; ++i) {
1769 r->draw (abox, trans, frame, frame, 0, 0);
1770 r->draw (abox, trans, vertex, vertex, 0, 0);
1771 abox.move (a);
1772 }
1773 return true;
1774
1775 } else {
1776
1777 db::DBox array_box_trans = trans * array_shape.bbox ();
1778 if ((array_box_trans.height () < 1.5 && array_box_trans.width () < 3.5) ||
1779 (array_box_trans.height () < 3.5 && array_box_trans.width () < 1.5)) {

Callers

nothing calls this directly

Calls 14

objectMethod · 0.80
yMethod · 0.80
VectorClass · 0.50
is_regular_arrayMethod · 0.45
sizeMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
xMethod · 0.45
ctransMethod · 0.45
lengthMethod · 0.45
bboxMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected