API reference - Class DPath

Notation used in Ruby API documentation

Module: db

Description: A 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. In particular, a round-ended path with a single point can represent a circle. Round-ended paths should have being and end extensions equal to half the width. Non-round-ended paths with a single point are allowed but the definition of the resulting shape in not well defined and may differ in other tools.

See The Database API for more details about the database objects.

Public constructors

new DPath ptrnew(const Path path)Creates a floating-point coordinate path from an integer coordinate path
new DPath ptrnewDefault constructor: creates an empty (invalid) path with width 0
new DPath ptrnew(DPoint[] pts,
double width)
Constructor given the points of the path's spine and the width
new DPath ptrnew(DPoint[] pts,
double width,
double bgn_ext,
double end_ext)
Constructor given the points of the path's spine, the width and the extensions
new DPath ptrnew(DPoint[] pts,
double width,
double bgn_ext,
double 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 DPath p)Inequality test
[const]DPath*(double f)Scaling by some factor
[const]bool<(const DPath p)Less operator
[const]bool==(const DPath p)Equality test
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[const]doubleareaReturns the approximate area of the path
voidassign(const DPath other)Assigns another object to self
[const]DBoxbboxReturns the bounding box of the path
[const]doublebgn_extGet the begin extension
voidbgn_ext=(double ext)Set the begin extension
[const]new DPath ptrdupCreates a copy of self
[const,iter]DPointeach_pointGet the points that make up the path's spine
[const]doubleend_extGet the end extension
voidend_ext=(double ext)Set the end extension
[const]unsigned longhashComputes a hash value
[const]boolis_round?Returns true, if the path has round ends
[const]doublelengthReturns the length of the path
DPathmove(const DVector p)Moves the path.
DPathmove(double dx,
double dy)
Moves the path.
[const]DPathmoved(const DVector p)Returns the moved path (does not change self)
[const]DPathmoved(double dx,
double dy)
Returns the moved path (does not change self)
[const]unsigned longnum_pointsGet the number of points
[const]doubleperimeterReturns the approximate perimeter of the path
voidpoints=(DPoint[] p)Set the points of the path
[const]DPolygonpolygonConvert the path to a polygon
voidround=(bool round_ends_flag)Set the 'round ends' flag
[const]DPathround_corners(double radius,
int npoints,
double accuracy)
Creates a new path whose corners are interpolated with circular bends
[const]DSimplePolygonsimple_polygonConvert the path to a simple polygon
[const]Pathto_itype(double dbu = 1)Converts the path to an integer coordinate path
[const]stringto_sConvert to a string
[const]Pathtransformed(const VCplxTrans t)Transforms the polygon with the given complex transformation
[const]DPathtransformed(const DTrans t)Transform the path.
[const]DPathtransformed(const DCplxTrans t)Transform the path.
[const]doublewidthGet the width
voidwidth=(double w)Set the width

Public static methods and constants

new DPath ptrfrom_s(string s)Creates an object from a string

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

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[static]new DPath ptrfrom_ipath(const Path path)Use of this method is deprecated. Use new instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead
[static]new DPath ptrnew_pw(DPoint[] pts,
double width)
Use of this method is deprecated. Use new instead
[static]new DPath ptrnew_pwx(DPoint[] pts,
double width,
double bgn_ext,
double end_ext)
Use of this method is deprecated. Use new instead
[static]new DPath ptrnew_pwxr(DPoint[] pts,
double width,
double bgn_ext,
double end_ext,
bool round)
Use of this method is deprecated. Use new instead
[const]unsigned longpointsUse of this method is deprecated. Use num_points instead
[const]DPathtransformed_cplx(const DCplxTrans t)Use of this method is deprecated. Use transformed instead

Detailed description

!=

Signature: [const] bool != (const DPath p)

Description: Inequality test

p:The object to compare against

*

Signature: [const] DPath * (double f)

Description: Scaling by some factor

Returns the scaled object. All coordinates are multiplied with the given factor and if necessary rounded.

Python specific notes:
This method also implements '__rmul__'.

<

Signature: [const] bool < (const DPath p)

Description: Less operator

p:The object to compare against

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

==

Signature: [const] bool == (const DPath p)

Description: Equality test

p:The object to compare against

_create

Signature: 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.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

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

_destroyed?

