Avogadro
1.1.0
|
Pure virtual Painter base class to be implemented by painters. More...
#include <avogadro/painter.h>
Public Member Functions | |
Painter () | |
virtual | ~Painter () |
virtual bool | initialize () |
virtual bool | finalize () |
virtual int | quality () const =0 |
virtual void | setName (const Primitive *primitive)=0 |
virtual void | setName (Primitive::Type type, int id)=0 |
virtual void | setColor (const Color *color)=0 |
virtual void | setColor (const QColor *color)=0 |
virtual void | setColor (float red, float green, float blue, float alpha=1.0)=0 |
virtual void | setColor (QString name)=0 |
virtual void | drawSphere (const Eigen::Vector3d ¢er, double radius)=0 |
virtual void | drawSphere (const Eigen::Vector3d *center, double radius) |
virtual void | drawCylinder (const Eigen::Vector3d &end1, const Eigen::Vector3d &end2, double radius)=0 |
virtual void | drawMultiCylinder (const Eigen::Vector3d &end1, const Eigen::Vector3d &end2, double radius, int order, double shift)=0 |
virtual void | drawCone (const Eigen::Vector3d &base, const Eigen::Vector3d &cap, double baseRadius, double capRadius=0.0)=0 |
virtual void | drawLine (const Eigen::Vector3d &start, const Eigen::Vector3d &end, double lineWidth)=0 |
virtual void | drawMultiLine (const Eigen::Vector3d &start, const Eigen::Vector3d &end, double lineWidth, int order, short stipple)=0 |
virtual void | drawTriangle (const Eigen::Vector3d &p1, const Eigen::Vector3d &p2, const Eigen::Vector3d &p3)=0 |
virtual void | drawTriangle (const Eigen::Vector3d &p1, const Eigen::Vector3d &p2, const Eigen::Vector3d &p3, const Eigen::Vector3d &n)=0 |
virtual void | drawSpline (const QVector< Eigen::Vector3d > &pts, double radius)=0 |
virtual void | drawShadedSector (const Eigen::Vector3d &origin, const Eigen::Vector3d &direction1, const Eigen::Vector3d &direction2, double radius, bool alternateAngle=false)=0 |
virtual void | drawArc (const Eigen::Vector3d &origin, const Eigen::Vector3d &direction1, const Eigen::Vector3d &direction2, double radius, double lineWidth, bool alternateAngle=false)=0 |
virtual void | drawShadedQuadrilateral (const Eigen::Vector3d &point1, const Eigen::Vector3d &point2, const Eigen::Vector3d &point3, const Eigen::Vector3d &point4)=0 |
virtual void | drawQuadrilateral (const Eigen::Vector3d &point1, const Eigen::Vector3d &point2, const Eigen::Vector3d &point3, const Eigen::Vector3d &point4, double lineWidth) |
virtual void | drawLineLoop (const QList< Eigen::Vector3d > &points, const double lineWidth) |
virtual void | drawMesh (const Mesh &mesh, int mode=0)=0 |
virtual void | drawColorMesh (const Mesh &mesh, int mode=0)=0 |
virtual int | drawText (int x, int y, const QString &string)=0 |
virtual int | drawText (const QPoint &pos, const QString &string)=0 |
virtual int | drawText (const Eigen::Vector3d &pos, const QString &string)=0 |
virtual int | drawText (const Eigen::Vector3d &, const QString &, const QFont &) |
virtual void | drawBox (const Eigen::Vector3d &corner1, const Eigen::Vector3d &corner2)=0 |
virtual void | drawBoxEdges (const Eigen::Vector3d &offset, const Eigen::Vector3d &v1, const Eigen::Vector3d &v2, const Eigen::Vector3d &v3, const double linewidth) |
virtual void | drawBoxEdges (const Eigen::Vector3d &c1, const Eigen::Vector3d &c2, const Eigen::Vector3d &c3, const Eigen::Vector3d &c4, const Eigen::Vector3d &c5, const Eigen::Vector3d &c6, const Eigen::Vector3d &c7, const Eigen::Vector3d &c8, const double linewidth) |
virtual void | drawTorus (const Eigen::Vector3d &pos, double majorRadius, double minorRadius)=0 |
virtual void | drawEllipsoid (const Eigen::Vector3d &position, const Eigen::Matrix3d &matrix)=0 |
Pure virtual Painter base class to be implemented by painters.
This class is a pure virtual base class of the Painter. It should be implemented by painters in order to satisfy all primitives objects to be drawn by the engines.
Constructor.
Avogadro::Painter::~Painter | ( | ) | [virtual] |
Destructor.
virtual void Avogadro::Painter::drawArc | ( | const Eigen::Vector3d & | origin, |
const Eigen::Vector3d & | direction1, | ||
const Eigen::Vector3d & | direction2, | ||
double | radius, | ||
double | lineWidth, | ||
bool | alternateAngle = false |
||
) | [pure virtual] |
Draws an arc. The arc is defined by three vectors, the center of the circle, and two vectors that define the lines going out from the center of the circle to the circumference of the circle. The actual points on the circumference are found using these two vectors and the radius of the circle.
origin | the center of the circle whose circumference this arc is a portion of. |
direction1 | a vector defining the line the start of the arc will lie on. |
direction2 | a vector defining the line the end of the arc will lie on. |
radius | the radius of the circle whose circumference this arc is a portion of. |
lineWidth | the thickness of the line the arc will be drawn with. |
alternateAngle | whether to draw the obtuse angle made by the two vectors instead of the acute angle between them. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawBox | ( | const Eigen::Vector3d & | corner1, |
const Eigen::Vector3d & | corner2 | ||
) | [pure virtual] |
Placeholder to draw a cube.
corner1 | First corner of the cube. |
corner2 | Second corner of the cube. |
Implemented in Avogadro::GLPainter.
void Avogadro::Painter::drawBoxEdges | ( | const Eigen::Vector3d & | offset, |
const Eigen::Vector3d & | v1, | ||
const Eigen::Vector3d & | v2, | ||
const Eigen::Vector3d & | v3, | ||
const double | linewidth | ||
) | [virtual] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Draws the outline of a parallelpiped at offset with three vectors v1, v2, and v3 defining the edges.
6------8 c1 = origin /: /| c2 = origin + v1 / : / | c3 = origin + v2 / 4---/--7 c4 = origin + v3 / / / / c5 = origin + v1 + v2 3------5 / c6 = origin + v2 + v3 | / | / c7 = origin + v1 + v3 |/ |/ c8 = origin + v1 + v2 + v3 1------2
offset | Corner of the box. |
v1 | Edge of box, pointing relative to offset. |
v2 | Edge of box, pointing relative to offset. |
v3 | Edge of box, pointing relative to offset. |
linewidth | The width of the line. |
Reimplemented in Avogadro::GLPainter.
void Avogadro::Painter::drawBoxEdges | ( | const Eigen::Vector3d & | c1, |
const Eigen::Vector3d & | c2, | ||
const Eigen::Vector3d & | c3, | ||
const Eigen::Vector3d & | c4, | ||
const Eigen::Vector3d & | c5, | ||
const Eigen::Vector3d & | c6, | ||
const Eigen::Vector3d & | c7, | ||
const Eigen::Vector3d & | c8, | ||
const double | linewidth | ||
) | [virtual] |
Draws the outline of a box with the given corners.
6------8 /: /| / : / | / 4---/--7 / / / / 3------5 / | / | / |/ |/ 1------2
c1 | Corner |
c2 | Corner |
c3 | Corner |
c4 | Corner |
c5 | Corner |
c6 | Corner |
c7 | Corner |
c8 | Corner |
linewidth | The width of the line. |
Reimplemented in Avogadro::GLPainter.
References drawLine().
virtual void Avogadro::Painter::drawColorMesh | ( | const Mesh & | mesh, |
int | mode = 0 |
||
) | [pure virtual] |
Draws a continuous mesh of triangles and respects the colors stored.
mesh | the mesh to be drawn. |
mode | the mode to use. 0 = filled, 1 = lines and 2 = points. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawCone | ( | const Eigen::Vector3d & | base, |
const Eigen::Vector3d & | cap, | ||
double | baseRadius, | ||
double | capRadius = 0.0 |
||
) | [pure virtual] |
Draws a cone between the tip and the base with the base radius given.
base | the position of the base of the cone. |
cap | the position of the tip of the cone. |
baseRadius | the radius of the base of the cone. |
capRadius | the radius of the base of the cone. |
Implemented in Avogadro::GLPainter.
Referenced by Avogadro::GLWidget::renderAxesOverlay().
virtual void Avogadro::Painter::drawCylinder | ( | const Eigen::Vector3d & | end1, |
const Eigen::Vector3d & | end2, | ||
double | radius | ||
) | [pure virtual] |
Draws a cylinder, leaving the Painter choose the appropriate detail level based on the apparent radius (ratio of radius over distance) and the global quality setting.
end1 | the position of the first end of the cylinder. |
end2 | the position of the second end of the cylinder. |
radius | the radius of the cylinder. |
Implemented in Avogadro::GLPainter.
Referenced by Avogadro::GLWidget::renderAxesOverlay().
virtual void Avogadro::Painter::drawEllipsoid | ( | const Eigen::Vector3d & | position, |
const Eigen::Matrix3d & | matrix | ||
) | [pure virtual] |
Placeholder to draw an ellipsoid.
pos | Position of the center of the ellipsoid. |
matrix | Linear transformation matrix for scaling and rotation. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawLine | ( | const Eigen::Vector3d & | start, |
const Eigen::Vector3d & | end, | ||
double | lineWidth | ||
) | [pure virtual] |
Draws a line between the given points of the given width.
start | the position of the start of the line. |
end | the position of the end of the line. |
lineWidth | the width of the line. |
Implemented in Avogadro::GLPainter.
Referenced by drawBoxEdges(), drawLineLoop(), and drawQuadrilateral().
void Avogadro::Painter::drawLineLoop | ( | const QList< Eigen::Vector3d > & | points, |
const double | lineWidth | ||
) | [virtual] |
Draws a closed line loop connecting each of the points in points,
points | A list of consecutive points defining the line loop |
lineWidth | the thickness of the line the pentagon will be drawn with. |
Reimplemented in Avogadro::GLPainter.
References QList::constBegin(), QList::constEnd(), drawLine(), QList::first(), QList::last(), and QList::size().
virtual void Avogadro::Painter::drawMesh | ( | const Mesh & | mesh, |
int | mode = 0 |
||
) | [pure virtual] |
Draws a continuous mesh of triangles.
mesh | the mesh to be drawn. |
mode | the mode to use. 0 = filled, 1 = lines and 2 = points. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawMultiCylinder | ( | const Eigen::Vector3d & | end1, |
const Eigen::Vector3d & | end2, | ||
double | radius, | ||
int | order, | ||
double | shift | ||
) | [pure virtual] |
Draws a multiple cylinder (see below), leaving the Painter choose the appropriate detail level based on the apparent radius (ratio of radius over distance) and the global quality setting.
What is a "multiple cylinder"? Think bond of order two or more between two atoms. This function is here to allow drawing multiple bonds in a single call.
This function takes care of rendering multiple bonds in such a way that the individual bonds avoid hiding each other, at least in the defaut viewpoint of a molecule. To achieves that, it asks the GLWidget for the the normal vector of the molecule's best-fitting plane.
end1 | the position of the first end of the bond. |
end2 | the position of the second end of the bond. |
radius | the radius, i.e. half-width of each cylinder. |
order | the multiplicity order of the bond, e.g. 2 for a double bond. When this parameter equals 1, this function is equivalent to drawCylinder(). |
shift | how far away from the central axis the cylinders are shifted. In other words this influences the total width of multiple bonds. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawMultiLine | ( | const Eigen::Vector3d & | start, |
const Eigen::Vector3d & | end, | ||
double | lineWidth, | ||
int | order, | ||
short | stipple | ||
) | [pure virtual] |
Draws a multiple line between the given points. This function is the line equivalent to the drawMultiCylinder function and performs the same basic operations using simpler and quicker lines.
start | the position of the start of the line. |
end | the position of the end of the line. |
lineWidth | the width of the line. |
order | the order of the bond, e.g. 2 for a double bond. |
stipple | The stipple parameter for the bond, can be used to draw aromatic bonds etc. sa drawMultiCylinder |
Implemented in Avogadro::GLPainter.
void Avogadro::Painter::drawQuadrilateral | ( | const Eigen::Vector3d & | point1, |
const Eigen::Vector3d & | point2, | ||
const Eigen::Vector3d & | point3, | ||
const Eigen::Vector3d & | point4, | ||
double | lineWidth | ||
) | [virtual] |
Draws the outline of a two dimensional quadrilateral in three dimensional space.
point1 | the first of the four corners of the quadrilateral. |
point2 | the second of the four corners of the quadrilateral. |
point3 | the third of the four corners of the quadrilateral. |
point4 | the last of the four corners of the quadrilateral. |
lineWidth | the thickness of the line the quadrilateral will be drawn with. |
Reimplemented in Avogadro::GLPainter.
References drawLine().
virtual void Avogadro::Painter::drawShadedQuadrilateral | ( | const Eigen::Vector3d & | point1, |
const Eigen::Vector3d & | point2, | ||
const Eigen::Vector3d & | point3, | ||
const Eigen::Vector3d & | point4 | ||
) | [pure virtual] |
Draws a solid two dimensional quadrilateral in three dimensional space.
point1 | the first of the four corners of the quadrilateral. |
point2 | the second of the four corners of the quadrilateral. |
point3 | the third of the four corners of the quadrilateral. |
point4 | the last of the four corners of the quadrilateral. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawShadedSector | ( | const Eigen::Vector3d & | origin, |
const Eigen::Vector3d & | direction1, | ||
const Eigen::Vector3d & | direction2, | ||
double | radius, | ||
bool | alternateAngle = false |
||
) | [pure virtual] |
Draws a shaded sector of a circle. The sector is defined by three vectors, the center of the circle, and two vectors that define the lines going out from the centre of the circle to the circumference of the circle. The actual points on the circumference are found using these two vectors and the radius of the circle.
origin | the center of the circle this sector is a portion of. |
direction1 | a vector defining the line the first point will lie on. |
direction2 | a vector defining the line the second point will lie on. |
radius | the radius of the circle this sector is a portion of. |
alternateAngle | whether to draw the obtuse angle made by the two vectors instead of the acute angle between them. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawSphere | ( | const Eigen::Vector3d & | center, |
double | radius | ||
) | [pure virtual] |
Draws a sphere, leaving the Painter choose the appropriate detail level based on the apparent radius (ratio of radius over distance) and the global quality setting.
center | the position of the center of the sphere. |
radius | the radius of the sphere. |
Implemented in Avogadro::GLPainter.
Referenced by drawSphere(), and Avogadro::GLWidget::renderAxesOverlay().
void Avogadro::Painter::drawSphere | ( | const Eigen::Vector3d * | center, |
double | radius | ||
) | [virtual] |
Draws a sphere, leaving the Painter choose the appropriate detail level based on the apparent radius (ratio of radius over distance) and the global quality setting.
center | the position of the center of the sphere. |
radius | the radius of the sphere. |
References drawSphere().
virtual void Avogadro::Painter::drawSpline | ( | const QVector< Eigen::Vector3d > & | pts, |
double | radius | ||
) | [pure virtual] |
Draw a cubic B-spline between the given points.
pts | QVector containing the points to draw the cubic B-spline along. |
radius | the radius of the cubic B-spline. |
Implemented in Avogadro::GLPainter.
virtual int Avogadro::Painter::drawText | ( | int | x, |
int | y, | ||
const QString & | string | ||
) | [pure virtual] |
Draws text at a given window position, on top of the scene.
x,y | the window coordinates of the top-left corner of the text to render, (0, 0) is the top-left corner of the window. |
string | the string to render. All character encodings are allowed but superposed characters are not supported yet. For accented letters, use a character giving the whole accented letter, not a separate character for the accent. |
Implemented in Avogadro::GLPainter.
virtual int Avogadro::Painter::drawText | ( | const QPoint & | pos, |
const QString & | string | ||
) | [pure virtual] |
Draws text at a given window position, on top of the scene.
pos | the window coordinates of the top-left corner of the text to render, (0, 0) is the top-left corner of the window. |
string | the string to render. All character encodings are allowed but superposed characters are not supported yet. For accented letters, use a character giving the whole accented letter, not a separate character for the accent. |
Implemented in Avogadro::GLPainter.
virtual int Avogadro::Painter::drawText | ( | const Eigen::Vector3d & | pos, |
const QString & | string | ||
) | [pure virtual] |
Draws text at a given scene position, inside the scene.
pos | the scene coordinates of the top-left corner of the text to render. |
string | The string to render. All character encodings are allowed but superposed characters are not supported yet. For accented letters, use a character giving the whole accented letter, not a separate character for the accent. |
Implemented in Avogadro::GLPainter.
virtual int Avogadro::Painter::drawText | ( | const Eigen::Vector3d & | , |
const QString & | , | ||
const QFont & | |||
) | [inline, virtual] |
Draws text at a given scene position, inside the scene, using given font
pos | the scene coordinates of the top-left corner of the text to render. |
string | The string to render. All character encodings are allowed but superposed characters are not supported yet. For accented letters, use a character giving the whole accented letter, not a separate character for the accent. |
font | The font to use for rendering |
Reimplemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawTorus | ( | const Eigen::Vector3d & | pos, |
double | majorRadius, | ||
double | minorRadius | ||
) | [pure virtual] |
Placeholder to draw a torus.
pos | Position of the center of the torus. |
majorRadius | Major radius of the torus. |
minorRadius | Minor radius of the torus. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawTriangle | ( | const Eigen::Vector3d & | p1, |
const Eigen::Vector3d & | p2, | ||
const Eigen::Vector3d & | p3 | ||
) | [pure virtual] |
Draws a triangle with vertives on the three given points. This function calculates the normal of the triangle and corrects the winding order to ensure the front face is facing the camera.
p1 | first triangle vertex. |
p2 | second triangle vertex. |
p3 | third triangle vertex. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::drawTriangle | ( | const Eigen::Vector3d & | p1, |
const Eigen::Vector3d & | p2, | ||
const Eigen::Vector3d & | p3, | ||
const Eigen::Vector3d & | n | ||
) | [pure virtual] |
Draws a triangle with vertives on the three given points using the given normal. This function corrects the triangle's winding order.
p1 | first triangle vertex. |
p2 | second triangle vertex. |
p3 | third triangle vertex. |
n | the normal of the triangle. |
Implemented in Avogadro::GLPainter.
bool Avogadro::Painter::finalize | ( | ) | [virtual] |
Function to clean up before the drawing context is destroyed.
bool Avogadro::Painter::initialize | ( | ) | [virtual] |
Function that may be used to initialize the drawing context when the painter is first used.
virtual int Avogadro::Painter::quality | ( | ) | const [pure virtual] |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::setColor | ( | const Color * | color | ) | [pure virtual] |
Set the color to paint the primitive elements with.
color | the color to be used for painting. |
Implemented in Avogadro::GLPainter.
Referenced by Avogadro::GLWidget::renderAxesOverlay().
virtual void Avogadro::Painter::setColor | ( | const QColor * | color | ) | [pure virtual] |
Set the color to paint the primitive elements with.
color | the color to be used for painting. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::setColor | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 |
||
) | [pure virtual] |
Set the color to paint elements with where 0.0 is the minimum and 1.0 is the maximum.
red | component of the color. |
green | component of the color. |
blue | component of the color. |
alpha | component of the color. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::setColor | ( | QString | name | ) | [pure virtual] |
Set the color to paint elements by its name
name | name of the color to be used |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::setName | ( | const Primitive * | primitive | ) | [pure virtual] |
Uses the primitive to set the type and name if the Paint Device supports it.
primitive | the primitive about to be drawn. |
Implemented in Avogadro::GLPainter.
virtual void Avogadro::Painter::setName | ( | Primitive::Type | type, |
int | id | ||
) | [pure virtual] |
Sets the primitive type and id.
type | the primitive type about to be drawn. |
id | the primitive id. |
Implemented in Avogadro::GLPainter.