bpp-core3
3.0.0
|
LaTeX Portable Graphic Format (Pgf) plotting format. More...
#include <Bpp/Graphics/Latex/PgfGraphicDevice.h>
Public Member Functions | |
PgfGraphicDevice (std::ostream &out, double unit) | |
Build a new Pgf device object. More... | |
virtual | ~PgfGraphicDevice () |
void | begin () |
Start the painting. More... | |
void | end () |
End the painting. More... | |
void | setCurrentForegroundColor (const RGBColor &color) |
void | setCurrentBackgroundColor (const RGBColor &color) |
void | setCurrentFont (const Font &font) |
void | setCurrentPointSize (unsigned int size) |
void | setCurrentLineType (short type) |
void | setCurrentLayer (int layerIndex) |
void | drawLine (double x1, double y1, double x2, double y2) |
Draw a line between two points. More... | |
void | drawRect (double x, double y, double width, double height, short fill=FILL_EMPTY) |
Draw a rectangle. More... | |
void | drawCircle (double x, double y, double radius, short fill=FILL_EMPTY) |
Draw a circle. More... | |
void | drawText (double x, double y, const std::string &text, short hpos=TEXT_HORIZONTAL_LEFT, short vpos=TEXT_VERTICAL_BOTTOM, double angle=0) |
Draw some characters. More... | |
void | comment (const std::string &text) |
Add a comment in the output. More... | |
const std::string & | getFontShape (const Font &font) |
void | setXUnit (double xu) |
void | setYUnit (double yu) |
double | getXUnit () const |
double | getYUnit () const |
const RGBColor & | getCurrentForegroundColor () const |
const RGBColor & | getCurrentBackgroundColor () const |
const Font & | getCurrentFont () const |
unsigned int | getCurrentPointSize () const |
short | getCurrentLineType () const |
int | getCurrentLayer () const |
Static Public Attributes | |
static short | TEXT_HORIZONTAL_CENTER = 0 |
static short | TEXT_HORIZONTAL_LEFT = 1 |
static short | TEXT_HORIZONTAL_RIGHT = 2 |
static short | TEXT_VERTICAL_CENTER = 3 |
static short | TEXT_VERTICAL_BOTTOM = 4 |
static short | TEXT_VERTICAL_TOP = 5 |
static short | FILL_EMPTY = 10 |
static short | FILL_FILLED = 11 |
static short | FILL_PATTERN = 12 |
static short | LINE_SOLID = 20 |
static short | LINE_DASHED = 21 |
static short | LINE_DOTTED = 22 |
Protected Member Functions | |
double | x_ (double x) const |
double | y_ (double y) const |
double | revx_ (double x) const |
double | revy_ (double y) const |
Private Attributes | |
std::ostream & | out_ |
std::string | fgColorStr_ |
std::string | bgColorStr_ |
std::vector< std::string > | content_ |
std::vector< int > | layers_ |
std::map< const RGBColor, std::string > | colorIndex_ |
unsigned int | colorCount_ |
bool | useLayers_ |
bool | contentStarted_ |
std::map< short int, std::string > | fontShapes_ |
std::map< short int, std::string > | fontSeries_ |
double | xUnit_ |
double | yUnit_ |
RGBColor | fgColor_ |
RGBColor | bgColor_ |
Font | font_ |
unsigned int | pointSize_ |
short | lineType_ |
int | currentLayer_ |
LaTeX Portable Graphic Format (Pgf) plotting format.
Definition at line 58 of file PgfGraphicDevice.h.
PgfGraphicDevice::PgfGraphicDevice | ( | std::ostream & | out, |
double | unit | ||
) |
Build a new Pgf device object.
Coordinates in Pgf are the same as in LaTeX, so it can be any of cm, mm, in, pt, px, etc. For compatibility with other devices, the constructor takes as input the scale of the drawing, as cm per points. All coordinates and widths will be multiplied by the factor in the output file.
out | The output stream. |
unit | The unit length. |
Definition at line 50 of file PgfGraphicDevice.cpp.
References bpp::ColorTools::BLACK, bpp::ColorTools::BLUE, colorIndex_, bpp::ColorTools::CYAN, fontSeries_, fontShapes_, bpp::ColorTools::GREEN, bpp::ColorTools::MAGENTA, bpp::ColorTools::RED, setCurrentFont(), bpp::AbstractGraphicDevice::setXUnit(), bpp::AbstractGraphicDevice::setYUnit(), bpp::Font::STYLE_ITALIC, bpp::Font::STYLE_NORMAL, bpp::Font::WEIGHT_BOLD, bpp::Font::WEIGHT_NORMAL, bpp::ColorTools::WHITE, and bpp::ColorTools::YELLOW.
|
inlinevirtual |
Definition at line 87 of file PgfGraphicDevice.h.
|
virtual |
Start the painting.
Implements bpp::GraphicDevice.
Definition at line 82 of file PgfGraphicDevice.cpp.
References colorCount_, colorIndex_, content_, contentStarted_, layers_, and useLayers_.
|
inlinevirtual |
Add a comment in the output.
comment | Comment text. |
Implements bpp::GraphicDevice.
Definition at line 104 of file PgfGraphicDevice.h.
References content_.
|
virtual |
Draw a circle.
This method uses the current foreground color and the current line type for drawing the stroke of the circle, and the current background color for filling the circle.
x | x coordinate of the center |
y | y coordinate of the center |
radius | The circle radius |
fill | Filling type (one of FILL_EMPTY, FILL_FILLED or FILL_PATTERN). |
Implements bpp::GraphicDevice.
Definition at line 268 of file PgfGraphicDevice.cpp.
References content_, contentStarted_, and bpp::GraphicDevice::FILL_FILLED.
|
virtual |
Draw a line between two points.
This method uses the current foreground color and the current line type.
x1 | x coordinate 1 |
y1 | y coordinate 1 |
x2 | x coordinate 2 |
y2 | y coordinate 2 |
Implements bpp::GraphicDevice.
Definition at line 245 of file PgfGraphicDevice.cpp.
References content_, and contentStarted_.
|
virtual |
Draw a rectangle.
This method uses the current foreground color and the current line type for drawing the stroke of the rectangle, and the current background color for filling the rectangle.
x | x coordinate |
y | y coordinate |
width | The rectangle width |
height | The rectangle height |
fill | Filling type (one of FILL_EMPTY, FILL_FILLED or FILL_PATTERN). |
Implements bpp::GraphicDevice.
Definition at line 256 of file PgfGraphicDevice.cpp.
References content_, contentStarted_, and bpp::GraphicDevice::FILL_FILLED.
|
virtual |
Draw some characters.
This method uses the current foreground color.
x | x coordinate |
y | y coordinate |
text | The characters to draw |
hpos | Horizontal adjustment, one of TEXT_HORIZONTAL_LEFT, TEXT_HORIZONTAL_CENTER or TEXT_HORIZONTAL_RIGHT. |
vpos | Vertical adjustment, one of TEXT_VERTICAL_LEFT, TEXT_VERTICAL_CENTER or TEXT_VERTICAL_RIGHT. |
angle | Angle i radian to rotate the text. |
Implements bpp::GraphicDevice.
Definition at line 280 of file PgfGraphicDevice.cpp.
References content_, contentStarted_, fgColorStr_, bpp::GraphicDevice::TEXT_HORIZONTAL_CENTER, bpp::GraphicDevice::TEXT_HORIZONTAL_LEFT, bpp::GraphicDevice::TEXT_HORIZONTAL_RIGHT, bpp::GraphicDevice::TEXT_VERTICAL_BOTTOM, bpp::GraphicDevice::TEXT_VERTICAL_CENTER, and bpp::GraphicDevice::TEXT_VERTICAL_TOP.
|
virtual |
End the painting.
Depending on the implementation of the device, the call of this method might be required before the plotting commands become visible.
Implements bpp::GraphicDevice.
Definition at line 93 of file PgfGraphicDevice.cpp.
References colorIndex_, comp(), content_, bpp::AbstractGraphicDevice::getCurrentLayer(), bpp::AbstractGraphicDevice::getXUnit(), bpp::AbstractGraphicDevice::getYUnit(), layers_, out_, bpp::TextTools::toString(), and useLayers_.
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 94 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::bgColor_.
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 95 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::font_.
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 93 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::fgColor_.
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 98 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::currentLayer_.
Referenced by bpp::SvgGraphicDevice::comment(), end(), and setCurrentLayer().
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 97 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::lineType_.
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 96 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::pointSize_.
Referenced by setCurrentLineType().
const std::string& bpp::PgfGraphicDevice::getFontShape | ( | const Font & | font | ) |
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 77 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
Referenced by end().
|
inlinevirtualinherited |
Implements bpp::GraphicDevice.
Definition at line 78 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
Referenced by end().
|
inlineprotectedinherited |
Definition at line 104 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
|
inlineprotectedinherited |
Definition at line 105 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
|
virtual |
Reimplemented from bpp::AbstractGraphicDevice.
Definition at line 163 of file PgfGraphicDevice.cpp.
References bgColorStr_, colorCount_, colorIndex_, content_, bpp::AbstractGraphicDevice::setCurrentBackgroundColor(), and bpp::TextTools::toString().
|
virtual |
Reimplemented from bpp::AbstractGraphicDevice.
Definition at line 182 of file PgfGraphicDevice.cpp.
References content_, fontSeries_, fontShapes_, bpp::Font::getFamily(), bpp::Font::getSeries(), bpp::Font::getShape(), bpp::Font::getSize(), and bpp::AbstractGraphicDevice::setCurrentFont().
Referenced by PgfGraphicDevice().
|
virtual |
Reimplemented from bpp::AbstractGraphicDevice.
Definition at line 144 of file PgfGraphicDevice.cpp.
References colorCount_, colorIndex_, content_, fgColorStr_, bpp::AbstractGraphicDevice::setCurrentForegroundColor(), and bpp::TextTools::toString().
|
virtual |
Reimplemented from bpp::AbstractGraphicDevice.
Definition at line 227 of file PgfGraphicDevice.cpp.
References bgColorStr_, content_, contentStarted_, fgColorStr_, bpp::AbstractGraphicDevice::getCurrentLayer(), layers_, bpp::AbstractGraphicDevice::setCurrentLayer(), bpp::TextTools::toString(), and useLayers_.
|
virtual |
Reimplemented from bpp::AbstractGraphicDevice.
Definition at line 202 of file PgfGraphicDevice.cpp.
References content_, bpp::AbstractGraphicDevice::getCurrentPointSize(), bpp::GraphicDevice::LINE_DASHED, bpp::GraphicDevice::LINE_DOTTED, bpp::GraphicDevice::LINE_SOLID, bpp::AbstractGraphicDevice::setCurrentLineType(), bpp::TextTools::toString(), and bpp::AbstractGraphicDevice::x_().
|
virtual |
Reimplemented from bpp::AbstractGraphicDevice.
Definition at line 194 of file PgfGraphicDevice.cpp.
References content_, bpp::AbstractGraphicDevice::setCurrentPointSize(), and bpp::AbstractGraphicDevice::x_().
|
inlinevirtualinherited |
xu | The x expansion factor. The actual unit actually depends on the implementation. |
Implements bpp::GraphicDevice.
Definition at line 75 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
Referenced by PgfGraphicDevice().
|
inlinevirtualinherited |
yu | The y expansion factor. The actual unit actually depends on the implementation. |
Implements bpp::GraphicDevice.
Definition at line 76 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
Referenced by PgfGraphicDevice().
|
inlineprotectedinherited |
Definition at line 101 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
Referenced by setCurrentLineType(), and setCurrentPointSize().
|
inlineprotectedinherited |
Definition at line 102 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
|
privateinherited |
Definition at line 61 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getCurrentBackgroundColor(), and bpp::AbstractGraphicDevice::setCurrentBackgroundColor().
|
private |
Definition at line 64 of file PgfGraphicDevice.h.
Referenced by setCurrentBackgroundColor(), and setCurrentLayer().
|
private |
Definition at line 68 of file PgfGraphicDevice.h.
Referenced by begin(), setCurrentBackgroundColor(), and setCurrentForegroundColor().
|
private |
Definition at line 67 of file PgfGraphicDevice.h.
Referenced by begin(), end(), PgfGraphicDevice(), setCurrentBackgroundColor(), and setCurrentForegroundColor().
|
private |
Definition at line 65 of file PgfGraphicDevice.h.
Referenced by begin(), comment(), drawCircle(), drawLine(), drawRect(), drawText(), end(), setCurrentBackgroundColor(), setCurrentFont(), setCurrentForegroundColor(), setCurrentLayer(), setCurrentLineType(), and setCurrentPointSize().
|
private |
Definition at line 70 of file PgfGraphicDevice.h.
Referenced by begin(), drawCircle(), drawLine(), drawRect(), drawText(), and setCurrentLayer().
|
privateinherited |
Definition at line 65 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getCurrentLayer(), and bpp::AbstractGraphicDevice::setCurrentLayer().
|
privateinherited |
Definition at line 60 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getCurrentForegroundColor(), and bpp::AbstractGraphicDevice::setCurrentForegroundColor().
|
private |
Definition at line 63 of file PgfGraphicDevice.h.
Referenced by drawText(), setCurrentForegroundColor(), and setCurrentLayer().
|
staticinherited |
Definition at line 186 of file GraphicDevice.h.
|
staticinherited |
Definition at line 187 of file GraphicDevice.h.
Referenced by drawCircle(), and drawRect().
|
staticinherited |
Definition at line 188 of file GraphicDevice.h.
|
privateinherited |
Definition at line 62 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getCurrentFont(), and bpp::AbstractGraphicDevice::setCurrentFont().
|
mutableprivate |
Definition at line 72 of file PgfGraphicDevice.h.
Referenced by PgfGraphicDevice(), and setCurrentFont().
|
mutableprivate |
Definition at line 71 of file PgfGraphicDevice.h.
Referenced by PgfGraphicDevice(), and setCurrentFont().
|
private |
Definition at line 66 of file PgfGraphicDevice.h.
Referenced by begin(), end(), and setCurrentLayer().
|
staticinherited |
Definition at line 191 of file GraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::setCurrentLineType(), bpp::XFigGraphicDevice::setCurrentLineType(), and setCurrentLineType().
|
staticinherited |
Definition at line 192 of file GraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::setCurrentLineType(), bpp::XFigGraphicDevice::setCurrentLineType(), and setCurrentLineType().
|
staticinherited |
Definition at line 190 of file GraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::setCurrentLineType(), bpp::XFigGraphicDevice::setCurrentLineType(), and setCurrentLineType().
|
privateinherited |
Definition at line 64 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getCurrentLineType(), and bpp::AbstractGraphicDevice::setCurrentLineType().
|
private |
Definition at line 62 of file PgfGraphicDevice.h.
Referenced by end().
|
privateinherited |
Definition at line 63 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getCurrentPointSize(), and bpp::AbstractGraphicDevice::setCurrentPointSize().
|
staticinherited |
Definition at line 179 of file GraphicDevice.h.
Referenced by drawText().
|
staticinherited |
Definition at line 180 of file GraphicDevice.h.
Referenced by drawText().
|
staticinherited |
Definition at line 181 of file GraphicDevice.h.
Referenced by drawText().
|
staticinherited |
Definition at line 183 of file GraphicDevice.h.
Referenced by drawText().
|
staticinherited |
Definition at line 182 of file GraphicDevice.h.
Referenced by drawText().
|
staticinherited |
Definition at line 184 of file GraphicDevice.h.
Referenced by drawText().
|
private |
Definition at line 69 of file PgfGraphicDevice.h.
Referenced by begin(), end(), and setCurrentLayer().
|
privateinherited |
Definition at line 58 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getXUnit(), bpp::AbstractGraphicDevice::revx_(), bpp::AbstractGraphicDevice::setXUnit(), and bpp::AbstractGraphicDevice::x_().
|
privateinherited |
Definition at line 59 of file AbstractGraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::getYUnit(), bpp::AbstractGraphicDevice::revy_(), bpp::AbstractGraphicDevice::setYUnit(), and bpp::AbstractGraphicDevice::y_().