| 3920 | } |
| 3921 | |
| 3922 | db::DBox |
| 3923 | LayoutViewBase::full_box () const |
| 3924 | { |
| 3925 | // compute the bounding box over all layers |
| 3926 | // this will trigger the update procedures of the layout objects if not done yet .. |
| 3927 | |
| 3928 | db::DBox bbox; |
| 3929 | |
| 3930 | auto tv = cv_transform_variants_with_empty (); |
| 3931 | |
| 3932 | // first, use the bounding box of actual drawn layout (issue #2326) |
| 3933 | for (auto i = tv.begin (); i != tv.end (); ++i) { |
| 3934 | const lay::CellView &cv = cellview (i->second); |
| 3935 | if (cv.is_valid ()) { |
| 3936 | double dbu = cv->layout ().dbu (); |
| 3937 | bbox += (i->first * db::CplxTrans (dbu) * cv.context_trans ()) * cv.cell ()->bbox (); |
| 3938 | } |
| 3939 | } |
| 3940 | |
| 3941 | // if that is empty, use the bounding box computed while treating empty cells as |
| 3942 | // dots at the origin of the cells |
| 3943 | if (bbox.empty ()) { |
| 3944 | for (auto i = tv.begin (); i != tv.end (); ++i) { |
| 3945 | const lay::CellView &cv = cellview (i->second); |
| 3946 | if (cv.is_valid ()) { |
| 3947 | double dbu = cv->layout ().dbu (); |
| 3948 | bbox += (i->first * db::CplxTrans (dbu) * cv.context_trans ()) * cv.cell ()->bbox_with_empty (); |
| 3949 | } |
| 3950 | } |
| 3951 | } |
| 3952 | |
| 3953 | // add annotations |
| 3954 | for (lay::AnnotationShapes::iterator a = annotation_shapes ().begin (); ! a.at_end (); ++a) { |
| 3955 | bbox += a->box (); |
| 3956 | } |
| 3957 | |
| 3958 | // produce a default if still empty and enlarge by some small amount to have a border |
| 3959 | if (bbox.empty ()) { |
| 3960 | bbox = db::DBox (0, 0, 0, 0); // default box |
| 3961 | } else { |
| 3962 | bbox = db::DBox (bbox.left () - 0.025 * bbox.width (), bbox.bottom () - 0.025 * bbox.height (), |
| 3963 | bbox.right () + 0.025 * bbox.width (), bbox.top () + 0.025 * bbox.height ()); |
| 3964 | } |
| 3965 | |
| 3966 | return bbox; |
| 3967 | } |
| 3968 | |
| 3969 | void |
| 3970 | LayoutViewBase::select_all () |