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