WIP: flat region tests, partially working

This commit is contained in:
Matthias Koefferlein 2023-01-16 02:06:21 +01:00
parent db870614ab
commit 48b55f142a
32 changed files with 17 additions and 4 deletions

View File

@ -364,6 +364,7 @@ AsIfFlatRegion::filtered (const PolygonFilterBase &filter) const
}
}
new_region->set_is_merged (true);
return new_region.release ();
}
@ -1017,7 +1018,7 @@ AsIfFlatRegion::snapped (db::Coord gx, db::Coord gy)
throw tl::Exception (tl::to_string (tr ("Grid snap requires a positive grid value")));
}
std::unique_ptr<FlatRegion> new_region (new FlatRegion (merged_semantics ()));
std::unique_ptr<FlatRegion> new_region (new FlatRegion ());
gx = std::max (db::Coord (1), gx);
gy = std::max (db::Coord (1), gy);
@ -1386,7 +1387,7 @@ AsIfFlatRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
} else if (! merged_semantics () || is_merged ()) {
// Generic case
std::unique_ptr<FlatRegion> new_region (new FlatRegion (false /*output isn't merged*/));
std::unique_ptr<FlatRegion> new_region (new FlatRegion ());
db::ShapeGenerator pc (new_region->raw_polygons (), false);
db::PolygonGenerator pg (pc, false, true);
@ -1395,6 +1396,12 @@ AsIfFlatRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
sf.put (*p);
}
// in case of negative sizing the output polygons will still be merged (on positive sizing they might
// overlap after size and are not necessarily merged)
if (dx < 0 && dy < 0 && is_merged ()) {
new_region->set_is_merged (true);
}
return new_region.release ();
} else {
@ -1416,7 +1423,7 @@ AsIfFlatRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
ep.insert (*p, n);
}
std::unique_ptr<FlatRegion> new_region (new FlatRegion (false /*output isn't merged*/));
std::unique_ptr<FlatRegion> new_region (new FlatRegion ());
db::ShapeGenerator pc (new_region->raw_polygons (), true /*clear*/);
db::PolygonGenerator pg2 (pc, false /*don't resolve holes*/, true /*min. coherence*/);
db::SizingPolygonFilter siz (pg2, dx, dy, mode);
@ -1424,6 +1431,12 @@ AsIfFlatRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
db::BooleanOp op (db::BooleanOp::Or);
ep.process (pg, op);
// in case of negative sizing the output polygons will still be merged (on positive sizing they might
// overlap after size and are not necessarily merged)
if (dx < 0 && dy < 0 && merged_semantics ()) {
new_region->set_is_merged (true);
}
return new_region.release ();
}

View File

@ -350,7 +350,7 @@ TEST(5_BoolXOR)
db::Region r42xor3 = r42 ^ r3;
db::Region r42xor42 = r42 ^ r42;
EXPECT_EQ (r2xor3.is_merged (), false);
EXPECT_EQ (r2xor3.is_merged (), true);
db::Layout target;
unsigned int target_top_cell_index = target.add_cell (ly.cell_name (top_cell_index));

BIN
testdata/algo/flat_region_au1.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au10.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au11.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au12.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au13.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au13b.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au14a.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au14b.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au15a.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au15b.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au16.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au17.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au18.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au19.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au2.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au20.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au21.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au22.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au27.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au28.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au29.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au3.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au31.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au3b.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au40.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au4a.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au4b.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au5.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au7.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/flat_region_au9a.gds vendored Normal file

Binary file not shown.