Chemical Data Processing Library Python API - Version 1.1.1
Classes | Public Member Functions | Properties | List of all members
CDPL.Vis.Pen Class Reference

Specifies how to draw lines and outlines of shapes. More...

+ Inheritance diagram for CDPL.Vis.Pen:

Classes

class  CapStyle
 Defines constants for supported line cap styles. More...
 
class  JoinStyle
 Defines constants for supported line join styles. More...
 
class  LineStyle
 Defines constants for supported line styles. More...
 

Public Member Functions

None __init__ ()
 Constructs a pen with line style Pen.SOLID_LINE, line width 1.0, cap style Pen.ROUND_CAP, join style Pen.ROUND_JOIN and color Color.BLACK.
 
None __init__ (Pen pen)
 Initializes a copy of the Pen instance pen. More...
 
None __init__ (LineStyle line_style)
 Constructs a pen with the specified line style, line width 1.0, cap style Pen.ROUND_CAP, join style Pen.ROUND_JOIN and color Color.BLACK. More...
 
None __init__ (Color color, float width=1.0, LineStyle line_style=CDPL.Vis.LineStyle.SOLID_LINE, CapStyle cap_style=CDPL.Vis.CapStyle.ROUND_CAP, JoinStyle join_style=CDPL.Vis.JoinStyle.ROUND_JOIN)
 Constructs a pen with the specified color, line width, line style, cap style and join style. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
Pen assign (Pen pen)
 Replaces the current state of self with a copy of the state of the Pen instance pen. More...
 
CapStyle getCapStyle ()
 Returns the line cap style. More...
 
None setCapStyle (CapStyle cap_style)
 Sets the line cap style to cap_style. More...
 
Color getColor ()
 Returns the color of the pen. More...
 
None setColor (Color color)
 Sets the pen's color to the specified value. More...
 
JoinStyle getJoinStyle ()
 Returns the line join style. More...
 
None setJoinStyle (JoinStyle join_style)
 Sets the line join style to join_style. More...
 
LineStyle getLineStyle ()
 Returns the line style. More...
 
None setLineStyle (LineStyle line_style)
 Sets the line style to line_style. More...
 
float getWidth ()
 Returns the line width. More...
 
None setWidth (float width)
 Sets the line width to the specified value. More...
 
bool __eq__ (Pen pen)
 Equality comparison operator. More...
 
bool __ne__ (Pen pen)
 Inequality comparison operator. More...
 

Properties

 objectID = property(getObjectID)
 
 capStyle = property(getCapStyle, setCapStyle)
 
 lineStyle = property(getLineStyle, setLineStyle)
 
 joinStyle = property(getJoinStyle, setJoinStyle)
 
 color = property(getColor, setColor)
 
 width = property(getWidth, setWidth)
 

Detailed Description

Specifies how to draw lines and outlines of shapes.

A pen has a line style, width, color, cap style and join style attribute. The line style specifies how a line will look like (solid, dashed, ...). The default line style is Pen.SOLID_LINE. Setting the line style to Pen.NO_LINE tells the renderer not to draw lines or outlines. The pen color defines the color of lines and text. The default line color is Color.BLACK. The cap style specifies how the end points of lines are drawn and the join style defines how the joins between two or more connected have to be drawn. The default cap style is Pen.ROUND_CAP and the default join style is Pen.ROUND_JOIN.

Constructor & Destructor Documentation

◆ __init__() [1/3]

None CDPL.Vis.Pen.__init__ ( Pen  pen)

Initializes a copy of the Pen instance pen.

Parameters
penThe Pen instance to copy.

◆ __init__() [2/3]

None CDPL.Vis.Pen.__init__ ( LineStyle  line_style)

Constructs a pen with the specified line style, line width 1.0, cap style Pen.ROUND_CAP, join style Pen.ROUND_JOIN and color Color.BLACK.

Parameters
line_styleThe line style.

◆ __init__() [3/3]

None CDPL.Vis.Pen.__init__ ( Color  color,
float   width = 1.0,
LineStyle   line_style = CDPL.Vis.LineStyle.SOLID_LINE,
CapStyle   cap_style = CDPL.Vis.CapStyle.ROUND_CAP,
JoinStyle   join_style = CDPL.Vis.JoinStyle.ROUND_JOIN 
)

Constructs a pen with the specified color, line width, line style, cap style and join style.

If width is negative, the line width is set to zero.

Parameters
colorThe pen color.
widthThe line width.
line_styleThe line style.
cap_styleThe line cap style.
join_styleThe line join style.

Member Function Documentation

◆ getObjectID()

int CDPL.Vis.Pen.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python Pen instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two Pen instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ assign()

Pen CDPL.Vis.Pen.assign ( Pen  pen)

Replaces the current state of self with a copy of the state of the Pen instance pen.

Parameters
penThe Pen instance to copy.
Returns
self

◆ getCapStyle()

CapStyle CDPL.Vis.Pen.getCapStyle ( )

Returns the line cap style.

Returns
The line cap style.

◆ setCapStyle()

None CDPL.Vis.Pen.setCapStyle ( CapStyle  cap_style)

Sets the line cap style to cap_style.

Parameters
cap_styleThe line cap style.

◆ getColor()

Color CDPL.Vis.Pen.getColor ( )

Returns the color of the pen.

Returns
The color of the pen.

◆ setColor()

None CDPL.Vis.Pen.setColor ( Color  color)

Sets the pen's color to the specified value.

Parameters
colorThe color of the pen.

◆ getJoinStyle()

JoinStyle CDPL.Vis.Pen.getJoinStyle ( )

Returns the line join style.

Returns
The line join style.

◆ setJoinStyle()

None CDPL.Vis.Pen.setJoinStyle ( JoinStyle  join_style)

Sets the line join style to join_style.

Parameters
join_styleThe line join style.

◆ getLineStyle()

LineStyle CDPL.Vis.Pen.getLineStyle ( )

Returns the line style.

Returns
The line style.

◆ setLineStyle()

None CDPL.Vis.Pen.setLineStyle ( LineStyle  line_style)

Sets the line style to line_style.

Parameters
line_styleThe line style.

◆ getWidth()

float CDPL.Vis.Pen.getWidth ( )

Returns the line width.

Returns
The line width.

◆ setWidth()

None CDPL.Vis.Pen.setWidth ( float  width)

Sets the line width to the specified value.

If width is negative, the line width is set to zero.

Parameters
widthThe line width.

◆ __eq__()

bool CDPL.Vis.Pen.__eq__ ( Pen  pen)

Equality comparison operator.

Parameters
penThe other Pen object to be compared with.
Returns
True if all pen attributes compare equal, and False otherwise.

◆ __ne__()

bool CDPL.Vis.Pen.__ne__ ( Pen  pen)

Inequality comparison operator.

The result is equivalent to !(self == pen).

Parameters
penThe other Pen object to be compared with.
Returns
True if the pen attributes compare non-equal, and False otherwise.