RDKit: DrawMol.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
DrawMol.h
Go to the documentation of this file.
1//
2// Copyright (C) 2021-2022 David Cosgrove and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10// Original author: David Cosgrove (CozChemIx Limited)
11//
12// This class is a helper class used by MolDraw2D to draw an ROMol.
13// It is not part of the public API and is not intended to be used except
14// by MolDraw2D.
15
16#ifndef RDKIT_DRAWMOL_H
17#define RDKIT_DRAWMOL_H
18
19#include <map>
20#include <string>
21#include <vector>
22
23#include <Geometry/point.h>
24#include <GraphMol/MolDraw2D/AtomSymbol.h>
25#include <GraphMol/MolDraw2D/DrawAnnotation.h>
26#include <GraphMol/MolDraw2D/DrawShape.h>
27#include <GraphMol/MolDraw2D/MolDraw2DHelpers.h>
28
29namespace RDKit {
30
31class Atom;
32class Bond;
33class ROMol;
34class RWMol;
35class DrawText;
36
37namespace MolDraw2D_detail {
38
39 class DrawMol {
40 public:
41 virtual ~DrawMol() = default;
42
43 // Make the object, scaled to a given pixel size.
44 /*!
45 \param mol : the molecule to draw
46 \param legend : the legend (to be drawn under the molecule)
47 \param width : width (in pixels) of the rendering
48 set this to -1 to have the canvas size set automatically
49 \param height : height (in pixels) of the rendering
50 set this to -1 to have the canvas size set automatically
51 \param drawOptions : a MolDrawOptions object from the owning MolDraw2D
52 \param textDrawer : a DrawText object from the owning MolDraw2D
53 \param highlightAtoms : (optional) vector of atom ids to highlight
54 \param highlightBonds : (optional) vector of bond ids to highlight
55 \param highlightAtomMap : (optional) map from atomId -> DrawColour
56 providing the highlight colors. If not provided the default highlight colour
57 from \c drawOptions() will be used.
58 \param highlightBondMap : (optional) map from bondId -> DrawColour
59 providing the highlight colors. If not provided the default highlight colour
60 from \c drawOptions() will be used.
61 \param highlightRadii : (optional) map from atomId -> radius (in molecule
62 coordinates) for the radii of atomic highlights. If not provided the default
63 value from \c drawOptions() will be used.
64 \param confId : (optional) conformer ID to be used for atomic
65 coordinates
66 */
67 DrawMol(const ROMol &mol, const std::string &legend, int width, int height,
68 const MolDrawOptions &drawOptions, DrawText &textDrawer,
69 const std::vector<int> *highlightAtoms = nullptr,
70 const std::vector<int> *highlightBonds = nullptr,
71 const std::map<int, DrawColour> *highlightAtomMap = nullptr,
72 const std::map<int, DrawColour> *highlightBondMap = nullptr,
73 const std::vector<std::pair<DrawColour, DrawColour>> *bondColours =
74 nullptr,
75 const std::map<int, double> *highlight_radii = nullptr,
76 bool includeAnnotations = true, int confId = -1,
77 bool isReactionMol = false);
78 /*!
79 Make a DrawMol when there's no molecule to draw, but we still want
80 a DrawMol in the MolDraw2D for scale, conversion of atom coords to
81 draw coords etc. And so DrawMol starts sounding like a poor name for
82 the class.
83 \param width : width (in pixels) of the rendering
84 \param height : height (in pixels) of the rendering
85 \param drawOptions : a MolDrawOptions object from the owning MolDraw2D
86 \param textDrawer : a DrawText object from the owning MolDraw2D
87 \param xmin : minimum value expected in X
88 \param xmax : miaximum value expected in X
89 \param ymin : minimum value expected in Y
90 \param ymax : maximum value expected in Y
91 \param scale : scale to use
92 \param fontscale : font scale to use
93 */
94 DrawMol(int width, int height, const MolDrawOptions &drawOptions,
95 DrawText &textDrawer, double xmin, double xmax, double ymin,
96 double ymax, double scale, double fontscale);
97 DrawMol(const DrawMol &) = delete;
98 DrawMol(DrawMol &&) = delete;
99 DrawMol &operator=(const DrawMol &) = delete;
100 DrawMol &operator=(DrawMol &&) = delete;
101
102 // this must be called before a drawing can be done.
103 void createDrawObjects();
104 // common bits used by createDrawObjects and setScale.
105 void finishCreateDrawObjects();
106 void initDrawMolecule(const ROMol &mol);
107 void extractAll(double scale);
108 void extractAtomCoords();
109 void extractAtomSymbols();
110 void extractBonds();
111 virtual void extractHighlights(double scale);
112 void extractRegions();
113 void extractAttachments();
114 void extractMolNotes();
115 void extractCIPCodes(bool showAllCIPCodes);
116 void extractStereoGroups();
117 void extractAtomNotes();
118 void extractBondNotes();
119 void extractRadicals();
120 void extractSGroupData();
121 void extractVariableBonds();
122 void extractBrackets();
123 void extractLinkNodes();
124 // extractCloseContacts is to show where 2 atoms are drawn too close
125 // together and so needs the final drawing coords. It is therefore called
126 // at the end of changeToDrawCoords() and any necessary DrawShapePolyLines
127 // added to postShapes_ in drawCoords.
128 void extractCloseContacts();
129 void resolveAtomSymbolClashes();
130 void calculateScale();
131 void findExtremes();
132 void changeToDrawCoords();
133 void draw(MolDraw2D &drawer) const;
134 void drawRadicals(MolDraw2D &drawer) const;
135 void resetEverything();
136 // reduce width_ and height_ to just accomodate the Xrange_ and YRange_
137 // at the current scale. Recentres everything. So the DrawMol takes up
138 // no more screen real estate than it needs.
139 void shrinkToFit(bool withPadding = true);
140
141 // adds LaTeX-like annotation for super- and sub-script.
142 std::pair<std::string, OrientType> getAtomSymbolAndOrientation(
143 const Atom &atom) const;
144 std::string getAtomSymbol(const Atom &atom, OrientType orientation) const;
145 OrientType getAtomOrientation(const Atom &atom) const;
146
147 // if there's a legend, partition the height_ to accommodate it
148 void partitionForLegend();
149 // extractLegend is different from all the other extract... functions
150 // in that it needs to be called once the final scale has been found
151 // by calculateScale.
152 void extractLegend();
153
154 void calcMeanBondLength();
155 void makeStandardBond(Bond *bond, double doubleBondOffset);
156 void makeQueryBond(Bond *bond, double doubleBondOffset);
157 void makeDoubleBondLines(Bond *bond, double doubleBondOffset,
158 const std::pair<DrawColour, DrawColour> &cols);
159 void makeTripleBondLines(Bond *bond, double doubleBondOffset,
160 const std::pair<DrawColour, DrawColour> &cols);
161 void makeWedgedBond(Bond *bond,
162 const std::pair<DrawColour, DrawColour> &cols);
163 void makeWavyBond(Bond *bond, double offset,
164 const std::pair<DrawColour, DrawColour> &cols);
165 void makeDativeBond(Bond *bond, double offset,
166 const std::pair<DrawColour, DrawColour> &cols);
167 void makeZeroBond(Bond *bond, const std::pair<DrawColour, DrawColour> &cols,
168 const DashPattern &dashPattern);
169 void adjustBondEndsForLabels(int begAtIdx, int endAtIdx, Point2D &begCds,
170 Point2D &endCds) const;
171 void newBondLine(const Point2D &pt1, const Point2D &pt2,
172 const DrawColour &col1, const DrawColour &col2, int atom1Idx,
173 int atom2Idx, int bondIdx, const DashPattern &dashPattern);
174 std::pair<DrawColour, DrawColour> getBondColours(Bond *bond);
175 void makeContinuousHighlights(double scale);
176 void makeAtomCircleHighlights();
177 void makeAtomEllipseHighlights(double lineWidth);
178 // These are the lines for continuous highlights, that are
179 // now filled trapezoids rather than fat simple lines.
180 void makeBondHighlightLines(double lineWidth, double scale);
181 void calcAnnotationPosition(const Atom *atom, DrawAnnotation &annot) const;
182 void calcAnnotationPosition(const Bond *bond, DrawAnnotation &annot) const;
183 double getNoteStartAngle(const Atom *atom) const;
184 // see if the note will clash with anything else drawn on the molecule.
185 // Returns 0 if no clash, 1-4 if there is a clash, denoting what clashed.
186 int doesNoteClash(const DrawAnnotation &annot) const;
187 int doesRectClash(const StringRect &rect, double padding) const;
188 OrientType calcRadicalRect(const Atom *atom, StringRect &rad_rect) const;
189 void getDrawTransformers(Point2D &trans, Point2D &scale,
190 Point2D &toCentre) const;
191 // Given some coords in molecule space (angstrom, probably) return the
192 // screen coords.
193 Point2D getDrawCoords(const Point2D &atCds, const Point2D &trans,
194 const Point2D &scaleFactor,
195 const Point2D &toCentre) const;
196 Point2D getDrawCoords(const Point2D &atCds) const;
197 Point2D getDrawCoords(int atnum) const;
198 // and the other way.
199 Point2D getAtomCoords(const Point2D &screenCds) const;
200 Point2D getAtomCoords(int atnum) const;
201 double getScale() const { return scale_; }
202 double getFontScale() const { return fontScale_; }
203 // More often than not, newScale and newFontScale will be the same,
204 // but not if minFontScale or maxFontScale have become involved.
205 // The newFontScale will be used without checking the min and max.
206 void setScale(double newScale, double newFontScale,
207 bool ignoreFontLimits = true);
208 // Set all the transformation details from the incoming DrawMol to this
209 // one, so they can be overlaid properly. Doesn't change the offsets.
210 void setTransformation(const DrawMol &sourceMol);
211
212 // For drawing into a grid, for example. Must be set before
213 // changeToDrawCoords is called for it to have effect.
214 void setOffsets(double xOffset, double yOffset);
215 // So we can add metadata later. Most likely used after changeToDrawCoords
216 // has been called.
217 void tagAtomsWithCoords();
218 // Apply the transformations to everything. trans and toCentre are added,
219 // scale is multiplied.
220 void transformAll(const Point2D *trans = nullptr, Point2D *scale = nullptr,
221 const Point2D *toCentre = nullptr);
222 // Apply the transformations to the given point and return a new one.
223 Point2D transformPoint(const Point2D &pt, const Point2D *trans = nullptr,
224 Point2D *scale = nullptr,
225 const Point2D *toCentre = nullptr) const;
226 void calcDoubleBondLines(double offset, const Bond &bond, Point2D &l1s,
227 Point2D &l1f, Point2D &l2s, Point2D &l2f) const;
228 void bondInsideRing(const Bond &bond, double offset, Point2D &l2s,
229 Point2D &l2f) const;
230 void bondNonRing(const Bond &bond, double offset, Point2D &l2s,
231 Point2D &l2f) const;
232 // deal with terminal double bond between at1 and at2, either to atoms of
233 // degree 2 or 3.
234 void doubleBondTerminal(Atom *at1, Atom *at2, double offset, Point2D &l1s,
235 Point2D &l1f, Point2D &l2s, Point2D &l2f) const;
236 // assuming at[1-3] are atoms where at1 is bonded to at2 and at2 is bonded
237 // to at3, find the position of the at2 end of a double bond between at2
238 // and at3. If trunc, it'll be along the vector that bisects the two bonds
239 // on the inside, otherwise it's perpendicular to the bond from at1 to at2.
240 Point2D doubleBondEnd(unsigned int at1, unsigned int at2, unsigned int at3,
241 double offset, bool trunc) const;
242 void calcTripleBondLines(double offset, const Bond &bond, Point2D &l1s,
243 Point2D &l1f, Point2D &l2s, Point2D &l2f);
244 // find the vectors of any atoms singly bonded to atom that aren't
245 // otherAtom.
246 void findOtherBondVecs(const Atom *atom, const Atom *otherAtom,
247 std::vector<Point2D> &otherBondVecs) const;
248 void adjustBondsOnSolidWedgeEnds();
249 void smoothBondJoins();
250 // If doing a continuous highlight, add to points the 2 or 3 points that
251 // will be for the end1 end of the highlight. The final highlight will
252 // be a 4-6 sided polygon formed by calling this twice, with the ends in
253 // opposite order the second time.
254 void makeHighlightEnd(const Atom *end1, const Atom *end2, double lineWidth,
255 const std::vector<Atom *> &end1HighNbrs,
256 std::vector<Point2D> &points);
257 DrawColour getColour(int atom_idx) const;
258
259 const MolDrawOptions &drawOptions_;
260 DrawText &textDrawer_;
261 // For drawing reactions, padding needs to be 0 irrespective
262 // of what drawOptions_ does elsewhere, so it is copied from drawOptions_
263 // on construction, and is then immune to changes in the outer program.
264 double marginPadding_;
265 std::vector<int> highlightAtoms_;
266 std::vector<int> highlightBonds_;
267 std::map<int, DrawColour> highlightAtomMap_;
268 std::map<int, DrawColour> highlightBondMap_;
269 std::vector<std::pair<DrawColour, DrawColour>> bondColours_;
270 std::map<int, double> highlightRadii_;
271 bool includeAnnotations_;
272 bool isReactionMol_;
273 std::string legend_;
274
275 std::unique_ptr<RWMol> drawMol_;
276 int confId_;
277 // atCds_ are as extracted from the molecule, except that the y is
278 // inverted and drawOptions_.rotate is applied.
279 std::vector<Point2D> atCds_;
280 std::vector<std::unique_ptr<DrawShape>> bonds_;
281 std::vector<std::unique_ptr<DrawShape>> preShapes_;
282 std::vector<std::unique_ptr<DrawShape>> postShapes_;
283 std::vector<int> atomicNums_;
284 std::vector<std::pair<std::string, OrientType>> atomSyms_;
285 std::vector<std::unique_ptr<AtomSymbol>> atomLabels_;
286 std::vector<std::unique_ptr<DrawShape>> highlights_;
287 std::vector<std::unique_ptr<DrawAnnotation>> annotations_;
288 std::vector<std::unique_ptr<DrawAnnotation>> legends_;
289 std::vector<std::tuple<StringRect, OrientType, int>> radicals_;
290 std::vector<int> singleBondLines_;
291
292 // The total width and height of the canvas. Either or both may be
293 // -1 initially, in which case they will be calculated so the molecule
294 // can be drawn within it at a fixed scale (the so-called flexiCanvas).
295 int width_, height_;
296 // The width and height of the drawing area within the canvas. This is
297 // width_ and height_ less the drawOptions._padding round the outside.
298 // Will always be <= width_, height_.
299 int drawWidth_, drawHeight_;
300 // to allow for min and max font sizes, the font scale needs to be
301 // independent of the main scale.
302 double scale_, fontScale_;
303 double xMin_, yMin_, xMax_, yMax_, xRange_, yRange_;
304 // offsets are for drawing molecules in grids, for example.
305 double xOffset_ = 0.0, yOffset_ = 0.0;
306 double meanBondLength_ = 0.0;
307 // if there's a legend, we reserve a bit for it. molHeight_ is the
308 // bit for drawing the molecule, legendHeight_ the bit under that
309 // for the legend. In pixels.
310 int molHeight_, legendHeight_ = 0;
311 bool drawingInitialised_ = false;
312 // when drawing the atoms and bonds in an SVG, they are given a class
313 // via MolDraw2D's activeAtmIdx[12]_ and activeBndIdx. We don't always want
314 // them to start from 0 for atom/bond 0.
315 int activeAtmIdxOffset_ = 0, activeBndIdxOffset_ = 0;
316 bool flexiCanvasX_ = false;
317 bool flexiCanvasY_ = false;
318};
319
320 void centerMolForDrawing(RWMol &mol, int confId = 1);
321 bool isLinearAtom(const Atom &atom, const std::vector<Point2D> &atCds);
322std::string getAtomListText(const Atom &atom);
323 DrawColour getColourByAtomicNum(int atomicNum,
324 const MolDrawOptions &drawOptions);
325 DrawColour getHighlightBondColour(
326 const Bond *bond, const MolDrawOptions &drawOptions,
327 const std::vector<int> &highlightBonds,
328 const std::map<int, DrawColour> &highlightBondMap,
329 const std::vector<int> &highlightAtoms,
330 const std::map<int, DrawColour> &highlightAtomMap);
331 double getHighlightBondWidth(
332 const MolDrawOptions &drawOptions, int bond_idx,
333 const std::map<int, int> *highlight_linewidth_multipliers);
334
335 Point2D calcPerpendicular(const Point2D &cds1, const Point2D &cds2);
336 Point2D calcInnerPerpendicular(const Point2D &cds1, const Point2D &cds2,
337 const Point2D &cds3);
338// return a point that is moveEnd moved so as not to clash with any of the
339// rects of a label. moveEnd to end2 are the coords of 2 ends of a bond.
340 void adjustBondEndForString(
341 const Point2D &end2, double padding,
342 const std::vector<std::shared_ptr<StringRect>> &rects, Point2D &moveEnd);
343 void findRadicalExtremes(
344 const std::vector<std::tuple<StringRect, OrientType, int>> &radicals,
345 double &xmin, double &xmax, double &ymin, double &ymax);
346 void findRectExtremes(const StringRect &rect, const TextAlignType &align,
347 double &xmin, double &xmax, double &ymin, double &ymax);
348 void getBondHighlightsForAtoms(const ROMol &mol,
349 const std::vector<int> &highlight_atoms,
350 std::vector<int> &highlight_bonds);
351// returns true if the vector at2->at1 points in roughly the opposite
352// direction to at3->at4. Basically, if the dot product is negative.
353 bool areBondsTrans(const Point2D &at1, const Point2D &at2, const Point2D &at3,
354 const Point2D &at4);
355// returns true if the vector at2->at1 points is roughly linear with
356// direction of at3->at4. Basically, if the dot product is 1.0 within the
357// given tolerance.
358 bool areBondsParallel(const Point2D &at1, const Point2D &at2,
359 const Point2D &at3, const Point2D &at4,
360 double tol = 1.0e-4);
361
362// find the nborNum'th neighbour of firstAtom that isn't secondAtom
363 const Atom *otherNeighbor(const Atom *firstAtom, const Atom *secondAtom,
364 int nborNum, const ROMol &mol);
365} // namespace MolDraw2D_detail
366} // namespace RDKit
367
368#endif // RDKIT_DRAWMOL_H
AtomSymbol.h
DrawAnnotation.h
DrawShape.h
MolDraw2DHelpers.h
RDGeom::Point2D
Definition point.h:284
RDKit::Atom
The class for representing atoms.
Definition Atom.h:74
RDKit::Bond
class for representing a bond
Definition Bond.h:46
RDKit::MolDraw2D_detail::DrawAnnotation
Definition DrawAnnotation.h:29
RDKit::MolDraw2D_detail::DrawMol::fontScale_
double fontScale_
Definition DrawMol.h:302
RDKit::MolDraw2D_detail::DrawMol::getAtomSymbolAndOrientation
std::pair< std::string, OrientType > getAtomSymbolAndOrientation(const Atom &atom) const
RDKit::MolDraw2D_detail::DrawMol::newBondLine
void newBondLine(const Point2D &pt1, const Point2D &pt2, const DrawColour &col1, const DrawColour &col2, int atom1Idx, int atom2Idx, int bondIdx, const DashPattern &dashPattern)
RDKit::MolDraw2D_detail::DrawMol::height_
int height_
Definition DrawMol.h:295
RDKit::MolDraw2D_detail::DrawMol::extractCIPCodes
void extractCIPCodes(bool showAllCIPCodes)
RDKit::MolDraw2D_detail::DrawMol::makeDativeBond
void makeDativeBond(Bond *bond, double offset, const std::pair< DrawColour, DrawColour > &cols)
RDKit::MolDraw2D_detail::DrawMol::extractAttachments
void extractAttachments()
RDKit::MolDraw2D_detail::DrawMol::extractVariableBonds
void extractVariableBonds()
RDKit::MolDraw2D_detail::DrawMol::calcDoubleBondLines
void calcDoubleBondLines(double offset, const Bond &bond, Point2D &l1s, Point2D &l1f, Point2D &l2s, Point2D &l2f) const
RDKit::MolDraw2D_detail::DrawMol::meanBondLength_
double meanBondLength_
Definition DrawMol.h:306
RDKit::MolDraw2D_detail::DrawMol::bondInsideRing
void bondInsideRing(const Bond &bond, double offset, Point2D &l2s, Point2D &l2f) const
RDKit::MolDraw2D_detail::DrawMol::getDrawCoords
Point2D getDrawCoords(const Point2D &atCds) const
RDKit::MolDraw2D_detail::DrawMol::getBondColours
std::pair< DrawColour, DrawColour > getBondColours(Bond *bond)
RDKit::MolDraw2D_detail::DrawMol::resolveAtomSymbolClashes
void resolveAtomSymbolClashes()
RDKit::MolDraw2D_detail::DrawMol::tagAtomsWithCoords
void tagAtomsWithCoords()
RDKit::MolDraw2D_detail::DrawMol::operator=
DrawMol & operator=(DrawMol &&)=delete
RDKit::MolDraw2D_detail::DrawMol::doubleBondTerminal
void doubleBondTerminal(Atom *at1, Atom *at2, double offset, Point2D &l1s, Point2D &l1f, Point2D &l2s, Point2D &l2f) const
RDKit::MolDraw2D_detail::DrawMol::drawHeight_
int drawHeight_
Definition DrawMol.h:299
RDKit::MolDraw2D_detail::DrawMol::drawMol_
std::unique_ptr< RWMol > drawMol_
Definition DrawMol.h:275
RDKit::MolDraw2D_detail::DrawMol::highlightAtomMap_
std::map< int, DrawColour > highlightAtomMap_
Definition DrawMol.h:267
RDKit::MolDraw2D_detail::DrawMol::extractRegions
void extractRegions()
RDKit::MolDraw2D_detail::DrawMol::extractLinkNodes
void extractLinkNodes()
RDKit::MolDraw2D_detail::DrawMol::isReactionMol_
bool isReactionMol_
Definition DrawMol.h:272
RDKit::MolDraw2D_detail::DrawMol::singleBondLines_
std::vector< int > singleBondLines_
Definition DrawMol.h:290
RDKit::MolDraw2D_detail::DrawMol::calcMeanBondLength
void calcMeanBondLength()
RDKit::MolDraw2D_detail::DrawMol::calculateScale
void calculateScale()
RDKit::MolDraw2D_detail::DrawMol::setTransformation
void setTransformation(const DrawMol &sourceMol)
RDKit::MolDraw2D_detail::DrawMol::atomLabels_
std::vector< std::unique_ptr< AtomSymbol > > atomLabels_
Definition DrawMol.h:285
RDKit::MolDraw2D_detail::DrawMol::getAtomSymbol
std::string getAtomSymbol(const Atom &atom, OrientType orientation) const
RDKit::MolDraw2D_detail::DrawMol::highlightRadii_
std::map< int, double > highlightRadii_
Definition DrawMol.h:270
RDKit::MolDraw2D_detail::DrawMol::scale_
double scale_
Definition DrawMol.h:302
RDKit::MolDraw2D_detail::DrawMol::extractCloseContacts
void extractCloseContacts()
RDKit::MolDraw2D_detail::DrawMol::shrinkToFit
void shrinkToFit(bool withPadding=true)
RDKit::MolDraw2D_detail::DrawMol::yRange_
double yRange_
Definition DrawMol.h:303
RDKit::MolDraw2D_detail::DrawMol::extractBondNotes
void extractBondNotes()
RDKit::MolDraw2D_detail::DrawMol::highlightBondMap_
std::map< int, DrawColour > highlightBondMap_
Definition DrawMol.h:268
RDKit::MolDraw2D_detail::DrawMol::extractStereoGroups
void extractStereoGroups()
RDKit::MolDraw2D_detail::DrawMol::yMax_
double yMax_
Definition DrawMol.h:303
RDKit::MolDraw2D_detail::DrawMol::atomSyms_
std::vector< std::pair< std::string, OrientType > > atomSyms_
Definition DrawMol.h:284
RDKit::MolDraw2D_detail::DrawMol::~DrawMol
virtual ~DrawMol()=default
RDKit::MolDraw2D_detail::DrawMol::drawRadicals
void drawRadicals(MolDraw2D &drawer) const
RDKit::MolDraw2D_detail::DrawMol::setScale
void setScale(double newScale, double newFontScale, bool ignoreFontLimits=true)
RDKit::MolDraw2D_detail::DrawMol::bondNonRing
void bondNonRing(const Bond &bond, double offset, Point2D &l2s, Point2D &l2f) const
RDKit::MolDraw2D_detail::DrawMol::yMin_
double yMin_
Definition DrawMol.h:303
RDKit::MolDraw2D_detail::DrawMol::extractAtomCoords
void extractAtomCoords()
RDKit::MolDraw2D_detail::DrawMol::getColour
DrawColour getColour(int atom_idx) const
RDKit::MolDraw2D_detail::DrawMol::getScale
double getScale() const
Definition DrawMol.h:201
RDKit::MolDraw2D_detail::DrawMol::marginPadding_
double marginPadding_
Definition DrawMol.h:264
RDKit::MolDraw2D_detail::DrawMol::annotations_
std::vector< std::unique_ptr< DrawAnnotation > > annotations_
Definition DrawMol.h:287
RDKit::MolDraw2D_detail::DrawMol::xRange_
double xRange_
Definition DrawMol.h:303
RDKit::MolDraw2D_detail::DrawMol::getAtomCoords
Point2D getAtomCoords(int atnum) const
RDKit::MolDraw2D_detail::DrawMol::extractSGroupData
void extractSGroupData()
RDKit::MolDraw2D_detail::DrawMol::highlightAtoms_
std::vector< int > highlightAtoms_
Definition DrawMol.h:265
RDKit::MolDraw2D_detail::DrawMol::DrawMol
DrawMol(const DrawMol &)=delete
RDKit::MolDraw2D_detail::DrawMol::transformPoint
Point2D transformPoint(const Point2D &pt, const Point2D *trans=nullptr, Point2D *scale=nullptr, const Point2D *toCentre=nullptr) const
RDKit::MolDraw2D_detail::DrawMol::makeWedgedBond
void makeWedgedBond(Bond *bond, const std::pair< DrawColour, DrawColour > &cols)
RDKit::MolDraw2D_detail::DrawMol::preShapes_
std::vector< std::unique_ptr< DrawShape > > preShapes_
Definition DrawMol.h:281
RDKit::MolDraw2D_detail::DrawMol::extractAtomNotes
void extractAtomNotes()
RDKit::MolDraw2D_detail::DrawMol::extractBrackets
void extractBrackets()
RDKit::MolDraw2D_detail::DrawMol::xOffset_
double xOffset_
Definition DrawMol.h:305
RDKit::MolDraw2D_detail::DrawMol::finishCreateDrawObjects
void finishCreateDrawObjects()
RDKit::MolDraw2D_detail::DrawMol::bondColours_
std::vector< std::pair< DrawColour, DrawColour > > bondColours_
Definition DrawMol.h:269
RDKit::MolDraw2D_detail::DrawMol::extractRadicals
void extractRadicals()
RDKit::MolDraw2D_detail::DrawMol::setOffsets
void setOffsets(double xOffset, double yOffset)
RDKit::MolDraw2D_detail::DrawMol::legends_
std::vector< std::unique_ptr< DrawAnnotation > > legends_
Definition DrawMol.h:288
RDKit::MolDraw2D_detail::DrawMol::doubleBondEnd
Point2D doubleBondEnd(unsigned int at1, unsigned int at2, unsigned int at3, double offset, bool trunc) const
RDKit::MolDraw2D_detail::DrawMol::makeStandardBond
void makeStandardBond(Bond *bond, double doubleBondOffset)
RDKit::MolDraw2D_detail::DrawMol::makeTripleBondLines
void makeTripleBondLines(Bond *bond, double doubleBondOffset, const std::pair< DrawColour, DrawColour > &cols)
RDKit::MolDraw2D_detail::DrawMol::getAtomCoords
Point2D getAtomCoords(const Point2D &screenCds) const
RDKit::MolDraw2D_detail::DrawMol::partitionForLegend
void partitionForLegend()
RDKit::MolDraw2D_detail::DrawMol::xMax_
double xMax_
Definition DrawMol.h:303
RDKit::MolDraw2D_detail::DrawMol::width_
int width_
Definition DrawMol.h:295
RDKit::MolDraw2D_detail::DrawMol::flexiCanvasY_
bool flexiCanvasY_
Definition DrawMol.h:317
RDKit::MolDraw2D_detail::DrawMol::getNoteStartAngle
double getNoteStartAngle(const Atom *atom) const
RDKit::MolDraw2D_detail::DrawMol::makeAtomEllipseHighlights
void makeAtomEllipseHighlights(double lineWidth)
RDKit::MolDraw2D_detail::DrawMol::drawOptions_
const MolDrawOptions & drawOptions_
Definition DrawMol.h:259
RDKit::MolDraw2D_detail::DrawMol::legendHeight_
int legendHeight_
Definition DrawMol.h:310
RDKit::MolDraw2D_detail::DrawMol::makeAtomCircleHighlights
void makeAtomCircleHighlights()
RDKit::MolDraw2D_detail::DrawMol::radicals_
std::vector< std::tuple< StringRect, OrientType, int > > radicals_
Definition DrawMol.h:289
RDKit::MolDraw2D_detail::DrawMol::makeQueryBond
void makeQueryBond(Bond *bond, double doubleBondOffset)
RDKit::MolDraw2D_detail::DrawMol::DrawMol
DrawMol(const ROMol &mol, const std::string &legend, int width, int height, const MolDrawOptions &drawOptions, DrawText &textDrawer, const std::vector< int > *highlightAtoms=nullptr, const std::vector< int > *highlightBonds=nullptr, const std::map< int, DrawColour > *highlightAtomMap=nullptr, const std::map< int, DrawColour > *highlightBondMap=nullptr, const std::vector< std::pair< DrawColour, DrawColour > > *bondColours=nullptr, const std::map< int, double > *highlight_radii=nullptr, bool includeAnnotations=true, int confId=-1, bool isReactionMol=false)
RDKit::MolDraw2D_detail::DrawMol::operator=
DrawMol & operator=(const DrawMol &)=delete
RDKit::MolDraw2D_detail::DrawMol::postShapes_
std::vector< std::unique_ptr< DrawShape > > postShapes_
Definition DrawMol.h:282
RDKit::MolDraw2D_detail::DrawMol::atCds_
std::vector< Point2D > atCds_
Definition DrawMol.h:279
RDKit::MolDraw2D_detail::DrawMol::doesRectClash
int doesRectClash(const StringRect &rect, double padding) const
RDKit::MolDraw2D_detail::DrawMol::drawingInitialised_
bool drawingInitialised_
Definition DrawMol.h:311
RDKit::MolDraw2D_detail::DrawMol::highlights_
std::vector< std::unique_ptr< DrawShape > > highlights_
Definition DrawMol.h:286
RDKit::MolDraw2D_detail::DrawMol::legend_
std::string legend_
Definition DrawMol.h:273
RDKit::MolDraw2D_detail::DrawMol::textDrawer_
DrawText & textDrawer_
Definition DrawMol.h:260
RDKit::MolDraw2D_detail::DrawMol::atomicNums_
std::vector< int > atomicNums_
Definition DrawMol.h:283
RDKit::MolDraw2D_detail::DrawMol::xMin_
double xMin_
Definition DrawMol.h:303
RDKit::MolDraw2D_detail::DrawMol::highlightBonds_
std::vector< int > highlightBonds_
Definition DrawMol.h:266
RDKit::MolDraw2D_detail::DrawMol::draw
void draw(MolDraw2D &drawer) const
RDKit::MolDraw2D_detail::DrawMol::calcTripleBondLines
void calcTripleBondLines(double offset, const Bond &bond, Point2D &l1s, Point2D &l1f, Point2D &l2s, Point2D &l2f)
RDKit::MolDraw2D_detail::DrawMol::confId_
int confId_
Definition DrawMol.h:276
RDKit::MolDraw2D_detail::DrawMol::transformAll
void transformAll(const Point2D *trans=nullptr, Point2D *scale=nullptr, const Point2D *toCentre=nullptr)
RDKit::MolDraw2D_detail::DrawMol::makeContinuousHighlights
void makeContinuousHighlights(double scale)
RDKit::MolDraw2D_detail::DrawMol::findExtremes
void findExtremes()
RDKit::MolDraw2D_detail::DrawMol::findOtherBondVecs
void findOtherBondVecs(const Atom *atom, const Atom *otherAtom, std::vector< Point2D > &otherBondVecs) const
RDKit::MolDraw2D_detail::DrawMol::smoothBondJoins
void smoothBondJoins()
RDKit::MolDraw2D_detail::DrawMol::molHeight_
int molHeight_
Definition DrawMol.h:310
RDKit::MolDraw2D_detail::DrawMol::getDrawTransformers
void getDrawTransformers(Point2D &trans, Point2D &scale, Point2D &toCentre) const
RDKit::MolDraw2D_detail::DrawMol::calcRadicalRect
OrientType calcRadicalRect(const Atom *atom, StringRect &rad_rect) const
RDKit::MolDraw2D_detail::DrawMol::makeZeroBond
void makeZeroBond(Bond *bond, const std::pair< DrawColour, DrawColour > &cols, const DashPattern &dashPattern)
RDKit::MolDraw2D_detail::DrawMol::resetEverything
void resetEverything()
RDKit::MolDraw2D_detail::DrawMol::makeHighlightEnd
void makeHighlightEnd(const Atom *end1, const Atom *end2, double lineWidth, const std::vector< Atom * > &end1HighNbrs, std::vector< Point2D > &points)
RDKit::MolDraw2D_detail::DrawMol::bonds_
std::vector< std::unique_ptr< DrawShape > > bonds_
Definition DrawMol.h:280
RDKit::MolDraw2D_detail::DrawMol::makeBondHighlightLines
void makeBondHighlightLines(double lineWidth, double scale)
RDKit::MolDraw2D_detail::DrawMol::doesNoteClash
int doesNoteClash(const DrawAnnotation &annot) const
RDKit::MolDraw2D_detail::DrawMol::extractBonds
void extractBonds()
RDKit::MolDraw2D_detail::DrawMol::extractAtomSymbols
void extractAtomSymbols()
RDKit::MolDraw2D_detail::DrawMol::calcAnnotationPosition
void calcAnnotationPosition(const Atom *atom, DrawAnnotation &annot) const
RDKit::MolDraw2D_detail::DrawMol::calcAnnotationPosition
void calcAnnotationPosition(const Bond *bond, DrawAnnotation &annot) const
RDKit::MolDraw2D_detail::DrawMol::getDrawCoords
Point2D getDrawCoords(int atnum) const
RDKit::MolDraw2D_detail::DrawMol::yOffset_
double yOffset_
Definition DrawMol.h:305
RDKit::MolDraw2D_detail::DrawMol::getAtomOrientation
OrientType getAtomOrientation(const Atom &atom) const
RDKit::MolDraw2D_detail::DrawMol::includeAnnotations_
bool includeAnnotations_
Definition DrawMol.h:271
RDKit::MolDraw2D_detail::DrawMol::getDrawCoords
Point2D getDrawCoords(const Point2D &atCds, const Point2D &trans, const Point2D &scaleFactor, const Point2D &toCentre) const
RDKit::MolDraw2D_detail::DrawMol::extractLegend
void extractLegend()
RDKit::MolDraw2D_detail::DrawMol::extractAll
void extractAll(double scale)
RDKit::MolDraw2D_detail::DrawMol::extractHighlights
virtual void extractHighlights(double scale)
RDKit::MolDraw2D_detail::DrawMol::drawWidth_
int drawWidth_
Definition DrawMol.h:299
RDKit::MolDraw2D_detail::DrawMol::DrawMol
DrawMol(DrawMol &&)=delete
RDKit::MolDraw2D_detail::DrawMol::flexiCanvasX_
bool flexiCanvasX_
Definition DrawMol.h:316
RDKit::MolDraw2D_detail::DrawMol::adjustBondsOnSolidWedgeEnds
void adjustBondsOnSolidWedgeEnds()
RDKit::MolDraw2D_detail::DrawMol::activeAtmIdxOffset_
int activeAtmIdxOffset_
Definition DrawMol.h:315
RDKit::MolDraw2D_detail::DrawMol::makeDoubleBondLines
void makeDoubleBondLines(Bond *bond, double doubleBondOffset, const std::pair< DrawColour, DrawColour > &cols)
RDKit::MolDraw2D_detail::DrawMol::createDrawObjects
void createDrawObjects()
RDKit::MolDraw2D_detail::DrawMol::getFontScale
double getFontScale() const
Definition DrawMol.h:202
RDKit::MolDraw2D_detail::DrawMol::adjustBondEndsForLabels
void adjustBondEndsForLabels(int begAtIdx, int endAtIdx, Point2D &begCds, Point2D &endCds) const
RDKit::MolDraw2D_detail::DrawMol::initDrawMolecule
void initDrawMolecule(const ROMol &mol)
RDKit::MolDraw2D_detail::DrawMol::DrawMol
DrawMol(int width, int height, const MolDrawOptions &drawOptions, DrawText &textDrawer, double xmin, double xmax, double ymin, double ymax, double scale, double fontscale)
RDKit::MolDraw2D_detail::DrawMol::extractMolNotes
void extractMolNotes()
RDKit::MolDraw2D_detail::DrawMol::activeBndIdxOffset_
int activeBndIdxOffset_
Definition DrawMol.h:315
RDKit::MolDraw2D_detail::DrawMol::makeWavyBond
void makeWavyBond(Bond *bond, double offset, const std::pair< DrawColour, DrawColour > &cols)
RDKit::MolDraw2D_detail::DrawMol::changeToDrawCoords
void changeToDrawCoords()
RDKit::MolDraw2D_detail::DrawText
Definition DrawText.h:46
RDKit::MolDraw2D
MolDraw2D is the base class for doing 2D renderings of molecules.
Definition MolDraw2D.h:47
RDKit::ROMol
Definition ROMol.h:199
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
RDKit::MolDraw2D_detail
Definition AtomSymbol.h:30
RDKit::MolDraw2D_detail::calcPerpendicular
Point2D calcPerpendicular(const Point2D &cds1, const Point2D &cds2)
RDKit::MolDraw2D_detail::calcInnerPerpendicular
Point2D calcInnerPerpendicular(const Point2D &cds1, const Point2D &cds2, const Point2D &cds3)
RDKit::MolDraw2D_detail::findRectExtremes
void findRectExtremes(const StringRect &rect, const TextAlignType &align, double &xmin, double &xmax, double &ymin, double &ymax)
RDKit::MolDraw2D_detail::isLinearAtom
bool isLinearAtom(const Atom &atom, const std::vector< Point2D > &atCds)
RDKit::MolDraw2D_detail::findRadicalExtremes
void findRadicalExtremes(const std::vector< std::tuple< StringRect, OrientType, int > > &radicals, double &xmin, double &xmax, double &ymin, double &ymax)
RDKit::MolDraw2D_detail::centerMolForDrawing
void centerMolForDrawing(RWMol &mol, int confId=1)
RDKit::MolDraw2D_detail::areBondsTrans
bool areBondsTrans(const Point2D &at1, const Point2D &at2, const Point2D &at3, const Point2D &at4)
RDKit::MolDraw2D_detail::otherNeighbor
const Atom * otherNeighbor(const Atom *firstAtom, const Atom *secondAtom, int nborNum, const ROMol &mol)
RDKit::MolDraw2D_detail::adjustBondEndForString
void adjustBondEndForString(const Point2D &end2, double padding, const std::vector< std::shared_ptr< StringRect > > &rects, Point2D &moveEnd)
RDKit::MolDraw2D_detail::areBondsParallel
bool areBondsParallel(const Point2D &at1, const Point2D &at2, const Point2D &at3, const Point2D &at4, double tol=1.0e-4)
RDKit::MolDraw2D_detail::getColourByAtomicNum
DrawColour getColourByAtomicNum(int atomicNum, const MolDrawOptions &drawOptions)
RDKit::MolDraw2D_detail::getHighlightBondWidth
double getHighlightBondWidth(const MolDrawOptions &drawOptions, int bond_idx, const std::map< int, int > *highlight_linewidth_multipliers)
RDKit::MolDraw2D_detail::getHighlightBondColour
DrawColour getHighlightBondColour(const Bond *bond, const MolDrawOptions &drawOptions, const std::vector< int > &highlightBonds, const std::map< int, DrawColour > &highlightBondMap, const std::vector< int > &highlightAtoms, const std::map< int, DrawColour > &highlightAtomMap)
RDKit::MolDraw2D_detail::getBondHighlightsForAtoms
void getBondHighlightsForAtoms(const ROMol &mol, const std::vector< int > &highlight_atoms, std::vector< int > &highlight_bonds)
RDKit::MolDraw2D_detail::getAtomListText
std::string getAtomListText(const Atom &atom)
RDKit::MolDraw2D_detail::OrientType
OrientType
Definition MolDraw2DHelpers.h:26
RDKit::MolDraw2D_detail::TextAlignType
TextAlignType
Definition MolDraw2DHelpers.h:33
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::DashPattern
std::vector< double > DashPattern
Definition MolDraw2DHelpers.h:69
point.h
RDKit::DrawColour
Definition MolDraw2DHelpers.h:40
RDKit::MolDraw2D_detail::StringRect
Definition StringRect.h:24
RDKit::MolDrawOptions
Definition MolDraw2DHelpers.h:174