bpp-core3  3.0.0
bpp::XFigGraphicDevice Class Reference

XFig plotting format. More...

#include <Bpp/Graphics/Fig/XFigGraphicDevice.h>

+ Inheritance diagram for bpp::XFigGraphicDevice:
+ Collaboration diagram for bpp::XFigGraphicDevice:

Public Member Functions

 XFigGraphicDevice (std::ostream &out)
 
virtual ~XFigGraphicDevice ()
 
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 setCurrentLineType (short type)
 
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...
 
void setFontFlag (unsigned int flag)
 
void setXUnit (double xu)
 
void setYUnit (double yu)
 
double getXUnit () const
 
double getYUnit () const
 
void setCurrentPointSize (unsigned int size)
 
void setCurrentLayer (int layerIndex)
 
const RGBColorgetCurrentForegroundColor () const
 
const RGBColorgetCurrentBackgroundColor () const
 
const FontgetCurrentFont () const
 
unsigned int getCurrentPointSize () const
 
short getCurrentLineType () const
 
int getCurrentLayer () const
 

Static Public Attributes

static const unsigned int FONTFLAG_LATEX = 0
 
static const unsigned int FONTFLAG_POSTSCRIPT = 4
 
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

int getFillCode (short fill)
 
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::vector< std::string > content_
 
XFigColorManager colorManager_
 
XFigLaTeXFontManager latexFontManager_
 
XFigPostscriptFontManager postscriptFontManager_
 
unsigned int fgColorCode_
 
unsigned int bgColorCode_
 
int fontCode_
 
unsigned int fontSize_
 
unsigned int fontFlag_
 
short lineTypeCode_
 

Detailed Description

XFig plotting format.

Definition at line 23 of file XFigGraphicDevice.h.

Constructor & Destructor Documentation

◆ XFigGraphicDevice()

bpp::XFigGraphicDevice::XFigGraphicDevice ( std::ostream &  out)
inline

Definition at line 40 of file XFigGraphicDevice.h.

References bpp::AbstractGraphicDevice::setCurrentLayer().

◆ ~XFigGraphicDevice()

virtual bpp::XFigGraphicDevice::~XFigGraphicDevice ( )
inlinevirtual

Member Function Documentation

◆ begin()

void XFigGraphicDevice::begin ( )
virtual

Start the painting.

Implements bpp::GraphicDevice.

Definition at line 13 of file XFigGraphicDevice.cpp.

Referenced by ~XFigGraphicDevice().

◆ comment()

void bpp::XFigGraphicDevice::comment ( const std::string &  comment)
inlinevirtual

Add a comment in the output.

Parameters
commentComment text.

Implements bpp::GraphicDevice.

Definition at line 77 of file XFigGraphicDevice.h.

◆ drawCircle()

void XFigGraphicDevice::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.

Parameters
xx coordinate of the center
yy coordinate of the center
radiusThe circle radius
fillFilling type (one of FILL_EMPTY, FILL_FILLED or FILL_PATTERN).

Implements bpp::GraphicDevice.

Definition at line 105 of file XFigGraphicDevice.cpp.

Referenced by setCurrentLineType().

◆ drawLine()

void XFigGraphicDevice::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.

Parameters
x1x coordinate 1
y1y coordinate 1
x2x coordinate 2
y2y coordinate 2

Implements bpp::GraphicDevice.

Definition at line 75 of file XFigGraphicDevice.cpp.

Referenced by setCurrentLineType().

◆ drawRect()

void XFigGraphicDevice::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.

Parameters
xx coordinate
yy coordinate
widthThe rectangle width
heightThe rectangle height
fillFilling type (one of FILL_EMPTY, FILL_FILLED or FILL_PATTERN).

Implements bpp::GraphicDevice.

Definition at line 88 of file XFigGraphicDevice.cpp.

Referenced by setCurrentLineType().

◆ drawText()

void XFigGraphicDevice::drawText ( double  x,
double  y,
const std::string &  text,
short  hpos = TEXT_HORIZONTAL_LEFT,
short  vpos = TEXT_VERTICAL_BOTTOM,
double  angle = 0 
)
virtual

Draw some characters.

This method uses the current foreground color.

