mirror of https://github.com/KLayout/klayout.git
WIP: flat region tests, partially working
This commit is contained in:
parent
db870614ab
commit
48b55f142a
|
|
@ -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 ();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue