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

The abstract base class of all 2D graphics primitives. More...

+ Inheritance diagram for CDPL.Vis.GraphicsPrimitive2D:

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)
 

Detailed Description

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.

Member Function Documentation

◆ getObjectID()

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().

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

◆ render()

None CDPL.Vis.GraphicsPrimitive2D.render ( Renderer2D  renderer)

Visualizes the graphics primitive by means of the Renderer2D instance renderer.

Parameters
rendererThe renderer that performs the drawing operations.

◆ getBounds()

None CDPL.Vis.GraphicsPrimitive2D.getBounds ( Rectangle2D  bounds,
FontMetrics   font_metrics = 0 
)

Calculates the bounds of the graphics primitive.

Parameters
boundsThe object storing the calculated bounding box.
font_metricsThe font metrics object to use for bounds calculation (if required).

◆ clone()

GraphicsPrimitive2D CDPL.Vis.GraphicsPrimitive2D.clone ( )

Creates a dynamically allocated copy of the graphics primitive.

Returns
The copy of the graphics primitive.