mirror of https://github.com/KLayout/klayout.git
Transformation of objects with properties, GSI binding, bug fixing, tests
This commit is contained in:
parent
8a9d7c6d15
commit
233d70d085
|
|
@ -134,7 +134,7 @@ bool NetShape::interacts_with (const db::NetShape &other) const
|
|||
// Polygon vs. polygon
|
||||
db::PolygonRef pr_other = other.polygon_ref ();
|
||||
db::PolygonRef pr = polygon_ref ();
|
||||
db::Polygon p = pr_other.obj ().transformed (pr.trans ().inverted () * pr_other.trans (), false);
|
||||
db::Polygon p = pr_other.obj ().transformed_ext (pr.trans ().inverted () * pr_other.trans (), false);
|
||||
return db::interact_pp (pr.obj (), p);
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ PCellVariant::update (ImportLayerMapping *layer_mapping)
|
|||
} else if (m_parameters[i].is_user<db::DPolygon> ()) {
|
||||
|
||||
db::complex_trans<db::DCoord, db::Coord> dbu_trans (1.0 / layout ()->dbu ());
|
||||
db::Polygon poly = m_parameters[i].to_user<db::DPolygon> ().transformed (dbu_trans, false);
|
||||
db::Polygon poly = m_parameters[i].to_user<db::DPolygon> ().transformed_ext (dbu_trans, false);
|
||||
// Hint: we don't compress the polygon since we don't want to loose information
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PolygonWithProperties (poly, db::properties_id (props)));
|
||||
|
||||
|
|
|
|||
|
|
@ -1928,7 +1928,7 @@ public:
|
|||
* @return The transformed polygon.
|
||||
*/
|
||||
template <class Tr>
|
||||
polygon<typename Tr::target_coord_type> transformed (const Tr &t, bool compress = default_compression<typename Tr::target_coord_type> (), bool remove_reflected = false) const
|
||||
polygon<typename Tr::target_coord_type> transformed_ext (const Tr &t, bool compress = default_compression<typename Tr::target_coord_type> (), bool remove_reflected = false) const
|
||||
{
|
||||
typedef typename Tr::target_coord_type target_coord_type;
|
||||
polygon<target_coord_type> poly;
|
||||
|
|
@ -1942,6 +1942,22 @@ public:
|
|||
return poly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform the polygon.
|
||||
*
|
||||
* Transforms the polygon with the given transformation.
|
||||
* Does not modify the polygon but returns the transformed polygon.
|
||||
*
|
||||
* @param t The transformation to apply.
|
||||
*
|
||||
* @return The transformed polygon.
|
||||
*/
|
||||
template <class Tr>
|
||||
polygon<typename Tr::target_coord_type> transformed (const Tr &t) const
|
||||
{
|
||||
return this->transformed_ext<Tr> (t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the moved polyon
|
||||
*
|
||||
|
|
@ -2821,7 +2837,7 @@ public:
|
|||
* @return The transformed polygon.
|
||||
*/
|
||||
template <class Tr>
|
||||
simple_polygon<typename Tr::target_coord_type> transformed (const Tr &t, bool compress = default_compression<typename Tr::target_coord_type> (), bool remove_reflected = false) const
|
||||
simple_polygon<typename Tr::target_coord_type> transformed_ext (const Tr &t, bool compress = default_compression<typename Tr::target_coord_type> (), bool remove_reflected = false) const
|
||||
{
|
||||
typedef typename Tr::target_coord_type target_coord_type;
|
||||
simple_polygon<target_coord_type> poly;
|
||||
|
|
@ -2832,6 +2848,22 @@ public:
|
|||
return poly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transform the polygon.
|
||||
*
|
||||
* Transforms the polygon with the given transformation.
|
||||
* Does not modify the polygon but returns the transformed polygon.
|
||||
*
|
||||
* @param t The transformation to apply.
|
||||
*
|
||||
* @return The transformed polygon.
|
||||
*/
|
||||
template <class Tr>
|
||||
simple_polygon<typename Tr::target_coord_type> transformed (const Tr &t) const
|
||||
{
|
||||
return this->transformed_ext<Tr> (t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the moved polyon
|
||||
*
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ namespace
|
|||
|
||||
virtual void put (const IPolygonType &p)
|
||||
{
|
||||
PolygonType pp = p.transformed (m_tr, false);
|
||||
PolygonType pp = p.transformed_ext (m_tr, false);
|
||||
mp_next->put (pp);
|
||||
}
|
||||
|
||||
|
|
@ -607,7 +607,7 @@ namespace
|
|||
rec.set_trans (tr);
|
||||
rec.set_next (right_of_line);
|
||||
|
||||
cut_polygon_internal_int (input.transformed (tr.inverted (), false), line.transformed (tr.inverted ()), &rec);
|
||||
cut_polygon_internal_int (input.transformed_ext (tr.inverted (), false), line.transformed (tr.inverted ()), &rec);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ struct simple_polygon_defs
|
|||
|
||||
static C scale (const C *p, double s)
|
||||
{
|
||||
return C (p->transformed (icomplex_trans_type (s), false /*don't compress*/));
|
||||
return C (p->transformed_ext (icomplex_trans_type (s), false /*don't compress*/));
|
||||
}
|
||||
|
||||
static C *transform (C *poly, const simple_trans_type &t)
|
||||
|
|
@ -194,12 +194,12 @@ struct simple_polygon_defs
|
|||
|
||||
static C transformed (const C *poly, const simple_trans_type &t)
|
||||
{
|
||||
return poly->transformed (t, false /*don't compress*/);
|
||||
return poly->transformed_ext (t, false /*don't compress*/);
|
||||
}
|
||||
|
||||
static db::simple_polygon<double> transformed_cplx (const C *poly, const complex_trans_type &t)
|
||||
{
|
||||
return poly->transformed (t, false /*don't compress*/);
|
||||
return poly->transformed_ext (t, false /*don't compress*/);
|
||||
}
|
||||
|
||||
#if defined(HAVE_64BIT_COORD)
|
||||
|
|
@ -677,7 +677,7 @@ static db::SimplePolygon *transform_icplx_sp (db::SimplePolygon *p, const db::IC
|
|||
|
||||
static db::SimplePolygon transformed_icplx_sp (const db::SimplePolygon *p, const db::ICplxTrans &t)
|
||||
{
|
||||
return p->transformed (t, false /*no compression*/);
|
||||
return p->transformed_ext (t, false /*no compression*/);
|
||||
}
|
||||
|
||||
static db::SimplePolygon *spolygon_from_dspolygon (const db::DSimplePolygon &p)
|
||||
|
|
@ -817,7 +817,7 @@ static db::SimplePolygon dspolygon_to_spolygon (const db::DSimplePolygon *p, dou
|
|||
|
||||
static db::SimplePolygon transformed_vplx_sp (const db::DSimplePolygon *p, const db::VCplxTrans &t)
|
||||
{
|
||||
return p->transformed (t, false /*no compression*/);
|
||||
return p->transformed_ext (t, false /*no compression*/);
|
||||
}
|
||||
|
||||
Class<db::DSimplePolygon> decl_DSimplePolygon ("db", "DSimplePolygon",
|
||||
|
|
@ -1111,7 +1111,7 @@ struct polygon_defs
|
|||
|
||||
static C scale (const C *p, double s)
|
||||
{
|
||||
return C (p->transformed (icomplex_trans_type (s), false /*no compression*/));
|
||||
return C (p->transformed_ext (icomplex_trans_type (s), false /*no compression*/));
|
||||
}
|
||||
|
||||
static void compress (C *poly, bool remove_reflected)
|
||||
|
|
@ -1127,12 +1127,12 @@ struct polygon_defs
|
|||
|
||||
static C transformed (const C *poly, const simple_trans_type &t)
|
||||
{
|
||||
return poly->transformed (t, false /*no compression*/);
|
||||
return poly->transformed_ext (t, false /*no compression*/);
|
||||
}
|
||||
|
||||
static db::polygon<double> transformed_cplx (const C *poly, const complex_trans_type &t)
|
||||
{
|
||||
return poly->transformed (t, false /*no compression*/);
|
||||
return poly->transformed_ext (t, false /*no compression*/);
|
||||
}
|
||||
|
||||
#if defined(HAVE_64BIT_COORD)
|
||||
|
|
@ -1751,7 +1751,7 @@ static db::Polygon *transform_icplx_dp (db::Polygon *p, const db::ICplxTrans &t)
|
|||
|
||||
static db::Polygon transformed_icplx_dp (const db::Polygon *p, const db::ICplxTrans &t)
|
||||
{
|
||||
return p->transformed (t, false /*don't compress*/);
|
||||
return p->transformed_ext (t, false /*don't compress*/);
|
||||
}
|
||||
|
||||
static db::Polygon smooth (const db::Polygon *p, db::Coord d, bool keep_hv)
|
||||
|
|
@ -2096,7 +2096,7 @@ static db::Polygon dpolygon_to_polygon (const db::DPolygon *p, double dbu)
|
|||
|
||||
static db::Polygon transformed_vcplx_dp (const db::DPolygon *p, const db::VCplxTrans &t)
|
||||
{
|
||||
return p->transformed (t, false /*don't compress*/);
|
||||
return p->transformed_ext (t, false /*don't compress*/);
|
||||
}
|
||||
|
||||
Class<db::DPolygon> decl_DPolygon ("db", "DPolygon",
|
||||
|
|
|
|||
|
|
@ -1195,6 +1195,118 @@ Class<db::Shapes> decl_Shapes ("db", "Shapes",
|
|||
"\n"
|
||||
"This variant has been introduced in version 0.25."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::BoxWithProperties>, gsi::arg ("box"),
|
||||
"@brief Inserts a box with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DBoxWithProperties>, gsi::arg ("box"),
|
||||
"@brief Inserts a micrometer-unit box with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\BoxWithProperties argument, except that it will "
|
||||
"internally translate the box from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::PathWithProperties>, gsi::arg ("path"),
|
||||
"@brief Inserts a path with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DPathWithProperties>, gsi::arg ("path"),
|
||||
"@brief Inserts a micrometer-unit path with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\PathWithProperties argument, except that it will "
|
||||
"internally translate the path from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::EdgeWithProperties>, gsi::arg ("edge"),
|
||||
"@brief Inserts an edge with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DEdgeWithProperties>, gsi::arg ("edge"),
|
||||
"@brief Inserts a micrometer-unit edge with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\EdgeWithProperties argument, except that it will "
|
||||
"internally translate the edge from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::EdgePairWithProperties>, gsi::arg ("edge_pair"),
|
||||
"@brief Inserts an edge pair with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DEdgePairWithProperties>, gsi::arg ("edge_pair"),
|
||||
"@brief Inserts a micrometer-unit edge pair with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\EdgePairWithProperties argument, except that it will "
|
||||
"internally translate the edge pair from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::TextWithProperties>, gsi::arg ("text"),
|
||||
"@brief Inserts a text with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DTextWithProperties>, gsi::arg ("text"),
|
||||
"@brief Inserts a micrometer-unit text with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\TextWithProperties argument, except that it will "
|
||||
"internally translate the text from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::SimplePolygonWithProperties>, gsi::arg ("simple_polygon"),
|
||||
"@brief Inserts a simple polygon with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DSimplePolygonWithProperties>, gsi::arg ("simple_polygon"),
|
||||
"@brief Inserts a micrometer-unit simple polygon with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\SimplePolygonWithProperties argument, except that it will "
|
||||
"internally translate the simple polygon from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &insert<db::PolygonWithProperties>, gsi::arg ("polygon"),
|
||||
"@brief Inserts a polygon with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"The property Id must be obtained from the \\Layout object's property_id method which "
|
||||
"associates a property set with a property Id."
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::method_ext ("insert", &dinsert<db::DPolygonWithProperties>, gsi::arg ("polygon"),
|
||||
"@brief Inserts a micrometer-unit polygon with properties into the shapes list\n"
|
||||
"@return A reference to the new shape (a \\Shape object)\n"
|
||||
"This method behaves like the \\insert version with a \\PolygonWithProperties argument, except that it will "
|
||||
"internally translate the polygon from micrometer to database units.\n"
|
||||
"\n"
|
||||
"This variant has been introduced in version 0.30."
|
||||
) +
|
||||
gsi::iterator_ext ("each", &begin, gsi::arg ("flags"),
|
||||
"@brief Gets all shapes\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -816,6 +816,41 @@ struct cplx_trans_defs
|
|||
return text.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::edge<target_coord_type> > trans_edge_wp (const C *t, const db::object_with_properties<db::edge<coord_type> > &edge)
|
||||
{
|
||||
return edge.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::edge_pair<target_coord_type> > trans_edge_pair_wp (const C *t, const db::object_with_properties<db::edge_pair<coord_type> > &edge_pair)
|
||||
{
|
||||
return edge_pair.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::box<target_coord_type> > trans_box_wp (const C *t, const db::object_with_properties<db::box<coord_type> > &box)
|
||||
{
|
||||
return box.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::polygon<target_coord_type> > trans_polygon_wp (const C *t, const db::object_with_properties<db::polygon<coord_type> > &polygon)
|
||||
{
|
||||
return polygon.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::simple_polygon<target_coord_type> > trans_simple_polygon_wp (const C *t, const db::object_with_properties<db::simple_polygon<coord_type> > &polygon)
|
||||
{
|
||||
return polygon.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::path<target_coord_type> > trans_path_wp (const C *t, const db::object_with_properties<db::path<coord_type> > &path)
|
||||
{
|
||||
return path.transformed (*t);
|
||||
}
|
||||
|
||||
static db::object_with_properties<db::text<target_coord_type> > trans_text_wp (const C *t, const db::object_with_properties<db::text<coord_type> > &text)
|
||||
{
|
||||
return text.transformed (*t);
|
||||
}
|
||||
|
||||
static size_t hash_value (const C *t)
|
||||
{
|
||||
return std::hfunc (*t);
|
||||
|
|
@ -996,6 +1031,76 @@ struct cplx_trans_defs
|
|||
"\n"
|
||||
"This convenience method has been introduced in version 0.25."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_box_wp, arg ("box"),
|
||||
"@brief Transforms a box with properties\n"
|
||||
"\n"
|
||||
"'t*box' or 't.trans(box)' is equivalent to box.transformed(t).\n"
|
||||
"\n"
|
||||
"@param box The box to transform\n"
|
||||
"@return The transformed box\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_edge_wp, arg ("edge"),
|
||||
"@brief Transforms an edge with properties\n"
|
||||
"\n"
|
||||
"'t*edge' or 't.trans(edge)' is equivalent to edge.transformed(t).\n"
|
||||
"\n"
|
||||
"@param edge The edge to transform\n"
|
||||
"@return The transformed edge\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_edge_pair_wp, arg ("edge_pair"),
|
||||
"@brief Transforms an edge pair with properties\n"
|
||||
"\n"
|
||||
"'t*edge_pair' or 't.trans(edge_pair)' is equivalent to edge_pair.transformed(t).\n"
|
||||
"\n"
|
||||
"@param edge_pair The edge pair to transform\n"
|
||||
"@return The transformed edge pair\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_polygon_wp, arg ("polygon"),
|
||||
"@brief Transforms a polygon with properties\n"
|
||||
"\n"
|
||||
"'t*polygon' or 't.trans(polygon)' is equivalent to polygon.transformed(t).\n"
|
||||
"\n"
|
||||
"@param polygon The polygon to transform\n"
|
||||
"@return The transformed polygon\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_simple_polygon_wp, arg ("simple_polygon"),
|
||||
"@brief Transforms a simple polygon with properties\n"
|
||||
"\n"
|
||||
"'t*polygon' or 't.trans(simple_polygon)' is equivalent to simple_polygon.transformed(t).\n"
|
||||
"\n"
|
||||
"@param simple_polygon The simple polygon to transform\n"
|
||||
"@return The transformed simple polygon\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_path_wp, arg ("path"),
|
||||
"@brief Transforms a path with properties\n"
|
||||
"\n"
|
||||
"'t*path' or 't.trans(path)' is equivalent to path.transformed(t).\n"
|
||||
"\n"
|
||||
"@param path The path to transform\n"
|
||||
"@return The transformed path\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method_ext ("trans|*", &trans_text_wp, arg ("text"),
|
||||
"@brief Transforms a text with properties\n"
|
||||
"\n"
|
||||
"'t*text' or 't.trans(text)' is equivalent to text.transformed(t).\n"
|
||||
"\n"
|
||||
"@param text The text to transform\n"
|
||||
"@return The transformed text\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.30."
|
||||
) +
|
||||
method ("*!", (C (C::*) (const C &c) const) &C::concat_same, arg ("t"),
|
||||
"@brief Returns the concatenated transformation\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
parameters_for_pcell [pnm->second] = tl::Variant (dbu_trans * sh->point ());
|
||||
} else if (sh->is_polygon ()) {
|
||||
// Hint: we don't compress since we don't want to loose information
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->polygon ().transformed (dbu_trans, false));
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->polygon ().transformed_ext (dbu_trans, false));
|
||||
} else if (sh->is_path ()) {
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (dbu_trans * sh->path ());
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
|
||||
db::complex_trans<db::DCoord, db::Coord> dbu_trans (1.0 / layout->dbu ());
|
||||
// Hint: we don't compress the polygon since we don't want to loose information
|
||||
db::Polygon poly = org_parameters[i].to_user<db::DPolygon> ().transformed (dbu_trans, false);
|
||||
db::Polygon poly = org_parameters[i].to_user<db::DPolygon> ().transformed_ext (dbu_trans, false);
|
||||
guiding_shapes.insert (db::PolygonWithProperties (poly, db::properties_id (props)));
|
||||
|
||||
} else if (org_parameters[i].is_user<db::DPath> ()) {
|
||||
|
|
|
|||
|
|
@ -520,6 +520,7 @@ class DBBox_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::BoxWithProperties::new(RBA::Box::new(0, 0, 100, 200), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,200) props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "(0,0;0.1,0.2) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -534,6 +535,7 @@ class DBBox_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DBoxWithProperties::new(RBA::DBox::new(0, 0, 100, 200), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,200) props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "(0,0;250,500) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ class DBEdgePair_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::EdgePairWithProperties::new(RBA::EdgePair::new(RBA::Edge::new(0, 0, 100, 200), RBA::Edge::new(10, 10, 110, 210)), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,200)/(10,10;110,210) props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "(0,0;0.1,0.2)/(0.01,0.01;0.11,0.21) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -268,6 +269,7 @@ class DBEdgePair_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DEdgePairWithProperties::new(RBA::DEdgePair::new(RBA::DEdge::new(0, 0, 100, 200), RBA::DEdge::new(10, 10, 110, 210)), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,200)/(10,10;110,210) props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "(0,0;250,500)/(25,25;275,525) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@ class DBEdge_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::EdgeWithProperties::new(RBA::Edge::new(0, 0, 100, 200), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,200) props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "(0,0;0.1,0.2) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -355,6 +356,7 @@ class DBEdge_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DEdgeWithProperties::new(RBA::DEdge::new(0, 0, 100, 200), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,200) props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "(0,0;250,500) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
|
|||
|
|
@ -337,6 +337,7 @@ class DBPath_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::PathWithProperties::new(RBA::Path::new([ [0,0], [100, 0] ], 100), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,0) w=100 bx=0 ex=0 r=false props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "(0,0;0.1,0) w=0.1 bx=0 ex=0 r=false props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -351,6 +352,7 @@ class DBPath_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DPathWithProperties::new(RBA::DPath::new([ [0,0], [100, 0] ], 100), pid)
|
||||
assert_equal(s.to_s, "(0,0;100,0) w=100 bx=0 ex=0 r=false props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "(0,0;250,0) w=250 bx=0 ex=0 r=false props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
|
|||
|
|
@ -902,6 +902,7 @@ class DBPolygon_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::PolygonWithProperties::new(RBA::Polygon::new(RBA::Box::new(0, 0, 100, 200)), pid)
|
||||
assert_equal(s.to_s, "(0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "(0,0;0,0.2;0.1,0.2;0.1,0) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -916,6 +917,7 @@ class DBPolygon_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DPolygonWithProperties::new(RBA::DPolygon::new(RBA::DBox::new(0, 0, 100, 200)), pid)
|
||||
assert_equal(s.to_s, "(0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "(0,0;0,500;250,500;250,0) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -930,6 +932,7 @@ class DBPolygon_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::SimplePolygonWithProperties::new(RBA::SimplePolygon::new(RBA::Box::new(0, 0, 100, 200)), pid)
|
||||
assert_equal(s.to_s, "(0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "(0,0;0,0.2;0.1,0.2;0.1,0) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -944,6 +947,7 @@ class DBPolygon_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DSimplePolygonWithProperties::new(RBA::DSimplePolygon::new(RBA::DBox::new(0, 0, 100, 200)), pid)
|
||||
assert_equal(s.to_s, "(0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "(0,0;0,500;250,500;250,0) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
|
|||
|
|
@ -1685,6 +1685,49 @@ class DBShapes_TestClass < TestBase
|
|||
|
||||
end
|
||||
|
||||
# Shape objects with properties
|
||||
|
||||
def test_14
|
||||
|
||||
ly = RBA::Layout::new
|
||||
l1 = ly.layer(1, 0)
|
||||
tc = ly.create_cell("TOP")
|
||||
shapes = tc.shapes(l1)
|
||||
|
||||
ps1 = RBA::Layout::properties_id({ 1 => "one" })
|
||||
|
||||
sh = shapes.insert(RBA::BoxWithProperties::new(RBA::Box::new(0, 0, 100, 200), ps1))
|
||||
assert_equal(sh.to_s, "box (0,0;100,200) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::PolygonWithProperties::new(RBA::Box::new(0, 0, 100, 200), ps1))
|
||||
assert_equal(sh.to_s, "polygon (0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::SimplePolygonWithProperties::new(RBA::Box::new(0, 0, 100, 200), ps1))
|
||||
assert_equal(sh.to_s, "simple_polygon (0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::PathWithProperties::new(RBA::Path::new([ [0, 0], [100, 200] ], 100), ps1))
|
||||
assert_equal(sh.to_s, "path (0,0;100,200) w=100 bx=0 ex=0 r=false props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::TextWithProperties::new(RBA::Text::new("text", RBA::Trans::R90), ps1))
|
||||
assert_equal(sh.to_s, "text ('text',r90 0,0) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::DBoxWithProperties::new(RBA::DBox::new(0, 0, 0.1, 0.2), ps1))
|
||||
assert_equal(sh.to_s, "box (0,0;100,200) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::DPolygonWithProperties::new(RBA::DBox::new(0, 0, 0.1, 0.2), ps1))
|
||||
assert_equal(sh.to_s, "polygon (0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::DSimplePolygonWithProperties::new(RBA::DBox::new(0, 0, 0.1, 0.2), ps1))
|
||||
assert_equal(sh.to_s, "simple_polygon (0,0;0,200;100,200;100,0) props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::DPathWithProperties::new(RBA::DPath::new([ [0, 0], [0.1, 0.2] ], 0.1), ps1))
|
||||
assert_equal(sh.to_s, "path (0,0;100,200) w=100 bx=0 ex=0 r=false props={1=>one}")
|
||||
|
||||
sh = shapes.insert(RBA::DTextWithProperties::new(RBA::DText::new("text", RBA::Trans::R90), ps1))
|
||||
assert_equal(sh.to_s, "text ('text',r90 0,0) props={1=>one}")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
|
|
|||
|
|
@ -262,6 +262,7 @@ class DBText_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::TextWithProperties::new(RBA::Text::new("text", RBA::Trans::R90), pid)
|
||||
assert_equal(s.to_s, "('text',r90 0,0) props={1=>one}")
|
||||
assert_equal((RBA::CplxTrans::new(0.001) * s).to_s, "('text',r90 0,0) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
@ -276,6 +277,7 @@ class DBText_TestClass < TestBase
|
|||
pid = RBA::Layout::properties_id({ 1 => "one" })
|
||||
s = RBA::DTextWithProperties::new(RBA::DText::new("text", RBA::Trans::R90), pid)
|
||||
assert_equal(s.to_s, "('text',r90 0,0) props={1=>one}")
|
||||
assert_equal((RBA::VCplxTrans::new(2.5) * s).to_s, "('text',r90 0,0) props={1=>one}")
|
||||
assert_equal(s.property(1), "one")
|
||||
assert_equal(s.properties, { 1 => "one" })
|
||||
s.set_property(1, "xxx")
|
||||
|
|
|
|||
Loading…
Reference in New Issue