Chemical Data Processing Library Python API - Version 1.2.0
|
The abstract base class of all 2D graphics primitives. More...
Public Member Functions | |
None | __init__ () |
Initializes the GraphicsPrimitive2D instance. | |
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 | |
objectID = property(getObjectID) | |
The abstract base class of all 2D graphics primitives.
Graphics primitives are simple (atomic) geometrical objects which can be used as building blocks for larger and more complex drawings (e.g. the 2D depiction of a molecular structure). The actual type (e.g. point, line, polygon, ...) and look (e.g. color, font, ...) of an graphics primitive is defined by subclasses of GraphicsPrimitive2D
. Subclasses have to implement the render() method that visualizes the primitive by means of a Renderer2D implementation instance.
int CDPL.Vis.GraphicsPrimitive2D.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python GraphicsPrimitive2D 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 GraphicsPrimitive2D 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()
.
None CDPL.Vis.GraphicsPrimitive2D.render | ( | Renderer2D | renderer | ) |
Visualizes the graphics primitive by means of the Renderer2D instance renderer.
renderer | The renderer that performs the drawing operations. |
None CDPL.Vis.GraphicsPrimitive2D.getBounds | ( | Rectangle2D | bounds, |
FontMetrics | font_metrics = 0 |
||
) |
Calculates the bounds of the graphics primitive.
bounds | The object storing the calculated bounding box. |
font_metrics | The font metrics object to use for bounds calculation (if required). |
GraphicsPrimitive2D CDPL.Vis.GraphicsPrimitive2D.clone | ( | ) |
Creates a dynamically allocated copy of the graphics primitive.