|
libkpl
6.0
A Library for Graphical Presentation of Data Sets and Functions
|
PS graphics class. More...
#include <psgraph.h>
Public Member Functions | |
| PSGraph (QTextStream *stream, const QList< QGraphicsItem * > &list, const QSizeF &size, bool landscape=false, bool eps=true) | |
| Constructor. | |
| PSGraph (QTextStream *stream, const QSizeF &size, const QPointF &topRight=QPointF(), const QPointF &bottomLeft=QPointF(), bool landscape=false, bool eps=true) | |
| Constructor. | |
| ~PSGraph () | |
| Destructor. | |
| void | drawArray (const double *x, const double *y, double fx, double fy, int n, KplItem::FillStyle fillStyle=KplItem::NoBrush, double xOff=0, double yOff=0, bool clip=true) |
| Plots array item. | |
| void | drawItems (const QList< QGraphicsItem * > &list) |
| Plots items. | |
| void | drawText (const QString &text, double x, double y, TextItem::Alignment alignment=TextItem::AlignLeft) |
| Plots text. | |
| void | finish () |
| Finishes plot. | |
| void | setColorData (unsigned color) |
| Sets color for data plotting. | |
| void | setDir (double dir) |
| Sets rotation angle. | |
| double | setRelSize (double m_relSize) |
| Sets relative size of item. | |
Static Public Attributes | |
| static const double | pts |
| Points per cm. | |
Protected Member Functions | |
| void | cm2r (double xcm, double ycm, double fx, double fy, double *xu, double *yu) const |
| Converts from centimeters to user units. | |
| void | draw3D (ThreeDItem *item) |
| Plots 3D item. | |
| void | drawArc (ArcItem *item) |
| Plots arc item. | |
| void | drawArray (ArrayItem *item) |
| Plots array item. | |
| void | drawArray3D (Array3DItem *item) |
| Plots 3D array item. | |
| void | drawArrow (ArrowItem *item) |
| Plots arrow item. | |
| void | drawEllipse (EllipseItem *item) |
| Plots ellipse item. | |
| void | drawErrorBars (const double *x, const double *y, const double *errors, double fx, double fy, int n, double xOff=0, double yOff=0, bool clip=true) |
| Plots error bars for array item. | |
| void | drawFrame (FrameItem *item) |
| Plots frame item. | |
| void | drawFunc (FunItem *item) |
| Plots function item. | |
| void | drawFunc3D (Fun3DItem *item) |
| Plots 3D function item. | |
| void | drawImage (ImageItem *item) |
| Plots image item. | |
| void | drawLegend (LegendItem *item) |
| Plots legend item. | |
| void | drawLine (LineItem *item) |
| Plots line item. | |
| void | drawParFunc (ParFunItem *item) |
| Plots parametric function item. | |
| void | drawRect (RectItem *item) |
| Plots rectangle item. | |
| void | drawScaleBar (ScaleBarItem *item) |
| Plots scale bar item. | |
| void | drawSpline (SplineItem *item) |
| Plots spline item. | |
| void | drawText (TextItem *item) |
| Plots text item. | |
| void | labelX (const QString &text, int exp, bool xTop) |
| Plots x axis label. | |
| void | labelY (const QString &text, int exp, bool yRight) |
| Plots y axis label. | |
| void | prolog (bool landscape, bool eps, const QPointF &topRight=QPointF(), const QPointF &bottomLeft=QPointF()) |
| Writes PostScript prolog. | |
| void | psStr (const QString &text) |
| Converts to PostScript string. | |
| void | resetDashOffset () |
| Resets offset for dashed lines. | |
| void | scale (double xMin, double xMax, double yMin, double yMax, bool logX=false, bool logY=false) |
| Scales data window to user units. | |
| void | setColorFrame (unsigned color) |
| Sets color for frame. | |
| void | setColorGrid (unsigned color) |
| Sets color for grid and tics. | |
| void | setProperties (ScaledItem *item) |
| Sets color and symbol type for array and function items. | |
| void | setSymbol (KplItem::Symbol symbol) |
| Sets symbol type. | |
| void | window (double x0, double width, double y0, double height) |
| Sets position and size of the data window. | |
Protected Attributes | |
| bool | m_logX |
| bool | m_logY |
| KplItem::Symbol | m_symbol |
| double | m_x0 |
| double | m_y0 |
| double | m_width |
| double | m_height |
| double | m_xMin |
| double | m_yMin |
| double | m_xMax |
| double | m_yMax |
| double | m_relSize |
| QTextStream * | ts |
| QSizeF | m_size |
PS graphics class.
Provides methods to generate PS and EPS output.
| PSGraph::PSGraph | ( | QTextStream * | stream, |
| const QList< QGraphicsItem * > & | list, | ||
| const QSizeF & | size, | ||
| bool | landscape = false, | ||
| bool | eps = true ) |
Constructor.
Creates PS or EPS output of plot items.
| stream | pointer to output stream. |
| list | list of plot items. |
| size | media size in cm. |
| landscape | true for landscape orientation. |
| eps | true for EPS, false for PS output. |
| PSGraph::PSGraph | ( | QTextStream * | stream, |
| const QSizeF & | size, | ||
| const QPointF & | topRight = QPointF(), | ||
| const QPointF & | bottomLeft = QPointF(), | ||
| bool | landscape = false, | ||
| bool | eps = true ) |
Constructor.
Writes PS prolog.
| stream | pointer to output stream. |
| size | media size in cm. |
| topRight | top-right coordinates of graphics rectangle in cm. |
| bottomLeft | bottom-left coordinates of graphics rectangle in cm. |
| landscape | true for landscape orientation. |
| eps | true for EPS, false for PS output. |
|
protected |
Converts from centimeters to user units.
| xcm | x value in centimeters. |
| ycm | y value in centimeters. |
| fx | normalization factor for x values. |
| fy | normalization factor for y values. |
| xu | pointer to x value in user units (output). |
| yu | pointer to y value in user units (output). |
|
protected |
Plots 3D item.
| item | pointer to item. |
|
protected |
Plots arc item.
| item | pointer to item. |
|
protected |
Plots array item.
| item | pointer to item. |
| void PSGraph::drawArray | ( | const double * | x, |
| const double * | y, | ||
| double | fx, | ||
| double | fy, | ||
| int | n, | ||
| KplItem::FillStyle | fillStyle = KplItem::NoBrush, | ||
| double | xOff = 0, | ||
| double | yOff = 0, | ||
| bool | clip = true ) |
Plots array item.
| x | array with x values. |
| y | array with y values. |
| fx | normalization factor for x values. |
| fy | normalization factor for y values. |
| n | number of data points. |
| fillStyle | fill style. |
| xOff | offset for x values. |
| yOff | offset for x values. |
| clip | true for clipping. |
|
protected |
Plots 3D array item.
| item | pointer to item. |
|
protected |
Plots arrow item.
| item | pointer to item. |
|
protected |
Plots ellipse item.
| item | pointer to item. |
|
protected |
Plots error bars for array item.
| x | array with x values. |
| y | array with y values. |
| errors | array with y error values. |
| fx | normalization factor for x values. |
| fy | normalization factor for y values. |
| n | number of data points. |
| xOff | offset for x values. |
| yOff | offset for x values. |
| clip | true for clipping. |
|
protected |
Plots frame item.
| item | pointer to item. |
|
protected |
Plots function item.
| item | pointer to item. |
|
protected |
Plots 3D function item.
| item | pointer to item. |
|
protected |
Plots image item.
| item | pointer to item. |
| void PSGraph::drawItems | ( | const QList< QGraphicsItem * > & | list | ) |
Plots items.
| list | list of items. |
|
protected |
Plots legend item.
| item | pointer to item. |
|
protected |
Plots line item.
| item | pointer to item. |
|
protected |
Plots parametric function item.
| item | pointer to item. |
|
protected |
Plots rectangle item.
| item | pointer to item. |
|
protected |
Plots scale bar item.
| item | pointer to item. |
|
protected |
Plots spline item.
| item | pointer to item. |
| void PSGraph::drawText | ( | const QString & | text, |
| double | x, | ||
| double | y, | ||
| TextItem::Alignment | alignment = TextItem::AlignLeft ) |
Plots text.
| text | text. |
| x | x value in points. |
| y | y value in points. |
| alignment | horizontal alignment. |
|
protected |
Plots text item.
| item | pointer to item. |
|
protected |
Plots x axis label.
| text | label text. |
| exp | logarithm of normalization factor for x axis. |
| xTop | true for top side, false for bottom side label. |
|
protected |
Plots y axis label.
| text | label text. |
| exp | logarithm of normalization factor for y axis. |
| yRight | true for right side, false for left side label. |
|
protected |
Writes PostScript prolog.
| landscape | true for landscape orientation. |
| eps | true for EPS, false for PS output. |
| topRight | coordinates of top-right corner in cm. |
| bottomLeft | coordinates of bottom-left corner in cm. |
|
protected |
Converts to PostScript string.
| text | text. |
|
protected |
Scales data window to user units.
| xMin | x value of left data window margin in user units. |
| xMax | x value of right data window margin in user units. |
| yMin | y value of bottom data window margin in user units. |
| yMax | y value of top window data margin in user units. |
| logX | true for logarithmic x scale. |
| logY | true for logarithmic y scale. |
| void PSGraph::setColorData | ( | unsigned | color | ) |
Sets color for data plotting.
| color | color. |
|
protected |
Sets color for frame.
| color | color. |
|
protected |
Sets color for grid and tics.
| color | color. |
| void PSGraph::setDir | ( | double | dir | ) |
Sets rotation angle.
| dir | rotation angle in deg. |
|
protected |
Sets color and symbol type for array and function items.
| item | pointer to item. |
| double PSGraph::setRelSize | ( | double | m_relSize | ) |
Sets relative size of item.
| m_relSize | relative size. |
|
protected |
Sets symbol type.
| symbol | symbol type. |
|
protected |
Sets position and size of the data window.
| x0 | left page margin in centimeters. |
| width | width in centimeters. |
| y0 | bottom page margin in centimeters. |
| height | height in centimeters. |