Open Babel  3.0
depict.h
Go to the documentation of this file.
1 /**********************************************************************
2 depict.h - 2D Depiction of molecules using OBPainter.
3 
4 Copyright (C) 2009-2010 by Tim Vandermeersch
5 Some portions Copyright (C) 2009 by Chris Morley
6 
7 This file is part of the Open Babel project.
8 For more information, see <http://openbabel.org/>
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation version 2 of the License.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 ***********************************************************************/
19 #ifndef OB_DEPICT_H
20 #define OB_DEPICT_H
21 
22 #include <openbabel/babelconfig.h>
23 #include <openbabel/math/vector3.h>
24 
25 namespace OpenBabel
26 {
27 
28  class OBMol;
29  class OBPainter;
30  class OBDepictPrivate;
31 
32  #ifndef OBDEPICT
33  #define OBDEPICT
34  #endif
35 
41  class OBDEPICT OBDepict
42  {
43  public:
45  AtomId = 1,
49  AtomTetrahedralStereo
50  };
51 
52  enum OptionType{
53  bwAtoms = 0x0001,
54  internalColor = 0x0002,
55  noMargin = 0x0004,
56  drawTermC = 0x0010,
57  drawAllC = 0x0020,
58  noWedgeHashGen = 0x0100,
59  asymmetricDoubleBond = 0x0200,
60  allExplicit = 0x0400
61  };
62 
66  OBDepict(OBPainter *painter);
67  OBDepict(OBPainter *painter, bool withBall, bool symbolOnBall=false);
71  ~OBDepict();
77  bool DrawMolecule(OBMol *mol);
83  bool AddAtomLabels(AtomLabelType type);
84 
85  void SetBondLength(double length);
86  double GetBondLength() const;
87 
88  void SetPenWidth(double length);
89  double GetPenWidth() const;
90 
91  void SetBondSpacing(double spacing);
92  double GetBondSpacing() const;
93 
94  void SetBondWidth(double width);
95  double GetBondWidth() const;
96 
97  //void SetDrawingTerminalCarbon(bool enabled);
98  //bool GetDrawingTerminalCarbon() const;
99 
100  void SetOption(unsigned opts); //extendable with binary compatibility
101  unsigned GetOptions() const;
102  void ClearOptions();
103 
104  void SetFontFamily(const std::string &family);
105  const std::string& GetFontFamily() const;
106 
107  void SetFontSize(int pointSize, bool subscript = false);
108  int GetFontSize(bool subscript = false) const;
109 
110  void SetAliasMode(bool b=true);
111 
112  void SetBondColor(const std::string& scolor);
113 
114  private:
115  OBDepictPrivate * d;
116  };
117 
118 }
119 
120 #endif
121 
Definition: depict.h:46
Abstract painter base class used by OBDepict.
Definition: painter.h:128
Handle 3D coordinates.
2D depiction of molecules using OBPainter.
Definition: depict.h:41
Molecule Class.
Definition: mol.h:118
Definition: depict.h:48
OptionType
Definition: depict.h:52
AtomLabelType
Definition: depict.h:44
Global namespace for all Open Babel code.
Definition: alias.h:22