mirror of https://github.com/KLayout/klayout.git
WIP: don't fallback to flat in case of non-deep other arguments in select_interacting and pull.
This commit is contained in:
parent
a1e87d4c14
commit
77c8ff50ed
|
|
@ -108,6 +108,15 @@ DeepEdges::DeepEdges (const RecursiveShapeIterator &si, DeepShapeStore &dss, con
|
|||
set_merged_semantics (merged_semantics);
|
||||
}
|
||||
|
||||
DeepEdges::DeepEdges (const db::Edges &other, DeepShapeStore &dss)
|
||||
: AsIfFlatEdges (), m_merged_edges ()
|
||||
{
|
||||
m_deep_layer = dss.create_from_flat (other);
|
||||
|
||||
init ();
|
||||
set_merged_semantics (other.merged_semantics ());
|
||||
}
|
||||
|
||||
DeepEdges::DeepEdges ()
|
||||
: AsIfFlatEdges ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class DB_PUBLIC DeepEdges
|
|||
{
|
||||
public:
|
||||
DeepEdges ();
|
||||
DeepEdges (const db::Edges &other, DeepShapeStore &dss);
|
||||
DeepEdges (const RecursiveShapeIterator &si, DeepShapeStore &dss, bool as_edges = true);
|
||||
DeepEdges (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool as_edges = true, bool merged_semantics = true);
|
||||
|
||||
|
|
|
|||
|
|
@ -1855,10 +1855,12 @@ DeepRegion::selected_interacting_generic (const Region &other, int mode, bool to
|
|||
// with these flag set to true, the resulting polygons are broken again.
|
||||
bool split_after = false;
|
||||
|
||||
std::auto_ptr<db::DeepRegion> dr_holder;
|
||||
const db::DeepRegion *other_deep = dynamic_cast<const db::DeepRegion *> (other.delegate ());
|
||||
if (! other_deep) {
|
||||
// @@@ turn into deep
|
||||
return db::AsIfFlatRegion::selected_interacting_generic (other, mode, touching, inverse);
|
||||
// if the other region isn't deep, turn into a top-level only deep region to facilitate re-hierarchisation
|
||||
dr_holder.reset (new db::DeepRegion (other, const_cast<db::DeepShapeStore &> (*deep_layer ().store ())));
|
||||
other_deep = dr_holder.get ();
|
||||
}
|
||||
|
||||
ensure_merged_polygons_valid ();
|
||||
|
|
@ -1890,10 +1892,12 @@ DeepRegion::selected_interacting_generic (const Edges &other, bool inverse) cons
|
|||
// with these flag set to true, the resulting polygons are broken again.
|
||||
bool split_after = false;
|
||||
|
||||
std::auto_ptr<db::DeepEdges> dr_holder;
|
||||
const db::DeepEdges *other_deep = dynamic_cast<const db::DeepEdges *> (other.delegate ());
|
||||
if (! other_deep) {
|
||||
// @@@ turn into deep
|
||||
return db::AsIfFlatRegion::selected_interacting_generic (other, inverse);
|
||||
// if the other region isn't deep, turn into a top-level only deep region to facilitate re-hierarchisation
|
||||
dr_holder.reset (new db::DeepEdges (other, const_cast<db::DeepShapeStore &> (*deep_layer ().store ())));
|
||||
other_deep = dr_holder.get ();
|
||||
}
|
||||
|
||||
ensure_merged_polygons_valid ();
|
||||
|
|
@ -1959,10 +1963,12 @@ DeepRegion::pull_generic (const Region &other, int mode, bool touching) const
|
|||
EdgesDelegate *
|
||||
DeepRegion::pull_generic (const Edges &other) const
|
||||
{
|
||||
std::auto_ptr<db::DeepEdges> dr_holder;
|
||||
const db::DeepEdges *other_deep = dynamic_cast<const db::DeepEdges *> (other.delegate ());
|
||||
if (! other_deep) {
|
||||
// @@@ see above
|
||||
return db::AsIfFlatRegion::pull_generic (other);
|
||||
// if the other region isn't deep, turn into a top-level only deep region to facilitate re-hierarchisation
|
||||
dr_holder.reset (new db::DeepEdges (other, const_cast<db::DeepShapeStore &> (*deep_layer ().store ())));
|
||||
other_deep = dr_holder.get ();
|
||||
}
|
||||
|
||||
ensure_merged_polygons_valid ();
|
||||
|
|
|
|||
|
|
@ -326,6 +326,36 @@ DeepLayer DeepShapeStore::create_from_flat (const db::Region ®ion, bool for_n
|
|||
return dl;
|
||||
}
|
||||
|
||||
DeepLayer DeepShapeStore::create_from_flat (const db::Edges &edges, const db::ICplxTrans &trans)
|
||||
{
|
||||
// reuse existing layer
|
||||
std::pair<bool, DeepLayer> lff = layer_for_flat (tl::id_of (edges.delegate ()));
|
||||
if (lff.first) {
|
||||
return lff.second;
|
||||
}
|
||||
|
||||
require_singular ();
|
||||
|
||||
unsigned int layer = layout ().insert_layer ();
|
||||
|
||||
db::Shapes *shapes = &initial_cell ().shapes (layer);
|
||||
db::Box world = db::Box::world ();
|
||||
|
||||
db::EdgeBuildingHierarchyBuilderShapeReceiver eb (false);
|
||||
|
||||
std::pair<db::RecursiveShapeIterator, db::ICplxTrans> ii = edges.begin_iter ();
|
||||
db::ICplxTrans ttop = trans * ii.second;
|
||||
while (! ii.first.at_end ()) {
|
||||
eb.push (*ii.first, ttop * ii.first.trans (), world, 0, shapes);
|
||||
++ii.first;
|
||||
}
|
||||
|
||||
DeepLayer dl (this, 0 /*singular layout index*/, layer);
|
||||
m_layers_for_flat [tl::id_of (edges.delegate ())] = std::make_pair (dl.layout_index (), dl.layer ());
|
||||
m_flat_region_id [std::make_pair (dl.layout_index (), dl.layer ())] = tl::id_of (edges.delegate ());
|
||||
return dl;
|
||||
}
|
||||
|
||||
std::pair<bool, DeepLayer> DeepShapeStore::layer_for_flat (const db::Region ®ion) const
|
||||
{
|
||||
return layer_for_flat (tl::id_of (region.delegate ()));
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ namespace db {
|
|||
|
||||
class DeepShapeStore;
|
||||
class Region;
|
||||
class Edges;
|
||||
|
||||
/**
|
||||
* @brief Represents a shape collection from the deep shape store
|
||||
|
|
@ -274,6 +275,17 @@ public:
|
|||
*/
|
||||
DeepLayer create_from_flat (const db::Region ®ion, bool for_netlist, double max_area_ratio = 0.0, size_t max_vertex_count = 0, const db::ICplxTrans &trans = db::ICplxTrans ());
|
||||
|
||||
/**
|
||||
* @brief Creates a new layer from a flat edge collection (or the edge collection is made flat)
|
||||
*
|
||||
* This method is intended for use with singular-created DSS objects (see
|
||||
* singular constructor).
|
||||
*
|
||||
* After a flat layer has been created for a region, it can be retrieved
|
||||
* from the region later with layer_for_flat (region).
|
||||
*/
|
||||
DeepLayer create_from_flat (const db::Edges ®ion, const db::ICplxTrans &trans = db::ICplxTrans ());
|
||||
|
||||
/**
|
||||
* @brief Gets the layer for a given flat region.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue