mirror of https://github.com/KLayout/klayout.git
Fixed doc
This commit is contained in:
parent
2dc9df3f40
commit
7f16c7b597
|
|
@ -2796,7 +2796,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
|
|||
"\n"
|
||||
"@return The new polygons representing the forbidden region.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29.\n"
|
||||
"This method has been introduced in version 0.29.1.\n"
|
||||
) +
|
||||
method_ext ("move", &move_p, gsi::arg ("v"),
|
||||
"@brief Moves the region\n"
|
||||
|
|
|
|||
|
|
@ -2137,14 +2137,14 @@ Class<db::Shape> decl_Shape ("db", "Shape",
|
|||
"The less operator implementation is based on pointers and not strictly reproducible."
|
||||
"However, it is good enough so Shape objects can serve as keys in hashes (see also \\hash).\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29."
|
||||
"This method has been introduced in version 0.29.1."
|
||||
) +
|
||||
gsi::method ("hash", &db::Shape::hash_value,
|
||||
"@brief Hash function\n"
|
||||
"\n"
|
||||
"The hash function enables Shape objects as keys in hashes.\n"
|
||||
"\n"
|
||||
"This method has been introduced in version 0.29."
|
||||
"This method has been introduced in version 0.29.1."
|
||||
) +
|
||||
gsi::method ("to_s", &db::Shape::to_string,
|
||||
"@brief Create a string showing the contents of the reference\n"
|
||||
|
|
|
|||
|
|
@ -389,114 +389,147 @@ gsi::Class<EditorHooksImpl> decl_EditorHooks ("lay", "EditorHooks",
|
|||
"This class provides the basic interface. To implement callbacks, use the \\EditorHooks class. "
|
||||
"You should not need to instantiate this class.\n"
|
||||
"\n"
|
||||
"The following is an excample for editor hooks that add DRC space indicators for polygon-alike shapes:\n"
|
||||
"The following is an excample for editor hooks that add DRC space indicators for polygon-alike shapes,\n"
|
||||
"It implements the shape creation protocol to capture new shapes and the modification protocol to "
|
||||
"capture shape manipulations. It displays a halo following hard-coded DRC rules to indicate the "
|
||||
"forbidden zones around the shapes:\n"
|
||||
"\n"
|
||||
"@code\n"
|
||||
"class MyEditorHooks(pya.EditorHooks):\n"
|
||||
"class MyEditorHooks < RBA::EditorHooks\n"
|
||||
"\n"
|
||||
" def __init__(self):\n"
|
||||
" def initialize()\n"
|
||||
" \n"
|
||||
" self.register(\"editor_hooks_demo\")\n"
|
||||
" \n"
|
||||
" self.markers = []\n"
|
||||
" self.view = None\n"
|
||||
" self.layout = None\n"
|
||||
" self.space = 0.0\n"
|
||||
" \n"
|
||||
" self.spaces = {\n"
|
||||
" pya.LayerInfo(1, 0): ( 0.2, pya.Region.Euclidian ),\n"
|
||||
" pya.LayerInfo(2, 0): ( 0.5, pya.Region.Projection )\n"
|
||||
" register(\"editor_hooks_demo\")\n"
|
||||
"\n"
|
||||
" cleanup \n"
|
||||
"\n"
|
||||
" # some demo values \n"
|
||||
" @spaces = {\n"
|
||||
" RBA::LayerInfo::new(1, 0) => [ 0.2, RBA::Region::Euclidian ],\n"
|
||||
" RBA::LayerInfo::new(2, 0) => [ 0.5, RBA::Region::Projection ]\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" self.instance_space = 0.4\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" # Utilities\n"
|
||||
" \n"
|
||||
" def set_space_from_layer(self, layer_index):\n"
|
||||
" # pick the space value or None\n"
|
||||
" lp = self.layout.get_info(layer_index)\n"
|
||||
" if lp in self.spaces:\n"
|
||||
" (s, m) = self.spaces[lp]\n"
|
||||
" self.space = s / self.layout.dbu\n"
|
||||
" self.metrics = m\n"
|
||||
" else:\n"
|
||||
" self.space = None\n"
|
||||
" # pick the space value from layer or set to nil\n"
|
||||
" def set_space_from_layer(layer_index)\n"
|
||||
" lp = @layout.get_info(layer_index)\n"
|
||||
" if @spaces[lp]\n"
|
||||
" (s, m) = @spaces[lp]\n"
|
||||
" @space = s / @layout.dbu\n"
|
||||
" @metrics = m\n"
|
||||
" else\n"
|
||||
" @space = nil\n"
|
||||
" end\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" def add_marker_from_shape(self, shape, trans):\n"
|
||||
" if self.space is None:\n"
|
||||
" return\n"
|
||||
" def add_marker_from_shape(shape, trans)\n"
|
||||
" \n"
|
||||
" if !@space\n"
|
||||
" return # no space value set\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" p = shape.polygon\n"
|
||||
" if p is not None and p.num_points() < 100:\n"
|
||||
" r = pya.Region()\n"
|
||||
" # maintain 2-point polygons for the first edge drawn\n"
|
||||
" r.merged_semantics = (p.num_points() != 2)\n"
|
||||
" r.insert(p)\n"
|
||||
" r = r.drc_hull(self.metrics, self.space)\n"
|
||||
" for pp in r.each():\n"
|
||||
" m = pya.Marker(self.view)\n"
|
||||
" m.line_style = 2\n"
|
||||
" m.vertex_size = 0\n"
|
||||
" m.set_polygon(trans * pp)\n"
|
||||
" self.markers.append(m)\n"
|
||||
" if !p\n"
|
||||
" return # not a polygon-like object\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" r = RBA::Region::new\n"
|
||||
" # maintain 2-point polygons for the first edge drawn\n"
|
||||
" r.merged_semantics = (p.num_points != 2)\n"
|
||||
" r.insert(p)\n"
|
||||
" \n"
|
||||
" # compute DRC hull and prepare markers\n"
|
||||
" r.drc_hull(@metrics, @space).each do |pp|\n"
|
||||
" m = RBA::Marker::new(@view)\n"
|
||||
" m.line_style = 2\n"
|
||||
" m.vertex_size = 0\n"
|
||||
" m.set_polygon(trans * pp)\n"
|
||||
" @markers.append(m)\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" # setup session\n"
|
||||
" def start(cv)\n"
|
||||
" cleanup\n"
|
||||
" @view = cv.view\n"
|
||||
" @layout = cv.layout\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" # end session\n"
|
||||
" def cleanup\n"
|
||||
" @space = nil\n"
|
||||
" @view = nil\n"
|
||||
" @layout = nil\n"
|
||||
" clear_markers\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" def clear_markers\n"
|
||||
" @markers && @markers.each do |m|\n"
|
||||
" # this is how a marker gets removed in Ruby:\n"
|
||||
" m._destroy\n"
|
||||
" end\n"
|
||||
" @markers = []\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" # Shape creation protocol\n"
|
||||
" \n"
|
||||
" def begin_create_shapes(self, cv, layer):\n"
|
||||
" # setup session\n"
|
||||
" self.view = cv.view()\n"
|
||||
" self.layout = cv.layout()\n"
|
||||
" self.markers = []\n"
|
||||
" # pick the space value\n"
|
||||
" self.set_space_from_layer(layer.layer_index())\n"
|
||||
" def begin_create_shapes(cv, layer)\n"
|
||||
" start(cv)\n"
|
||||
" set_space_from_layer(layer.layer_index)\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" def begin_new_shapes(self):\n"
|
||||
" # create new markers\n"
|
||||
" self.markers = []\n"
|
||||
" def begin_new_shapes\n"
|
||||
" clear_markers\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" def create_shape(self, shape, trans):\n"
|
||||
" # create a marker with space halo\n"
|
||||
" self.add_marker_from_shape(shape, trans)\n"
|
||||
" def create_shape(shape, trans)\n"
|
||||
" add_marker_from_shape(shape, trans)\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" def end_create_shapes(self):\n"
|
||||
" # cleanup\n"
|
||||
" self.markers = []\n"
|
||||
" self.view = None\n"
|
||||
" self.layout = None\n"
|
||||
" def end_create_shapes\n"
|
||||
" cleanup\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
" # Modification protocol\n"
|
||||
" \n"
|
||||
" def begin_edit(self, cv):\n"
|
||||
" # setup session\n"
|
||||
" self.view = cv.view()\n"
|
||||
" self.layout = cv.layout()\n"
|
||||
" self.markers = []\n"
|
||||
" def begin_edit(cv)\n"
|
||||
" start(cv)\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" def begin_edits(self):\n"
|
||||
" def begin_edits\n"
|
||||
" # create new markers\n"
|
||||
" self.markers = []\n"
|
||||
" clear_markers\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" def transformed(self, path, applied, trans):\n"
|
||||
" # transformation of a shape or instance\n"
|
||||
" if path.shape is not None:\n"
|
||||
" self.set_space_from_layer(path.layer)\n"
|
||||
" self.add_marker_from_shape(path.shape, trans * applied)\n"
|
||||
" # transformation of a shape or instance\n"
|
||||
" def transformed(path, applied, trans)\n"
|
||||
" if path.shape\n"
|
||||
" set_space_from_layer(path.layer)\n"
|
||||
" add_marker_from_shape(path.shape, trans * applied)\n"
|
||||
" end\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" def modified(self, path, shape, trans):\n"
|
||||
" # modification of a shape\n"
|
||||
" self.set_space_from_layer(path.layer)\n"
|
||||
" self.add_marker_from_shape(shape, trans)\n"
|
||||
" # modification of a shape\n"
|
||||
" def modified(path, shape, trans)\n"
|
||||
" set_space_from_layer(path.layer)\n"
|
||||
" add_marker_from_shape(shape, trans)\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" def end_edit(self):\n"
|
||||
" # cleanup\n"
|
||||
" self.markers = []\n"
|
||||
" self.view = None\n"
|
||||
" self.layout = None\n"
|
||||
" def end_edit\n"
|
||||
" cleanup\n"
|
||||
" end\n"
|
||||
" \n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"# instantiation of the hooks object\n"
|
||||
"MyEditorHooks()\n"
|
||||
"MyEditorHooks::new\n"
|
||||
"@/code\n"
|
||||
"\n"
|
||||
"The EditorHooks class has been introduced in version 0.29."
|
||||
"The EditorHooks class has been introduced in version 0.29.1."
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue