diff --git a/src/db/db/dbAsIfFlatEdgePairs.cc b/src/db/db/dbAsIfFlatEdgePairs.cc index c733966b9..568ea3efb 100644 --- a/src/db/db/dbAsIfFlatEdgePairs.cc +++ b/src/db/db/dbAsIfFlatEdgePairs.cc @@ -81,6 +81,9 @@ AsIfFlatEdgePairs::to_string (size_t nmax) const } first = false; os << p->to_string (); + if (p.prop_id () != 0) { + os << db::properties (p.prop_id ()).to_dict_var ().to_string (); + } } if (! p.at_end ()) { os << "..."; diff --git a/src/db/db/dbAsIfFlatEdges.cc b/src/db/db/dbAsIfFlatEdges.cc index 3a09e4bc0..6a4b51e06 100644 --- a/src/db/db/dbAsIfFlatEdges.cc +++ b/src/db/db/dbAsIfFlatEdges.cc @@ -89,6 +89,9 @@ AsIfFlatEdges::to_string (size_t nmax) const } first = false; os << p->to_string (); + if (p.prop_id () != 0) { + os << db::properties (p.prop_id ()).to_dict_var ().to_string (); + } } if (! p.at_end ()) { os << "..."; diff --git a/src/db/db/dbAsIfFlatTexts.cc b/src/db/db/dbAsIfFlatTexts.cc index c5498fd64..56d5cc803 100644 --- a/src/db/db/dbAsIfFlatTexts.cc +++ b/src/db/db/dbAsIfFlatTexts.cc @@ -79,6 +79,9 @@ AsIfFlatTexts::to_string (size_t nmax) const } first = false; os << p->to_string (); + if (p.prop_id () != 0) { + os << db::properties (p.prop_id ()).to_dict_var ().to_string (); + } } if (! p.at_end ()) { os << "..."; diff --git a/src/db/db/dbDeepEdgePairs.cc b/src/db/db/dbDeepEdgePairs.cc index 80c4f752a..16cb80de9 100644 --- a/src/db/db/dbDeepEdgePairs.cc +++ b/src/db/db/dbDeepEdgePairs.cc @@ -161,12 +161,16 @@ EdgePairsDelegate *DeepEdgePairs::clone () const return new DeepEdgePairs (*this); } -void DeepEdgePairs::do_insert (const db::EdgePair &edge_pair) +void DeepEdgePairs::do_insert (const db::EdgePair &edge_pair, 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 ()); - top_cell.shapes (deep_layer ().layer ()).insert (edge_pair); + 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)); + } } invalidate_bbox (); diff --git a/src/db/db/dbDeepEdgePairs.h b/src/db/db/dbDeepEdgePairs.h index b8d346148..20397185a 100644 --- a/src/db/db/dbDeepEdgePairs.h +++ b/src/db/db/dbDeepEdgePairs.h @@ -50,7 +50,7 @@ public: EdgePairsDelegate *clone () const; - virtual void do_insert (const db::EdgePair &edge_pair); + virtual void do_insert (const db::EdgePair &edge_pair, db::properties_id_type prop_id); virtual void do_transform (const db::Trans &t); virtual void do_transform (const db::ICplxTrans &t); diff --git a/src/db/db/dbDeepTexts.cc b/src/db/db/dbDeepTexts.cc index 6a751cec2..b542a5e0a 100644 --- a/src/db/db/dbDeepTexts.cc +++ b/src/db/db/dbDeepTexts.cc @@ -178,12 +178,16 @@ TextsDelegate *DeepTexts::clone () const return new DeepTexts (*this); } -void DeepTexts::do_insert (const db::Text &text) +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 ()); - top_cell.shapes (deep_layer ().layer ()).insert (db::TextRef (text, layout.shape_repository ())); + 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)); + } } invalidate_bbox (); diff --git a/src/db/db/dbDeepTexts.h b/src/db/db/dbDeepTexts.h index 5917e142f..e34a61284 100644 --- a/src/db/db/dbDeepTexts.h +++ b/src/db/db/dbDeepTexts.h @@ -51,7 +51,7 @@ public: TextsDelegate *clone () const; - virtual void do_insert (const db::Text &text); + virtual void do_insert (const db::Text &text, properties_id_type prop_id); virtual void do_transform (const db::Trans &t); virtual void do_transform (const db::ICplxTrans &t); diff --git a/src/db/db/dbEdgePairs.cc b/src/db/db/dbEdgePairs.cc index 7f388b513..68f3f64c7 100644 --- a/src/db/db/dbEdgePairs.cc +++ b/src/db/db/dbEdgePairs.cc @@ -120,6 +120,7 @@ void EdgePairs::insert (const Sh &shape) } template DB_PUBLIC void EdgePairs::insert (const db::EdgePair &); +template DB_PUBLIC void EdgePairs::insert (const db::EdgePairWithProperties &); void EdgePairs::insert (const db::Shape &shape) { diff --git a/src/db/db/dbEdgePairs.h b/src/db/db/dbEdgePairs.h index 5333e1b06..723885d08 100644 --- a/src/db/db/dbEdgePairs.h +++ b/src/db/db/dbEdgePairs.h @@ -128,6 +128,17 @@ public: insert (s); } + /** + * @brief Constructor from an object with properties + * + * Creates an edge pair set representing a single instance of that object + */ + explicit EdgePairs (const db::EdgePairWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Constructor from an object * diff --git a/src/db/db/dbEdges.h b/src/db/db/dbEdges.h index 649ded1c3..db2398164 100644 --- a/src/db/db/dbEdges.h +++ b/src/db/db/dbEdges.h @@ -112,6 +112,17 @@ public: insert (s); } + /** + * @brief Constructor from a box with properties + * + * Creates an edge set representing the contour of the box + */ + explicit Edges (const db::BoxWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Constructor from a simple polygon * @@ -123,6 +134,17 @@ public: insert (s); } + /** + * @brief Constructor from a simple polygon with properties + * + * Creates an edge set representing the contour of the polygon + */ + explicit Edges (const db::SimplePolygonWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Constructor from a polygon * @@ -134,6 +156,17 @@ public: insert (s); } + /** + * @brief Constructor from a polygon with properties + * + * Creates an edge set representing the contour of the polygon + */ + explicit Edges (const db::PolygonWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Constructor from a path * @@ -145,6 +178,17 @@ public: insert (s); } + /** + * @brief Constructor from a path with properties + * + * Creates an edge set representing the contour of the path + */ + explicit Edges (const db::PathWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Constructor from an edge * @@ -156,6 +200,17 @@ public: insert (s); } + /** + * @brief Constructor from an edge with properties + * + * Creates an edge set representing the single edge + */ + explicit Edges (const db::EdgeWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Sequence constructor * diff --git a/src/db/db/dbFlatEdgePairs.cc b/src/db/db/dbFlatEdgePairs.cc index f19463faa..e6b9808ac 100644 --- a/src/db/db/dbFlatEdgePairs.cc +++ b/src/db/db/dbFlatEdgePairs.cc @@ -221,9 +221,13 @@ FlatEdgePairs::insert_into (Layout *layout, db::cell_index_type into_cell, unsig } void -FlatEdgePairs::do_insert (const db::EdgePair &ep) +FlatEdgePairs::do_insert (const db::EdgePair &ep, db::properties_id_type prop_id) { - mp_edge_pairs->insert (ep); + if (prop_id != 0) { + mp_edge_pairs->insert (db::EdgePairWithProperties (ep, prop_id)); + } else { + mp_edge_pairs->insert (ep); + } invalidate_cache (); } diff --git a/src/db/db/dbFlatEdgePairs.h b/src/db/db/dbFlatEdgePairs.h index 793e59b90..dc38dc088 100644 --- a/src/db/db/dbFlatEdgePairs.h +++ b/src/db/db/dbFlatEdgePairs.h @@ -83,7 +83,7 @@ public: virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const; virtual void insert_into_as_polygons (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer, db::Coord enl) const; - virtual void do_insert (const db::EdgePair &edge_pair); + virtual void do_insert (const db::EdgePair &edge_pair, db::properties_id_type prop_id); virtual void do_transform (const db::Trans &t) { diff --git a/src/db/db/dbFlatTexts.cc b/src/db/db/dbFlatTexts.cc index 6b9297e20..4028812b0 100644 --- a/src/db/db/dbFlatTexts.cc +++ b/src/db/db/dbFlatTexts.cc @@ -219,9 +219,13 @@ FlatTexts::insert_into (Layout *layout, db::cell_index_type into_cell, unsigned } void -FlatTexts::do_insert (const db::Text &t) +FlatTexts::do_insert (const db::Text &t, db::properties_id_type prop_id) { - mp_texts->insert (t); + if (prop_id != 0) { + mp_texts->insert (db::TextWithProperties (t, prop_id)); + } else { + mp_texts->insert (t); + } invalidate_cache (); } diff --git a/src/db/db/dbFlatTexts.h b/src/db/db/dbFlatTexts.h index 0fc3a5e92..f7e5ff16c 100644 --- a/src/db/db/dbFlatTexts.h +++ b/src/db/db/dbFlatTexts.h @@ -86,7 +86,7 @@ public: virtual void flatten () { } - void do_insert (const db::Text &text); + void do_insert (const db::Text &text, properties_id_type prop_id); virtual void do_transform (const db::Trans &t) { diff --git a/src/db/db/dbMutableEdgePairs.h b/src/db/db/dbMutableEdgePairs.h index 447767941..33703cbe0 100644 --- a/src/db/db/dbMutableEdgePairs.h +++ b/src/db/db/dbMutableEdgePairs.h @@ -45,7 +45,7 @@ public: MutableEdgePairs (const MutableEdgePairs &other); virtual ~MutableEdgePairs (); - virtual void do_insert (const db::EdgePair &edge_pair) = 0; + virtual void do_insert (const db::EdgePair &edge_pair, db::properties_id_type prop_id) = 0; virtual void do_transform (const db::Trans &t) = 0; virtual void do_transform (const db::ICplxTrans &t) = 0; @@ -63,7 +63,8 @@ public: void transform (const db::IMatrix2d &t) { do_transform (t); } void transform (const db::IMatrix3d &t) { do_transform (t); } - void insert (const db::EdgePair &edge_pair) { do_insert (edge_pair); } + void insert (const db::EdgePair &edge_pair) { do_insert (edge_pair, 0); } + void insert (const db::EdgePairWithProperties &edge_pair) { do_insert (edge_pair, edge_pair.properties_id ()); } void insert (const db::Shape &shape); template @@ -72,7 +73,7 @@ public: if (shape.is_edge_pair ()) { db::EdgePair ep = shape.edge_pair (); ep.transform (trans); - insert (ep); + do_insert (ep, shape.prop_id ()); } } diff --git a/src/db/db/dbMutableTexts.h b/src/db/db/dbMutableTexts.h index ced0caba5..6d850f3ef 100644 --- a/src/db/db/dbMutableTexts.h +++ b/src/db/db/dbMutableTexts.h @@ -45,7 +45,7 @@ public: MutableTexts (const MutableTexts &other); virtual ~MutableTexts (); - virtual void do_insert (const db::Text &text) = 0; + virtual void do_insert (const db::Text &text, db::properties_id_type prop_id) = 0; virtual void do_transform (const db::Trans &t) = 0; virtual void do_transform (const db::ICplxTrans &t) = 0; @@ -63,7 +63,8 @@ public: void transform (const db::IMatrix3d &t) { do_transform (t); } void transform (const db::IMatrix2d &t) { do_transform (t); } - void insert (const db::Text &text) { do_insert (text); } + void insert (const db::Text &text) { do_insert (text, 0); } + void insert (const db::TextWithProperties &text) { do_insert (text, text.properties_id ()); } void insert (const db::Shape &shape); template @@ -72,7 +73,7 @@ public: if (shape.is_text ()) { db::Text text = shape.text (); text.transform (trans); - insert (text); + do_insert (text, shape.prop_id ()); } } diff --git a/src/db/db/dbTexts.cc b/src/db/db/dbTexts.cc index f420c7f90..98a86513a 100644 --- a/src/db/db/dbTexts.cc +++ b/src/db/db/dbTexts.cc @@ -116,6 +116,7 @@ void Texts::insert (const Sh &shape) } template DB_PUBLIC void Texts::insert (const db::Text &); +template DB_PUBLIC void Texts::insert (const db::TextWithProperties &); void Texts::insert (const db::Shape &shape) { diff --git a/src/db/db/dbTexts.h b/src/db/db/dbTexts.h index 86b2a7e24..d69fe8a40 100644 --- a/src/db/db/dbTexts.h +++ b/src/db/db/dbTexts.h @@ -124,6 +124,17 @@ public: insert (s); } + /** + * @brief Constructor from an object with properties + * + * Creates an text set representing a single instance of that object + */ + explicit Texts (const db::TextWithProperties &s) + : mp_delegate (0) + { + insert (s); + } + /** * @brief Constructor from an object * diff --git a/src/db/db/gsiDeclDbEdgePairs.cc b/src/db/db/gsiDeclDbEdgePairs.cc index 99f289880..20f1817dc 100644 --- a/src/db/db/gsiDeclDbEdgePairs.cc +++ b/src/db/db/gsiDeclDbEdgePairs.cc @@ -230,11 +230,21 @@ static db::EdgePairs *new_a (const std::vector &pairs) return new db::EdgePairs (pairs.begin (), pairs.end ()); } +static db::EdgePairs *new_ap (const std::vector &pairs) +{ + return new db::EdgePairs (pairs.begin (), pairs.end ()); +} + static db::EdgePairs *new_ep (const db::EdgePair &pair) { return new db::EdgePairs (pair); } +static db::EdgePairs *new_epp (const db::EdgePairWithProperties &pair) +{ + return new db::EdgePairs (pair); +} + static db::EdgePairs *new_shapes (const db::Shapes &s) { db::EdgePairs *r = new db::EdgePairs (); @@ -582,6 +592,13 @@ Class decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs", "\n" "This constructor has been introduced in version 0.26." ) + + constructor ("new", &new_ap, gsi::arg ("array"), + "@brief Constructor from an array of edge pairs with properties\n" + "\n" + "This constructor creates an edge pair collection from an array of \\EdgePairWithProperties objects.\n" + "\n" + "This constructor has been introduced in version 0.30." + ) + constructor ("new", &new_ep, gsi::arg ("edge_pair"), "@brief Constructor from a single edge pair object\n" "\n" @@ -589,6 +606,13 @@ Class decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs", "\n" "This constructor has been introduced in version 0.26." ) + + constructor ("new", &new_epp, gsi::arg ("edge_pair"), + "@brief Constructor from a single edge pair object with properties\n" + "\n" + "This constructor creates an edge pair collection with a single edge pair.\n" + "\n" + "This constructor has been introduced in version 0.30." + ) + constructor ("new", &new_shapes, gsi::arg ("shapes"), "@brief Shapes constructor\n" "\n" @@ -701,6 +725,11 @@ Class decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs", method ("insert", (void (db::EdgePairs::*) (const db::EdgePair &)) &db::EdgePairs::insert, gsi::arg ("edge_pair"), "@brief Inserts an edge pair into the collection\n" ) + + method ("insert", (void (db::EdgePairs::*) (const db::EdgePairWithProperties &)) &db::EdgePairs::insert, gsi::arg ("edge_pair"), + "@brief Inserts an edge pair with properties into the collection\n" + "\n" + "This variant has been introduced in version 0.30." + ) + method_ext ("is_deep?", &is_deep, "@brief Returns true if the edge pair collection is a deep (hierarchical) one\n" "\n" diff --git a/src/db/db/gsiDeclDbEdges.cc b/src/db/db/gsiDeclDbEdges.cc index 76181040e..31d66458c 100644 --- a/src/db/db/gsiDeclDbEdges.cc +++ b/src/db/db/gsiDeclDbEdges.cc @@ -258,36 +258,73 @@ static db::Edges *new_e (const db::Edge &e) return ee; } +static db::Edges *new_ep (const db::EdgeWithProperties &e) +{ + db::Edges *ee = new db::Edges (); + ee->insert (e); + return ee; +} + static db::Edges *new_a1 (const std::vector &a) { return new db::Edges (a.begin (), a.end ()); } +static db::Edges *new_a1p (const std::vector &a) +{ + return new db::Edges (a.begin (), a.end ()); +} + static db::Edges *new_a2 (const std::vector &a) { return new db::Edges (a.begin (), a.end ()); } +static db::Edges *new_a2p (const std::vector &a) +{ + return new db::Edges (a.begin (), a.end ()); +} + static db::Edges *new_b (const db::Box &o) { return new db::Edges (o); } +static db::Edges *new_bp (const db::BoxWithProperties &o) +{ + return new db::Edges (o); +} + static db::Edges *new_p (const db::Polygon &o) { return new db::Edges (o); } +static db::Edges *new_pp (const db::PolygonWithProperties &o) +{ + return new db::Edges (o); +} + static db::Edges *new_ps (const db::SimplePolygon &o) { return new db::Edges (o); } +static db::Edges *new_psp (const db::SimplePolygonWithProperties &o) +{ + return new db::Edges (o); +} + static db::Edges *new_path (const db::Path &o) { return new db::Edges (o); } +static db::Edges *new_pathp (const db::PathWithProperties &o) +{ + return new db::Edges (o); +} + static db::Edges *new_shapes (const db::Shapes &s, bool as_edges) { db::Edges *r = new db::Edges (); @@ -334,6 +371,13 @@ static void insert_a1 (db::Edges *r, const std::vector &a) } } +static void insert_a1p (db::Edges *r, const std::vector &a) +{ + for (std::vector ::const_iterator p = a.begin (); p != a.end (); ++p) { + r->insert (*p); + } +} + static void insert_a2 (db::Edges *r, const std::vector &a) { for (std::vector ::const_iterator p = a.begin (); p != a.end (); ++p) { @@ -341,6 +385,13 @@ static void insert_a2 (db::Edges *r, const std::vector &a) } } +static void insert_a2p (db::Edges *r, const std::vector &a) +{ + for (std::vector ::const_iterator p = a.begin (); p != a.end (); ++p) { + r->insert (*p); + } +} + static void insert_si (db::Edges *r, db::RecursiveShapeIterator si) { while (! si.at_end ()) { @@ -582,14 +633,22 @@ static db::Region extents0 (const db::Edges *r) static void insert_r (db::Edges *e, const db::Region &a) { for (db::Region::const_iterator p = a.begin (); ! p.at_end (); ++p) { - e->insert (*p); + if (p.prop_id () != 0) { + e->insert (db::PolygonWithProperties (*p, p.prop_id ())); + } else { + e->insert (*p); + } } } static void insert_e (db::Edges *e, const db::Edges &a) { for (db::Edges::const_iterator p = a.begin (); ! p.at_end (); ++p) { - e->insert (*p); + if (p.prop_id () != 0) { + e->insert (db::EdgeWithProperties (*p, p.prop_id ())); + } else { + e->insert (*p); + } } } @@ -599,12 +658,20 @@ static void insert_st (db::Edges *e, const db::Shapes &a, const Trans &t) for (db::Shapes::shape_iterator p = a.begin (db::ShapeIterator::Polygons | db::ShapeIterator::Boxes | db::ShapeIterator::Paths); !p.at_end (); ++p) { db::Polygon poly; p->polygon (poly); - e->insert (poly.transformed (t)); + if (p->prop_id () != 0) { + e->insert (db::PolygonWithProperties (poly.transformed (t), p->prop_id ())); + } else { + e->insert (poly.transformed (t)); + } } for (db::Shapes::shape_iterator p = a.begin (db::ShapeIterator::Edges); !p.at_end (); ++p) { db::Edge edge; p->edge (edge); - e->insert (edge.transformed (t)); + if (p->prop_id () != 0) { + e->insert (db::EdgeWithProperties (edge.transformed (t), p->prop_id ())); + } else { + e->insert (edge.transformed (t)); + } } } @@ -694,41 +761,95 @@ Class decl_Edges (decl_dbShapeCollection, "db", "Edges", "\n" "This constructor creates an edge collection with a single edge.\n" ) + + constructor ("new", &new_ep, gsi::arg ("edge"), + "@brief Constructor from a single edge with properties\n" + "\n" + "This constructor creates an edge collection with a single edge.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_a1, gsi::arg ("array"), "@brief Constructor from a polygon array\n" "\n" "This constructor creates an edge collection from an array of polygons.\n" "The edges form the contours of the polygons.\n" ) + + constructor ("new", &new_a1p, gsi::arg ("array"), + "@brief Constructor from a polygon array\n" + "\n" + "This constructor creates an edge collection from an array of polygons with properties.\n" + "The edges form the contours of the polygons.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_a2, gsi::arg ("array"), "@brief Constructor from an edge array\n" "\n" "This constructor creates an edge collection from an array of edges.\n" ) + + constructor ("new", &new_a2p, gsi::arg ("array"), + "@brief Constructor from an edge array\n" + "\n" + "This constructor creates an edge collection from an array of edges with properties.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_b, gsi::arg ("box"), "@brief Box constructor\n" "\n" "This constructor creates an edge collection from a box.\n" "The edges form the contour of the box.\n" ) + + constructor ("new", &new_bp, gsi::arg ("box"), + "@brief Box constructor\n" + "\n" + "This constructor creates an edge collection from a box with properties.\n" + "The edges form the contour of the box.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_p, gsi::arg ("polygon"), "@brief Polygon constructor\n" "\n" "This constructor creates an edge collection from a polygon.\n" "The edges form the contour of the polygon.\n" ) + + constructor ("new", &new_pp, gsi::arg ("polygon"), + "@brief Polygon constructor\n" + "\n" + "This constructor creates an edge collection from a polygon with properties.\n" + "The edges form the contour of the polygon.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_ps, gsi::arg ("polygon"), "@brief Simple polygon constructor\n" "\n" "This constructor creates an edge collection from a simple polygon.\n" "The edges form the contour of the polygon.\n" ) + + constructor ("new", &new_psp, gsi::arg ("polygon"), + "@brief Simple polygon constructor\n" + "\n" + "This constructor creates an edge collection from a simple polygon with properties.\n" + "The edges form the contour of the polygon.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_path, gsi::arg ("path"), "@brief Path constructor\n" "\n" "This constructor creates an edge collection from a path.\n" "The edges form the contour of the path.\n" ) + + constructor ("new", &new_pathp, gsi::arg ("path"), + "@brief Path constructor\n" + "\n" + "This constructor creates an edge collection from a path with properties.\n" + "The edges form the contour of the path.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_shapes, gsi::arg ("shapes"), gsi::arg ("as_edges", true), "@brief Constructor of a flat edge collection from a \\Shapes container\n" "\n" @@ -969,26 +1090,61 @@ Class decl_Edges (decl_dbShapeCollection, "db", "Edges", "\n" "Inserts the edge into the edge collection.\n" ) + + method ("insert", (void (db::Edges::*)(const db::EdgeWithProperties &)) &db::Edges::insert, gsi::arg ("edge"), + "@brief Inserts an edge\n" + "\n" + "Inserts the edge with properties into the edge collection.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + method ("insert", (void (db::Edges::*)(const db::Box &)) &db::Edges::insert, gsi::arg ("box"), "@brief Inserts a box\n" "\n" "Inserts the edges that form the contour of the box into the edge collection.\n" ) + + method ("insert", (void (db::Edges::*)(const db::BoxWithProperties &)) &db::Edges::insert, gsi::arg ("box"), + "@brief Inserts a box\n" + "\n" + "Inserts the edges that form the contour of the box into the edge collection with the boxes properties.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + method ("insert", (void (db::Edges::*)(const db::Polygon &)) &db::Edges::insert, gsi::arg ("polygon"), "@brief Inserts a polygon\n" "\n" "Inserts the edges that form the contour of the polygon into the edge collection.\n" ) + + method ("insert", (void (db::Edges::*)(const db::PolygonWithProperties &)) &db::Edges::insert, gsi::arg ("polygon"), + "@brief Inserts a polygon\n" + "\n" + "Inserts the edges that form the contour of the polygon into the edge collection with the properties of the polygon.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + method ("insert", (void (db::Edges::*)(const db::SimplePolygon &)) &db::Edges::insert, gsi::arg ("polygon"), "@brief Inserts a simple polygon\n" "\n" "Inserts the edges that form the contour of the simple polygon into the edge collection.\n" ) + + method ("insert", (void (db::Edges::*)(const db::SimplePolygonWithProperties &)) &db::Edges::insert, gsi::arg ("polygon"), + "@brief Inserts a simple polygon\n" + "\n" + "Inserts the edges that form the contour of the simple polygon into the edge collection with the properties of the polygon.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + method ("insert", (void (db::Edges::*)(const db::Path &)) &db::Edges::insert, gsi::arg ("path"), "@brief Inserts a path\n" "\n" "Inserts the edges that form the contour of the path into the edge collection.\n" ) + + method ("insert", (void (db::Edges::*)(const db::PathWithProperties &)) &db::Edges::insert, gsi::arg ("path"), + "@brief Inserts a path\n" + "\n" + "Inserts the edges that form the contour of the path into the edge collection with the properties of the path.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + method_ext ("insert", &insert_e, gsi::arg ("edges"), "@brief Inserts all edges from the other edge collection into this one\n" "This method has been introduced in version 0.25." @@ -1040,9 +1196,19 @@ Class decl_Edges (decl_dbShapeCollection, "db", "Edges", method_ext ("insert", &insert_a1, gsi::arg ("polygons"), "@brief Inserts all polygons from the array into this edge collection\n" ) + + method_ext ("insert", &insert_a1p, gsi::arg ("polygons"), + "@brief Inserts all polygons from the array into this edge collection\n" + "\n" + "This variant accepting polygons with properties has been introduced in version 0.30." + ) + method_ext ("insert", &insert_a2, gsi::arg ("edges"), "@brief Inserts all edges from the array into this edge collection\n" ) + + method_ext ("insert", &insert_a2p, gsi::arg ("edges"), + "@brief Inserts all edges from the array into this edge collection\n" + "\n" + "This variant accepting edges with properties has been introduced in version 0.30." + ) + method ("merge", (db::Edges &(db::Edges::*) ()) &db::Edges::merge, "@brief Merge the edges\n" "\n" diff --git a/src/db/db/gsiDeclDbTexts.cc b/src/db/db/gsiDeclDbTexts.cc index 241e734c4..a683ec7b4 100644 --- a/src/db/db/gsiDeclDbTexts.cc +++ b/src/db/db/gsiDeclDbTexts.cc @@ -197,11 +197,21 @@ static db::Texts *new_a (const std::vector &t) return new db::Texts (t.begin (), t.end ()); } +static db::Texts *new_ap (const std::vector &t) +{ + return new db::Texts (t.begin (), t.end ()); +} + static db::Texts *new_text (const db::Text &t) { return new db::Texts (t); } +static db::Texts *new_textp (const db::TextWithProperties &t) +{ + return new db::Texts (t); +} + static db::Texts *new_shapes (const db::Shapes &s) { db::Texts *r = new db::Texts (); @@ -361,15 +371,29 @@ Class decl_Texts (decl_dbShapeCollection, "db", "Texts", "This constructor creates an empty text collection.\n" ) + constructor ("new", &new_a, gsi::arg ("array"), - "@brief Constructor from an text array\n" + "@brief Constructor from a text array\n" "\n" "This constructor creates an text collection from an array of \\Text objects.\n" ) + + constructor ("new", &new_ap, gsi::arg ("array"), + "@brief Constructor from an array with texts with properties\n" + "\n" + "This constructor creates an text collection from an array of \\TextWithProperties objects.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_text, gsi::arg ("text"), - "@brief Constructor from a single edge pair object\n" + "@brief Constructor from a single text object\n" "\n" "This constructor creates an text collection with a single text.\n" ) + + constructor ("new", &new_textp, gsi::arg ("text"), + "@brief Constructor from a single text object\n" + "\n" + "This constructor creates an text collection with a single text with properties.\n" + "\n" + "This variant has been introduced in version 0.30." + ) + constructor ("new", &new_shapes, gsi::arg ("shapes"), "@brief Shapes constructor\n" "\n" @@ -457,6 +481,11 @@ Class decl_Texts (decl_dbShapeCollection, "db", "Texts", method ("insert", (void (db::Texts::*) (const db::Text &)) &db::Texts::insert, gsi::arg ("text"), "@brief Inserts a text into the collection\n" ) + + method ("insert", (void (db::Texts::*) (const db::TextWithProperties &)) &db::Texts::insert, gsi::arg ("text"), + "@brief Inserts a text into the collection\n" + "\n" + "This variant accepting a text with properties has been introduced in version 0.30." + ) + method_ext ("is_deep?", &is_deep, "@brief Returns true if the edge pair collection is a deep (hierarchical) one\n" ) + diff --git a/testdata/ruby/dbEdgeNeighborhood.rb b/testdata/ruby/dbEdgeNeighborhood.rb index 529931251..7ed108704 100644 --- a/testdata/ruby/dbEdgeNeighborhood.rb +++ b/testdata/ruby/dbEdgeNeighborhood.rb @@ -135,7 +135,7 @@ class DBEdgeNeighborhood_TestClass < TestBase "/Polygon\n" ) - assert_equal(res.to_s, "(-1100,0;-1100,1000;-100,1000;-100,0);(0,0;0,1000;1000,1000;1000,0)") + assert_equal(res.to_s, "(-1100,0;-1100,1000;-100,1000;-100,0);(0,0;0,1000;1000,1000;1000,0){1=>one}") end diff --git a/testdata/ruby/dbEdgePairsTest.rb b/testdata/ruby/dbEdgePairsTest.rb index 0c46601c7..3c1036dcb 100644 --- a/testdata/ruby/dbEdgePairsTest.rb +++ b/testdata/ruby/dbEdgePairsTest.rb @@ -574,6 +574,21 @@ class DBEdgePairs_TestClass < TestBase end + # properties + def test_props + + r = RBA::EdgePairs::new([ RBA::EdgePairWithProperties::new(RBA::EdgePair::new(RBA::Edge::new(0, 0, 100, 100), RBA::Edge::new(200, 300, 200, 500)), { 1 => "one" }) ]) + assert_equal(r.to_s, "(0,0;100,100)/(200,300;200,500){1=>one}") + + r = RBA::EdgePairs::new(RBA::EdgePairWithProperties::new(RBA::EdgePair::new(RBA::Edge::new(0, 0, 100, 100), RBA::Edge::new(200, 300, 200, 500)), { 1 => "one" })) + assert_equal(r.to_s, "(0,0;100,100)/(200,300;200,500){1=>one}") + + r = RBA::EdgePairs::new + r.insert(RBA::EdgePairWithProperties::new(RBA::EdgePair::new(RBA::Edge::new(0, 0, 100, 100), RBA::Edge::new(200, 300, 200, 500)), { 1 => "one" })) + assert_equal(r.to_s, "(0,0;100,100)/(200,300;200,500){1=>one}") + + end + end diff --git a/testdata/ruby/dbRegionTest.rb b/testdata/ruby/dbRegionTest.rb index 116fb190c..85a1848a8 100644 --- a/testdata/ruby/dbRegionTest.rb +++ b/testdata/ruby/dbRegionTest.rb @@ -1314,9 +1314,9 @@ class DBRegion_TestClass < TestBase rr = RBA::Region::new(tc.begin_shapes_rec(l2)).enable_properties assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false).to_s), csort("(400,200;500,200)/(500,250;400,250);(0,200;100,200)/(100,250;0,250);(200,200;300,200)/(300,250;200,250)")) - assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false, RBA::Region::NoPropertyConstraint).to_s), csort("(400,200;500,200)/(500,250;400,250);(0,200;100,200)/(100,250;0,250);(200,200;300,200)/(300,250;200,250)")) - assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false, RBA::Region::SamePropertiesConstraint).to_s), csort("(0,200;100,200)/(100,250;0,250)")) - assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false, RBA::Region::DifferentPropertiesConstraint).to_s), csort("(400,200;500,200)/(500,250;400,250);(200,200;300,200)/(300,250;200,250)")) + assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false, RBA::Region::NoPropertyConstraint).to_s), csort("(0,200;100,200)/(100,250;0,250){1=>17};(200,200;300,200)/(300,250;200,250){1=>42};(400,200;500,200)/(500,250;400,250)")) + assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false, RBA::Region::SamePropertiesConstraint).to_s), csort("(0,200;100,200)/(100,250;0,250){1=>17}")) + assert_equal(csort(r.separation_check(rr, 100, false, RBA::Region::Projection, nil, nil, nil, false, RBA::Region::NoOppositeFilter, RBA::Region::NoRectFilter, false, RBA::Region::DifferentPropertiesConstraint).to_s), csort("(200,200;300,200)/(300,250;200,250){1=>42};(400,200;500,200)/(500,250;400,250)")) r.remove_properties rr.remove_properties diff --git a/testdata/ruby/dbTextsTest.rb b/testdata/ruby/dbTextsTest.rb index 813fe29ad..f2c78403f 100644 --- a/testdata/ruby/dbTextsTest.rb +++ b/testdata/ruby/dbTextsTest.rb @@ -443,6 +443,21 @@ class DBTexts_TestClass < TestBase end + # properties + def test_props + + r = RBA::Texts::new([ RBA::TextWithProperties::new(RBA::Text::new("abc", RBA::Trans::new), { 1 => "one" }) ]) + assert_equal(r.to_s, "('abc',r0 0,0){1=>one}") + + r = RBA::Texts::new(RBA::TextWithProperties::new(RBA::Text::new("abc", RBA::Trans::new), { 1 => "one" })) + assert_equal(r.to_s, "('abc',r0 0,0){1=>one}") + + r = RBA::Texts::new + r.insert(RBA::TextWithProperties::new(RBA::Text::new("abc", RBA::Trans::new), { 1 => "one" })) + assert_equal(r.to_s, "('abc',r0 0,0){1=>one}") + + end + end