RDKit: DrawMolMCHCircleAndLine.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
DrawMolMCHCircleAndLine.h
Go to the documentation of this file.
1//
2// Copyright (C) 2023 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// This is the original multi-coloured highlighting code, which is done
11// by multi-coloured arcs and bars.
12
13#ifndef DRAWMOLMCHCIRCLEANDLINE_H
14#define DRAWMOLMCHCIRCLEANDLINE_H
15
16#include <GraphMol/MolDraw2D/DrawMolMCH.h>
17
18namespace RDKit {
19namespace MolDraw2D_detail {
20
21 class DrawMolMCHCircleAndLine : public DrawMolMCH {
22 public:
23 /*!
24 Make a DrawMol that does multi-coloured highlights. Both atoms and
25 bonds can have more than 1 highlight. There's no maximum although more
26 than 4 is very cluttered.
27 \param mol : the molecule to draw
28 \param legend : the legend (to be drawn under the molecule)
29 \param width : width (in pixels) of the rendering
30 set this to -1 to have the canvas size set automatically
31 \param height : height (in pixels) of the rendering
32 set this to -1 to have the canvas size set automatically
33 \param drawOptions : a MolDrawOptions object from the owning MolDraw2D
34 \param textDrawer : a DrawText object from the owning MolDraw2D
35 \param highlight_atom_map : indexed on atom idx, the colours to be used to
36 highlight atoms. Not all atoms need to be mentioned.
37 \param highlight_bond_map : indexed on bond idx, the colours to be used to
38 highlight bonds. Not all bonds need to be mentioned.
39 \param highlightRadii : map from atomId -> radius (in molecule coordinates)
40 for the radii of atomic highlights. If not provided for an atom, the default
41 value from \c drawOptions() will be used.
42 \param highlight_linewidth_multipliers : map from bondId -> int, to change
43 the thickness of the lines used for the highlighting.
44 \param confId : (optional) conformer ID to be used for atomic
45 coordinates
46 */
47 DrawMolMCHCircleAndLine(
48 const ROMol &mol, const std::string &legend, int width, int height,
49 MolDrawOptions &drawOptions, DrawText &textDrawer,
50 const std::map<int, std::vector<DrawColour>> &highlight_atom_map,
51 const std::map<int, std::vector<DrawColour>> &highlight_bond_map,
52 const std::map<int, double> &highlight_radii,
53 const std::map<int, int> &highlight_linewidth_multipliers,
54 int confId = -1);
55 DrawMolMCHCircleAndLine(const DrawMol &) = delete;
56 DrawMolMCHCircleAndLine(DrawMol &&) = delete;
57 DrawMolMCHCircleAndLine &operator=(const DrawMol &) = delete;
58 DrawMolMCHCircleAndLine &operator=(DrawMol &&) = delete;
59
60 void extractHighlights(double scale) override;
61 void extractMCHighlights() override;
62
63 void makeBondHighlights(
64 std::vector<std::unique_ptr<DrawShape>> &bondHighlights);
65 void makeAtomHighlights(
66 std::vector<std::unique_ptr<DrawShape>> &atomHighlights);
67 // adjust p2 so that the line from p1 to p2 stops where it intersects
68 // the label ellipse for at_idx.
69 void adjustLineEndForHighlight(int at_idx, Point2D p1, Point2D &p2) const;
70 void calcSymbolEllipse(unsigned int atomIdx, Point2D &centre, double &xradius,
71 double &yradius) const;
72 void fixHighlightJoinProblems(
73 std::vector<std::unique_ptr<DrawShape>> &atomHighlights,
74 std::vector<std::unique_ptr<DrawShape>> &bondHighlights);
75};
76} // namespace MolDraw2D_detail
77} // namespace RDKit
78#endif // DRAWMOLMCHCIRCLEANDLINE_H
DrawMolMCH.h
RDGeom::Point2D
Definition point.h:284
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::extractMCHighlights
void extractMCHighlights() override
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::calcSymbolEllipse
void calcSymbolEllipse(unsigned int atomIdx, Point2D &centre, double &xradius, double &yradius) const
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::makeAtomHighlights
void makeAtomHighlights(std::vector< std::unique_ptr< DrawShape > > &atomHighlights)
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::DrawMolMCHCircleAndLine
DrawMolMCHCircleAndLine(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)
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::adjustLineEndForHighlight
void adjustLineEndForHighlight(int at_idx, Point2D p1, Point2D &p2) const
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::makeBondHighlights
void makeBondHighlights(std::vector< std::unique_ptr< DrawShape > > &bondHighlights)
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::fixHighlightJoinProblems
void fixHighlightJoinProblems(std::vector< std::unique_ptr< DrawShape > > &atomHighlights, std::vector< std::unique_ptr< DrawShape > > &bondHighlights)
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::operator=
DrawMolMCHCircleAndLine & operator=(DrawMol &&)=delete
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::DrawMolMCHCircleAndLine
DrawMolMCHCircleAndLine(const DrawMol &)=delete
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::operator=
DrawMolMCHCircleAndLine & operator=(const DrawMol &)=delete
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::DrawMolMCHCircleAndLine
DrawMolMCHCircleAndLine(DrawMol &&)=delete
RDKit::MolDraw2D_detail::DrawMolMCHCircleAndLine::extractHighlights
void extractHighlights(double scale) override
RDKit::MolDraw2D_detail::DrawMolMCH::DrawMolMCH
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)
RDKit::MolDraw2D_detail::DrawMol
Definition DrawMol.h:39
RDKit::MolDraw2D_detail::DrawText
Definition DrawText.h:46
RDKit::ROMol
Definition ROMol.h:199
RDKit::MolDraw2D_detail
Definition AtomSymbol.h:30
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::MolDrawOptions
Definition MolDraw2DHelpers.h:174