22 contentStarted_(false),
55 bool comp(
int a,
int b ) {
return a > b; }
64 out_ <<
"\\documentclass{article}" << endl;
65 out_ <<
"% This figure was generated by the Bio++ Pgf Graphic Device." << endl;
66 out_ <<
"% Althought this file can be compiled 'as is' it may not be displayed correctly, depending on the size of the picture." << endl;
67 out_ <<
"% You may consider copying the pgfpicture environment to your own LaTeX file and play with pgf settings (e.g. the pgfpages module)." << endl;
68 out_ <<
"% You can also use the geometry package, for instance:" << endl;
69 out_ <<
"% \\usepackage[a3paper]{geometry}" << endl;
70 out_ <<
"\\usepackage{pgf}" << endl;
73 if (it->second.substr(0, 3) ==
"use")
74 out_ <<
"\\definecolor{" << it->second <<
"}{rgb}{" << it->first[0] / 255. <<
"," << it->first[1] / 255. <<
"," << it->first[2] / 255. <<
"}" << endl;
76 out_ <<
"\\begin{document}" << endl;
83 for (
unsigned int i = 0; i <
layers_.size(); i++)
88 out_ <<
"\\pgfdeclarelayer{" <<
layers_[i] <<
"}" << endl;
90 out_ <<
"\\pgfsetlayers{" << tmp <<
"}" << endl;
94 out_ <<
"\\begin{pgfpicture}" << endl;
95 out_ <<
"\\pgfsetxvec{\\pgfpoint{" <<
getXUnit() <<
"cm}{0cm}}" << endl;
96 out_ <<
"\\pgfsetyvec{\\pgfpoint{0cm}{-" <<
getYUnit() <<
"cm}}" << endl;
98 for (
unsigned int i = 0; i <
content_.size(); i++)
103 out_ <<
"\\end{pgfpicture}" << endl;
104 out_ <<
"\\end{document}" << endl;
109 map<const RGBColor, string>::iterator it =
colorIndex_.find(color);
122 oss <<
"\\pgfsetstrokecolor{" <<
fgColorStr_ <<
"}" << endl;
128 map<const RGBColor, string>::iterator it =
colorIndex_.find(color);
141 oss <<
"\\pgfsetfillcolor{" <<
bgColorStr_ <<
"}" << endl;
149 oss <<
"\\fontfamily{" << font.
getFamily() <<
"}" << endl;
152 oss <<
"\\fontsize{" << font.
getSize() <<
"}{" << font.
getSize() <<
"}" << endl;
153 oss <<
"\\selectfont" << endl;
161 oss <<
"\\pgfsetlinewidth{" <<
x_(size) <<
"}" << endl;
171 oss <<
"\\pgfsetdash{}{0pt}" << endl;
177 oss <<
"\\pgfsetdash{{3mm}{2mm}}{0pt}" << endl;
193 throw Exception(
"PgfGraphicDevice::setCurrentLayer. A layer is specified after some content has been already added, this would result in a corrupted display.");
199 oss <<
"\\pgfsetstrokecolor{" <<
fgColorStr_ <<
"}" << endl;
200 oss <<
"\\pgfsetfillcolor{" <<
bgColorStr_ <<
"}" << endl;
211 oss <<
"\\pgfpathmoveto{\\pgfpointxy{" << x1 <<
"}{" << y1 <<
"}}" << endl;
212 oss <<
"\\pgfpathlineto{\\pgfpointxy{" << x2 <<
"}{" << y2 <<
"}}" << endl;
213 oss <<
"\\pgfpathclose" << endl;
214 oss <<
"\\pgfusepath{stroke}" << endl;
222 oss <<
"\\pgfpathrectangle{\\pgfpointxy{" << x <<
"}{" << y <<
"}}{\\pgfpointxy{" << width <<
"}{" << height <<
"}}" << endl;
224 oss <<
"\\pgfusepath{stroke,fill}" << endl;
226 oss <<
"\\pgfusepath{stroke}" << endl;
234 oss <<
"\\pgfpathcircle{\\pgfpointxy{" << x <<
"}{" << y <<
"}}{" << radius <<
"}" << endl;
236 oss <<
"\\pgfusepath{stroke,fill}" << endl;
238 oss <<
"\\pgfusepath{stroke}" << endl;
264 oss <<
"\\pgftransformrotate{" << angle <<
"}" << endl;
265 oss <<
"\\pgftext[" << anchor <<
",at=\\pgfpointxy{" << x <<
"}{" << y <<
"}]{\\textcolor{" <<
fgColorStr_ <<
"}" << text <<
"}" << endl;
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.
static const short int WEIGHT_NORMAL
static const short int STYLE_NORMAL
void drawRect(double x, double y, double width, double height, short fill=FILL_EMPTY)
Draw a rectangle.
Data structure for fonts.
void end()
End the painting.
static short TEXT_VERTICAL_TOP
std::map< const RGBColor, std::string > colorIndex_
void drawCircle(double x, double y, double radius, short fill=FILL_EMPTY)
Draw a circle.
std::map< short int, std::string > fontShapes_
void setCurrentFont(const Font &font)
void setCurrentForegroundColor(const RGBColor &color)
void setCurrentBackgroundColor(const RGBColor &color)
Describe a color according to its red, green and blue componants.
static const short int STYLE_ITALIC
double x_(double x) const
unsigned int getCurrentPointSize() const
static short TEXT_HORIZONTAL_RIGHT
int getCurrentLayer() const
void setCurrentLineType(short type)
std::vector< std::string > content_
void setCurrentLayer(int layerIndex)
static const short int WEIGHT_BOLD
void setCurrentPointSize(unsigned int size)
void setCurrentForegroundColor(const RGBColor &color)
static short TEXT_HORIZONTAL_CENTER
const unsigned int & getSize() const
void setCurrentLayer(int layerIndex)
std::map< short int, std::string > fontSeries_
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
short int getSeries() const
Alias function for getWeight.
static short TEXT_VERTICAL_BOTTOM
void begin()
Start the painting.
std::vector< int > layers_
void setCurrentPointSize(unsigned int size)
short int getShape() const
Alias function for getStyle.
std::string toString(T t)
General template method to convert to a string.
PgfGraphicDevice(std::ostream &out, double unit)
Build a new Pgf device object.
const std::string & getFamily() const
void setCurrentBackgroundColor(const RGBColor &color)
void drawLine(double x1, double y1, double x2, double y2)
Draw a line between two points.
void setCurrentLineType(short type)
static short TEXT_VERTICAL_CENTER
void setCurrentFont(const Font &font)
static short TEXT_HORIZONTAL_LEFT