mirror of https://github.com/KLayout/klayout.git
Fixed some issues with operator+ and operator+= on Texts, Edges, Regions and EdgePairs with properties
This commit is contained in:
parent
e48c6f3660
commit
54242bc848
|
|
@ -630,10 +630,6 @@ AsIfFlatEdgePairs::add (const EdgePairs &other) const
|
|||
std::unique_ptr<FlatEdgePairs> new_edge_pairs (new FlatEdgePairs (*other_flat));
|
||||
new_edge_pairs->invalidate_cache ();
|
||||
|
||||
size_t n = new_edge_pairs->raw_edge_pairs ().size () + count ();
|
||||
|
||||
new_edge_pairs->reserve (n);
|
||||
|
||||
for (EdgePairsIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
db::properties_id_type prop_id = p.prop_id ();
|
||||
if (prop_id) {
|
||||
|
|
@ -649,10 +645,6 @@ AsIfFlatEdgePairs::add (const EdgePairs &other) const
|
|||
|
||||
std::unique_ptr<FlatEdgePairs> new_edge_pairs (new FlatEdgePairs ());
|
||||
|
||||
size_t n = count () + other.count ();
|
||||
|
||||
new_edge_pairs->reserve (n);
|
||||
|
||||
for (EdgePairsIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
db::properties_id_type prop_id = p.prop_id ();
|
||||
if (prop_id) {
|
||||
|
|
|
|||
|
|
@ -1012,12 +1012,12 @@ AsIfFlatEdges::add (const Edges &other) const
|
|||
new_edges->set_is_merged (false);
|
||||
new_edges->invalidate_cache ();
|
||||
|
||||
size_t n = new_edges->raw_edges ().size () + count ();
|
||||
|
||||
new_edges->reserve (n);
|
||||
|
||||
for (EdgesIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
new_edges->raw_edges ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_edges->raw_edges ().insert (*p);
|
||||
} else {
|
||||
new_edges->raw_edges ().insert (db::EdgeWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
return new_edges.release ();
|
||||
|
|
@ -1026,15 +1026,19 @@ AsIfFlatEdges::add (const Edges &other) const
|
|||
|
||||
std::unique_ptr<FlatEdges> new_edges (new FlatEdges (false /*not merged*/));
|
||||
|
||||
size_t n = count () + other.count ();
|
||||
|
||||
new_edges->reserve (n);
|
||||
|
||||
for (EdgesIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
new_edges->raw_edges ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_edges->raw_edges ().insert (*p);
|
||||
} else {
|
||||
new_edges->raw_edges ().insert (db::EdgeWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
for (EdgesIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
new_edges->raw_edges ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_edges->raw_edges ().insert (*p);
|
||||
} else {
|
||||
new_edges->raw_edges ().insert (db::EdgeWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
return new_edges.release ();
|
||||
|
|
|
|||
|
|
@ -1821,12 +1821,12 @@ AsIfFlatRegion::add (const Region &other) const
|
|||
new_region->set_is_merged (false);
|
||||
new_region->invalidate_cache ();
|
||||
|
||||
size_t n = new_region->raw_polygons ().size () + count ();
|
||||
|
||||
new_region->reserve (n);
|
||||
|
||||
for (RegionIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
} else {
|
||||
new_region->raw_polygons ().insert (db::PolygonWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
return new_region.release ();
|
||||
|
|
@ -1835,15 +1835,19 @@ AsIfFlatRegion::add (const Region &other) const
|
|||
|
||||
std::unique_ptr<FlatRegion> new_region (new FlatRegion (false /*not merged*/));
|
||||
|
||||
size_t n = count () + other.count ();
|
||||
|
||||
new_region->reserve (n);
|
||||
|
||||
for (RegionIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
} else {
|
||||
new_region->raw_polygons ().insert (db::PolygonWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
for (RegionIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
} else {
|
||||
new_region->raw_polygons ().insert (db::PolygonWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
return new_region.release ();
|
||||
|
|
|
|||
|
|
@ -247,12 +247,12 @@ AsIfFlatTexts::add (const Texts &other) const
|
|||
std::unique_ptr<FlatTexts> new_texts (new FlatTexts (*other_flat));
|
||||
new_texts->invalidate_cache ();
|
||||
|
||||
size_t n = new_texts->raw_texts ().size () + count ();
|
||||
|
||||
new_texts->reserve (n);
|
||||
|
||||
for (TextsIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
} else {
|
||||
new_texts->raw_texts ().insert (TextWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
return new_texts.release ();
|
||||
|
|
@ -261,15 +261,19 @@ AsIfFlatTexts::add (const Texts &other) const
|
|||
|
||||
std::unique_ptr<FlatTexts> new_texts (new FlatTexts ());
|
||||
|
||||
size_t n = count () + other.count ();
|
||||
|
||||
new_texts->reserve (n);
|
||||
|
||||
for (TextsIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
} else {
|
||||
new_texts->raw_texts ().insert (db::TextWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
for (TextsIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
} else {
|
||||
new_texts->raw_texts ().insert (db::TextWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
return new_texts.release ();
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void DeepEdgePairs::do_insert (const db::EdgePair &edge_pair, db::properties_id_
|
|||
db::Layout &layout = deep_layer ().layout ();
|
||||
if (layout.begin_top_down () != layout.end_top_down ()) {
|
||||
db::Cell &top_cell = layout.cell (*layout.begin_top_down ());
|
||||
if (prop_id != 0) {
|
||||
if (prop_id == 0) {
|
||||
top_cell.shapes (deep_layer ().layer ()).insert (edge_pair);
|
||||
} else {
|
||||
top_cell.shapes (deep_layer ().layer ()).insert (db::EdgePairWithProperties (edge_pair, prop_id));
|
||||
|
|
@ -344,9 +344,12 @@ DeepEdgePairs::add_in_place (const EdgePairs &other)
|
|||
|
||||
db::Shapes &shapes = deep_layer ().initial_cell ().shapes (deep_layer ().layer ());
|
||||
for (db::EdgePairs::const_iterator p = other.begin (); ! p.at_end (); ++p) {
|
||||
shapes.insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
shapes.insert (*p);
|
||||
} else {
|
||||
shapes.insert (db::EdgePairWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -1236,7 +1236,11 @@ DeepEdges::add_in_place (const Edges &other)
|
|||
|
||||
db::Shapes &shapes = deep_layer ().initial_cell ().shapes (deep_layer ().layer ());
|
||||
for (db::Edges::const_iterator p = other.begin (); ! p.at_end (); ++p) {
|
||||
shapes.insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
shapes.insert (*p);
|
||||
} else {
|
||||
shapes.insert (db::EdgeWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1125,6 +1125,7 @@ DeepRegion::add_in_place (const Region &other)
|
|||
db::Shapes &shapes = deep_layer ().initial_cell ().shapes (deep_layer ().layer ());
|
||||
db::PolygonRefToShapesGenerator pr (const_cast<db::Layout *> (& deep_layer ().layout ()), &shapes);
|
||||
for (db::Region::const_iterator p = other.begin (); ! p.at_end (); ++p) {
|
||||
pr.set_prop_id (p.prop_id ());
|
||||
pr.put (*p);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ void DeepTexts::do_insert (const db::Text &text, db::properties_id_type prop_id)
|
|||
db::Layout &layout = deep_layer ().layout ();
|
||||
if (layout.begin_top_down () != layout.end_top_down ()) {
|
||||
db::Cell &top_cell = layout.cell (*layout.begin_top_down ());
|
||||
if (prop_id != 0) {
|
||||
if (prop_id == 0) {
|
||||
top_cell.shapes (deep_layer ().layer ()).insert (db::TextRef (text, layout.shape_repository ()));
|
||||
} else {
|
||||
top_cell.shapes (deep_layer ().layer ()).insert (db::TextRefWithProperties (db::TextRef (text, layout.shape_repository ()), prop_id));
|
||||
|
|
@ -365,7 +365,11 @@ DeepTexts::add_in_place (const Texts &other)
|
|||
|
||||
db::Shapes &shapes = deep_layer ().initial_cell ().shapes (deep_layer ().layer ());
|
||||
for (db::Texts::const_iterator p = other.begin (); ! p.at_end (); ++p) {
|
||||
shapes.insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
shapes.insert (*p);
|
||||
} else {
|
||||
shapes.insert (db::TextWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,13 @@ EdgePairs::EdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss, con
|
|||
mp_delegate = new DeepEdgePairs (si, dss, trans);
|
||||
}
|
||||
|
||||
EdgePairs::EdgePairs (DeepShapeStore &dss)
|
||||
{
|
||||
tl_assert (dss.is_singular ());
|
||||
unsigned int layout_index = 0; // singular layout index
|
||||
mp_delegate = new DeepEdgePairs (DeepLayer (&dss, layout_index, dss.layout (layout_index).insert_layer ()));
|
||||
}
|
||||
|
||||
void
|
||||
EdgePairs::write (const std::string &fn) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -196,6 +196,12 @@ public:
|
|||
*/
|
||||
explicit EdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans);
|
||||
|
||||
/**
|
||||
* @brief Creates a new empty layer inside the dss
|
||||
* This method requires the DSS to be singular.
|
||||
*/
|
||||
explicit EdgePairs (DeepShapeStore &dss);
|
||||
|
||||
/**
|
||||
* @brief Writes the edge pair collection to a file
|
||||
*
|
||||
|
|
|
|||
|
|
@ -107,6 +107,13 @@ Edges::Edges (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::I
|
|||
mp_delegate = new DeepEdges (si, dss, trans, as_edges, merged_semantics);
|
||||
}
|
||||
|
||||
Edges::Edges (DeepShapeStore &dss)
|
||||
{
|
||||
tl_assert (dss.is_singular ());
|
||||
unsigned int layout_index = 0; // singular layout index
|
||||
mp_delegate = new DeepEdges (DeepLayer (&dss, layout_index, dss.layout (layout_index).insert_layer ()));
|
||||
}
|
||||
|
||||
const db::RecursiveShapeIterator &
|
||||
Edges::iter () const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -258,6 +258,12 @@ public:
|
|||
*/
|
||||
explicit Edges (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool as_edges = true, bool merged_semantics = true);
|
||||
|
||||
/**
|
||||
* @brief Creates a new empty layer inside the dss
|
||||
* This method requires the DSS to be singular.
|
||||
*/
|
||||
explicit Edges (DeepShapeStore &dss);
|
||||
|
||||
/**
|
||||
* @brief Implementation of the ShapeCollection interface
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -314,18 +314,16 @@ EdgesDelegate *FlatEdges::add (const Edges &other) const
|
|||
if (other_flat) {
|
||||
|
||||
new_region->raw_edges ().insert (other_flat->raw_edges ().get_layer<db::Edge, db::unstable_layer_tag> ().begin (), other_flat->raw_edges ().get_layer<db::Edge, db::unstable_layer_tag> ().end ());
|
||||
new_region->raw_edges ().insert (other_flat->raw_edges ().get_layer<db::EdgeWithProperties, db::unstable_layer_tag> ().begin (), other_flat->raw_edges ().get_layer<db::EdgeWithProperties, db::unstable_layer_tag> ().end ());
|
||||
|
||||
} else {
|
||||
|
||||
size_t n = new_region->raw_edges ().size ();
|
||||
for (EdgesIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
++n;
|
||||
}
|
||||
|
||||
new_region->raw_edges ().reserve (db::Edge::tag (), n);
|
||||
|
||||
for (EdgesIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
new_region->raw_edges ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_region->raw_edges ().insert (*p);
|
||||
} else {
|
||||
new_region->raw_edges ().insert (db::EdgeWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -344,18 +342,16 @@ EdgesDelegate *FlatEdges::add_in_place (const Edges &other)
|
|||
if (other_flat) {
|
||||
|
||||
e.insert (other_flat->raw_edges ().get_layer<db::Edge, db::unstable_layer_tag> ().begin (), other_flat->raw_edges ().get_layer<db::Edge, db::unstable_layer_tag> ().end ());
|
||||
e.insert (other_flat->raw_edges ().get_layer<db::EdgeWithProperties, db::unstable_layer_tag> ().begin (), other_flat->raw_edges ().get_layer<db::EdgeWithProperties, db::unstable_layer_tag> ().end ());
|
||||
|
||||
} else {
|
||||
|
||||
size_t n = e.size ();
|
||||
for (EdgesIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
++n;
|
||||
}
|
||||
|
||||
e.reserve (db::Edge::tag (), n);
|
||||
|
||||
for (EdgesIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
e.insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
e.insert (*p);
|
||||
} else {
|
||||
e.insert (db::EdgeWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,15 +323,12 @@ RegionDelegate *FlatRegion::add (const Region &other) const
|
|||
|
||||
} else {
|
||||
|
||||
size_t n = new_region->raw_polygons ().size ();
|
||||
for (RegionIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
++n;
|
||||
}
|
||||
|
||||
new_region->raw_polygons ().reserve (db::Polygon::tag (), n);
|
||||
|
||||
for (RegionIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_region->raw_polygons ().insert (*p);
|
||||
} else {
|
||||
new_region->raw_polygons ().insert (db::PolygonWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -354,15 +351,12 @@ RegionDelegate *FlatRegion::add_in_place (const Region &other)
|
|||
|
||||
} else {
|
||||
|
||||
size_t n = polygons.size ();
|
||||
for (RegionIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
++n;
|
||||
}
|
||||
|
||||
polygons.reserve (db::Polygon::tag (), n);
|
||||
|
||||
for (RegionIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
polygons.insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
polygons.insert (*p);
|
||||
} else {
|
||||
polygons.insert (db::PolygonWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,18 +125,16 @@ TextsDelegate *FlatTexts::add (const Texts &other) const
|
|||
if (other_flat) {
|
||||
|
||||
new_texts->raw_texts ().insert (other_flat->raw_texts ().get_layer<db::Text, db::unstable_layer_tag> ().begin (), other_flat->raw_texts ().get_layer<db::Text, db::unstable_layer_tag> ().end ());
|
||||
new_texts->raw_texts ().insert (other_flat->raw_texts ().get_layer<db::TextWithProperties, db::unstable_layer_tag> ().begin (), other_flat->raw_texts ().get_layer<db::TextWithProperties, db::unstable_layer_tag> ().end ());
|
||||
|
||||
} else {
|
||||
|
||||
size_t n = new_texts->raw_texts ().size ();
|
||||
for (TextsIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
++n;
|
||||
}
|
||||
|
||||
new_texts->raw_texts ().reserve (db::Text::tag (), n);
|
||||
|
||||
for (TextsIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
new_texts->raw_texts ().insert (*p);
|
||||
} else {
|
||||
new_texts->raw_texts ().insert (db::TextWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -154,18 +152,16 @@ TextsDelegate *FlatTexts::add_in_place (const Texts &other)
|
|||
if (other_flat) {
|
||||
|
||||
texts.insert (other_flat->raw_texts ().get_layer<db::Text, db::unstable_layer_tag> ().begin (), other_flat->raw_texts ().get_layer<db::Text, db::unstable_layer_tag> ().end ());
|
||||
texts.insert (other_flat->raw_texts ().get_layer<db::TextWithProperties, db::unstable_layer_tag> ().begin (), other_flat->raw_texts ().get_layer<db::TextWithProperties, db::unstable_layer_tag> ().end ());
|
||||
|
||||
} else {
|
||||
|
||||
size_t n = texts.size ();
|
||||
for (TextsIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
++n;
|
||||
}
|
||||
|
||||
texts.reserve (db::Text::tag (), n);
|
||||
|
||||
for (TextsIterator p (other.begin ()); ! p.at_end (); ++p) {
|
||||
texts.insert (*p);
|
||||
if (p.prop_id () == 0) {
|
||||
texts.insert (*p);
|
||||
} else {
|
||||
texts.insert (db::TextWithProperties (*p, p.prop_id ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,13 @@ Texts::Texts (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::I
|
|||
mp_delegate = new DeepTexts (si, dss, trans);
|
||||
}
|
||||
|
||||
Texts::Texts (DeepShapeStore &dss)
|
||||
{
|
||||
tl_assert (dss.is_singular ());
|
||||
unsigned int layout_index = 0; // singular layout index
|
||||
mp_delegate = new DeepTexts (DeepLayer (&dss, layout_index, dss.layout (layout_index).insert_layer ()));
|
||||
}
|
||||
|
||||
void
|
||||
Texts::write (const std::string &fn) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,6 +192,12 @@ public:
|
|||
*/
|
||||
explicit Texts (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans);
|
||||
|
||||
/**
|
||||
* @brief Creates a new empty layer inside the dss
|
||||
* This method requires the DSS to be singular.
|
||||
*/
|
||||
explicit Texts (DeepShapeStore &dss);
|
||||
|
||||
/**
|
||||
* @brief Writes the text collection to a file
|
||||
*
|
||||
|
|
|
|||
|
|
@ -210,3 +210,72 @@ TEST(5_InternalAngleFilter)
|
|||
EXPECT_EQ (db::InternalAngleEdgePairFilter (0.0, true, 45.0, true, true).selected (ep45), false);
|
||||
EXPECT_EQ (db::InternalAngleEdgePairFilter (0.0, true, 45.0, true, true).selected (ep45inv), false);
|
||||
}
|
||||
|
||||
TEST(6_add_with_properties)
|
||||
{
|
||||
db::DeepShapeStore dss ("TOP", 0.001);
|
||||
db::EdgePairs rd1 (dss), rd2 (dss);
|
||||
db::EdgePairs rf1, rf2;
|
||||
|
||||
db::PropertiesSet ps;
|
||||
ps.insert ("net", 17);
|
||||
db::properties_id_type pid = db::properties_id (ps);
|
||||
|
||||
rf1.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (-10, 20, 20, 60), db::Edge (-10, 30, 20, 70)), pid));
|
||||
rd1.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (-10, 20, 20, 60), db::Edge (-10, 30, 20, 70)), pid));
|
||||
|
||||
rf2.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (10, 20, -20, 60), db::Edge (10, 30, -20, 70)), pid));
|
||||
rd2.insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (10, 20, -20, 60), db::Edge (10, 30, -20, 70)), pid));
|
||||
|
||||
db::Layout ly;
|
||||
db::Cell &top_cell = ly.cell (ly.add_cell ("TOP"));
|
||||
unsigned int l1 = ly.insert_layer ();
|
||||
unsigned int l2 = ly.insert_layer ();
|
||||
|
||||
top_cell.shapes (l1).insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (-10, 20, 20, 60), db::Edge (-10, 30, 20, 70)), pid));
|
||||
top_cell.shapes (l2).insert (db::EdgePairWithProperties (db::EdgePair (db::Edge (10, 20, -20, 60), db::Edge (10, 30, -20, 70)), pid));
|
||||
|
||||
db::EdgePairs ro1 (db::RecursiveShapeIterator (ly, top_cell, l1));
|
||||
db::EdgePairs ro2 (db::RecursiveShapeIterator (ly, top_cell, l2));
|
||||
|
||||
// enable properties
|
||||
ro1.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
ro2.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
|
||||
db::EdgePairs r;
|
||||
r += rf1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rf2).to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
|
||||
r = db::EdgePairs ();
|
||||
r += rd1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rf2).to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
|
||||
r = db::EdgePairs ();
|
||||
r += rf1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rd2).to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
|
||||
r = db::EdgePairs ();
|
||||
r += rd1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rd2).to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
|
||||
r = db::EdgePairs ();
|
||||
r += ro1;
|
||||
r += ro2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
EXPECT_EQ ((ro1 + ro2).to_string (), "(-10,20;20,60)/(-10,30;20,70){net=>17};(10,20;-20,60)/(10,30;-20,70){net=>17}");
|
||||
|
||||
r = db::EdgePairs ();
|
||||
r += ro1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(10,20;-20,60)/(10,30;-20,70){net=>17};(-10,20;20,60)/(-10,30;20,70){net=>17}");
|
||||
EXPECT_EQ ((ro1 + rf2).to_string (), "(10,20;-20,60)/(10,30;-20,70){net=>17};(-10,20;20,60)/(-10,30;20,70){net=>17}");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1375,6 +1375,74 @@ TEST(31)
|
|||
db::compare_layouts (_this, target, tl::testdata () + "/algo/deep_edges_au3_flat.gds");
|
||||
}
|
||||
|
||||
TEST(32_add_with_properties)
|
||||
{
|
||||
db::DeepShapeStore dss ("TOP", 0.001);
|
||||
db::Edges rd1 (dss), rd2 (dss);
|
||||
db::Edges rf1, rf2;
|
||||
|
||||
db::PropertiesSet ps;
|
||||
ps.insert ("net", 17);
|
||||
db::properties_id_type pid = db::properties_id (ps);
|
||||
|
||||
rf1.insert (db::EdgeWithProperties (db::Edge (-10, 20, 20, 60), pid));
|
||||
rd1.insert (db::EdgeWithProperties (db::Edge (-10, 20, 20, 60), pid));
|
||||
|
||||
rf2.insert (db::EdgeWithProperties (db::Edge (10, 20, 40, 60), pid));
|
||||
rd2.insert (db::EdgeWithProperties (db::Edge (10, 20, 40, 60), pid));
|
||||
|
||||
db::Layout ly;
|
||||
db::Cell &top_cell = ly.cell (ly.add_cell ("TOP"));
|
||||
unsigned int l1 = ly.insert_layer ();
|
||||
unsigned int l2 = ly.insert_layer ();
|
||||
|
||||
top_cell.shapes (l1).insert (db::EdgeWithProperties (db::Edge (-10, 20, 20, 60), pid));
|
||||
top_cell.shapes (l2).insert (db::EdgeWithProperties (db::Edge (10, 20, 40, 60), pid));
|
||||
|
||||
db::Edges ro1 (db::RecursiveShapeIterator (ly, top_cell, l1), false);
|
||||
db::Edges ro2 (db::RecursiveShapeIterator (ly, top_cell, l2), false);
|
||||
|
||||
// enable properties
|
||||
ro1.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
ro2.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
|
||||
db::Edges r;
|
||||
r += rf1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rf2).to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
|
||||
r = db::Edges ();
|
||||
r += rd1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rf2).to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
|
||||
r = db::Edges ();
|
||||
r += rf1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rd2).to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
|
||||
r = db::Edges ();
|
||||
r += rd1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rd2).to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
|
||||
r = db::Edges ();
|
||||
r += ro1;
|
||||
r += ro2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
EXPECT_EQ ((ro1 + ro2).to_string (), "(-10,20;20,60){net=>17};(10,20;40,60){net=>17}");
|
||||
|
||||
r = db::Edges ();
|
||||
r += ro1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(10,20;40,60){net=>17};(-10,20;20,60){net=>17}");
|
||||
EXPECT_EQ ((ro1 + rf2).to_string (), "(10,20;40,60){net=>17};(-10,20;20,60){net=>17}");
|
||||
}
|
||||
|
||||
// GitHub issue #72 (Edges/Region NOT issue)
|
||||
TEST(100)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2804,6 +2804,74 @@ TEST(63_sized_outside_deep)
|
|||
}
|
||||
}
|
||||
|
||||
TEST(64_add_with_properties)
|
||||
{
|
||||
db::DeepShapeStore dss ("TOP", 0.001);
|
||||
db::Region rd1 (dss), rd2 (dss);
|
||||
db::Region rf1, rf2;
|
||||
|
||||
db::PropertiesSet ps;
|
||||
ps.insert ("net", 17);
|
||||
db::properties_id_type pid = db::properties_id (ps);
|
||||
|
||||
rf1.insert (db::BoxWithProperties (db::Box (-10, 20, 20, 60), pid));
|
||||
rd1.insert (db::BoxWithProperties (db::Box (-10, 20, 20, 60), pid));
|
||||
|
||||
rf2.insert (db::BoxWithProperties (db::Box (10, 20, 40, 60), pid));
|
||||
rd2.insert (db::BoxWithProperties (db::Box (10, 20, 40, 60), pid));
|
||||
|
||||
db::Layout ly;
|
||||
db::Cell &top_cell = ly.cell (ly.add_cell ("TOP"));
|
||||
unsigned int l1 = ly.insert_layer ();
|
||||
unsigned int l2 = ly.insert_layer ();
|
||||
|
||||
top_cell.shapes (l1).insert (db::BoxWithProperties (db::Box (-10, 20, 20, 60), pid));
|
||||
top_cell.shapes (l2).insert (db::BoxWithProperties (db::Box (10, 20, 40, 60), pid));
|
||||
|
||||
db::Region ro1 (db::RecursiveShapeIterator (ly, top_cell, l1));
|
||||
db::Region ro2 (db::RecursiveShapeIterator (ly, top_cell, l2));
|
||||
|
||||
// enable properties
|
||||
ro1.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
ro2.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
|
||||
db::Region r;
|
||||
r += rf1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rf2).to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
|
||||
r = db::Region ();
|
||||
r += rd1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rf2).to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
|
||||
r = db::Region ();
|
||||
r += rf1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rd2).to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
|
||||
r = db::Region ();
|
||||
r += rd1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rd2).to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
|
||||
r = db::Region ();
|
||||
r += ro1;
|
||||
r += ro2;
|
||||
EXPECT_EQ (r.to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
EXPECT_EQ ((ro1 + ro2).to_string (), "(-10,20;-10,60;20,60;20,20){net=>17};(10,20;10,60;40,60;40,20){net=>17}");
|
||||
|
||||
r = db::Region ();
|
||||
r += ro1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "(10,20;10,60;40,60;40,20){net=>17};(-10,20;-10,60;20,60;20,20){net=>17}");
|
||||
EXPECT_EQ ((ro1 + rf2).to_string (), "(10,20;10,60;40,60;40,20){net=>17};(-10,20;-10,60;20,60;20,20){net=>17}");
|
||||
}
|
||||
|
||||
TEST(100_Processors)
|
||||
{
|
||||
db::Region r;
|
||||
|
|
@ -2895,3 +2963,4 @@ TEST(issue_909)
|
|||
db::Region r = r1 + r2;
|
||||
EXPECT_EQ (r.to_string (), "(0,0;0,100;100,100;100,0);(0,0;0,300;200,300;200,0)");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,3 +208,71 @@ TEST(7)
|
|||
texts.pull_interacting (region_out, region);
|
||||
EXPECT_EQ (region_out.to_string (), "(50,-300;50,-100;150,-100;150,-300)");
|
||||
}
|
||||
|
||||
TEST(8_add_with_properties)
|
||||
{
|
||||
db::DeepShapeStore dss ("TOP", 0.001);
|
||||
db::Texts rd1 (dss), rd2 (dss);
|
||||
db::Texts rf1, rf2;
|
||||
|
||||
db::PropertiesSet ps;
|
||||
ps.insert ("net", 17);
|
||||
db::properties_id_type pid = db::properties_id (ps);
|
||||
|
||||
rf1.insert (db::TextWithProperties (db::Text ("abc", db::Trans (db::Vector (10, 20))), pid));
|
||||
rd1.insert (db::TextWithProperties (db::Text ("abc", db::Trans (db::Vector (10, 20))), pid));
|
||||
|
||||
rf2.insert (db::TextWithProperties (db::Text ("uvw", db::Trans (db::Vector (-10, 20))), pid));
|
||||
rd2.insert (db::TextWithProperties (db::Text ("uvw", db::Trans (db::Vector (-10, 20))), pid));
|
||||
|
||||
db::Layout ly;
|
||||
db::Cell &top_cell = ly.cell (ly.add_cell ("TOP"));
|
||||
unsigned int l1 = ly.insert_layer ();
|
||||
unsigned int l2 = ly.insert_layer ();
|
||||
|
||||
top_cell.shapes (l1).insert (db::TextWithProperties (db::Text ("abc", db::Trans (db::Vector (10, 20))), pid));
|
||||
top_cell.shapes (l2).insert (db::TextWithProperties (db::Text ("uvw", db::Trans (db::Vector (-10, 20))), pid));
|
||||
|
||||
db::Texts ro1 (db::RecursiveShapeIterator (ly, top_cell, l1));
|
||||
db::Texts ro2 (db::RecursiveShapeIterator (ly, top_cell, l2));
|
||||
|
||||
// enable properties
|
||||
ro1.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
ro2.apply_property_translator (db::PropertiesTranslator::make_pass_all ());
|
||||
|
||||
db::Texts r;
|
||||
r += rf1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rf2).to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
|
||||
r = db::Texts ();
|
||||
r += rd1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "('uvw',r0 -10,20){net=>17};('abc',r0 10,20){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rf2).to_string (), "('uvw',r0 -10,20){net=>17};('abc',r0 10,20){net=>17}");
|
||||
|
||||
r = db::Texts ();
|
||||
r += rf1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
EXPECT_EQ ((rf1 + rd2).to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
|
||||
r = db::Texts ();
|
||||
r += rd1;
|
||||
r += rd2;
|
||||
EXPECT_EQ (r.to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
EXPECT_EQ ((rd1 + rd2).to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
|
||||
r = db::Texts ();
|
||||
r += ro1;
|
||||
r += ro2;
|
||||
EXPECT_EQ (r.to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
EXPECT_EQ ((ro1 + ro2).to_string (), "('abc',r0 10,20){net=>17};('uvw',r0 -10,20){net=>17}");
|
||||
|
||||
r = db::Texts ();
|
||||
r += ro1;
|
||||
r += rf2;
|
||||
EXPECT_EQ (r.to_string (), "('uvw',r0 -10,20){net=>17};('abc',r0 10,20){net=>17}");
|
||||
EXPECT_EQ ((ro1 + rf2).to_string (), "('uvw',r0 -10,20){net=>17};('abc',r0 10,20){net=>17}");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue