KLayout Manual: Main Index » Class Index » API reference - Class RecursiveShapeIterator

API reference - Class RecursiveShapeIterator

Notation used in Ruby API documentation

Description: An iterator delivering shapes that touch or overlap the given region recursively

The iterator can be obtained from a layout, specifying a starting cell, a layer and optionally a region. It simplifies retrieval of shapes from a geometrical region while considering subcells as well. Some options can be specified, i.e. the level to which to look into or shape classes and shape properties. The shapes are retrieved by using the shape method, next moves to the next shape and at_end tells, if the iterator has move shapes to deliver.

Layout offers three methods to get these iterators: begin_shapes, begin_shapes_touching and begin_shapes_overlapping.

This class has been introduced in version 0.18.

Public constructors

RecursiveShapeIteratornewCreates a new object of this class

Public methods

[const]bool!=(const RecursiveShapeIterator other)Comparison of iterators - inequality
[const]bool==(const RecursiveShapeIterator other)Comparison of iterators - equality
[const]voidassign(const RecursiveShapeIterator other)Assign the contents of another object to self
[const]boolat_end?End of iterator predicate
[const]unsigned intcell_indexGet the current cell's index
voidcreateEnsures the C++ object is created
voiddestroyExplicitly destroy the object
[const]booldestroyed?Returns a value indicating whether the object was already destroyed
[const]RecursiveShapeIteratordupCreates a copy of self
[const]boolis_const_object?Returns a value indicating whether the reference is a const reference
[const]ICplxTransitransGet the current transformation by which the shapes must be transformed into the initial cell
voidmax_depth=(int depth)Specify the maximum hierarchy depth to look into
voidnextIncrement the iterator
[const]ShapeshapeGet the current shape
voidshape_flags=(unsigned int flags)Specify the shape selection flags
[const]CplxTranstransGet the current transformation by which the shapes must be transformed into the initial cell

Deprecated methods (protected, public, static, non-static and constructors)

[const]boolat_endUse of this method is deprecated. Use at_end? instead

Detailed description

[const] bool !=(const RecursiveShapeIterator other)

Description: Comparison of iterators - inequality

Two iterators are not equal if they do not point to the same shape.

[const] bool ==(const RecursiveShapeIterator other)

Description: Comparison of iterators - equality

Two iterators are equal if they point to the same shape.

[const] void assign(const RecursiveShapeIterator other)

Description: Assign the contents of another object to self

This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.

[const] bool at_end

Description: End of iterator predicate

This method is deprecated. Use method 'at_end?' instead

[const] bool at_end?

Description: End of iterator predicate

Returns true, if the iterator is at the end of the sequence

[const] unsigned int cell_index

Description: Get the current cell's index

void create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

void destroy

Description: Explicitly destroy the object

Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing.

[const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

[const] RecursiveShapeIterator dup

Description: Creates a copy of self

[const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

[const] ICplxTrans itrans

Description: Get the current transformation by which the shapes must be transformed into the initial cell

The shapes delivered are not transformed. Instead, this transformation must be applied to get the shape in the coordinate system of the top cell. This method delivers the integer version which is not accurate in the strict sense but delivers integer coordinate shapes. This method is somewhat slower than the 'trans' method.

void max_depth=(int depth)

Description: Specify the maximum hierarchy depth to look into

A depth of 0 instructs the iterator to deliver only shapes from the initial cell. The depth must be specified before the shapes are being retrieved.

[static] RecursiveShapeIterator new

Description: Creates a new object of this class

void next

Description: Increment the iterator

This moves the iterator to the next shape inside the search scope.

[const] Shape shape

Description: Get the current shape

Returns the shape currently referred to by the recursive iterator. This shape is not transformed yet and is located in the current cell.

void shape_flags=(unsigned int flags)

Description: Specify the shape selection flags

The flags are the same then being defined in Shapes (the default is RBA::Shapes::SAll). The flags must be specified before the shapes are being retrieved.

[const] CplxTrans trans

Description: Get the current transformation by which the shapes must be transformed into the initial cell

The shapes delivered are not transformed. Instead, this transformation must be applied to get the shape in the coordinate system of the top cell.