RDKit
Open-source cheminformatics and machine learning.
DrawMolMCH.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, derived from DrawMol, does multi-coloured highlights.
13 // Like DrawMol, it is not part of the public API and should only be
14 // used by MolDraw2D.
15 
16 #ifndef RDKIT_DRAWMOLMCH_H
17 #define RDKIT_DRAWMOLMCH_H
18 
21 
22 namespace RDKit {
23 namespace MolDraw2D_detail {
24 
25 class DrawMolMCH : public DrawMol {
26  public:
27  /*!
28  Make a DrawMol that does multi-coloured highlights. Both atoms and
29  bonds can have more than 1 highlight. There's no maximum although more
30  than 4 is very cluttered.
31  \param mol : the molecule to draw
32  \param legend : the legend (to be drawn under the molecule)
33  \param width : width (in pixels) of the rendering
34  set this to -1 to have the canvas size set automatically
35  \param height : height (in pixels) of the rendering
36  set this to -1 to have the canvas size set automatically
37  \param drawOptions : a MolDrawOptions object from the owning MolDraw2D
38  \param textDrawer : a DrawText object from the owning MolDraw2D
39  \param highlight_atom_map : indexed on atom idx, the colours to be used to
40  highlight atoms. Not all atoms need to be mentioned.
41  \param highlight_bond_map : indexed on bond idx, the colours to be used to
42  highlight bonds. Not all bonds need to be mentioned.
43  \param highlightRadii : map from atomId -> radius (in molecule coordinates)
44  for the radii of atomic highlights. If not provided for an atom, the default
45  value from \c drawOptions() will be used.
46  \param highlight_linewidth_multipliers : map from bondId -> int, to change
47  the thickness of the lines used for the highlighting.
48  \param confId : (optional) conformer ID to be used for atomic
49  coordinates
50  */
51  DrawMolMCH(const ROMol &mol, const std::string &legend, int width, int height,
52  MolDrawOptions &drawOptions, DrawText &textDrawer,
53  const std::map<int, std::vector<DrawColour>> &highlight_atom_map,
54  const std::map<int, std::vector<DrawColour>> &highlight_bond_map,
55  const std::map<int, double> &highlight_radii,
56  const std::map<int, int> &highlight_linewidth_multipliers,
57  int confId = -1);
58  DrawMolMCH(const DrawMol &) = delete;
59  DrawMolMCH(DrawMol &&) = delete;
60  DrawMolMCH &operator=(const DrawMol &) = delete;
61  DrawMolMCH &operator=(DrawMol &&) = delete;
62 
63  void extractHighlights() override;
67  void adjustLineEndForHighlight(int at_idx, Point2D p1, Point2D &p2) const;
68  void calcSymbolEllipse(unsigned int atomIdx, Point2D &centre, double &xradius,
69  double &yradius) const;
70 
71  const std::map<int, std::vector<DrawColour>> mcHighlightAtomMap_;
72  const std::map<int, std::vector<DrawColour>> &mcHighlightBondMap_;
73  const std::map<int, int> &highlightLinewidthMultipliers_;
74 };
75 
76 } // namespace MolDraw2D_detail
77 } // namespace RDKit
78 
79 #endif // RDKIT_DRAWMOLMCH_H
const std::map< int, std::vector< DrawColour > > mcHighlightAtomMap_
Definition: DrawMolMCH.h:71
DrawMolMCH(const ROMol &mol, const std::string &legend, int width, int height, MolDrawOptions &drawOptions, DrawText &textDrawer, const std::map< int, std::vector< DrawColour >> &highlight_atom_map, const std::map< int, std::vector< DrawColour >> &highlight_bond_map, const std::map< int, double > &highlight_radii, const std::map< int, int > &highlight_linewidth_multipliers, int confId=-1)
DrawMolMCH(const DrawMol &)=delete
DrawMolMCH & operator=(DrawMol &&)=delete
DrawMolMCH & operator=(const DrawMol &)=delete
const std::map< int, std::vector< DrawColour > > & mcHighlightBondMap_
Definition: DrawMolMCH.h:72
void adjustLineEndForHighlight(int at_idx, Point2D p1, Point2D &p2) const
const std::map< int, int > & highlightLinewidthMultipliers_
Definition: DrawMolMCH.h:73
void calcSymbolEllipse(unsigned int atomIdx, Point2D &centre, double &xradius, double &yradius) const
Std stuff.
Definition: Abbreviations.h:18