mirror of https://github.com/KLayout/klayout.git
More support for properties inside Edges, Texts, EdgePairs. WIP
This commit is contained in:
parent
dfc7d6bef4
commit
375ac6364b
|
|
@ -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 << "...";
|
||||
|
|
|
|||
|
|
@ -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 << "...";
|
||||
|
|
|
|||
|
|
@ -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 << "...";
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 <class T>
|
||||
|
|
@ -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 ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <class T>
|
||||
|
|
@ -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 ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -230,11 +230,21 @@ static db::EdgePairs *new_a (const std::vector<db::EdgePair> &pairs)
|
|||
return new db::EdgePairs (pairs.begin (), pairs.end ());
|
||||
}
|
||||
|
||||
static db::EdgePairs *new_ap (const std::vector<db::EdgePairWithProperties> &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<db::EdgePairs> 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<db::EdgePairs> 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<db::EdgePairs> 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"
|
||||
|
|
|
|||
|
|
@ -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 <db::Polygon> &a)
|
||||
{
|
||||
return new db::Edges (a.begin (), a.end ());
|
||||
}
|
||||
|
||||
static db::Edges *new_a1p (const std::vector <db::PolygonWithProperties> &a)
|
||||
{
|
||||
return new db::Edges (a.begin (), a.end ());
|
||||
}
|
||||
|
||||
static db::Edges *new_a2 (const std::vector <db::Edge> &a)
|
||||
{
|
||||
return new db::Edges (a.begin (), a.end ());
|
||||
}
|
||||
|
||||
static db::Edges *new_a2p (const std::vector <db::EdgeWithProperties> &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 <db::Polygon> &a)
|
|||
}
|
||||
}
|
||||
|
||||
static void insert_a1p (db::Edges *r, const std::vector <db::PolygonWithProperties> &a)
|
||||
{
|
||||
for (std::vector <db::PolygonWithProperties>::const_iterator p = a.begin (); p != a.end (); ++p) {
|
||||
r->insert (*p);
|
||||
}
|
||||
}
|
||||
|
||||
static void insert_a2 (db::Edges *r, const std::vector <db::Edge> &a)
|
||||
{
|
||||
for (std::vector <db::Edge>::const_iterator p = a.begin (); p != a.end (); ++p) {
|
||||
|
|
@ -341,6 +385,13 @@ static void insert_a2 (db::Edges *r, const std::vector <db::Edge> &a)
|
|||
}
|
||||
}
|
||||
|
||||
static void insert_a2p (db::Edges *r, const std::vector <db::EdgeWithProperties> &a)
|
||||
{
|
||||
for (std::vector <db::EdgeWithProperties>::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<db::Edges> 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<db::Edges> 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<db::Edges> 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"
|
||||
|
|
|
|||
|
|
@ -197,11 +197,21 @@ static db::Texts *new_a (const std::vector<db::Text> &t)
|
|||
return new db::Texts (t.begin (), t.end ());
|
||||
}
|
||||
|
||||
static db::Texts *new_ap (const std::vector<db::TextWithProperties> &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<db::Texts> 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<db::Texts> 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"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue