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

A graphics primitive representing a single line. More...

+ Inheritance diagram for CDPL.Vis.LinePrimitive2D:

Public Member Functions

None __init__ ()
 Constructs a line primitive whose starting and end point is set to (0, 0).
 
None __init__ (LinePrimitive2D prim)
 Initializes a copy of the LinePrimitive2D instance prim. More...
 
None __init__ (Line2D line)
 Constructs a line primitive with the same starting and end point as line. More...
 
None __init__ (Math.Vector2D beg, Math.Vector2D end)
 Constructs a line primitive with the starting point set to beg and the end point set to end. More...
 
LinePrimitive2D assign (LinePrimitive2D prim)
 Replaces the current state of self with a copy of the state of the LinePrimitive2D instance prim. More...
 
None setPen (Pen pen)
 Sets the pen defining the color, width, line style and cap style of the line. More...
 
Pen getPen ()
 Returns the pen defining the color, width, line style and cap style of the line. More...
 
- Public Member Functions inherited from CDPL.Vis.Line2D
None __init__ (float beg_x, float beg_y, float end_x, float end_y)
 Constructs a line with the starting point set to (beg_x, beg_y) and the end point set to (end_x, end_y). More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
Line2D assign (Line2D line)
 Replaces the current state of self with a copy of the state of the Line2D instance line. More...
 
None setBegin (Math.Vector2D pt)
 Sets the starting point of the line to pt. More...
 
None setBegin (float x, float y)
 Sets the starting point of the line to (x, y). More...
 
Math.Vector2D getBegin ()
 Returns the starting point of the line. More...
 
None setEnd (Math.Vector2D pt)
 Sets the end point of the line to pt. More...
 
None setEnd (float x, float y)
 Sets the end point of the line to (x, y). More...
 
Math.Vector2D getEnd ()
 Returns the end point of the line. More...
 
None setPoints (Math.Vector2D beg, Math.Vector2D end)
 Sets the starting point of the line to beg and the end point to end. More...
 
None setPoints (float beg_x, float beg_y, float end_x, float end_y)
 Sets the starting point of the line to (beg_x, beg_y) and the end point to (end_x, end_y). More...
 
None swapPoints ()
 Swaps the starting and end point of the line. More...
 
Math.Vector2D getDirection ()
 Calculates the normalized direction vector of the line. More...
 
None getDirection (Math.Vector2D dir)
 Calculates the normalized direction vector of the line and stores the result in dir. More...
 
Math.Vector2D getCCWPerpDirection ()
 Calculates the normalized direction vector rotated by 90 degrees in counter-clockwise direction. More...
 
None getCCWPerpDirection (Math.Vector2D dir)
 Calculates the normalized direction vector rotated by 90 degrees in counter-clockwise direction and stores the result in dir. More...
 
Math.Vector2D getCWPerpDirection ()
 Calculates the normalized direction vector rotated by 90 degrees in clockwise direction. More...
 
None getCWPerpDirection (Math.Vector2D dir)
 Calculates the normalized direction vector rotated by 90 degrees in clockwise direction and stores the result in dir. More...
 
Math.Vector2D getCenter ()
 Calculates the center point of the line. More...
 
None getCenter (Math.Vector2D ctr)
 Calculates the center point of the line and stores the result in ctr. More...
 
float getLength ()
 Returns the length of the line segment. More...
 
None translate (Math.Vector2D vec)
 Translates the starting and end point of the line by vec. More...
 
None translateBegin (Math.Vector2D vec)
 Translates the starting point of the line by vec. More...
 
None translateEnd (Math.Vector2D vec)
 Translates the end of the line point by vec. More...
 
bool containsPoint (Math.Vector2D pt)
 Tests if the point pt is contained within the boundary of the line segment. More...
 
object getIntersectionPoint (Line2D pt)
 
bool clipBeginAgainstLineSeg (Line2D line)
 Sets the starting point of the line to the point of intersection with the specified line segment. More...
 
