mirror of https://github.com/KLayout/klayout.git
WIP: bug fixes
This commit is contained in:
parent
7f2200cab5
commit
dc2ae953ed
|
|
@ -264,8 +264,13 @@ void AsIfFlatRegion::invalidate_bbox ()
|
|||
m_bbox_valid = false;
|
||||
}
|
||||
|
||||
void AsIfFlatRegion::merge_polygons_to (db::Shapes &output, bool min_coherence, unsigned int min_wc) const
|
||||
void AsIfFlatRegion::merge_polygons_to (db::Shapes &output, bool min_coherence, unsigned int min_wc, db::PropertiesRepository *target_rp) const
|
||||
{
|
||||
db::PropertyMapper pm;
|
||||
if (target_rp && properties_repository ()) {
|
||||
pm = db::PropertyMapper (*target_rp, *properties_repository ());
|
||||
}
|
||||
|
||||
db::EdgeProcessor ep (report_progress (), progress_desc ());
|
||||
ep.set_base_verbosity (base_verbosity ());
|
||||
|
||||
|
|
@ -318,7 +323,7 @@ void AsIfFlatRegion::merge_polygons_to (db::Shapes &output, bool min_coherence,
|
|||
|
||||
// and run the merge step
|
||||
db::MergeOp op (min_wc);
|
||||
db::ShapeGenerator pc (result, false /*don't clear*/, p->first);
|
||||
db::ShapeGenerator pc (result, false /*don't clear*/, pm (p->first));
|
||||
db::PolygonGenerator pg (pc, false /*don't resolve holes*/, min_coherence);
|
||||
ep.process (pg, op);
|
||||
|
||||
|
|
@ -346,7 +351,7 @@ void AsIfFlatRegion::merge_polygons_to (db::Shapes &output, bool min_coherence,
|
|||
|
||||
// and run the merge step
|
||||
db::MergeOp op (min_wc);
|
||||
db::ShapeGenerator pc (output, false /*don't clear*/, prop_id);
|
||||
db::ShapeGenerator pc (output, false /*don't clear*/, pm (prop_id));
|
||||
db::PolygonGenerator pg (pc, false /*don't resolve holes*/, min_coherence);
|
||||
ep.process (pg, op);
|
||||
|
||||
|
|
@ -1323,29 +1328,8 @@ AsIfFlatRegion::merged (bool min_coherence, unsigned int min_wc) const
|
|||
|
||||
} else {
|
||||
|
||||
db::EdgeProcessor ep (report_progress (), progress_desc ());
|
||||
ep.set_base_verbosity (base_verbosity ());
|
||||
|
||||
// count edges and reserve memory
|
||||
size_t n = 0;
|
||||
for (RegionIterator p (begin ()); ! p.at_end (); ++p, ++n) {
|
||||
n += p->vertices ();
|
||||
}
|
||||
ep.reserve (n);
|
||||
|
||||
// insert the polygons into the processor
|
||||
n = 0;
|
||||
for (RegionIterator p (begin ()); ! p.at_end (); ++p, ++n) {
|
||||
ep.insert (*p, n);
|
||||
}
|
||||
|
||||
std::unique_ptr<FlatRegion> new_region (new FlatRegion (true));
|
||||
|
||||
// and run the merge step
|
||||
db::MergeOp op (min_wc);
|
||||
db::ShapeGenerator pc (new_region->raw_polygons (), true /*clear*/);
|
||||
db::PolygonGenerator pg (pc, false /*don't resolve holes*/, min_coherence);
|
||||
ep.process (pg, op);
|
||||
merge_polygons_to (new_region->raw_polygons (), min_coherence, min_wc, new_region->properties_repository ());
|
||||
|
||||
return new_region.release ();
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ public:
|
|||
protected:
|
||||
void update_bbox (const db::Box &box);
|
||||
void invalidate_bbox ();
|
||||
void merge_polygons_to (db::Shapes &output, bool min_coherence, unsigned int min_wc) const;
|
||||
void merge_polygons_to (db::Shapes &output, bool min_coherence, unsigned int min_wc, PropertiesRepository *target_rp = 0) const;
|
||||
RegionDelegate *and_or_not_with (bool is_and, const Region &other, PropertyConstraint property_constraint) const;
|
||||
|
||||
virtual EdgePairsDelegate *run_check (db::edge_relation_type rel, bool different_polygons, const Region *other, db::Coord d, const RegionCheckOptions &options) const;
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ struct translate_into_shapes
|
|||
mp_shapes->insert (new_shape);
|
||||
}
|
||||
|
||||
template <class Sh, class T>
|
||||
template <class Sh>
|
||||
void operator() (const db::object_with_properties<Sh> &sh)
|
||||
{
|
||||
Sh new_shape;
|
||||
|
|
@ -495,7 +495,7 @@ struct translate_into_shapes
|
|||
mp_shapes->insert (db::object_with_properties<Sh> (new_shape, sh.properties_id ()));
|
||||
}
|
||||
|
||||
template <class Sh, class T, class PropIdMap>
|
||||
template <class Sh, class PropIdMap>
|
||||
void operator() (const db::object_with_properties<Sh> &sh, PropIdMap &pm)
|
||||
{
|
||||
Sh new_shape;
|
||||
|
|
|
|||
Loading…
Reference in New Issue