Chemical Data Processing Library C++ API - Version 1.1.1
Public Member Functions | List of all members
CDPL::Vis::QtRenderer2D Class Reference

Implements the Renderer2D interface on top of the Qt Toolkit. More...

#include <QtRenderer2D.hpp>

+ Inheritance diagram for CDPL::Vis::QtRenderer2D:

Public Member Functions

 QtRenderer2D (QPainter &painter)
 Constructs a renderer object which uses the QPainter instance painter for its drawing operations. More...
 
 ~QtRenderer2D ()
 Destructor. More...
 
void saveState ()
 Saves the current renderer state. More...
 
void restoreState ()
 Restores the last renderer state saved by a call to saveState(). More...
 
void setTransform (const Math::Matrix3D &xform)
 Sets the applied affine transformation matrix to xform. More...
 
void transform (const Math::Matrix3D &xform)
 Multiplies the current affine transformation matrix by xform. More...
 
void setPen (const Pen &pen)
 Sets the pen to be used in subsequent drawing operations. More...
 
void setBrush (const Brush &brush)
 Sets the brush to be used in subsequent drawing operations. More...
 
void setFont (const Font &font)
 Sets the font to be used in subsequent text drawing operations. More...
 
void drawRectangle (double x1, double y1, double x2, double y2)
 Draws an axis aligned rectangle of the specified width and height whose upper-left corner is located at (x, y). More...
 
void drawPolygon (const Math::Vector2DArray &points)
 Draws the polygon defined by points. More...
 
void drawLine (double x1, double y1, double x2, double y2)
 Draws a line segment from (x1, y1) to (x2, y2). More...
 
void drawPolyline (const Math::Vector2DArray &points)
 Draws the polyline defined by points. More...
 
void drawLineSegments (const Math::Vector2DArray &points)
 Draws the sequence of disjoint line segments defined by points. More...
 
void drawPoint (double x, double y)
 Draws a point at the position (x, y). More...
 
void drawText (double x, double y, const std::string &txt)
 Draws the specified text at the position (x, y). More...
 
void drawEllipse (double x, double y, double width, double height)
 Draws an ellipse with the given width and height around the center position (x, y). More...
 
void drawPath (const Path2D &path)
 Draws the given path. More...
 
void setClipPath (const Path2D &path)
 
void clearClipPath ()
 Disables clipping. More...
 
- Public Member Functions inherited from CDPL::Vis::Renderer2D
virtual ~Renderer2D ()
 Virtual destructor. More...
 

Detailed Description

Implements the Renderer2D interface on top of the Qt Toolkit.

QtRenderer2D is implemented by forwarding the drawing operations to a provided QPainter instance which has been created for the desired output device (screen, printer, off-screen image, ...). For more information about QPainter and the Qt Toolkit see [QTDOC].

Constructor & Destructor Documentation

◆ QtRenderer2D()

CDPL::Vis::QtRenderer2D::QtRenderer2D ( QPainter &  painter)

Constructs a renderer object which uses the QPainter instance painter for its drawing operations.

Parameters
painterThe wrapped QPainter instance.

◆ ~QtRenderer2D()

CDPL::Vis::QtRenderer2D::~QtRenderer2D ( )

Destructor.

Member Function Documentation

◆ saveState()

void CDPL::Vis::QtRenderer2D::saveState ( )
virtual

Saves the current renderer state.

The method saves the current pen, brush, font and transformation matrix on an internal stack. The last saved state can be restored later on by a call to restoreState().

See also
restoreState()

Implements CDPL::Vis::Renderer2D.

◆ restoreState()

void CDPL::Vis::QtRenderer2D::restoreState ( )
virtual

Restores the last renderer state saved by a call to saveState().

See also
saveState()

Implements CDPL::Vis::Renderer2D.

◆ setTransform()

void CDPL::Vis::QtRenderer2D::setTransform ( const Math::Matrix3D xform)
virtual

Sets the applied affine transformation matrix to xform.

Parameters
xformThe new affine transformation matrix.

Implements CDPL::Vis::Renderer2D.

◆ transform()

void CDPL::Vis::QtRenderer2D::transform ( const Math::Matrix3D xform)
virtual

Multiplies the current affine transformation matrix by xform.

Parameters
xformThe matrix by which the current affine transformation matrix is multiplied.

Implements CDPL::Vis::Renderer2D.

◆ setPen()

void CDPL::Vis::QtRenderer2D::setPen ( const Pen pen)
virtual

Sets the pen to be used in subsequent drawing operations.

Parameters
penThe new pen for subsequent drawing operations.
See also
Vis::Pen

Implements CDPL::Vis::Renderer2D.

◆ setBrush()

void CDPL::Vis::QtRenderer2D::setBrush ( const Brush brush)
virtual

Sets the brush to be used in subsequent drawing operations.

Parameters
brushThe new brush for subsequent drawing operations.
See also
Vis::Brush

Implements CDPL::Vis::Renderer2D.

◆ setFont()

void CDPL::Vis::QtRenderer2D::setFont ( const Font font)
virtual

Sets the font to be used in subsequent text drawing operations.

Parameters
fontThe new font used in subsequent text drawing operations.
See also
Vis::Font