bool clipEndAgainstLineSeg (Line2D line)
 Sets the end point of the line to the point of intersection with the specified line segment. More...
 
bool setBeginToLineSegIntersection (Line2D line)
 Sets the starting point of the line to the point of intersection with the specified line segment. More...
 
bool setEndToLineSegIntersection (Line2D line)
 Sets the end point of the line to the point of intersection with the specified line segment. More...
 
bool clipBeginAgainstRectangle (Rectangle2D rect)
 Sets the starting point of the line to the point of intersection between this line segment and the edges of the rectangle rect. More...
 
bool clipEndAgainstRectangle (Rectangle2D rect)
 Sets the end point of the line to the point of intersection between this line segment and the edges of the rectangle rect. More...
 
float getDistance (Math.Vector2D pt)
 Returns the perpendicular distance of the point pt to this line. More...
 
bool __eq__ (Line2D line)
 Equality comparison operator. More...
 
bool __ne__ (Line2D line)
 Inequality comparison operator. More...
 
bool __contains__ (Math.Vector2D pt)
 Returns the result of the membership test operation pt in self. More...
 
- Public Member Functions inherited from CDPL.Vis.GraphicsPrimitive2D
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None render (Renderer2D renderer)
 Visualizes the graphics primitive by means of the Renderer2D instance renderer. More...
 
None getBounds (Rectangle2D bounds, FontMetrics font_metrics=0)
 Calculates the bounds of the graphics primitive. More...
 
GraphicsPrimitive2D clone ()
 Creates a dynamically allocated copy of the graphics primitive. More...
 

Properties

 pen = property(getPen, setPen)
 
- Properties inherited from CDPL.Vis.Line2D
 objectID = property(getObjectID)
 
 length = property(getLength)
 
 begin = property(getBegin, setBegin)
 
 end = property(getEnd, setEnd)
 
 direction = property(getDirection)
 
 ccwPerpDirection = property(getCCWPerpDirection)
 
 cwPerpDirection = property(getCWPerpDirection)
 
 center = property(getCenter)
 
- Properties inherited from CDPL.Vis.GraphicsPrimitive2D
 objectID = property(getObjectID)
 

Detailed Description

A graphics primitive representing a single line.

Constructor & Destructor Documentation

◆ __init__() [1/3]

None CDPL.Vis.LinePrimitive2D.__init__ ( LinePrimitive2D  prim)

Initializes a copy of the LinePrimitive2D instance prim.

Parameters
primThe LinePrimitive2D instance to copy.

◆ __init__() [2/3]

None CDPL.Vis.LinePrimitive2D.__init__ ( Line2D  line)

Constructs a line primitive with the same starting and end point as line.

Parameters
lineThe line defining the starting and end point.

Reimplemented from CDPL.Vis.Line2D.

◆ __init__() [3/3]

None CDPL.Vis.LinePrimitive2D.__init__ ( Math.Vector2D  beg,
Math.Vector2D  end 
)

Constructs a line primitive with the starting point set to beg and the end point set to end.

Parameters
begThe starting point.
endThe end point.

Reimplemented from CDPL.Vis.Line2D.

Member Function Documentation

◆ assign()

LinePrimitive2D CDPL.Vis.LinePrimitive2D.assign ( LinePrimitive2D  prim)

Replaces the current state of self with a copy of the state of the LinePrimitive2D instance prim.

Parameters
primThe LinePrimitive2D instance to copy.
Returns
self

◆ setPen()

None CDPL.Vis.LinePrimitive2D.setPen ( Pen  pen)

Sets the pen defining the color, width, line style and cap style of the line.

Parameters
penThe pen defining the color, width, line style and cap style.

◆ getPen()

Pen CDPL.Vis.LinePrimitive2D.getPen ( )

Returns the pen defining the color, width, line style and cap style of the line.

Returns
The pen defining the color, width, line style and cap style of the line.