Parameters
xx coordinate
yy coordinate
textThe characters to draw
hposHorizontal adjustment, one of TEXT_HORIZONTAL_LEFT, TEXT_HORIZONTAL_CENTER or TEXT_HORIZONTAL_RIGHT.
vposVertical adjustment, one of TEXT_VERTICAL_LEFT, TEXT_VERTICAL_CENTER or TEXT_VERTICAL_RIGHT.
angleAngle i radian to rotate the text.

Implements bpp::GraphicDevice.

Definition at line 121 of file XFigGraphicDevice.cpp.

References bpp::TextTools::toString().

Referenced by setCurrentLineType().

◆ end()

void XFigGraphicDevice::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 18 of file XFigGraphicDevice.cpp.

Referenced by ~XFigGraphicDevice().

◆ getCurrentBackgroundColor()

const RGBColor& bpp::AbstractGraphicDevice::getCurrentBackgroundColor ( ) const
inlinevirtualinherited

Implements bpp::GraphicDevice.

Definition at line 58 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::bgColor_.

◆ getCurrentFont()

const Font& bpp::AbstractGraphicDevice::getCurrentFont ( ) const
inlinevirtualinherited

Implements bpp::GraphicDevice.

Definition at line 59 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::font_.

◆ getCurrentForegroundColor()

const RGBColor& bpp::AbstractGraphicDevice::getCurrentForegroundColor ( ) const
inlinevirtualinherited

Implements bpp::GraphicDevice.

Definition at line 57 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::fgColor_.

◆ getCurrentLayer()

int bpp::AbstractGraphicDevice::getCurrentLayer ( ) const
inlinevirtualinherited

◆ getCurrentLineType()

short bpp::AbstractGraphicDevice::getCurrentLineType ( ) const
inlinevirtualinherited

Implements bpp::GraphicDevice.

Definition at line 61 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::lineType_.

◆ getCurrentPointSize()

unsigned int bpp::AbstractGraphicDevice::getCurrentPointSize ( ) const
inlinevirtualinherited

◆ getFillCode()

int XFigGraphicDevice::getFillCode ( short  fill)
protected

Definition at line 150 of file XFigGraphicDevice.cpp.

Referenced by setFontFlag().

◆ getXUnit()

double bpp::AbstractGraphicDevice::getXUnit ( ) const
inlinevirtualinherited
Returns
The x expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 41 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::xUnit_.

Referenced by bpp::PgfGraphicDevice::end().

◆ getYUnit()

double bpp::AbstractGraphicDevice::getYUnit ( ) const
inlinevirtualinherited
Returns
The y expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 42 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::yUnit_.

Referenced by bpp::PgfGraphicDevice::end().

◆ revx_()

double bpp::AbstractGraphicDevice::revx_ ( double  x) const
inlineprotectedinherited

Definition at line 68 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::xUnit_.

◆ revy_()

double bpp::AbstractGraphicDevice::revy_ ( double  y) const
inlineprotectedinherited

Definition at line 69 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::yUnit_.

◆ setCurrentBackgroundColor()

void XFigGraphicDevice::setCurrentBackgroundColor ( const RGBColor color)
virtual

◆ setCurrentFont()

void XFigGraphicDevice::setCurrentFont ( const Font font)
virtual

◆ setCurrentForegroundColor()

void XFigGraphicDevice::setCurrentForegroundColor ( const RGBColor color)
virtual

◆ setCurrentLayer()

void bpp::AbstractGraphicDevice::setCurrentLayer ( int  layerIndex)
inlinevirtualinherited

Implements bpp::GraphicDevice.

Reimplemented in bpp::PgfGraphicDevice.

Definition at line 55 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::setCurrentLayer(), and XFigGraphicDevice().

◆ setCurrentLineType()

◆ setCurrentPointSize()

void bpp::AbstractGraphicDevice::setCurrentPointSize ( unsigned int  size)
inlinevirtualinherited

Implements bpp::GraphicDevice.

Reimplemented in bpp::PgfGraphicDevice.

Definition at line 47 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::setCurrentPointSize().

◆ setFontFlag()

void bpp::XFigGraphicDevice::setFontFlag ( unsigned int  flag)
inline

Definition at line 83 of file XFigGraphicDevice.h.

References getFillCode().

◆ setXUnit()

void bpp::AbstractGraphicDevice::setXUnit ( double  xu)
inlinevirtualinherited
Parameters
xuThe x expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 39 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::PgfGraphicDevice().

◆ setYUnit()