Implements CDPL::Vis::Renderer2D.

◆ drawRectangle()

void CDPL::Vis::QtRenderer2D::drawRectangle ( double  x,
double  y,
double  width,
double  height 
)
virtual

Draws an axis aligned rectangle of the specified width and height whose upper-left corner is located at (x, y).

The rectangle is filled as specified by the current brush and the outline will be drawn as specified by the current pen.

Parameters
xThe x-coordinate of the upper-left corner.
yThe y-coordinate of the upper-left corner.
widthThe width of the rectangle.
heightThe height of the rectangle.
See also
setPen(), setBrush()

Implements CDPL::Vis::Renderer2D.

◆ drawPolygon()

void CDPL::Vis::QtRenderer2D::drawPolygon ( const Math::Vector2DArray points)
virtual

Draws the polygon defined by points.

For a given set of \( N \) corner points \( p_i \) with \( i = 1, 2, \ldots, N \), the polygon's \( N \) edges are given by \( (p_1, p_2), (p_2, p_3), \ldots, (p_N, p_0) \). The polygon is filled as specified by the current brush and the outline will be drawn as specified by the current pen.

Parameters
pointsAn array of points specifying the corners of the polygon.
See also
setPen(), setBrush()

Implements CDPL::Vis::Renderer2D.

◆ drawLine()

void CDPL::Vis::QtRenderer2D::drawLine ( double  x1,
double  y1,
double  x2,
double  y2 
)
virtual

Draws a line segment from (x1, y1) to (x2, y2).

The line style, color, cap style and line width is specified by the current pen.

Parameters
x1The x-coordinate of the starting point.
y1The y-coordinate of the starting point.
x2The x-coordinate of the end point.
y2The y-coordinate of the end point.
See also
setPen()

Implements CDPL::Vis::Renderer2D.

◆ drawPolyline()

void CDPL::Vis::QtRenderer2D::drawPolyline ( const Math::Vector2DArray points)
virtual

Draws the polyline defined by points.

For a given set of \( N \) points \( p_i \) with \( i = 1, 2, \ldots, N \), \( N - 1 \) connected line segments \( (p_1, p_2), (p_2, p_3), \ldots, (p_{N - 1}, p_N) \) will be drawn. The line style, color, cap style, join style and line width is specified by the current pen.

Parameters
pointsAn array of points defining the polyline.
See also
setPen()

Implements CDPL::Vis::Renderer2D.

◆ drawLineSegments()

void CDPL::Vis::QtRenderer2D::drawLineSegments ( const Math::Vector2DArray points)
virtual

Draws the sequence of disjoint line segments defined by points.

For a given set of \( 2N \) points \( p_i \) with \( i = 1, 2, \ldots, 2N \), \( N \) disjoint line segments \( (p_1, p_2), (p_3, p_4), \ldots, (p_{2N - 1}, p_2N) \) will be drawn. The line style, color, cap style and line width is specified by the current pen.

Parameters
pointsAn array of points defining the line segments.
See also
setPen()

Implements CDPL::Vis::Renderer2D.

◆ drawPoint()

void CDPL::Vis::QtRenderer2D::drawPoint ( double  x,
double  y 
)
virtual

Draws a point at the position (x, y).

The diameter and color of the point is specified by the current pen.

Parameters
xThe x-coordinate of the point.
yThe y-coordinate of the point.
See also
setPen()

Implements CDPL::Vis::Renderer2D.

◆ drawText()

void CDPL::Vis::QtRenderer2D::drawText ( double  x,
double  y,
const std::string &  txt 
)
virtual

Draws the specified text at the position (x, y).

The text color is specified by the current pen. The font has to be specified by setFont().

Parameters
xThe x-position of the drawn text.
yThe y-position of the baseline.
txtThe text to draw.
See also
setPen(), setFont()

Implements CDPL::Vis::Renderer2D.

◆ drawEllipse()

void CDPL::Vis::QtRenderer2D::drawEllipse ( double  x,
double  y,
double  width,
double  height 
)
virtual

Draws an ellipse with the given width and height around the center position (x, y).

The ellipse is filled as specified by the current brush and the outline will be drawn as specified by the current pen.

Parameters
xThe x-coordinate of the center point.
yThe y-coordinate of the center point.
widthThe width of the ellipse.
heightThe height of the ellipse.
See also
setPen(), setBrush()

Implements CDPL::Vis::Renderer2D.

◆ drawPath()

void CDPL::Vis::QtRenderer2D::drawPath ( const Path2D path)
virtual

Draws the given path.

The path is filled as specified by the current brush and the outline will be drawn as specified by the current pen.

Parameters
pathThe path to draw.
See also
setPen(), setBrush()

Implements CDPL::Vis::Renderer2D.

◆ setClipPath()

void CDPL::Vis::QtRenderer2D::setClipPath ( const Path2D path)
virtual

Implements CDPL::Vis::Renderer2D.

◆ clearClipPath()

void CDPL::Vis::QtRenderer2D::clearClipPath ( )
virtual

Disables clipping.

Implements CDPL::Vis::Renderer2D.


The documentation for this class was generated from the following file: