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

API reference - Class Path

Notation used in Ruby API documentation

Description: An path class

A path consists of an sequence of line segments forming the 'spine' of the path and a width. In addition, the starting point can be drawn back by a certain extent (the 'begin extension') and the end point can be pulled forward somewhat (by the 'end extension'). A path may have round ends for special purposes.

Public constructors

new PathnewDefault constructor: creates an empty (invalid) path with width 0
new Pathnew(Point[] pts,
int width)
Constructor given the points of the path's spine and the width
new Pathnew(Point[] pts,
int width,
int bgn_ext,
int end_ext)
Constructor given the points of the path's spine, the width and the extensions
new Pathnew(Point[] pts,
int width,
int bgn_ext,
int end_ext,
bool round)
Constructor given the points of the path's spine, the width, the extensions and the round end flag

Public methods

[const]bool!=(const Path p)Inequality test
[const]bool<(const Path p)Less operator
[const]bool==(const Path p)Equality test
[const]long longareaReturns the approximate area of the path
[const]voidassign(const Path other)Assign the contents of another object to self
[const]BoxbboxReturns the bounding box of the path
[const]intbgn_extGet the begin extension
voidbgn_ext=(int ext)Set the begin extension
voidcreateEnsures the C++ object is created
voiddestroyExplicitly destroy the object
[const]booldestroyed?Returns a value indicating whether the object was already destroyed
[const]PathdupCreates a copy of self
[const,iter]Pointeach_pointGet the points that make up the path's spine
[const]intend_extGet the end extension
voidend_ext=(int ext)Set the end extension
[const]boolis_const_object?Returns a value indicating whether the reference is a const reference
[const]boolis_round?Tell, if the path has round ends
Pathmove(const Point p)Moves the path.
[const]Pathmoved(const Point p)Returns the moved path
[const]unsigned intnum_pointsGet the number of points
voidpoints=(Point[] p)Set the points of the path
[const]PolygonpolygonConvert the path to a polygon
voidround=(bool arg1)Set the 'round ends' flag
[const]SimplePolygonsimple_polygonConvert the path to a simple polygon
[const]stringto_sConvert to a string
[const]Pathtransformed(const Trans t)Transform the path.
[const]DPathtransformed_cplx(const CplxTrans t)Transform the path.
[const]Pathtransformed_cplx(const ICplxTrans t)Transform the path.
[const]intwidthGet the width
voidwidth=(int w)Set the width

Public static methods and constants

Pathfrom_dpath(const DPath double_path)Construct an integer-coordinate path from a floating-point coordinate one

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

[static]new Pathnew_pw(Point[] pts,
int width)
Use of this method is deprecated. Use new instead
[static]new Pathnew_pwx(Point[] pts,
int width,
int bgn_ext,
int end_ext)
Use of this method is deprecated. Use new instead
[static]new Pathnew_pwxr(Point[] pts,
int width,
int bgn_ext,
int end_ext,
bool round)
Use of this method is deprecated. Use new instead
[const]unsigned intpointsUse of this method is deprecated. Use num_points instead

Detailed description

[const] bool !=(const Path p)

Description: Inequality test

p:The object to compare against

[const] bool <(const Path p)

Description: Less operator

p:The object to compare against

This operator is provided to establish some, not necessarily a certain sorting order

[const] bool ==(const Path p)

Description: Equality test

p:The object to compare against

[const] long long area

Description: Returns the approximate area of the path

This method returns the approximate value of the area. It is computed from the length times the width. end extensions are taken into account correctly, but not effects of the corner interpolation. This method was added in version 0.22.

[const] void assign(const Path 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] Box bbox

Description: Returns the bounding box of the path

[const] int bgn_ext

Description: Get the begin extension

void bgn_ext=(int ext)

Description: Set the begin extension

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] Path dup

Description: Creates a copy of self

[const,iter] Point each_point

Description: Get the points that make up the path's spine

[const] int end_ext

Description: Get the end extension

