RDKit
Open-source cheminformatics and machine learning.
MolDraw2D.h
Go to the documentation of this file.
1 //
2 // @@ All Rights Reserved @@
3 // This file is part of the RDKit.
4 // The contents are covered by the terms of the BSD license
5 // which is included in the file license.txt, found at the root
6 // of the RDKit source tree.
7 //
8 // Original author: David Cosgrove (AstraZeneca)
9 // 27th May 2014
10 //
11 // This class makes a 2D drawing of an RDKit molecule.
12 // It draws heavily on $RDBASE/GraphMol/MolDrawing/MolDrawing.h.
13 // One purpose of this is to make it easier to overlay annotations on top of
14 // the molecule drawing, which is difficult to do from the output of
15 // MolDrawing.h
16 // The class design philosophy echoes a standard one:
17 // a virtual base class defines the interface and does all
18 // the heavy lifting and concrete derived classes implement
19 // library-specific drawing code such as drawing lines, writing strings
20 // etc.
21 
22 #include <RDGeneral/export.h>
23 #ifndef RDKITMOLDRAW2D_H
24 #define RDKITMOLDRAW2D_H
25 
26 #include <vector>
27 
28 #include <Geometry/point.h>
29 #include <GraphMol/RDKitBase.h>
31 
32 // ****************************************************************************
33 using RDGeom::Point2D;
34 
35 namespace RDKit {
36 
37 struct DrawColour {
38  double r = 0.0, g = 0.0, b = 0.0, a = 1.0;
40  DrawColour(double r, double g, double b, double a = 1.0)
41  : r(r), g(g), b(b), a(a){};
42  bool operator==(const DrawColour &other) const {
43  return r == other.r && g == other.g && b == other.b && a == other.a;
44  }
45  bool feq(const DrawColour &other, double tol = 0.001,
46  bool ignoreAlpha = true) const {
47  return fabs(r - other.r) <= tol && fabs(g - other.g) <= tol &&
48  fabs(b - other.b) <= tol &&
49  (ignoreAlpha || fabs(a - other.a) <= tol);
50  };
51  DrawColour operator+(const DrawColour &other) const {
52  return DrawColour(r + other.r, g + other.g, b + other.b, a + other.a);
53  }
54  DrawColour operator-(const DrawColour &other) const {
55  return DrawColour(r - other.r, g - other.g, b - other.b, a - other.a);
56  }
57  DrawColour operator/(double v) const {
58  PRECONDITION(v != 0.0, "divide by zero");
59  return DrawColour(r / v, g / v, b / v, a / v);
60  }
61  DrawColour operator*(double v) const {
62  return DrawColour(r * v, g * v, b * v, a * v);
63  }
64 };
65 
66 typedef std::map<int, DrawColour> ColourPalette;
67 typedef std::vector<unsigned int> DashPattern;
68 
69 inline void assignDefaultPalette(ColourPalette &palette) {
70  palette.clear();
71  palette[-1] = DrawColour(0, 0, 0);
72  palette[0] = DrawColour(0.5, 0.5, 0.5);
73  palette[1] = palette[6] = DrawColour(0.0, 0.0, 0.0);
74  palette[7] = DrawColour(0.0, 0.0, 1.0);
75  palette[8] = DrawColour(1.0, 0.0, 0.0);
76  palette[9] = DrawColour(0.2, 0.8, 0.8);
77  palette[15] = DrawColour(1.0, 0.5, 0.0);
78  palette[16] = DrawColour(0.8, 0.8, 0.0);
79  palette[17] = DrawColour(0.0, 0.802, 0.0);
80  palette[35] = DrawColour(0.5, 0.3, 0.1);
81  palette[53] = DrawColour(0.63, 0.12, 0.94);
82 };
83 
84 inline void assignBWPalette(ColourPalette &palette) {
85  palette.clear();
86  palette[-1] = DrawColour(0, 0, 0);
87 };
88 
90  bool atomLabelDeuteriumTritium; // toggles replacing 2H with D and 3H with T
91  bool dummiesAreAttachments; // draws "breaks" at dummy atoms
92  bool circleAtoms; // draws circles under highlighted atoms
93  DrawColour highlightColour; // default highlight color
94  bool continuousHighlight; // highlight by drawing an outline *underneath* the
95  // molecule
96  bool fillHighlights; // fill the areas used to highlight atoms and atom
97  // regions
98  int flagCloseContactsDist; // if positive, this will be used as a cutoff (in
99  // pixels) for highlighting close contacts
100  bool includeAtomTags; // toggles inclusion of atom tags in the output. does
101  // not make sense for all renderers.
102  bool clearBackground; // toggles clearing the background before drawing a
103  // molecule
104  DrawColour
105  backgroundColour; // color to be used while clearing the background
106  int legendFontSize; // font size (in pixels) to be used for the legend (if
107  // present)
108  DrawColour legendColour; // color to be used for the legend (if present)
109  double multipleBondOffset; // offset (in Angstroms) for the extra lines in a
110  // multiple bond
111  double padding; // fraction of empty space to leave around the molecule
112  double additionalAtomLabelPadding; // additional padding to leave around atom
113  // labels. Expressed as a fraction of the
114  // font size.
115  std::map<int, std::string> atomLabels; // replacement labels for atoms
116  std::vector<std::vector<int>> atomRegions; // regions
117  DrawColour
118  symbolColour; // color to be used for the symbols and arrows in reactions
119  int bondLineWidth; // if positive, this overrides the default line width
120  // when drawing bonds
121  bool prepareMolsBeforeDrawing; // call prepareMolForDrawing() on each
122  // molecule passed to drawMolecules()
123  std::vector<DrawColour> highlightColourPalette; // defining 10 default colors
124  // for highlighting atoms and bonds
125  // or reactants in a reactions
126  ColourPalette atomColourPalette; // the palette used to assign
127  // colors to atoms based on
128  // atomic number. -1 is the default value
129 
131  : atomLabelDeuteriumTritium(false),
132  dummiesAreAttachments(false),
133  circleAtoms(true),
134  highlightColour(1, .5, .5),
135  continuousHighlight(true),
136  fillHighlights(true),
137  flagCloseContactsDist(3),
138  includeAtomTags(false),
139  clearBackground(true),
140  backgroundColour(1, 1, 1),
141  legendFontSize(12),
142  legendColour(0, 0, 0),
143  multipleBondOffset(0.15),
144  padding(0.05),
145  additionalAtomLabelPadding(0.0),
146  symbolColour(0, 0, 0),
147  bondLineWidth(-1),
148  prepareMolsBeforeDrawing(true) {
149  highlightColourPalette.push_back(
150  DrawColour(1., 1., .67)); // popcorn yellow
151  highlightColourPalette.push_back(DrawColour(1., .8, .6)); // sand
152  highlightColourPalette.push_back(DrawColour(1., .71, .76)); // light pink
153  highlightColourPalette.push_back(DrawColour(.8, 1., .8)); // offwhitegreen
154  highlightColourPalette.push_back(DrawColour(.87, .63, .87)); // plum
155  highlightColourPalette.push_back(DrawColour(.76, .94, .96)); // pastel blue
156  highlightColourPalette.push_back(DrawColour(.67, .67, 1.)); // periwinkle
157  highlightColourPalette.push_back(DrawColour(.64, .76, .34)); // avocado
158  highlightColourPalette.push_back(DrawColour(.56, .93, .56)); // light green
159  highlightColourPalette.push_back(DrawColour(.20, .63, .79)); // peacock
160  assignDefaultPalette(atomColourPalette);
161  };
162 };
163 
164 //! MolDraw2D is the base class for doing 2D renderings of molecules
166  public:
167  typedef enum { C = 0, N, E, S, W } OrientType;
168  typedef enum {
169  TextDrawNormal = 0,
171  TextDrawSubscript
172  } TextDrawType;
173 
174  //! constructor for a particular size
175  /*!
176  \param width : width (in pixels) of the rendering
177  \param height : height (in pixels) of the rendering
178  \param panelWidth : (optional) width (in pixels) of a single panel
179  \param panelHeight : (optional) height (in pixels) of a single panel
180 
181  The \c panelWidth and \c panelHeight arguments are used to provide the
182  sizes of the panels individual molecules are drawn in when
183  \c drawMolecules() is called.
184  */
185  MolDraw2D(int width, int height, int panelWidth, int panelHeight)
186  : needs_scale_(true),
187  width_(width),
188  height_(height),
189  panel_width_(panelWidth > 0 ? panelWidth : width),
190  panel_height_(panelHeight > 0 ? panelHeight : height),
191  scale_(1.0),
192  x_trans_(0.0),
193  y_trans_(0.0),
194  x_offset_(0),
195  y_offset_(0),
196  font_size_(0.5),
197  curr_width_(2),
198  fill_polys_(true),
199  activeMolIdx_(-1) {}
200 
201  virtual ~MolDraw2D() {}
202 
203  //! draw a single molecule
204  /*!
205  \param mol : the molecule to draw
206  \param legend : the legend (to be drawn under the molecule)
207  \param highlight_atoms : (optional) vector of atom ids to highlight
208  \param highlight_atoms : (optional) vector of bond ids to highlight
209  \param highlight_atom_map : (optional) map from atomId -> DrawColour
210  providing the highlight colors. If not provided the default highlight colour
211  from \c drawOptions() will be used.
212  \param highlight_bond_map : (optional) map from bondId -> DrawColour
213  providing the highlight colors. If not provided the default highlight colour
214  from \c drawOptions() will be used.
215  \param highlight_radii : (optional) map from atomId -> radius (in molecule
216  coordinates) for the radii of atomic highlights. If not provided the default
217  value from \c drawOptions() will be used.
218  \param confId : (optional) conformer ID to be used for atomic
219  coordinates
220 
221  */
222  virtual void drawMolecule(
223  const ROMol &mol, const std::string &legend,
224  const std::vector<int> *highlight_atoms,
225  const std::vector<int> *highlight_bonds,
226  const std::map<int, DrawColour> *highlight_atom_map = nullptr,
227  const std::map<int, DrawColour> *highlight_bond_map = nullptr,
228  const std::map<int, double> *highlight_radii = nullptr, int confId = -1);
229 
230  //! \overload
231  virtual void drawMolecule(
232  const ROMol &mol, const std::vector<int> *highlight_atoms = nullptr,
233  const std::map<int, DrawColour> *highlight_map = nullptr,
234  const std::map<int, double> *highlight_radii = nullptr, int confId = -1);
235 
236  //! \overload
237  virtual void drawMolecule(
238  const ROMol &mol, const std::string &legend,
239  const std::vector<int> *highlight_atoms = nullptr,
240  const std::map<int, DrawColour> *highlight_map = nullptr,
241  const std::map<int, double> *highlight_radii = nullptr, int confId = -1);
242 
243  //! \overload
244  virtual void drawMolecule(
245  const ROMol &mol, const std::vector<int> *highlight_atoms,
246  const std::vector<int> *highlight_bonds,
247  const std::map<int, DrawColour> *highlight_atom_map = nullptr,
248  const std::map<int, DrawColour> *highlight_bond_map = nullptr,
249  const std::map<int, double> *highlight_radii = nullptr, int confId = -1);
250 
251  //! draw multiple molecules in a grid
252  /*!
253  \param mols : the molecules to draw
254  \param legends : (optional) the legends (to be drawn under the
255  molecules)
256  \param highlight_atoms : (optional) vectors of atom ids to highlight
257  \param highlight_atoms : (optional) vectors of bond ids to highlight
258  \param highlight_atom_map : (optional) maps from atomId -> DrawColour
259  providing the highlight colors. If not provided the default highlight colour
260  from \c drawOptions() will be used.
261  \param highlight_bond_map : (optional) maps from bondId -> DrawColour
262  providing the highlight colors. If not provided the default highlight colour
263  from \c drawOptions() will be used.
264  \param highlight_radii : (optional) maps from atomId -> radius (in molecule
265  coordinates) for the radii of atomic highlights. If not provided the default
266  value from \c drawOptions() will be used.
267  \param confId : (optional) conformer IDs to be used for atomic
268  coordinates
269 
270  The \c panelWidth and \c panelHeight values will be used to determine the
271  number of rows and columns to be drawn. Theres not a lot of error checking
272  here, so if you provide too many molecules for the number of panes things
273  are likely to get screweed up.
274  If the number of rows or columns ends up being <= 1, molecules will be
275  being drawn in a single row/column.
276  */
277  virtual void drawMolecules(
278  const std::vector<ROMol *> &mols,
279  const std::vector<std::string> *legends = nullptr,
280  const std::vector<std::vector<int>> *highlight_atoms = nullptr,
281  const std::vector<std::vector<int>> *highlight_bonds = nullptr,
282  const std::vector<std::map<int, DrawColour>> *highlight_atom_maps =
283  nullptr,
284  const std::vector<std::map<int, DrawColour>> *highlight_bond_maps =
285  nullptr,
286  const std::vector<std::map<int, double>> *highlight_radii = nullptr,
287  const std::vector<int> *confIds = nullptr);
288 
289  //! draw a ChemicalReaction
290  /*!
291  \param rxn : the reaction to draw
292  \param highlightByReactant : (optional) if this is set, atoms and bonds will
293  be highlighted based on which reactant they come from. Atom map numbers
294  will not be shown.
295  \param highlightColorsReactants : (optional) provide a vector of colors for
296  the
297  reactant highlighting.
298  \param confIds : (optional) vector of confIds to use for rendering. These
299  are numbered by reactants, then agents, then products.
300  */
301  virtual void drawReaction(
302  const ChemicalReaction &rxn, bool highlightByReactant = false,
303  const std::vector<DrawColour> *highlightColorsReactants = nullptr,
304  const std::vector<int> *confIds = nullptr);
305 
306  //! \name Transformations
307  //@{
308  // transform a set of coords in the molecule's coordinate system
309  // to drawing system coordinates and vice versa. Note that the coordinates
310  // have
311  // the origin in the top left corner, which is how Qt and Cairo have it, no
312  // doubt a holdover from X Windows. This means that a higher y value will be
313  // nearer the bottom of the screen. This doesn't really matter except when
314  // doing text superscripts and subscripts.
315 
316  //! transform a point from the molecule coordinate system into the drawing
317  //! coordinate system
318  virtual Point2D getDrawCoords(const Point2D &mol_cds) const;
319  //! returns the drawing coordinates of a particular atom
320  virtual Point2D getDrawCoords(int at_num) const;
321  virtual Point2D getAtomCoords(const std::pair<int, int> &screen_cds) const;
322  //! transform a point from drawing coordinates to the molecule coordinate
323  //! system
324  virtual Point2D getAtomCoords(
325  const std::pair<double, double> &screen_cds) const;
326  //! returns the molecular coordinates of a particular atom
327  virtual Point2D getAtomCoords(int at_num) const;
328  //@}
329 
330  //! return the width of the drawing area.
331  virtual int width() const { return width_; }
332  //! return the height of the drawing area.
333  virtual int height() const { return height_; }
334  //! return the width of the drawing panels.
335  virtual int panelWidth() const { return panel_width_; }
336  //! return the height of the drawing panels.
337  virtual int panelHeight() const { return panel_height_; }
338 
339  //! returns the drawing scale (conversion from molecular coords -> drawing
340  // coords)
341  double scale() const { return scale_; }
342  //! calculates the drawing scale (conversion from molecular coords -> drawing
343  // coords)
344  void calculateScale(int width, int height,
345  const std::vector<int> *highlight_atoms = nullptr,
346  const std::map<int, double> *highlight_radii = nullptr);
347  //! \overload
348  void calculateScale() { calculateScale(panel_width_, panel_height_); };
349  //! explicitly sets the scaling factors for the drawing
350  void setScale(int width, int height, const Point2D &minv,
351  const Point2D &maxv);
352  //! sets the drawing offset (in drawing coords)
353  void setOffset(int x, int y) {
354  x_offset_ = x;
355  y_offset_ = y;
356  }
357  //! returns the drawing offset (in drawing coords)
358  Point2D offset() const { return Point2D(x_offset_, y_offset_); }
359 
360  //! returns the minimum point of the drawing (in molecular coords)
361  Point2D minPt() const { return Point2D(x_min_, y_min_); }
362  //! returns the width and height of the grid (in molecular coords)
363  Point2D range() const { return Point2D(x_range_, y_range_); }
364 
365  //! returns the font size (in nolecule units)
366  virtual double fontSize() const { return font_size_; }
367  //! set font size in molecule coordinate units. That's probably Angstrom for
368  //! RDKit.
369  virtual void setFontSize(double new_size);
370 
371  //! sets the current draw color
372  virtual void setColour(const DrawColour &col) { curr_colour_ = col; }
373  //! returns the current draw color
374  virtual DrawColour colour() const { return curr_colour_; }
375  //! sets the current dash pattern
376  virtual void setDash(const DashPattern &patt) { curr_dash_ = patt; }
377  //! returns the current dash pattern
378  virtual const DashPattern &dash() const { return curr_dash_; }
379 
380  //! sets the current line width
381  virtual void setLineWidth(int width) { curr_width_ = width; }
382  //! returns the current line width
383  virtual int lineWidth() const { return curr_width_; }
384 
385  //! establishes whether to put string draw mode into super- or sub-script
386  //! mode based on contents of instring from i onwards. Increments i
387  //! appropriately
388  //! \returns true or false depending on whether it did something or not
389  bool setStringDrawMode(const std::string &instring, TextDrawType &draw_mode,
390  int &i) const;
391  //! clears the contes of the drawingd]
392  virtual void clearDrawing() = 0;
393  //! draws a line from \c cds1 to \c cds2 using the current drawing style
394  virtual void drawLine(const Point2D &cds1, const Point2D &cds2) = 0;
395 
396  //! using the current scale, work out the size of the label in molecule
397  //! coordinates.
398  /*!
399  Bear in mind when implementing this, that, for example, NH2 will appear as
400  NH<sub>2</sub> to convey that the 2 is a subscript, and this needs to
401  accounted for in the width and height.
402  */
403  virtual void getStringSize(const std::string &label, double &label_width,
404  double &label_height) const = 0;
405  //! drawString centres the string on cds.
406  virtual void drawString(const std::string &str, const Point2D &cds);
407 
408  //! draw a polygon
409  virtual void drawPolygon(const std::vector<Point2D> &cds) = 0;
410  //! draw a triange
411  virtual void drawTriangle(const Point2D &cds1, const Point2D &cds2,
412  const Point2D &cds3);
413  //! draw an ellipse
414  virtual void drawEllipse(const Point2D &cds1, const Point2D &cds2);
415  //! draw a rectangle
416  virtual void drawRect(const Point2D &cds1, const Point2D &cds2);
417  //! draw a line indicating the presence of an attachment point (normally a
418  //! squiggle line perpendicular to a bond)
419  virtual void drawAttachmentLine(const Point2D &cds1, const Point2D &cds2,
420  const DrawColour &col, double len = 1.0,
421  unsigned int nSegments = 16);
422  //! draw a wavy line like that used to indicate unknown stereochemistry
423  virtual void drawWavyLine(const Point2D &cds1, const Point2D &cds2,
424  const DrawColour &col1, const DrawColour &col2,
425  unsigned int nSegments = 16,
426  double vertOffset = 0.05);
427  //! adds additional information about the atoms to the output. Does not make
428  //! sense for all renderers.
429  virtual void tagAtoms(const ROMol &mol) { RDUNUSED_PARAM(mol); };
430  //! set whether or not polygons are being filled
431  virtual bool fillPolys() const { return fill_polys_; }
432  //! returns ehther or not polygons should be filled
433  virtual void setFillPolys(bool val) { fill_polys_ = val; }
434 
435  //! returns our current drawing options
436  MolDrawOptions &drawOptions() { return options_; }
437  //! \overload
438  const MolDrawOptions &drawOptions() const { return options_; }
439 
440  //! returns the coordinates of the atoms of the current molecule in molecular
441  //! coordinates
442  const std::vector<Point2D> &atomCoords() const {
443  PRECONDITION(activeMolIdx_ >= 0, "no index");
444  return at_cds_[activeMolIdx_];
445  };
446  //! returns the atomic symbols of the current molecule
447  const std::vector<std::pair<std::string, OrientType>> &atomSyms() const {
448  PRECONDITION(activeMolIdx_ >= 0, "no index");
449  return atom_syms_[activeMolIdx_];
450  };
451  //! Draw an arrow with either lines or a filled head (when asPolygon is true)
452  virtual void drawArrow(const Point2D &cds1, const Point2D &cds2,
453  bool asPolygon = false, double frac = 0.05,
454  double angle = M_PI / 6);
455 
456  private:
457  bool needs_scale_;
458  int width_, height_, panel_width_, panel_height_;
459  double scale_;
460  double x_min_, y_min_, x_range_, y_range_;
461  double x_trans_, y_trans_;
462  int x_offset_, y_offset_; // translation in screen coordinates
463  // font_size_ in molecule coordinate units. Default 0.5 (a bit bigger
464  // than the default width of a double bond)
465  double font_size_;
466  int curr_width_;
467  bool fill_polys_;
468  int activeMolIdx_;
469 
470  DrawColour curr_colour_;
471  DashPattern curr_dash_;
472  MolDrawOptions options_;
473 
474  std::vector<std::vector<Point2D>> at_cds_; // from mol
475  std::vector<std::vector<int>> atomic_nums_;
476  std::vector<std::vector<std::pair<std::string, OrientType>>> atom_syms_;
477  Point2D bbox_[2];
478 
479  // draw the char, with the bottom left hand corner at cds
480  virtual void drawChar(char c, const Point2D &cds) = 0;
481 
482  // return a DrawColour based on the contents of highlight_atoms or
483  // highlight_map, falling back to atomic number by default
484  DrawColour getColour(
485  int atom_idx, const std::vector<int> *highlight_atoms = nullptr,
486  const std::map<int, DrawColour> *highlight_map = nullptr);
487  DrawColour getColourByAtomicNum(int atomic_num);
488 
489  void extractAtomCoords(const ROMol &mol, int confId, bool updateBBox);
490  void extractAtomSymbols(const ROMol &mol);
491 
492  virtual void drawLine(const Point2D &cds1, const Point2D &cds2,
493  const DrawColour &col1, const DrawColour &col2);
494  void drawWedgedBond(const Point2D &cds1, const Point2D &cds2,
495  bool draw_dashed, const DrawColour &col1,
496  const DrawColour &col2);
497  void drawAtomLabel(int atom_num,
498  const std::vector<int> *highlight_atoms = nullptr,
499  const std::map<int, DrawColour> *highlight_map = nullptr);
500  // cds1 and cds2 are 2 atoms in a ring. Returns the perpendicular pointing
501  // into
502  // the ring.
503  Point2D bondInsideRing(const ROMol &mol, const Bond *bond,
504  const Point2D &cds1, const Point2D &cds2);
505  // cds1 and cds2 are 2 atoms in a chain double bond. Returns the
506  // perpendicular
507  // pointing into the inside of the bond
508  Point2D bondInsideDoubleBond(const ROMol &mol, const Bond *bond);
509  // calculate normalised perpendicular to vector between two coords, such
510  // that
511  // it's inside the angle made between (1 and 2) and (2 and 3).
512  Point2D calcInnerPerpendicular(const Point2D &cds1, const Point2D &cds2,
513  const Point2D &cds3);
514 
515  // take the coords for atnum, with neighbour nbr_cds, and move cds out to
516  // accommodate
517  // the label associated with it.
518  void adjustBondEndForLabel(int atnum, const Point2D &nbr_cds,
519  Point2D &cds) const;
520 
521  // adds LaTeX-like annotation for super- and sub-script.
522  std::pair<std::string, OrientType> getAtomSymbolAndOrientation(
523  const Atom &atom, const Point2D &nbr_sum);
524 
525  protected:
526  virtual void doContinuousHighlighting(
527  const ROMol &mol, const std::vector<int> *highlight_atoms,
528  const std::vector<int> *highlight_bonds,
529  const std::map<int, DrawColour> *highlight_atom_map,
530  const std::map<int, DrawColour> *highlight_bond_map,
531  const std::map<int, double> *highlight_radii);
532 
533  virtual void highlightCloseContacts();
534  virtual void drawBond(
535  const ROMol &mol, const Bond *bond, int at1_idx, int at2_idx,
536  const std::vector<int> *highlight_atoms = nullptr,
537  const std::map<int, DrawColour> *highlight_atom_map = nullptr,
538  const std::vector<int> *highlight_bonds = nullptr,
539  const std::map<int, DrawColour> *highlight_bond_map = nullptr);
540 
541  // calculate normalised perpendicular to vector between two coords
542  Point2D calcPerpendicular(const Point2D &cds1, const Point2D &cds2);
543 };
544 } // namespace RDKit
545 
546 #endif // RDKITMOLDRAW2D_H
RDKIT_MOLDRAW2D_EXPORT
#define RDKIT_MOLDRAW2D_EXPORT
Definition: export.h:398
RDKit::DrawColour::b
double b
Definition: MolDraw2D.h:38
RDKit::MolDrawOptions::padding
double padding
Definition: MolDraw2D.h:111
RDKit::MolDrawOptions::includeAtomTags
bool includeAtomTags
Definition: MolDraw2D.h:100
RDKit::MolDrawOptions::atomColourPalette
ColourPalette atomColourPalette
Definition: MolDraw2D.h:126
RDKit::MolDrawOptions::continuousHighlight
bool continuousHighlight
Definition: MolDraw2D.h:94
RDKit::MolDraw2D::offset
Point2D offset() const
returns the drawing offset (in drawing coords)
Definition: MolDraw2D.h:358
RDKit::DrawColour::operator+
DrawColour operator+(const DrawColour &other) const
Definition: MolDraw2D.h:51
point.h
RDKit::DrawColour::operator/
DrawColour operator/(double v) const
Definition: MolDraw2D.h:57
RDKit::MolDrawOptions::dummiesAreAttachments
bool dummiesAreAttachments
Definition: MolDraw2D.h:91
RDKit::MolDraw2D::drawOptions
const MolDrawOptions & drawOptions() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: MolDraw2D.h:438
RDKit::MolDraw2D::setFillPolys
virtual void setFillPolys(bool val)
returns ehther or not polygons should be filled
Definition: MolDraw2D.h:433
RDKit::MolDrawOptions::fillHighlights
bool fillHighlights
Definition: MolDraw2D.h:96
RDKit::MolDrawOptions::additionalAtomLabelPadding
double additionalAtomLabelPadding
Definition: MolDraw2D.h:112
RDKit::MolDraw2D::~MolDraw2D
virtual ~MolDraw2D()
Definition: MolDraw2D.h:201
RDKit::DashPattern
std::vector< unsigned int > DashPattern
Definition: MolDraw2D.h:67
RDKit::MolDraw2D::setOffset
void setOffset(int x, int y)
sets the drawing offset (in drawing coords)
Definition: MolDraw2D.h:353
RDKit::MolDraw2D::setColour
virtual void setColour(const DrawColour &col)
sets the current draw color
Definition: MolDraw2D.h:372
RDKit::MolDrawOptions::atomRegions
std::vector< std::vector< int > > atomRegions
Definition: MolDraw2D.h:116
RDKit::MolDraw2D::scale
double scale() const
returns the drawing scale (conversion from molecular coords -> drawing
Definition: MolDraw2D.h:341
RDKit::Bond
class for representing a bond
Definition: Bond.h:47
RDKit::MolDraw2D::fillPolys
virtual bool fillPolys() const
set whether or not polygons are being filled
Definition: MolDraw2D.h:431
RDKit::MolDrawOptions::MolDrawOptions
MolDrawOptions()
Definition: MolDraw2D.h:130
RDKit::MolDrawOptions::highlightColour
DrawColour highlightColour
Definition: MolDraw2D.h:93
RDKit::MolDraw2D::setDash
virtual void setDash(const DashPattern &patt)
sets the current dash pattern
Definition: MolDraw2D.h:376
RDKit::MolDraw2D::TextDrawSuperscript
@ TextDrawSuperscript
Definition: MolDraw2D.h:170
RDUNUSED_PARAM
#define RDUNUSED_PARAM(x)
Definition: Invariant.h:196
RDKit::MolDrawOptions::multipleBondOffset
double multipleBondOffset
Definition: MolDraw2D.h:109
RDKit::MolDraw2D::tagAtoms
virtual void tagAtoms(const ROMol &mol)
Definition: MolDraw2D.h:429
RDKit::MolDraw2D::lineWidth
virtual int lineWidth() const
returns the current line width
Definition: MolDraw2D.h:383
RDKit::MolDrawOptions::clearBackground
bool clearBackground
Definition: MolDraw2D.h:102
RDKit::Atom
The class for representing atoms.
Definition: Atom.h:69
RDKit::MolDraw2D::minPt
Point2D minPt() const
returns the minimum point of the drawing (in molecular coords)
Definition: MolDraw2D.h:361
RDKit::MolDraw2D::atomCoords
const std::vector< Point2D > & atomCoords() const
Definition: MolDraw2D.h:442
RDKit::MolDrawOptions::prepareMolsBeforeDrawing
bool prepareMolsBeforeDrawing
Definition: MolDraw2D.h:121
RDKit::assignBWPalette
void assignBWPalette(ColourPalette &palette)
Definition: MolDraw2D.h:84
RDKit::MolDrawOptions::legendColour
DrawColour legendColour
Definition: MolDraw2D.h:108
RDKit::DrawColour
Definition: MolDraw2D.h:37
M_PI
#define M_PI
Definition: MMFF/Params.h:27
RDKit::ROMol
Definition: ROMol.h:171
RDKitBase.h
pulls in the core RDKit functionality
RDKit::MolDraw2D::height
virtual int height() const
return the height of the drawing area.
Definition: MolDraw2D.h:333
RDKit::ColourPalette
std::map< int, DrawColour > ColourPalette
Definition: MolDraw2D.h:66
RDKit::MolDrawOptions::backgroundColour
DrawColour backgroundColour
Definition: MolDraw2D.h:105
Reaction.h
RDKit::ChemicalReaction
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:119
RDKit::MolDraw2D::width
virtual int width() const
return the width of the drawing area.
Definition: MolDraw2D.h:331
RDKit::DrawColour::r
double r
Definition: MolDraw2D.h:38
RDKit::MolDraw2D::panelWidth
virtual int panelWidth() const
return the width of the drawing panels.
Definition: MolDraw2D.h:335
RDKit::MolDrawOptions::symbolColour
DrawColour symbolColour
Definition: MolDraw2D.h:118
RDKit::MolDraw2D::dash
virtual const DashPattern & dash() const
returns the current dash pattern
Definition: MolDraw2D.h:378
RDKit::MolDraw2D::setLineWidth
virtual void setLineWidth(int width)
sets the current line width
Definition: MolDraw2D.h:381
RDKit::DrawColour::operator*
DrawColour operator*(double v) const
Definition: MolDraw2D.h:61
RDKit::MolDraw2D::fontSize
virtual double fontSize() const
returns the font size (in nolecule units)
Definition: MolDraw2D.h:366
RDKit::MolDrawOptions::highlightColourPalette
std::vector< DrawColour > highlightColourPalette
Definition: MolDraw2D.h:123
RDKit
Std stuff.
Definition: Atom.h:30
RDKit::MolDraw2D
MolDraw2D is the base class for doing 2D renderings of molecules.
Definition: MolDraw2D.h:165
RDKit::DrawColour::DrawColour
DrawColour(double r, double g, double b, double a=1.0)
Definition: MolDraw2D.h:40
RDKit::MolDraw2D::calculateScale
void calculateScale()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: MolDraw2D.h:348
RDKit::MolDrawOptions::flagCloseContactsDist
int flagCloseContactsDist
Definition: MolDraw2D.h:98
RDKit::MolDrawOptions
Definition: MolDraw2D.h:89
RDKit::DrawColour::g
double g
Definition: MolDraw2D.h:38
RDGeom::Point2D
Definition: point.h:258
RDKit::MolDraw2D::drawOptions
MolDrawOptions & drawOptions()
returns our current drawing options
Definition: MolDraw2D.h:436
RDKit::assignDefaultPalette
void assignDefaultPalette(ColourPalette &palette)
Definition: MolDraw2D.h:69
RDKit::DrawColour::operator==
bool operator==(const DrawColour &other) const
Definition: MolDraw2D.h:42
PRECONDITION
#define PRECONDITION(expr, mess)
Definition: Invariant.h:109
RDKit::DrawColour::DrawColour
DrawColour()
Definition: MolDraw2D.h:39
RDKit::MolDrawOptions::legendFontSize
int legendFontSize
Definition: MolDraw2D.h:106
RDKit::MolDrawOptions::atomLabelDeuteriumTritium
bool atomLabelDeuteriumTritium
Definition: MolDraw2D.h:90
RDKit::MolDrawOptions::atomLabels
std::map< int, std::string > atomLabels
Definition: MolDraw2D.h:115
RDKit::DrawColour::feq
bool feq(const DrawColour &other, double tol=0.001, bool ignoreAlpha=true) const
Definition: MolDraw2D.h:45
RDKit::MolDraw2D::MolDraw2D
MolDraw2D(int width, int height, int panelWidth, int panelHeight)
constructor for a particular size
Definition: MolDraw2D.h:185
RDKit::MolDrawOptions::circleAtoms
bool circleAtoms
Definition: MolDraw2D.h:92
RDKit::MolDraw2D::atomSyms
const std::vector< std::pair< std::string, OrientType > > & atomSyms() const
returns the atomic symbols of the current molecule
Definition: MolDraw2D.h:447
RDKit::DrawColour::operator-
DrawColour operator-(const DrawColour &other) const
Definition: MolDraw2D.h:54
RDKit::DrawColour::a
double a
Definition: MolDraw2D.h:38
RDKit::MolDraw2D::range
Point2D range() const
returns the width and height of the grid (in molecular coords)
Definition: MolDraw2D.h:363
RDKit::MolDraw2D::panelHeight
virtual int panelHeight() const
return the height of the drawing panels.
Definition: MolDraw2D.h:337
RDKit::MolDrawOptions::bondLineWidth
int bondLineWidth
Definition: MolDraw2D.h:119
RDKit::MolDraw2D::colour
virtual DrawColour colour() const
returns the current draw color
Definition: MolDraw2D.h:374
export.h