Fixed #142 (Issue with RBA::RecursiveShapeIterator#region=)

This commit is contained in:
Matthias Koefferlein 2018-07-12 21:16:14 +02:00
parent 165e1eb4b2
commit 20d1d0500f
3 changed files with 23 additions and 6 deletions

View File

@ -7,6 +7,8 @@
* Bugfix: https://github.com/klayoutmatthias/klayout/issues/139 * Bugfix: https://github.com/klayoutmatthias/klayout/issues/139
Libraries have not been reassigned when loading a GDS file Libraries have not been reassigned when loading a GDS file
from command line (does not happen on File/Open) from command line (does not happen on File/Open)
* Bugfix: https://github.com/klayoutmatthias/klayout/issues/142
Issue with RBA::RecursiveShapeIterator#region=
* Bugfix: 8 bit indexed GIF images can be used for package icons now * Bugfix: 8 bit indexed GIF images can be used for package icons now
* Enhancement: Selection now shows PCell display names * Enhancement: Selection now shows PCell display names
Before, the internal name was shown for instances Before, the internal name was shown for instances

View File

@ -280,7 +280,7 @@ Class<db::RecursiveShapeIterator> decl_RecursiveShapeIterator ("RecursiveShapeIt
) + ) +
gsi::method ("region=", (void (db::RecursiveShapeIterator::*)(const db::RecursiveShapeIterator::box_type &)) &db::RecursiveShapeIterator::set_region, gsi::method ("region=", (void (db::RecursiveShapeIterator::*)(const db::RecursiveShapeIterator::box_type &)) &db::RecursiveShapeIterator::set_region,
"@brief Sets the rectangular region that is iterator is iterating over\n" "@brief Sets the rectangular region that is iterator is iterating over\n"
"@args region\n" "@args box_region\n"
"See \\region for a description of this attribute.\n" "See \\region for a description of this attribute.\n"
"Setting a simple region will reset the complex region to a rectangle and reset the iterator to " "Setting a simple region will reset the complex region to a rectangle and reset the iterator to "
"the beginning of the sequence." "the beginning of the sequence."
@ -298,15 +298,19 @@ Class<db::RecursiveShapeIterator> decl_RecursiveShapeIterator ("RecursiveShapeIt
) + ) +
gsi::method ("confine_region", (void (db::RecursiveShapeIterator::*)(const db::RecursiveShapeIterator::box_type &)) &db::RecursiveShapeIterator::confine_region, gsi::method ("confine_region", (void (db::RecursiveShapeIterator::*)(const db::RecursiveShapeIterator::box_type &)) &db::RecursiveShapeIterator::confine_region,
"@brief Confines the region that is iterator is iterating over\n" "@brief Confines the region that is iterator is iterating over\n"
"@args region\n" "@args box_region\n"
"This method is similar to setting the region (see \\region=), but will add to any (complex or simple) region already set. " "This method is similar to setting the region (see \\region=), but will confine any region (complex or simple) already set. "
"Essentially it does a logical AND operation between the existing and given region. "
"Hence this method can only reduce a region, not extend it.\n"
"\n" "\n"
"This method has been introduced in version 0.25.\n" "This method has been introduced in version 0.25.\n"
) + ) +
gsi::method ("region=", (void (db::RecursiveShapeIterator::*)(const db::RecursiveShapeIterator::region_type &)) &db::RecursiveShapeIterator::confine_region, gsi::method ("confine_region", (void (db::RecursiveShapeIterator::*)(const db::RecursiveShapeIterator::region_type &)) &db::RecursiveShapeIterator::confine_region,
"@brief Confines the region that is iterator is iterating over\n" "@brief Confines the region that is iterator is iterating over\n"
"@args region\n" "@args complex_region\n"
"This method is similar to setting the complex region (see \\region=), but will add to any (complex or simple) region already set." "This method is similar to setting the region (see \\region=), but will confine any region (complex or simple) already set. "
"Essentially it does a logical AND operation between the existing and given region. "
"Hence this method can only reduce a region, not extend it.\n"
"\n" "\n"
"This method has been introduced in version 0.25.\n" "This method has been introduced in version 0.25.\n"
) + ) +

View File

@ -340,6 +340,17 @@ class DBLayout_TestClass < TestBase
i1copy.region = RBA::Box.new(0, 0, 100, 101) i1copy.region = RBA::Box.new(0, 0, 100, 101)
assert_equal(i1copy.region.to_s, "(0,0;100,101)") assert_equal(i1copy.region.to_s, "(0,0;100,101)")
assert_equal(collect(i1copy, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)"); assert_equal(collect(i1copy, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)");
i1copy.region = RBA::Region::new(RBA::Box.new(0, 0, 100, 101))
assert_equal(i1copy.region.to_s, "(0,0;100,101)")
assert_equal(collect(i1copy, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)");
i1copy.region = RBA::Box.new(-1000, -1000, 1100, 1101)
i1copy.confine_region(RBA::Box.new(0, 0, 100, 101))
assert_equal(i1copy.region.to_s, "(0,0;100,101)")
assert_equal(collect(i1copy, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)");
i1copy.region = RBA::Box.new(-1000, -1000, 1100, 1101)
i1copy.confine_region(RBA::Region::new(RBA::Box.new(0, 0, 100, 101)))
assert_equal(i1copy.region.to_s, "(0,0;100,101)")
assert_equal(collect(i1copy, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)");
i1o = l.begin_shapes_overlapping(c0.cell_index, 0, RBA::Box.new(0, 0, 101, 101)); i1o = l.begin_shapes_overlapping(c0.cell_index, 0, RBA::Box.new(0, 0, 101, 101));
assert_equal(collect(i1o, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)/[c2](100,0;1100,1100)"); assert_equal(collect(i1o, l), "[c0](0,100;1000,1200)/[c1](0,100;1000,1200)/[c2](100,0;1100,1100)");
i1o = c0.begin_shapes_rec_overlapping(0, RBA::Box.new(0, 0, 101, 101)); i1o = c0.begin_shapes_rec_overlapping(0, RBA::Box.new(0, 0, 101, 101));