Signature: [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.

_is_const_object?

Signature: [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.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

area

Signature: [const] double 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.

assign

Signature: void assign (const DPath other)

Description: Assigns another object to self

bbox

Signature: [const] DBox bbox

Description: Returns the bounding box of the path

bgn_ext

Signature: [const] double bgn_ext

Description: Get the begin extension

Python specific notes:
The object exposes a readable attribute 'bgn_ext'. This is the getter.

bgn_ext=

Signature: void bgn_ext= (double ext)

Description: Set the begin extension

Python specific notes:
The object exposes a writable attribute 'bgn_ext'. This is the setter.

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

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.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

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

destroyed?

Signature: [const] bool destroyed?

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

Use of this method is deprecated. Use _destroyed? instead

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.

dup

Signature: [const] new DPath ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

each_point

Signature: [const,iter] DPoint each_point

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

end_ext

Signature: [const] double end_ext

Description: Get the end extension

Python specific notes:
The object exposes a readable attribute 'end_ext'. This is the getter.

end_ext=

Signature: void end_ext= (double ext)

Description: Set the end extension

Python specific notes:
The object exposes a writable attribute 'end_ext'. This is the setter.

from_ipath

Signature: [static] new DPath ptr from_ipath (const Path path)

Description: Creates a floating-point coordinate path from an integer coordinate path

Use of this method is deprecated. Use new instead

This constructor has been introduced in version 0.25 and replaces the previous static method 'from_ipath'.

Python specific notes:
This method is the default initializer of the object.

from_s

Signature: [static] new DPath ptr from_s (string s)

Description: Creates an object from a string

Creates the object from a string representation (as returned by to_s)

This method has been added in version 0.23.

hash

Signature: [const] unsigned long hash

Description: Computes a hash value

Returns a hash value for the given polygon. This method enables polygons as hash keys.

This method has been introduced in version 0.25.

Python specific notes:
This method is also available as 'hash(object)'.

is_const_object?

Signature: [const] bool is_const_object?

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

Use of this method is deprecated. Use _is_const_object? instead

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

is_round?

Signature: [const] bool is_round?

Description: Returns true, if the path has round ends

Python specific notes:
The object exposes a readable attribute 'round'. This is the getter.

length

Signature: [const] double length

Description: Returns the length of the path

the length of the path is determined by summing the lengths of the segments and adding begin and end extensions. For round-ended paths the length of the paths between the tips of the ends.

This method was added in version 0.23.

move

(1) Signature: DPath move (const DVector 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.

(2) Signature: DPath move (double dx, double dy)

Description: Moves the path.

dx:The x distance to move the path.
dy:The y 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.

This version has been added in version 0.23.

moved

(1) Signature: [const] DPath moved (const DVector p)

Description: Returns the moved path (does not change self)

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.

(2) Signature: [const] DPath moved (double dx, double dy)

Description: Returns the moved path (does not change self)

dx:The x distance to move the path.
dy:The y 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.

This version has been added in version 0.23.

new

(1) Signature: [static] new DPath ptr new (const Path path)

Description: Creates a floating-point coordinate path from an integer coordinate path

This constructor has been introduced in version 0.25 and replaces the previous static method 'from_ipath'.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new DPath ptr new

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

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new DPath ptr new (DPoint[] pts, double 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

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new DPath ptr new (DPoint[] pts, double width, double bgn_ext, double 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

Python specific notes:
This method is the default initializer of the object.

(5) Signature: [static] new DPath ptr new (DPoint[] pts, double width, double bgn_ext, double 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

Python specific notes:
This method is the default initializer of the object.

new_pw

Signature: [static] new DPath ptr new_pw (DPoint[] pts, double 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

Use of this method is deprecated. Use new instead

Python specific notes:
This method is the default initializer of the object.

new_pwx

Signature: [static] new DPath ptr new_pwx (DPoint[] pts, double width, double bgn_ext, double 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

Use of this method is deprecated. Use new instead

Python specific notes:
This method is the default initializer of the object.

new_pwxr

Signature: [static] new DPath ptr new_pwxr (DPoint[] pts, double width, double bgn_ext, double 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

Use of this method is deprecated. Use new instead

Python specific notes:
This method is the default initializer of the object.

num_points

Signature: [const] unsigned long num_points

Description: Get the number of points

Python specific notes:
The object exposes a readable attribute 'points'. This is the getter.

perimeter

Signature: [const] double perimeter

Description: Returns the approximate perimeter of the path

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

points

Signature: [const] unsigned long points

Description: Get the number of points

Use of this method is deprecated. Use num_points instead

Python specific notes:
The object exposes a readable attribute 'points'. This is the getter.

points=

Signature: void points= (DPoint[] p)

Description: Set the points of the path

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

Python specific notes:
The object exposes a writable attribute 'points'. This is the setter.

polygon

Signature: [const] DPolygon 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.

round=

Signature: void round= (bool round_ends_flag)

Description: Set the 'round ends' flag

A path with round ends show half circles at the ends, instead of square or rectangular ends. Paths with this flag set should use a begin and end extension of half the width (see bgn_ext and end_ext). The interpretation of such paths in other tools may differ otherwise.

Python specific notes:
The object exposes a writable attribute 'round'. This is the setter.

round_corners

Signature: [const] DPath round_corners (double radius, int npoints, double accuracy)

Description: Creates a new path whose corners are interpolated with circular bends

radius:The radius of the bends
npoints:The number of points (per full circle) used for interpolating the bends
accuracy:The numerical accuracy of the computation

The accuracy parameter controls the numerical resolution of the approximation process and should be in the order of half the database unit. This accuracy is used for suppressing redundant points and simplification of the resulting path.

This method has been introduced in version 0.25.

simple_polygon

Signature: [const] DSimplePolygon 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.

to_itype

Signature: [const] Path to_itype (double dbu = 1)

Description: Converts the path to an integer coordinate path

The database unit can be specified to translate the floating-point coordinate path in micron units to an integer-coordinate path in database units. The path's' coordinates will be divided by the database unit.

This method has been introduced in version 0.25.

to_s

Signature: [const] string to_s

Description: Convert to a string

Python specific notes:
This method is also available as 'str(object)'.

transformed

(1) Signature: [const] Path transformed (const VCplxTrans t)

Description: Transforms the polygon with the given complex transformation

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

This method has been introduced in version 0.25.

(2) Signature: [const] DPath transformed (const DTrans 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.

(3) Signature: [const] DPath transformed (const DCplxTrans 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.

transformed_cplx

Signature: [const] DPath transformed_cplx (const DCplxTrans t)

Description: Transform the path.

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

Use of this method is deprecated. Use transformed instead

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

width

Signature: [const] double width

Description: Get the width

Python specific notes:
The object exposes a readable attribute 'width'. This is the getter.

width=

Signature: void width= (double w)

Description: Set the width

Python specific notes:
The object exposes a writable attribute 'width'. This is the setter.