mirror of https://github.com/KLayout/klayout.git
Merge remote-tracking branch 'origin/wip' into dvb
This commit is contained in:
commit
bc1deb1696
|
|
@ -851,7 +851,7 @@ public:
|
|||
*
|
||||
* Returns the distance between the edge and the point. The
|
||||
* distance is signed which is negative if the point is to the
|
||||
* "left" of the edge and positive if the point is to the "right".
|
||||
* "right" of the edge and positive if the point is to the "left".
|
||||
* The distance is measured by projecting the point onto the
|
||||
* line through the edge. If the edge is degenerated, the distance
|
||||
* is not defined.
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ private:
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief An interface that is used to map layer between libraries and PCell's and the layout
|
||||
* @brief An interface that is used to map layer between libraries and PCells and the layout
|
||||
*/
|
||||
class ImportLayerMapping
|
||||
{
|
||||
|
|
@ -1510,7 +1510,7 @@ public:
|
|||
/**
|
||||
* @brief Gets the guiding shape layer
|
||||
*
|
||||
* The guiding shape layer is used to store the guiding shapes of PCell's
|
||||
* The guiding shape layer is used to store the guiding shapes of PCells
|
||||
*/
|
||||
unsigned int guiding_shape_layer () const;
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ Library::remap_to (db::Library *other)
|
|||
}
|
||||
|
||||
// We do PCell resolution before the library proxy resolution. The reason is that
|
||||
// PCell's may generate library proxies in their instantiation. Hence we must instantiate
|
||||
// PCells may generate library proxies in their instantiation. Hence we must instantiate
|
||||
// the PCells before we can resolve them.
|
||||
for (std::vector<std::pair<db::LibraryProxy *, db::PCellVariant *> >::const_iterator lp = pcells_to_map.begin (); lp != pcells_to_map.end (); ++lp) {
|
||||
|
||||
|
|
|
|||
|
|
@ -293,9 +293,9 @@ private:
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief A layer declaration for PCell's
|
||||
* @brief A layer declaration for PCells
|
||||
*
|
||||
* PCell's must declare the layers it wants to create.
|
||||
* PCells must declare the layers it wants to create.
|
||||
* Such a layer declaration consists of a db::LayerProperties description (layer, datatype and/or name)
|
||||
* and a symbolic name which can potentially be used as a variable name.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2858,9 +2858,9 @@ Class<db::Cell> decl_Cell ("db", "Cell",
|
|||
"this method returns true, if this cell represents a pcell with a distinct\n"
|
||||
"set of parameters (a PCell proxy). This also is true, if the PCell is imported from a library.\n"
|
||||
"\n"
|
||||
"Technically, PCell's imported from a library are library proxies which are \n"
|
||||
"Technically, PCells imported from a library are library proxies which are \n"
|
||||
"pointing to PCell variant proxies. This scheme can even proceed over multiple\n"
|
||||
"indirections, i.e. a library using PCell's from another library.\n"
|
||||
"indirections, i.e. a library using PCells from another library.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.22.\n"
|
||||
) +
|
||||
|
|
@ -3011,7 +3011,7 @@ Class<db::Cell> decl_Cell ("db", "Cell",
|
|||
gsi::method ("basic_name", &db::Cell::get_basic_name,
|
||||
"@brief Returns the name of the library or PCell or the real name of the cell\n"
|
||||
"For non-proxy cells (see \\is_proxy?), this method simply returns the cell name.\n"
|
||||
"For proxy cells, this method returns the PCell's definition name or the library\n"
|
||||
"For proxy cells, this method returns the PCells definition name or the library\n"
|
||||
"cell name. This name may differ from the actual cell's name because to ensure\n"
|
||||
"that cell names are unique, KLayout may assign different names to the actual \n"
|
||||
"cell compared to the source cell.\n"
|
||||
|
|
|
|||
|
|
@ -72,9 +72,14 @@ struct edge_defs
|
|||
return box_type (e->p1 (), e->p2 ());
|
||||
}
|
||||
|
||||
static point_type intersect_point (const C *e, const C &ee)
|
||||
static tl::Variant intersect_point (const C *e, const C &ee)
|
||||
{
|
||||
return e->intersect_point (ee).second;
|
||||
std::pair<bool, point_type> ip = e->intersect_point (ee);
|
||||
if (ip.first) {
|
||||
return tl::Variant (ip.second);
|
||||
} else {
|
||||
return tl::Variant ();
|
||||
}
|
||||
}
|
||||
|
||||
static point_type crossing_point (const C *e, const C &ee)
|
||||
|
|
@ -82,6 +87,26 @@ struct edge_defs
|
|||
return e->crossed_by_point (ee).second;
|
||||
}
|
||||
|
||||
static tl::Variant clipped (const C *e, const box_type &bx)
|
||||
{
|
||||
std::pair<bool, C> c = e->clipped (bx);
|
||||
if (c.first) {
|
||||
return tl::Variant (c.second);
|
||||
} else {
|
||||
return tl::Variant ();
|
||||
}
|
||||
}
|
||||
|
||||
static tl::Variant clipped_line (const C *e, const box_type &bx)
|
||||
{
|
||||
std::pair<bool, C> c = e->clipped_line (bx);
|
||||
if (c.first) {
|
||||
return tl::Variant (c.second);
|
||||
} else {
|
||||
return tl::Variant ();
|
||||
}
|
||||
}
|
||||
|
||||
static C &move_xy (C *e, coord_type dx, coord_type dy)
|
||||
{
|
||||
return e->move (vector_type (dx, dy));
|
||||
|
|
@ -143,34 +168,27 @@ struct edge_defs
|
|||
constructor ("new", &new_v,
|
||||
"@brief Default constructor: creates a degenerated edge 0,0 to 0,0"
|
||||
) +
|
||||
constructor ("new|#new_xyxy", &new_xyxy,
|
||||
constructor ("new|#new_xyxy", &new_xyxy, gsi::arg ("x1"), gsi::arg ("y1"), gsi::arg ("x2"), gsi::arg ("y2"),
|
||||
"@brief Constructor with two coordinates given as single values\n"
|
||||
"\n"
|
||||
"@args x1, y1, x2, y2\n"
|
||||
"\n"
|
||||
"Two points are given to create a new edge."
|
||||
) +
|
||||
constructor ("new|#new_pp", &new_pp,
|
||||
constructor ("new|#new_pp", &new_pp, gsi::arg ("p1"), gsi::arg ("p2"),
|
||||
"@brief Constructor with two points\n"
|
||||
"\n"
|
||||
"@args p1, p2\n"
|
||||
"\n"
|
||||
"Two points are given to create a new edge."
|
||||
) +
|
||||
method ("<", &C::less,
|
||||
method ("<", &C::less, gsi::arg ("e"),
|
||||
"@brief Less operator\n"
|
||||
"@args e\n"
|
||||
"@param e The object to compare against\n"
|
||||
"@return True, if the edge is 'less' as the other edge with respect to first and second point"
|
||||
) +
|
||||
method ("==", &C::equal,
|
||||
method ("==", &C::equal, gsi::arg ("e"),
|
||||
"@brief Equality test\n"
|
||||
"@args e\n"
|
||||
"@param e The object to compare against"
|
||||
) +
|
||||
method ("!=", &C::not_equal,
|
||||
method ("!=", &C::not_equal, gsi::arg ("e"),
|
||||
"@brief Inequality test\n"
|
||||
"@args e\n"
|
||||
"@param e The object to compare against"
|
||||
) +
|
||||
method_ext ("hash", &hash_value,
|
||||
|
|
@ -179,9 +197,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"This method has been introduced in version 0.25.\n"
|
||||
) +
|
||||
method ("moved", &C::moved,
|
||||
method ("moved", &C::moved, gsi::arg ("p"),
|
||||
"@brief Returns the moved edge (does not modify self)\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Moves the edge by the given offset and returns the \n"
|
||||
"moved edge. The edge is not modified.\n"
|
||||
|
|
@ -190,9 +207,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The moved edge.\n"
|
||||
) +
|
||||
method_ext ("moved", &moved_xy,
|
||||
method_ext ("moved", &moved_xy, gsi::arg ("dx"), gsi::arg ("dy"),
|
||||
"@brief Returns the moved edge (does not modify self)\n"
|
||||
"@args dx, dy\n"
|
||||
"\n"
|
||||
"Moves the edge by the given offset and returns the \n"
|
||||
"moved edge. The edge is not modified.\n"
|
||||
|
|
@ -204,9 +220,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"This version has been added in version 0.23.\n"
|
||||
) +
|
||||
method ("enlarged", &C::enlarged,
|
||||
method ("enlarged", &C::enlarged, gsi::arg ("p"),
|
||||
"@brief Returns the enlarged edge (does not modify self)\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Enlarges the edge by the given offset and returns the \n"
|
||||
"enlarged edge. The edge is not modified. Enlargement means\n"
|
||||
|
|
@ -216,9 +231,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The enlarged edge.\n"
|
||||
) +
|
||||
method ("extended", &C::extended,
|
||||
method ("extended", &C::extended, gsi::arg ("d"),
|
||||
"@brief Returns the extended edge (does not modify self)\n"
|
||||
"@args d\n"
|
||||
"\n"
|
||||
"Extends the edge by the given distance and returns the \n"
|
||||
"extended edge. The edge is not modified. Extending means\n"
|
||||
|
|
@ -233,9 +247,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The extended edge.\n"
|
||||
) +
|
||||
method ("extend", &C::extend,
|
||||
method ("extend", &C::extend, gsi::arg ("d"),
|
||||
"@brief Extends the edge (modifies self)\n"
|
||||
"@args d\n"
|
||||
"\n"
|
||||
"Extends the edge by the given distance and returns the \n"
|
||||
"extended edge. The edge is not modified. Extending means\n"
|
||||
|
|
@ -250,9 +263,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The extended edge (self).\n"
|
||||
) +
|
||||
method ("shifted", &C::shifted,
|
||||
method ("shifted", &C::shifted, gsi::arg ("d"),
|
||||
"@brief Returns the shifted edge (does not modify self)\n"
|
||||
"@args d\n"
|
||||
"\n"
|
||||
"Shifts the edge by the given distance and returns the \n"
|
||||
"shifted edge. The edge is not modified. Shifting by a positive value "
|
||||
|
|
@ -267,9 +279,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The shifted edge.\n"
|
||||
) +
|
||||
method ("shift", &C::shift,
|
||||
method ("shift", &C::shift, gsi::arg ("d"),
|
||||
"@brief Shifts the edge (modifies self)\n"
|
||||
"@args d\n"
|
||||
"\n"
|
||||
"Shifts the edge by the given distance and returns the \n"
|
||||
"shifted edge. The edge is not modified. Shifting by a positive value "
|
||||
|
|
@ -284,9 +295,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The shifted edge (self).\n"
|
||||
) +
|
||||
method ("transformed", &C::template transformed<simple_trans_type>,
|
||||
method ("transformed", &C::template transformed<simple_trans_type>, gsi::arg ("t"),
|
||||
"@brief Transform the edge.\n"
|
||||
"@args t\n"
|
||||
"\n"
|
||||
"Transforms the edge with the given transformation.\n"
|
||||
"Does not modify the edge but returns the transformed edge.\n"
|
||||
|
|
@ -295,9 +305,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The transformed edge.\n"
|
||||
) +
|
||||
method ("transformed|#transformed_cplx", &C::template transformed<complex_trans_type>,
|
||||
method ("transformed|#transformed_cplx", &C::template transformed<complex_trans_type>, gsi::arg ("t"),
|
||||
"@brief Transform the edge.\n"
|
||||
"@args t\n"
|
||||
"\n"
|
||||
"Transforms the edge with the given complex transformation.\n"
|
||||
"Does not modify the edge but returns the transformed edge.\n"
|
||||
|
|
@ -306,9 +315,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The transformed edge.\n"
|
||||
) +
|
||||
method ("move", &C::move,
|
||||
method ("move", &C::move, gsi::arg ("p"),
|
||||
"@brief Moves the edge.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Moves the edge by the given offset and returns the \n"
|
||||
"moved edge. The edge is overwritten.\n"
|
||||
|
|
@ -317,9 +325,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The moved edge.\n"
|
||||
) +
|
||||
method_ext ("move", &move_xy,
|
||||
method_ext ("move", &move_xy, gsi::arg ("dx"), gsi::arg ("dy"),
|
||||
"@brief Moves the edge.\n"
|
||||
"@args dx, dy\n"
|
||||
"\n"
|
||||
"Moves the edge by the given offset and returns the \n"
|
||||
"moved edge. The edge is overwritten.\n"
|
||||
|
|
@ -331,9 +338,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"This version has been added in version 0.23.\n"
|
||||
) +
|
||||
method ("enlarge", &C::enlarge,
|
||||
method ("enlarge", &C::enlarge, gsi::arg ("p"),
|
||||
"@brief Enlarges the edge.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Enlarges the edge by the given distance and returns the \n"
|
||||
"enlarged edge. The edge is overwritten.\n"
|
||||
|
|
@ -347,17 +353,15 @@ struct edge_defs
|
|||
method ("p1", &C::p1,
|
||||
"@brief The first point.\n"
|
||||
) +
|
||||
method_ext ("p1=", &set_p1,
|
||||
method_ext ("p1=", &set_p1, gsi::arg ("point"),
|
||||
"@brief Sets the first point.\n"
|
||||
"@args point\n"
|
||||
"This method has been added in version 0.23."
|
||||
) +
|
||||
method ("p2", &C::p2,
|
||||
"@brief The second point.\n"
|
||||
) +
|
||||
method_ext ("p2=", &set_p2,
|
||||
method_ext ("p2=", &set_p2, gsi::arg ("point"),
|
||||
"@brief Sets the second point.\n"
|
||||
"@args point\n"
|
||||
"This method has been added in version 0.23."
|
||||
) +
|
||||
method ("dx", &C::dx,
|
||||
|
|
@ -369,33 +373,29 @@ struct edge_defs
|
|||
method ("x1", &C::x1,
|
||||
"@brief Shortcut for p1.x\n"
|
||||
) +
|
||||
method_ext ("x1=", &set_x1,
|
||||
method_ext ("x1=", &set_x1, gsi::arg ("coord"),
|
||||
"@brief Sets p1.x\n"
|
||||
"@args coord\n"
|
||||
"This method has been added in version 0.23."
|
||||
) +
|
||||
method ("y1", &C::y1,
|
||||
"@brief Shortcut for p1.y\n"
|
||||
) +
|
||||
method_ext ("y1=", &set_y1,
|
||||
method_ext ("y1=", &set_y1, gsi::arg ("coord"),
|
||||
"@brief Sets p1.y\n"
|
||||
"@args coord\n"
|
||||
"This method has been added in version 0.23."
|
||||
) +
|
||||
method ("x2", &C::x2,
|
||||
"@brief Shortcut for p2.x\n"
|
||||
) +
|
||||
method_ext ("x2=", &set_x2,
|
||||
method_ext ("x2=", &set_x2, gsi::arg ("coord"),
|
||||
"@brief Sets p2.x\n"
|
||||
"@args coord\n"
|
||||
"This method has been added in version 0.23."
|
||||
) +
|
||||
method ("y2", &C::y2,
|
||||
"@brief Shortcut for p2.y\n"
|
||||
) +
|
||||
method_ext ("y2=", &set_y2,
|
||||
method_ext ("y2=", &set_y2, gsi::arg ("coord"),
|
||||
"@brief Sets p2.y\n"
|
||||
"@args coord\n"
|
||||
"This method has been added in version 0.23."
|
||||
) +
|
||||
method ("dx_abs", &C::dx_abs,
|
||||
|
|
@ -423,9 +423,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The orthogonal length (abs(dx)+abs(dy))\n"
|
||||
) +
|
||||
constructor ("from_s", &from_string,
|
||||
constructor ("from_s", &from_string, gsi::arg ("s"),
|
||||
"@brief Creates an object from a string\n"
|
||||
"@args s\n"
|
||||
"Creates the object from a string representation (as returned by \\to_s)\n"
|
||||
"\n"
|
||||
"This method has been added in version 0.23.\n"
|
||||
|
|
@ -433,19 +432,16 @@ struct edge_defs
|
|||
method ("to_s", (std::string (C::*) () const) &C::to_string,
|
||||
"@brief Returns a string representing the edge\n"
|
||||
) +
|
||||
method ("is_parallel?", &C::parallel,
|
||||
method ("is_parallel?", &C::parallel, gsi::arg ("e"),
|
||||
"@brief Test for being parallel\n"
|
||||
"@args e\n"
|
||||
"\n"
|
||||
"@param e The edge to test against\n"
|
||||
"\n"
|
||||
"@return True if both edges are parallel\n"
|
||||
) +
|
||||
method ("*", &C::scaled,
|
||||
method ("*", &C::scaled, gsi::arg ("scale_factor"),
|
||||
"@brief Scale edge\n"
|
||||
"\n"
|
||||
"@args scale_factor\n"
|
||||
"\n"
|
||||
"The * operator scales self with the given factor.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.22.\n"
|
||||
|
|
@ -454,9 +450,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The scaled edge\n"
|
||||
) +
|
||||
method ("contains?", &C::contains,
|
||||
method ("contains?", &C::contains, gsi::arg ("p"),
|
||||
"@brief Test whether a point is on an edge.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"A point is on a edge if it is on (or at least closer \n"
|
||||
"than a grid point to) the edge.\n"
|
||||
|
|
@ -465,9 +460,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return True if the point is on the edge.\n"
|
||||
) +
|
||||
method ("contains_excl?", &C::contains_excl,
|
||||
method ("contains_excl?", &C::contains_excl, gsi::arg ("p"),
|
||||
"@brief Test whether a point is on an edge excluding the endpoints.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"A point is on a edge if it is on (or at least closer \n"
|
||||
"than a grid point to) the edge.\n"
|
||||
|
|
@ -476,9 +470,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return True if the point is on the edge but not equal p1 or p2.\n"
|
||||
) +
|
||||
method ("coincident?", &C::coincident,
|
||||
method ("coincident?", &C::coincident, gsi::arg ("e"),
|
||||
"@brief Coincidence check.\n"
|
||||
"@args e\n"
|
||||
"\n"
|
||||
"Checks whether a edge is coincident with another edge. \n"
|
||||
"Coincidence is defined by being parallel and that \n"
|
||||
|
|
@ -488,9 +481,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return True if the edges are coincident.\n"
|
||||
) +
|
||||
method ("intersect?", &C::intersect,
|
||||
method ("intersect?", &C::intersect, gsi::arg ("e"),
|
||||
"@brief Intersection test. \n"
|
||||
"@args e\n"
|
||||
"\n"
|
||||
"Returns true if the edges intersect. Two edges intersect if they share at least one point. \n"
|
||||
"If the edges coincide, they also intersect.\n"
|
||||
|
|
@ -499,9 +491,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@param e The edge to test.\n"
|
||||
) +
|
||||
method_ext ("intersection_point", &intersect_point,
|
||||
method_ext ("intersection_point", &intersect_point, gsi::arg ("e"),
|
||||
"@brief Returns the intersection point of two edges. \n"
|
||||
"@args e\n"
|
||||
"\n"
|
||||
"This method delivers the intersection point. If the edges do not intersect, the result is undefined.\n"
|
||||
"\n"
|
||||
|
|
@ -509,14 +500,39 @@ struct edge_defs
|
|||
"@return The point where the edges intersect.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.19.\n"
|
||||
"From version 0.26.2, this method will return nil in case of non-intersection.\n"
|
||||
) +
|
||||
method ("distance", &C::distance,
|
||||
method_ext ("clipped", &clipped, gsi::arg ("box"),
|
||||
"@brief Returns the edge clipped at the given box\n"
|
||||
"\n"
|
||||
"@param box The clip box.\n"
|
||||
"@return The clipped edge or nil if the edge does not intersect with the box.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.26.2.\n"
|
||||
) +
|
||||
method_ext ("clipped_line", &clipped_line, gsi::arg ("box"),
|
||||
"@brief Returns the line through the edge clipped at the given box\n"
|
||||
"\n"
|
||||
"@param box The clip box.\n"
|
||||
"@return The part of the line through the box or nil if the line does not intersect with the box.\n"
|
||||
"\n"
|
||||
"In contrast to \\clipped, this method will consider the edge exended infinitely (a \"line\"). "
|
||||
"The returned edge will be the part of this line going through the box.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.26.2.\n"
|
||||
) +
|
||||
method ("d", &C::d,
|
||||
"@brief Gets the edge extension as a vector.\n"
|
||||
"This method is equivalent to p2 - p1."
|
||||
"\n"
|
||||
"This method has been introduced in version 0.26.2.\n"
|
||||
) +
|
||||
method ("distance", &C::distance, gsi::arg ("p"),
|
||||
"@brief Distance between the edge and a point.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Returns the distance between the edge and the point. The \n"
|
||||
"distance is signed which is negative if the point is to the\n"
|
||||
"\"left\" of the edge and positive if the point is to the \"right\".\n"
|
||||
"\"right\" of the edge and positive if the point is to the \"left\".\n"
|
||||
"The distance is measured by projecting the point onto the\n"
|
||||
"line through the edge. If the edge is degenerated, the distance\n"
|
||||
"is not defined.\n"
|
||||
|
|
@ -525,9 +541,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The distance\n"
|
||||
) +
|
||||
method ("side_of", &C::side_of,
|
||||
method ("side_of", &C::side_of, gsi::arg ("p"),
|
||||
"@brief Indicates at which side the point is located relative to the edge.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Returns 1 if the point is \"left\" of the edge, 0 if on\n"
|
||||
"and -1 if the point is \"right\" of the edge.\n"
|
||||
|
|
@ -536,9 +551,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@return The side value\n"
|
||||
) +
|
||||
method ("distance_abs", &C::distance_abs,
|
||||
method ("distance_abs", &C::distance_abs, gsi::arg ("p"),
|
||||
"@brief Absolute distance between the edge and a point.\n"
|
||||
"@args p\n"
|
||||
"\n"
|
||||
"Returns the distance between the edge and the point. \n"
|
||||
"\n"
|
||||
|
|
@ -561,9 +575,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"This method has been introduced in version 0.23.\n"
|
||||
) +
|
||||
method ("crossed_by?", &C::crossed_by,
|
||||
method ("crossed_by?", &C::crossed_by, gsi::arg ("e"),
|
||||
"@brief Check, if an edge is cut by a line (given by an edge)\n"
|
||||
"@args e\n"
|
||||
"\n"
|
||||
"This method returns true if p1 is in one semispace \n"
|
||||
"while p2 is in the other or one of them is on the line\n"
|
||||
|
|
@ -571,9 +584,8 @@ struct edge_defs
|
|||
"\n"
|
||||
"@param e The edge representing the line that the edge must be crossing.\n"
|
||||
) +
|
||||
method_ext ("crossing_point", &crossing_point,
|
||||
method_ext ("crossing_point", &crossing_point, gsi::arg ("e"),
|
||||
"@brief Returns the crossing point on two edges. \n"
|
||||
"@args e\n"
|
||||
"\n"
|
||||
"This method delivers the point where the given edge (self) crosses the line given "
|
||||
"by the edge in argument \"e\". If self does not cross this line, the result is undefined. "
|
||||
|
|
@ -611,9 +623,8 @@ Class<db::Edge> decl_Edge ("db", "Edge",
|
|||
"\n"
|
||||
"This method has been introduced in version 0.25."
|
||||
) +
|
||||
method ("transformed", &db::Edge::transformed<db::ICplxTrans>,
|
||||
method ("transformed", &db::Edge::transformed<db::ICplxTrans>, gsi::arg ("t"),
|
||||
"@brief Transform the edge.\n"
|
||||
"@args t\n"
|
||||
"\n"
|
||||
"Transforms the edge with the given complex transformation.\n"
|
||||
"Does not modify the edge but returns the transformed edge.\n"
|
||||
|
|
@ -661,11 +672,9 @@ Class<db::DEdge> decl_DEdge ("db", "DEdge",
|
|||
"\n"
|
||||
"This method has been introduced in version 0.25."
|
||||
) +
|
||||
method ("transformed", &db::DEdge::transformed<db::VCplxTrans>,
|
||||
method ("transformed", &db::DEdge::transformed<db::VCplxTrans>, gsi::arg ("t"),
|
||||
"@brief Transforms the edge with the given complex transformation\n"
|
||||
"\n"
|
||||
"@args t\n"
|
||||
"\n"
|
||||
"@param t The magnifying transformation to apply\n"
|
||||
"@return The transformed edge (in this case an integer coordinate edge)\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -1878,7 +1878,7 @@ Class<db::Layout> decl_Layout ("db", "Layout",
|
|||
"@return The cell index of the pcell variant proxy cell\n"
|
||||
"This method will create a PCell variant proxy for a local PCell definition.\n"
|
||||
"It will create the PCell variant for the given parameters. Note that this method \n"
|
||||
"does not allow one to create PCell instances for PCell's located in a library. Use\n"
|
||||
"does not allow one to create PCell instances for PCells located in a library. Use\n"
|
||||
"\\add_pcell_variant with the library parameter for that purpose.\n"
|
||||
"Unlike the variant using a list of parameters, this version allows specification\n"
|
||||
"of the parameters with a key/value dictionary. The keys are the parameter names\n"
|
||||
|
|
@ -1898,7 +1898,7 @@ Class<db::Layout> decl_Layout ("db", "Layout",
|
|||
"@return The cell index of the pcell variant proxy cell\n"
|
||||
"This method will create a PCell variant proxy for a local PCell definition.\n"
|
||||
"It will create the PCell variant for the given parameters. Note that this method \n"
|
||||
"does not allow one to create PCell instances for PCell's located in a library. Use\n"
|
||||
"does not allow one to create PCell instances for PCells located in a library. Use\n"
|
||||
"\\add_pcell_variant with the library parameter for that purpose.\n"
|
||||
"\n"
|
||||
"The parameters are a sequence of variants which correspond to the parameters declared "
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ public:
|
|||
/**
|
||||
* @brief Handle changes in the guiding shapes, i.e. create PCell variants
|
||||
*
|
||||
* @return true, if PCell's have been updated, indicating that our selection is no longer valid
|
||||
* @return true, if PCells have been updated, indicating that our selection is no longer valid
|
||||
*
|
||||
* This version assumes there is only one guiding shape selected and will update the selection.
|
||||
* It will also call layout.cleanup() if required.
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
<li><b>Coded libraries:</b>
|
||||
Such libraries are provided by code, either through shared objects/DLL's or through Ruby code.
|
||||
Basically such code has to provide a layout object containing the library cells.
|
||||
A coded library can also provide PCell's (parametrized cells) as library components.
|
||||
A coded library can also provide PCells (parametrized cells) as library components.
|
||||
Sell <link href="/about/about_pcells.xml"/> for details about parametrized cells.
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
<doc>
|
||||
|
||||
<title>About PCell's</title>
|
||||
<title>About PCells</title>
|
||||
|
||||
<p>
|
||||
Starting with version 0.22, KLayout offers parametrized cells (PCell's).
|
||||
Starting with version 0.22, KLayout offers parametrized cells (PCells).
|
||||
PCells are a feature found in other tools to simplify layout by providing generators
|
||||
for common layout building blocks. Parametrized cells do not contain
|
||||
static layout but are created dynamically by code using a given set of parameters.
|
||||
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
<p>
|
||||
Using a PCell is easy: choose the library and the PCell from that library when asked for
|
||||
the cell in the instance options dialog. For PCell's, KLayout offers an additional
|
||||
the cell in the instance options dialog. For PCells, KLayout offers an additional
|
||||
parameters page where it asks for the parameter required by the PCell. The placement
|
||||
of the PCell is done as for simple instances. PCell's offer the same instantiation
|
||||
of the PCell is done as for simple instances. PCells offer the same instantiation
|
||||
options that normal cells.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
KLayout provides a simple library called "Basic" with some useful basic PCell's.
|
||||
KLayout provides a simple library called "Basic" with some useful basic PCells.
|
||||
See <link href="/about/basic_lib.xml"/> for more details about that library.
|
||||
</p>
|
||||
|
||||
|
|
@ -52,13 +52,13 @@
|
|||
<p>
|
||||
A PCell implementation consists of at least three parts:
|
||||
a description text, a parameter declaration and a production callback. In addition, a PCell
|
||||
can provide a method that "fixes" parameters according to the PCell's consistency rules
|
||||
can provide a method that "fixes" parameters according to the PCells consistency rules
|
||||
(coerce parameters). Technically, a PCell is a class implementing a certain interface with
|
||||
these methods.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
PCell's are usually packed in libraries. PCell libraries can be provided as
|
||||
PCells are usually packed in libraries. PCell libraries can be provided as
|
||||
shared objects/DLL's (in C++) or as Ruby scripts. Because PCell code is only executed if
|
||||
required, performance usually is not the main objective. A Ruby implementation
|
||||
will therefore be sufficient in most cases and
|
||||
|
|
|
|||
|
|
@ -10,22 +10,22 @@
|
|||
<h2>The "Basic" library</h2>
|
||||
|
||||
<p>
|
||||
The "Basic" Library provides some useful generic PCell's.
|
||||
The "Basic" Library provides some useful generic PCells.
|
||||
One use model is to draw a shape and convert the shape to one
|
||||
of the provided PCell's. This use model is suitable for creating
|
||||
of the provided PCells. This use model is suitable for creating
|
||||
Circles, Ellipses, Donuts, Texts and rounded and stroked polygons or
|
||||
rounded paths.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To use that feature, draw the shape and choose "Convert To PCell's"
|
||||
To use that feature, draw the shape and choose "Convert To PCells"
|
||||
from the "Edit"/"Selection" menu. A dialog will be shown where the
|
||||
target PCell can be selected. Only those PCell's supporting that
|
||||
target PCell can be selected. Only those PCells supporting that
|
||||
shape type will be shown.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The "Basic" library provides the following PCell's:
|
||||
The "Basic" library provides the following PCells:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
<h2>CIRCLE and ELLIPSE</h2>
|
||||
|
||||
<p>These PCell's define a circle and an ellipse. In both cases, the number of interpolation
|
||||
<p>These PCells define a circle and an ellipse. In both cases, the number of interpolation
|
||||
points (per full circle) can be specified. The default is 64 points. A circle features
|
||||
a handle to define the diameter. An ellipse features two handles defining the diameters in
|
||||
x and y direction.
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
|
||||
<h2>PIE and ARC</h2>
|
||||
|
||||
<p>Both of these PCell's are segments of circles or donuts. The PIE PCell features two handles to
|
||||
<p>Both of these PCells are segments of circles or donuts. The PIE PCell features two handles to
|
||||
define the radius and start and end angle. The ARC PCell also features two handles to define outer
|
||||
and inner radius as well. The following image shows PIE and ARC in action:</p>
|
||||
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
<img src="/about/pie_arc.png"/>
|
||||
</p>
|
||||
|
||||
<p>Both PCell's do not support conversion of shapes.</p>
|
||||
<p>Both PCells do not support conversion of shapes.</p>
|
||||
|
||||
<h2>ROUND_PATH</h2>
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
<p>
|
||||
To learn more about libraries, read <link href="/about/about_libraries.xml"/>. Read
|
||||
<link href="/about/about_pcells.xml"/> for details about PCell's.
|
||||
<link href="/about/about_pcells.xml"/> for details about PCells.
|
||||
</p>
|
||||
|
||||
</doc>
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@
|
|||
<keyword name="Convert PCell"/>
|
||||
|
||||
<p>
|
||||
PCell's can be created from shapes if the PCell is derived from a "guiding shape".
|
||||
Specifically the Basic library PCell's support derivation from guiding shapes with a few
|
||||
PCells can be created from shapes if the PCell is derived from a "guiding shape".
|
||||
Specifically the Basic library PCells support derivation from guiding shapes with a few
|
||||
exceptions. So for example, a round-cornered polygon can be created from a
|
||||
normal polygon by selecting the polygons, choosing "Edit/Selection/Convert To PCell" and
|
||||
selecting the "Basic.ROUND_POLYGON" for the PCell.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
PCell's can be converted to normal cells by choosing "Edit/Cell/Convert Cell To Static"
|
||||
PCells can be converted to normal cells by choosing "Edit/Cell/Convert Cell To Static"
|
||||
or "Edit/Layout/Convert All Cells To Static". Normal (static) cells can be edited
|
||||
individually but do no longer offer parameters to control the look of the cell.
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ lv.remove_unused_layers</pre>
|
|||
is a special layer.
|
||||
</p>
|
||||
|
||||
<p>In addition, a layout contains a special layer which is used to implement the "guiding shape" feature of PCell's.
|
||||
<p>In addition, a layout contains a special layer which is used to implement the "guiding shape" feature of PCells.
|
||||
It is a special layer that serves as a container for shapes which parametrize PCells. The index of that layer can be
|
||||
obtained with <class_doc href="Layout#guiding_shape_layer"/>.</p>
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ shape.set_property(1, "NewValue")</pre>
|
|||
API. It represents a cell, which itself is a collection of shapes per layer
|
||||
and instances of other cells. The methods provided by the Cell class deal with either the shape or
|
||||
the instance aspect. A cell is also responsible for handling parts of the PCell scheme, either for
|
||||
the cell itself (if it is an incarnation of a PCell) or instances of PCell's.
|
||||
the cell itself (if it is an incarnation of a PCell) or instances of PCells.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
So it is possible to write one script in Ruby and another one in Python. Just pick your favorite language.
|
||||
Scripts written in different languages share the same KLayout data structures.
|
||||
Naturally they cannot directly share variables or language-specific data. But you can, for example,
|
||||
implement PCell's in Python and Ruby and use those different PCells in the same layout at the same time.
|
||||
implement PCells in Python and Ruby and use those different PCells in the same layout at the same time.
|
||||
Depending on the type of PCell, KLayout will either execute Python or Ruby code.
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<doc>
|
||||
|
||||
<title>Coding PCell's In Ruby</title>
|
||||
<title>Coding PCells In Ruby</title>
|
||||
<keyword name="Ruby"/>
|
||||
<keyword name="PCell"/>
|
||||
<keyword name="Programming"/>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<h2-index/>
|
||||
|
||||
<p>
|
||||
A good starting point for Ruby PCell's is the PCell sample. Create a macro in the
|
||||
A good starting point for Ruby PCells is the PCell sample. Create a macro in the
|
||||
macro development IDE (use the "+" button) and choose "PCell sample" from the
|
||||
templates.
|
||||
</p>
|
||||
|
|
@ -171,7 +171,7 @@ end</pre>
|
|||
</p>
|
||||
|
||||
<p>Using the same concept, a library is an object derived from the <class_doc href="Library"/> class. It is basically
|
||||
a container for PCell's and static layout cells. A library has to be initialized (most conveniently in
|
||||
a container for PCells and static layout cells. A library has to be initialized (most conveniently in
|
||||
the constructor), registered and initialized once. That makes the library available to the system and
|
||||
it can be used in layouts.
|
||||
</p>
|
||||
|
|
@ -420,13 +420,13 @@ end</pre>
|
|||
|
||||
<p>
|
||||
Of course, more than one PCell class can be declared. Each PCell type must
|
||||
have an own implementation class which we will use later to create the PCell's from.
|
||||
have an own implementation class which we will use later to create the PCells from.
|
||||
</p>
|
||||
|
||||
<h2>The Library</h2>
|
||||
|
||||
<p>
|
||||
The library is the container for the PCell's.
|
||||
The library is the container for the PCells.
|
||||
All important code is packed into the constructor of the library.
|
||||
</p>
|
||||
|
||||
|
|
@ -476,14 +476,14 @@ end</pre>
|
|||
|
||||
<p>
|
||||
This line of code will instantiate the library and, through the constructor, instantiate
|
||||
the PCell's and register the library. We are done now and can use the library and our PCell.
|
||||
the PCells and register the library. We are done now and can use the library and our PCell.
|
||||
</p>
|
||||
|
||||
<h2>Debugging The Code</h2>
|
||||
|
||||
<p>
|
||||
When you have modified the code, you need to rerun the script. That will create the classes
|
||||
again and re-register the PCell's and the Library with the new implementation. PCell's already
|
||||
again and re-register the PCells and the Library with the new implementation. PCells already
|
||||
living in the layout will be migrated to the new implementation by mapping their parameters by
|
||||
their symbolic names.
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@
|
|||
<description/>
|
||||
<dbu>0.001</dbu>
|
||||
<base-path/>
|
||||
<layer-properties_file/>
|
||||
<layer-properties-file/>
|
||||
<add-other-layers>true</add-other-layers>
|
||||
</technology>
|
||||
|
|
|
|||
|
|
@ -2154,9 +2154,9 @@ public:
|
|||
bool layer_model_updated ();
|
||||
|
||||
/**
|
||||
* @brief Get the "select inside PCell's" selection mode
|
||||
* @brief Get the "select inside PCells" selection mode
|
||||
*
|
||||
* @return true, objects inside PCell's can be selected
|
||||
* @return true, objects inside PCells can be selected
|
||||
*/
|
||||
bool select_inside_pcells_mode () const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public:
|
|||
set_name ("Basic");
|
||||
set_description ("Basic layout objects");
|
||||
|
||||
// register all the PCell's:
|
||||
// register all the PCells:
|
||||
layout ().register_pcell ("TEXT", new BasicText ());
|
||||
layout ().register_pcell ("CIRCLE", new BasicCircle ());
|
||||
layout ().register_pcell ("ELLIPSE", new BasicEllipse ());
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ GDS2ReaderBase::do_read (db::Layout &layout)
|
|||
|
||||
if (cell == 0) {
|
||||
|
||||
// ignore everything in proxy cells: these are created from the libraries or PCell's.
|
||||
// ignore everything in proxy cells: these are created from the libraries or PCells.
|
||||
|
||||
} else if (rec_id == sPROPATTR) {
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ VariantUserClassBase::clear_class_table ()
|
|||
std::string
|
||||
VariantUserClassBase::translate_class_name (const std::string &lc_clsname)
|
||||
{
|
||||
// Note: for pre-0.23 versions to be able to read PCell's generated by 0.23 and further
|
||||
// Note: for pre-0.23 versions to be able to read PCells generated by 0.23 and further
|
||||
// (see #601), we need to use the old "complex type" names, specifically "layer" instead of "layerinfo".
|
||||
if (lc_clsname == "layerinfo") {
|
||||
return "layer";
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ class DBEdge_TestClass < TestBase
|
|||
|
||||
assert_equal( a.intersect?( RBA::DEdge::new( -1, -1, 1, 5 ) ), true )
|
||||
assert_equal( a.intersection_point( RBA::DEdge::new( -1, -1, 1, 5 ) ).to_s, "0,2" )
|
||||
assert_equal( a.intersection_point( RBA::DEdge::new( -1, 3, 1, 5 ) ) == nil, true )
|
||||
assert_equal( a.intersect?( RBA::DEdge::new( -1, 11, 1, 15 ) ), false )
|
||||
assert_equal( a.distance( RBA::DPoint::new( 3, 3 ) ), 1.0 )
|
||||
assert_equal( a.distance( RBA::DPoint::new( 3, 1 ) ), -1.0 )
|
||||
|
|
@ -162,6 +163,7 @@ class DBEdge_TestClass < TestBase
|
|||
assert_equal( a.dy, -9 )
|
||||
assert_equal( a.dx_abs, 16 )
|
||||
assert_equal( a.dy_abs, 9 )
|
||||
assert_equal( a.d.to_s, "16,-9" )
|
||||
assert_equal( a.is_degenerate?, false )
|
||||
|
||||
c = a.dup;
|
||||
|
|
@ -217,6 +219,7 @@ class DBEdge_TestClass < TestBase
|
|||
|
||||
assert_equal( a.intersect?( RBA::Edge::new( RBA::Point::new( -1, -1 ), RBA::Point::new( 1, 5 ) ) ), true )
|
||||
assert_equal( a.intersection_point( RBA::Edge::new( RBA::Point::new( -1, -1 ), RBA::Point::new( 1, 5 ) ) ).to_s, "0,2" )
|
||||
assert_equal( a.intersection_point( RBA::Edge::new( RBA::Point::new( -1, 3 ), RBA::Point::new( 1, 5 ) ) ) == nil, true )
|
||||
assert_equal( a.intersect?( RBA::Edge::new( RBA::Point::new( -1, 11 ), RBA::Point::new( 1, 15 ) ) ), false )
|
||||
assert_equal( a.distance( RBA::Point::new( 3, 3 ) ), 1.0 )
|
||||
assert_equal( a.distance( RBA::Point::new( 3, 1 ) ), -1.0 )
|
||||
|
|
@ -288,6 +291,39 @@ class DBEdge_TestClass < TestBase
|
|||
|
||||
end
|
||||
|
||||
# Clipped
|
||||
def test_4_clip
|
||||
|
||||
e = RBA::Edge::new(0, 0, 1000, 2000)
|
||||
|
||||
assert_equal(e.clipped(RBA::Box::new(100, 0, 200, 2000)).to_s, "(100,200;200,400)")
|
||||
assert_equal(e.clipped(RBA::Box::new(100, 1000, 200, 2000)) == nil, true)
|
||||
assert_equal(e.clipped(RBA::Box::new(1000, 0, 1100, 3000)).to_s, "(1000,2000;1000,2000)")
|
||||
assert_equal(e.clipped(RBA::Box::new(1001, 0, 1100, 3000)) == nil, true)
|
||||
assert_equal(e.clipped(RBA::Box::new(-100, -100, 200, 2000)).to_s, "(0,0;200,400)")
|
||||
|
||||
assert_equal(e.clipped_line(RBA::Box::new(100, 0, 200, 2000)).to_s, "(100,200;200,400)")
|
||||
assert_equal(e.clipped_line(RBA::Box::new(100, 1000, 200, 2000)) == nil, true)
|
||||
assert_equal(e.clipped_line(RBA::Box::new(1000, 0, 1100, 3000)).to_s, "(1000,2000;1100,2200)")
|
||||
assert_equal(e.clipped_line(RBA::Box::new(1001, 0, 1100, 3000)).to_s, "(1001,2002;1100,2200)")
|
||||
assert_equal(e.clipped_line(RBA::Box::new(-100, -100, 200, 2000)).to_s, "(-50,-100;200,400)")
|
||||
|
||||
e = RBA::DEdge::new(0, 0, 1000, 2000)
|
||||
|
||||
assert_equal(e.clipped(RBA::DBox::new(100, 0, 200, 2000)).to_s, "(100,200;200,400)")
|
||||
assert_equal(e.clipped(RBA::DBox::new(100, 1000, 200, 2000)) == nil, true)
|
||||
assert_equal(e.clipped(RBA::DBox::new(1000, 0, 1100, 3000)).to_s, "(1000,2000;1000,2000)")
|
||||
assert_equal(e.clipped(RBA::DBox::new(1001, 0, 1100, 3000)) == nil, true)
|
||||
assert_equal(e.clipped(RBA::DBox::new(-100, -100, 200, 2000)).to_s, "(0,0;200,400)")
|
||||
|
||||
assert_equal(e.clipped_line(RBA::DBox::new(100, 0, 200, 2000)).to_s, "(100,200;200,400)")
|
||||
assert_equal(e.clipped_line(RBA::DBox::new(100, 1000, 200, 2000)) == nil, true)
|
||||
assert_equal(e.clipped_line(RBA::DBox::new(1000, 0, 1100, 3000)).to_s, "(1000,2000;1100,2200)")
|
||||
assert_equal(e.clipped_line(RBA::DBox::new(1001, 0, 1100, 3000)).to_s, "(1001,2002;1100,2200)")
|
||||
assert_equal(e.clipped_line(RBA::DBox::new(-100, -100, 200, 2000)).to_s, "(-50,-100;200,400)")
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
load("test_epilogue.rb")
|
||||
|
|
|
|||
Loading…
Reference in New Issue