void bpp::AbstractGraphicDevice::setYUnit ( double  yu)
inlinevirtualinherited
Parameters
yuThe y expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 40 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::PgfGraphicDevice().

◆ x_()

double bpp::AbstractGraphicDevice::x_ ( double  x) const
inlineprotectedinherited

◆ y_()

double bpp::AbstractGraphicDevice::y_ ( double  y) const
inlineprotectedinherited

Definition at line 66 of file AbstractGraphicDevice.h.

References bpp::AbstractGraphicDevice::yUnit_.

Member Data Documentation

◆ bgColorCode_

unsigned int bpp::XFigGraphicDevice::bgColorCode_
private

Definition at line 33 of file XFigGraphicDevice.h.

◆ colorManager_

XFigColorManager bpp::XFigGraphicDevice::colorManager_
private

Definition at line 29 of file XFigGraphicDevice.h.

◆ content_

std::vector<std::string> bpp::XFigGraphicDevice::content_
private

Definition at line 28 of file XFigGraphicDevice.h.

◆ fgColorCode_

unsigned int bpp::XFigGraphicDevice::fgColorCode_
private

Definition at line 32 of file XFigGraphicDevice.h.

◆ FILL_EMPTY

short GraphicDevice::FILL_EMPTY = 10
staticinherited

◆ FILL_FILLED

short GraphicDevice::FILL_FILLED = 11
staticinherited

◆ FILL_PATTERN

short GraphicDevice::FILL_PATTERN = 12
staticinherited

Definition at line 152 of file GraphicDevice.h.

◆ fontCode_

int bpp::XFigGraphicDevice::fontCode_
private

Definition at line 34 of file XFigGraphicDevice.h.

◆ fontFlag_

unsigned int bpp::XFigGraphicDevice::fontFlag_
private

Definition at line 36 of file XFigGraphicDevice.h.

◆ FONTFLAG_LATEX

const unsigned int XFigGraphicDevice::FONTFLAG_LATEX = 0
static

Definition at line 89 of file XFigGraphicDevice.h.

◆ FONTFLAG_POSTSCRIPT

const unsigned int XFigGraphicDevice::FONTFLAG_POSTSCRIPT = 4
static

Definition at line 90 of file XFigGraphicDevice.h.

◆ fontSize_

unsigned int bpp::XFigGraphicDevice::fontSize_
private

Definition at line 35 of file XFigGraphicDevice.h.

◆ latexFontManager_

XFigLaTeXFontManager bpp::XFigGraphicDevice::latexFontManager_
private

Definition at line 30 of file XFigGraphicDevice.h.

◆ LINE_DASHED

short GraphicDevice::LINE_DASHED = 21
staticinherited

◆ LINE_DOTTED

short GraphicDevice::LINE_DOTTED = 22
staticinherited

◆ LINE_SOLID

short GraphicDevice::LINE_SOLID = 20
staticinherited

◆ lineTypeCode_

short bpp::XFigGraphicDevice::lineTypeCode_
private

Definition at line 37 of file XFigGraphicDevice.h.

◆ out_

std::ostream& bpp::XFigGraphicDevice::out_
private

Definition at line 27 of file XFigGraphicDevice.h.

◆ postscriptFontManager_

XFigPostscriptFontManager bpp::XFigGraphicDevice::postscriptFontManager_
private

Definition at line 31 of file XFigGraphicDevice.h.

◆ TEXT_HORIZONTAL_CENTER

short GraphicDevice::TEXT_HORIZONTAL_CENTER = 0
staticinherited

Definition at line 143 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ TEXT_HORIZONTAL_LEFT

short GraphicDevice::TEXT_HORIZONTAL_LEFT = 1
staticinherited

◆ TEXT_HORIZONTAL_RIGHT

short GraphicDevice::TEXT_HORIZONTAL_RIGHT = 2
staticinherited

Definition at line 145 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ TEXT_VERTICAL_BOTTOM

short GraphicDevice::TEXT_VERTICAL_BOTTOM = 4
staticinherited

◆ TEXT_VERTICAL_CENTER

short GraphicDevice::TEXT_VERTICAL_CENTER = 3
staticinherited

Definition at line 146 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ TEXT_VERTICAL_TOP

short GraphicDevice::TEXT_VERTICAL_TOP = 5
staticinherited

Definition at line 148 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().


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