|
bpp-core
2.1.0
|
SVG plotting format. More...
#include <Bpp/Graphics/Svg/SvgGraphicDevice.h>
Inheritance diagram for bpp::SvgGraphicDevice:
Collaboration diagram for bpp::SvgGraphicDevice:Public Member Functions | |
| SvgGraphicDevice (std::ostream &out, bool inkscapeEnabled=false) | |
| virtual | ~SvgGraphicDevice () |
| void | begin () |
| Start the painting. | |
| void | end () |
| End the painting. | |
| void | drawLine (double x1, double y1, double x2, double y2) |
| Draw a line between two points. | |
| void | drawRect (double x, double y, double width, double height, short fill=FILL_EMPTY) |
| Draw a rectangle. | |
| void | drawCircle (double x, double y, double radius, short fill=FILL_EMPTY) |
| Draw a circle. | |
| void | drawText (double x, double y, const std::string &text, short hpos=TEXT_HORIZONTAL_LEFT, short vpos=TEXT_VERTICAL_BOTTOM, double angle=0) throw (UnvalidFlagException) |
| Draw some characters. | |
| void | comment (const std::string &text) |
| Add a comment in the output. | |
| void | setXUnit (double xu) |
| void | setYUnit (double yu) |
| double | getXUnit () const |
| double | getYUnit () const |
| void | setCurrentForegroundColor (const RGBColor &color) |
| void | setCurrentBackgroundColor (const RGBColor &color) |
| void | setCurrentFont (const Font &font) |
| void | setCurrentPointSize (unsigned int size) |
| void | setCurrentLineType (short type) throw (Exception) |
| void | setCurrentLayer (int layerIndex) |
| const RGBColor & | getCurrentForegroundColor () const |
| const RGBColor & | getCurrentBackgroundColor () const |
| const Font & | getCurrentFont () const |
| unsigned int | getCurrentPointSize () const |
| short | getCurrentLineType () const |
| int | getCurrentLayer () const |
Static Public Member Functions | |
| static std::string | colorToText (const RGBColor &color) |
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::map< int, std::vector < std::string >, std::greater < int > > | layers_ |
| bool | inkscapeEnabled_ |
| double | minx_ |
| double | maxx_ |
| double | miny_ |
| double | maxy_ |
| std::map< short int, std::string > | fontStyles_ |
| std::map< short int, std::string > | fontWeights_ |
SVG plotting format.
Definition at line 55 of file SvgGraphicDevice.h.
| bpp::SvgGraphicDevice::SvgGraphicDevice | ( | std::ostream & | out, |
| bool | inkscapeEnabled = false |
||
| ) | [inline] |
Definition at line 67 of file SvgGraphicDevice.h.
References fontStyles_, fontWeights_, bpp::Font::STYLE_ITALIC, bpp::Font::STYLE_NORMAL, bpp::Font::WEIGHT_BOLD, and bpp::Font::WEIGHT_NORMAL.
| virtual bpp::SvgGraphicDevice::~SvgGraphicDevice | ( | ) | [inline, virtual] |
Definition at line 80 of file SvgGraphicDevice.h.
| void SvgGraphicDevice::begin | ( | ) | [virtual] |
Start the painting.
Implements bpp::GraphicDevice.
Definition at line 45 of file SvgGraphicDevice.cpp.
| static std::string bpp::SvgGraphicDevice::colorToText | ( | const RGBColor & | color | ) | [inline, static] |
Definition at line 96 of file SvgGraphicDevice.h.
References bpp::TextTools::toString().
| void bpp::SvgGraphicDevice::comment | ( | const std::string & | comment | ) | [inline, virtual] |
Add a comment in the output.
| comment | Comment text. |
Implements bpp::GraphicDevice.
Definition at line 90 of file SvgGraphicDevice.h.
References bpp::AbstractGraphicDevice::getCurrentLayer(), and layers_.
| void SvgGraphicDevice::drawCircle | ( | double | x, |
| double | y, | ||
| double | radius, | ||
| short | fill = FILL_EMPTY |
||
| ) | [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 129 of file SvgGraphicDevice.cpp.
References bpp::TextTools::toString().
| void SvgGraphicDevice::drawLine | ( | double | x1, |
| double | y1, | ||
| double | x2, | ||
| double | y2 | ||
| ) | [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 85 of file SvgGraphicDevice.cpp.
References bpp::TextTools::toString().
| void SvgGraphicDevice::drawRect | ( | double | x, |
| double | y, | ||
| double | width, | ||
| double | height, | ||
| short | fill = FILL_EMPTY |
||
| ) | [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 109 of file SvgGraphicDevice.cpp.
References bpp::TextTools::toString().
| void SvgGraphicDevice::drawText | ( | double | x, |
| double | y, | ||
| const std::string & | text, | ||
| short | hpos = TEXT_HORIZONTAL_LEFT, |
||
| short | vpos = TEXT_VERTICAL_BOTTOM, |
||
| double | angle = 0 |
||
| ) | throw (UnvalidFlagException) [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 144 of file SvgGraphicDevice.cpp.
References bpp::TextTools::toString().
| void SvgGraphicDevice::end | ( | ) | [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 51 of file SvgGraphicDevice.cpp.
| const RGBColor& bpp::AbstractGraphicDevice::getCurrentBackgroundColor | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 93 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::bgColor_.
| const Font& bpp::AbstractGraphicDevice::getCurrentFont | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 94 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::font_.
| const RGBColor& bpp::AbstractGraphicDevice::getCurrentForegroundColor | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 92 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::fgColor_.
| int bpp::AbstractGraphicDevice::getCurrentLayer | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 97 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::currentLayer_.
Referenced by comment(), bpp::PgfGraphicDevice::end(), and bpp::PgfGraphicDevice::setCurrentLayer().
| short bpp::AbstractGraphicDevice::getCurrentLineType | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 96 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::lineType_.
| unsigned int bpp::AbstractGraphicDevice::getCurrentPointSize | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 95 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::pointSize_.
| double bpp::AbstractGraphicDevice::getXUnit | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 76 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
Referenced by bpp::PgfGraphicDevice::end().
| double bpp::AbstractGraphicDevice::getYUnit | ( | ) | const [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Definition at line 77 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
Referenced by bpp::PgfGraphicDevice::end().
| double bpp::AbstractGraphicDevice::revx_ | ( | double | x | ) | const [inline, protected, inherited] |
Definition at line 104 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
| double bpp::AbstractGraphicDevice::revy_ | ( | double | y | ) | const [inline, protected, inherited] |
Definition at line 105 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
| void bpp::AbstractGraphicDevice::setCurrentBackgroundColor | ( | const RGBColor & | color | ) | [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Reimplemented in bpp::XFigGraphicDevice, and bpp::PgfGraphicDevice.
Definition at line 80 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::bgColor_.
Referenced by bpp::XFigGraphicDevice::setCurrentBackgroundColor().
| void bpp::AbstractGraphicDevice::setCurrentFont | ( | const Font & | font | ) | [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Reimplemented in bpp::XFigGraphicDevice, and bpp::PgfGraphicDevice.
Definition at line 81 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::font_.
Referenced by bpp::XFigGraphicDevice::setCurrentFont().
| void bpp::AbstractGraphicDevice::setCurrentForegroundColor | ( | const RGBColor & | color | ) | [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Reimplemented in bpp::XFigGraphicDevice, and bpp::PgfGraphicDevice.
Definition at line 79 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::fgColor_.
Referenced by bpp::XFigGraphicDevice::setCurrentForegroundColor().
| void bpp::AbstractGraphicDevice::setCurrentLayer | ( | int | layerIndex | ) | [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Reimplemented in bpp::PgfGraphicDevice.
Definition at line 90 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::currentLayer_.
Referenced by bpp::XFigGraphicDevice::XFigGraphicDevice().
| void bpp::AbstractGraphicDevice::setCurrentLineType | ( | short | type | ) | throw (Exception) [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Reimplemented in bpp::XFigGraphicDevice, and bpp::PgfGraphicDevice.
Definition at line 83 of file AbstractGraphicDevice.h.
References bpp::GraphicDevice::LINE_DASHED, bpp::GraphicDevice::LINE_DOTTED, bpp::GraphicDevice::LINE_SOLID, bpp::AbstractGraphicDevice::lineType_, and bpp::TextTools::toString().
Referenced by bpp::PgfGraphicDevice::setCurrentLineType().
| void bpp::AbstractGraphicDevice::setCurrentPointSize | ( | unsigned int | size | ) | [inline, virtual, inherited] |
Implements bpp::GraphicDevice.
Reimplemented in bpp::PgfGraphicDevice.
Definition at line 82 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::pointSize_.
| void bpp::AbstractGraphicDevice::setXUnit | ( | double | xu | ) | [inline, virtual, inherited] |
| xu | The x expansion factor. The actual unit actually depends on the implementation. |
Implements bpp::GraphicDevice.
Definition at line 74 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
Referenced by bpp::PgfGraphicDevice::PgfGraphicDevice().
| void bpp::AbstractGraphicDevice::setYUnit | ( | double | yu | ) | [inline, virtual, inherited] |
| yu | The y expansion factor. The actual unit actually depends on the implementation. |
Implements bpp::GraphicDevice.
Definition at line 75 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
Referenced by bpp::PgfGraphicDevice::PgfGraphicDevice().
| double bpp::AbstractGraphicDevice::x_ | ( | double | x | ) | const [inline, protected, inherited] |
Definition at line 101 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::xUnit_.
Referenced by bpp::PgfGraphicDevice::setCurrentPointSize().
| double bpp::AbstractGraphicDevice::y_ | ( | double | y | ) | const [inline, protected, inherited] |
Definition at line 102 of file AbstractGraphicDevice.h.
References bpp::AbstractGraphicDevice::yUnit_.
short GraphicDevice::FILL_EMPTY = 10 [static, inherited] |
Definition at line 186 of file GraphicDevice.h.
short GraphicDevice::FILL_FILLED = 11 [static, inherited] |
Definition at line 187 of file GraphicDevice.h.
Referenced by bpp::PgfGraphicDevice::drawCircle(), and bpp::PgfGraphicDevice::drawRect().
short GraphicDevice::FILL_PATTERN = 12 [static, inherited] |
Definition at line 188 of file GraphicDevice.h.
std::map<short int, std::string> bpp::SvgGraphicDevice::fontStyles_ [private] |
Definition at line 63 of file SvgGraphicDevice.h.
Referenced by SvgGraphicDevice().
std::map<short int, std::string> bpp::SvgGraphicDevice::fontWeights_ [private] |
Definition at line 64 of file SvgGraphicDevice.h.
Referenced by SvgGraphicDevice().
bool bpp::SvgGraphicDevice::inkscapeEnabled_ [private] |
Definition at line 61 of file SvgGraphicDevice.h.
std::map<int, std::vector<std::string>, std::greater<int> > bpp::SvgGraphicDevice::layers_ [private] |
Definition at line 60 of file SvgGraphicDevice.h.
Referenced by comment().
short GraphicDevice::LINE_DASHED = 21 [static, inherited] |
Definition at line 191 of file GraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::setCurrentLineType(), and bpp::XFigGraphicDevice::setCurrentLineType().
short GraphicDevice::LINE_DOTTED = 22 [static, inherited] |
Definition at line 192 of file GraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::setCurrentLineType(), and bpp::XFigGraphicDevice::setCurrentLineType().
short GraphicDevice::LINE_SOLID = 20 [static, inherited] |
Definition at line 190 of file GraphicDevice.h.
Referenced by bpp::AbstractGraphicDevice::setCurrentLineType(), and bpp::XFigGraphicDevice::setCurrentLineType().
double bpp::SvgGraphicDevice::maxx_ [private] |
Definition at line 62 of file SvgGraphicDevice.h.
double bpp::SvgGraphicDevice::maxy_ [private] |
Definition at line 62 of file SvgGraphicDevice.h.
double bpp::SvgGraphicDevice::minx_ [private] |
Definition at line 62 of file SvgGraphicDevice.h.
double bpp::SvgGraphicDevice::miny_ [private] |
Definition at line 62 of file SvgGraphicDevice.h.
std::ostream& bpp::SvgGraphicDevice::out_ [private] |
Definition at line 59 of file SvgGraphicDevice.h.
short GraphicDevice::TEXT_HORIZONTAL_CENTER = 0 [static, inherited] |
Definition at line 179 of file GraphicDevice.h.
short GraphicDevice::TEXT_HORIZONTAL_LEFT = 1 [static, inherited] |
Definition at line 180 of file GraphicDevice.h.
short GraphicDevice::TEXT_HORIZONTAL_RIGHT = 2 [static, inherited] |
Definition at line 181 of file GraphicDevice.h.
short GraphicDevice::TEXT_VERTICAL_BOTTOM = 4 [static, inherited] |
Definition at line 183 of file GraphicDevice.h.
short GraphicDevice::TEXT_VERTICAL_CENTER = 3 [static, inherited] |
Definition at line 182 of file GraphicDevice.h.
short GraphicDevice::TEXT_VERTICAL_TOP = 5 [static, inherited] |
Definition at line 184 of file GraphicDevice.h.