RDKit: MolDraw2D.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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