mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-06 09:17:42 +02:00
New import methods for Region, EdgePairs and Edges
Region: insert of other regions, shape collections (with transformation) Edges: insert of other edge collections, regions, shape collections (with transformation) EdgePairs: insert of other edge pair collections
This commit is contained in:
Vendored
+6
@@ -63,6 +63,12 @@ class DBEdgePairs_TestClass < TestBase
|
||||
assert_equal(r.size, 0)
|
||||
assert_equal(r.bbox.to_s, "()")
|
||||
|
||||
ep = RBA::EdgePairs::new
|
||||
e = RBA::EdgePairs::new
|
||||
e.insert(RBA::EdgePair::new(RBA::Edge::new(0, 0, 0, 100), RBA::Edge::new(-10, 0, -20, 50)))
|
||||
ep.insert(e)
|
||||
assert_equal(ep.to_s, "(0,0;0,100)/(-10,0;-20,50)")
|
||||
|
||||
end
|
||||
|
||||
# Basics
|
||||
|
||||
Vendored
+42
@@ -204,6 +204,48 @@ class DBEdges_TestClass < TestBase
|
||||
r.insert(ly.begin_shapes(c1.cell_index, l1), RBA::ICplxTrans::new(10, 20))
|
||||
assert_equal(r.to_s(30), "(0,0;0,40);(0,40;20,40);(20,40;20,0);(20,0;0,0);(0,100;0,140);(0,140;20,140);(20,140;20,100);(20,100;0,100);(200,100;200,140);(200,140;220,140);(220,140;220,100);(220,100;200,100)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
rr = RBA::Edges::new
|
||||
rr.insert(RBA::Edge::new(10, 20, 100, 200))
|
||||
r.insert(rr)
|
||||
assert_equal(r.to_s, "(10,20;100,200)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
rr = RBA::Region::new
|
||||
rr.insert(RBA::Box::new(10, 20, 100, 200))
|
||||
r.insert(rr)
|
||||
assert_equal(r.to_s, "(10,20;10,200);(10,200;100,200);(100,200;100,20);(100,20;10,20)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Edge::new(10, 20, 100, 200))
|
||||
r.insert(s)
|
||||
assert_equal(r.to_s, "(10,20;100,200)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Polygon::new(RBA::Box::new(10, 20, 100, 200)))
|
||||
r.insert(s)
|
||||
assert_equal(r.to_s, "(10,20;10,200);(10,200;100,200);(100,200;100,20);(100,20;10,20)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Text::new("ABC", RBA::Trans::new))
|
||||
r.insert(s)
|
||||
assert_equal(r.to_s, "")
|
||||
|
||||
r = RBA::Edges::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Edge::new(10, 20, 100, 200))
|
||||
r.insert(s, RBA::Trans::new(1, 1))
|
||||
assert_equal(r.to_s, "(11,21;101,201)")
|
||||
|
||||
r = RBA::Edges::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Edge::new(10, 20, 100, 200))
|
||||
r.insert(s, RBA::ICplxTrans::new(RBA::Trans::new(1, 1)))
|
||||
assert_equal(r.to_s, "(11,21;101,201)")
|
||||
|
||||
end
|
||||
|
||||
# Merge, booleans
|
||||
|
||||
Vendored
+36
@@ -184,6 +184,42 @@ class DBRegion_TestClass < TestBase
|
||||
r.insert(ly.begin_shapes(c1.cell_index, l1), RBA::ICplxTrans::new(10, 20))
|
||||
assert_equal(r.to_s, "(0,0;0,40;20,40;20,0);(0,100;0,140;20,140;20,100);(200,100;200,140;220,140;220,100)")
|
||||
|
||||
r = RBA::Region::new
|
||||
rr = RBA::Region::new
|
||||
rr.insert(RBA::Box::new(10, 20, 100, 200))
|
||||
r.insert(rr)
|
||||
assert_equal(r.to_s, "(10,20;10,200;100,200;100,20)")
|
||||
|
||||
r = RBA::Region::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Box::new(10, 20, 100, 200))
|
||||
r.insert(s)
|
||||
assert_equal(r.to_s, "(10,20;10,200;100,200;100,20)")
|
||||
|
||||
r = RBA::Region::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Polygon::new(RBA::Box::new(10, 20, 100, 200)))
|
||||
r.insert(s)
|
||||
assert_equal(r.to_s, "(10,20;10,200;100,200;100,20)")
|
||||
|
||||
r = RBA::Region::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Edge::new(10, 20, 100, 200))
|
||||
r.insert(s)
|
||||
assert_equal(r.to_s, "")
|
||||
|
||||
r = RBA::Region::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Box::new(10, 20, 100, 200))
|
||||
r.insert(s, RBA::Trans::new(1, 1))
|
||||
assert_equal(r.to_s, "(11,21;11,201;101,201;101,21)")
|
||||
|
||||
r = RBA::Region::new
|
||||
s = RBA::Shapes::new
|
||||
s.insert(RBA::Box::new(10, 20, 100, 200))
|
||||
r.insert(s, RBA::ICplxTrans::new(RBA::Trans::new(1, 1)))
|
||||
assert_equal(r.to_s, "(11,21;11,201;101,201;101,21)")
|
||||
|
||||
end
|
||||
|
||||
# Booleans
|
||||
|
||||
Reference in New Issue
Block a user