void end_ext=(int ext)

Description: Set the end extension

[static] Path from_dpath(const DPath double_path)

Description: Construct an integer-coordinate path from a floating-point coordinate one

This method has been added in version 0.15.

[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] bool is_round?

Description: Tell, if the path has round ends

Path move(const Point p)

Description: Moves the path.

p:The distance to move the path.
Returns:The moved path.

Moves the path by the given offset and returns the moved path. The path is overwritten.

[const] Path moved(const Point p)

Description: Returns the moved path

p:The distance to move the path.
Returns:The moved path.

Moves the path by the given offset and returns the moved path. The path is not modified.

[static] new Path new

Description: Default constructor: creates an empty (invalid) path with width 0

[static] new Path new(Point[] pts,int width)

Description: Constructor given the points of the path's spine and the width

pts:The points forming the spine of the path
width:The width of the path

[static] new Path new(Point[] pts,int width,int bgn_ext,int end_ext)

Description: Constructor given the points of the path's spine, the width and the extensions

pts:The points forming the spine of the path
width:The width of the path
bgn_ext:The begin extension of the path
end_ext:The end extension of the path

[static] new Path new(Point[] pts,int width,int bgn_ext,int end_ext,bool round)

Description: Constructor given the points of the path's spine, the width, the extensions and the round end flag

pts:The points forming the spine of the path
width:The width of the path
bgn_ext:The begin extension of the path
end_ext:The end extension of the path
round:If this flag is true, the path will get rounded ends

[static] new Path new_pw(Point[] pts,int width)

Description: Constructor given the points of the path's spine and the width

pts:The points forming the spine of the path
width:The width of the path

This method is deprecated. Use method 'new' instead

[static] new Path new_pwx(Point[] pts,int width,int bgn_ext,int end_ext)

Description: Constructor given the points of the path's spine, the width and the extensions

pts:The points forming the spine of the path
width:The width of the path
bgn_ext:The begin extension of the path
end_ext:The end extension of the path

This method is deprecated. Use method 'new' instead

[static] new Path new_pwxr(Point[] pts,int width,int bgn_ext,int end_ext,bool round)

Description: Constructor given the points of the path's spine, the width, the extensions and the round end flag

pts:The points forming the spine of the path
width:The width of the path
bgn_ext:The begin extension of the path
end_ext:The end extension of the path
round:If this flag is true, the path will get rounded ends

This method is deprecated. Use method 'new' instead

[const] unsigned int num_points

Description: Get the number of points

[const] unsigned int points

Description: Get the number of points

This method is deprecated. Use method 'num_points' instead

void points=(Point[] p)

Description: Set the points of the path

p:An array of points to assign to the path's spine

[const] Polygon polygon

Description: Convert the path to a polygon

The returned polygon is not guaranteed to be non-self overlapping. This may happen if the path overlaps itself or contains very short segments.

void round=(bool arg1)

Description: Set the 'round ends' flag

[const] SimplePolygon simple_polygon

Description: Convert the path to a simple polygon

The returned polygon is not guaranteed to be non-selfoverlapping. This may happen if the path overlaps itself or contains very short segments.

[const] string to_s

Description: Convert to a string

[const] Path transformed(const Trans t)

Description: Transform the path.

t:The transformation to apply.
Returns:The transformed path.

Transforms the path with the given transformation. Does not modify the path but returns the transformed path.

[const] DPath transformed_cplx(const CplxTrans t)

Description: Transform the path.

t:The transformation to apply.
Returns:The transformed path.

Transforms the path with the given complex transformation. Does not modify the path but returns the transformed path.

[const] Path transformed_cplx(const ICplxTrans t)

Description: Transform the path.

t:The transformation to apply.
Returns:The transformed path (in this case an integer coordinate path).

Transforms the path with the given complex transformation. Does not modify the path but returns the transformed path.

This method has been introduced in version 0.18.

[const] int width

Description: Get the width

void width=(int w)

Description: Set the width