Open Babel  3.0
commandpainter.h
Go to the documentation of this file.
1 /**********************************************************************
2 commandpainter.h - Render as depiction commands
3 
4 Copyright (C) 2012 by Noel O'Boyle
5 
6 This file is part of the Open Babel project.
7 For more information, see <http://openbabel.org/>
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation version 2 of the License.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 ***********************************************************************/
18 #ifndef OB_COMMANDPAINTER_H
19 #define OB_COMMANDPAINTER_H
20 
22 
23 namespace OpenBabel
24 {
25  class CommandPainter : public OBPainter
26  {
27  public:
28  CommandPainter(std::ostream& ofs);
31 
32  void NewCanvas(double width, double height);
33  bool IsGood() const;
34  void SetFontFamily(const std::string &fontFamily) {} // FIXME
35  void SetFontSize(int pointSize);
36  void SetFillColor(const OBColor &color);
37  void SetFillRadial(const OBColor &start, const OBColor &end);
38  void SetPenColor(const OBColor &color);
39  void SetPenWidth(double width);
40  double GetPenWidth();
41  void DrawLine(double x1, double y1, double x2, double y2, const std::vector<double> & dashes=std::vector<double>());
42  void DrawPolygon(const std::vector<std::pair<double,double> > &points);
43  void DrawCircle(double x, double y, double r);
44  void DrawBall(double x, double y, double r, double opacity = 1.0);
45  void DrawText(double x, double y, const std::string &text);
46  OBFontMetrics GetFontMetrics(const std::string &text);
48 
50 
51 
52 
53  private:
54  std::ostream& m_ofs;
55  std::streamsize m_oldprec;
56  double m_pen_width;
57  };
58 
59 }
60 
61 #endif
Abstract painter base class used by OBDepict.
Definition: painter.h:128
Definition: commandpainter.h:25
void SetFillRadial(const OBColor &start, const OBColor &end)
Definition: commandpainter.cpp:60
double GetPenWidth()
Definition: commandpainter.cpp:78
void DrawLine(double x1, double y1, double x2, double y2, const std::vector< double > &dashes=std::vector< double >())
Definition: commandpainter.cpp:83
void DrawBall(double x, double y, double r, double opacity=1.0)
Definition: commandpainter.cpp:115
void DrawPolygon(const std::vector< std::pair< double, double > > &points)
Definition: commandpainter.cpp:98
~CommandPainter()
Definition: commandpainter.cpp:34
Color class used by OBDepict.
Definition: painter.h:37
void SetFontSize(int pointSize)
Definition: commandpainter.cpp:50
Font metrics class used by OBDepict.
Definition: painter.h:116
void SetFillColor(const OBColor &color)
Definition: commandpainter.cpp:55
OBFontMetrics GetFontMetrics(const std::string &text)
Definition: commandpainter.cpp:125
void DrawCircle(double x, double y, double r)
Definition: commandpainter.cpp:110
void DrawText(double x, double y, const std::string &text)
Definition: commandpainter.cpp:120
CommandPainter(std::ostream &ofs)
Definition: commandpainter.cpp:28
Base class for graphical 2D depiction classes (e.g., "paint" to SVG)
void NewCanvas(double width, double height)
Definition: commandpainter.cpp:40
void SetPenColor(const OBColor &color)
Definition: commandpainter.cpp:67
void SetFontFamily(const std::string &fontFamily)
Definition: commandpainter.h:34
bool IsGood() const
Definition: commandpainter.cpp:45
void SetPenWidth(double width)
Definition: commandpainter.cpp:72
Global namespace for all Open Babel code.
Definition: alias.h:22