RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
DrawMolMCHLasso.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#ifndef DRAWMOLMCHLASSO_H
11#define DRAWMOLMCHLASSO_H
12
14
15namespace RDKit {
16namespace MolDraw2D_detail {
17
18// Struct to hold a pair of lines that make up part of the
19// lasso. Each atom in the lasso will have one for each
20// of its bonds that are in the lasso. The angles are
21// subtended by the line ends at the atom centres relative
22// to the x axis. The radius is also the distance from
23// the nearest end of each line ot the atom.
32
34 public:
35 /*!
36 Make a DrawMol that does multi-coloured highlights. Both atoms and
37 bonds can have more than 1 highlight. There's no maximum although more
38 than 4 is very cluttered.
39 \param mol : the molecule to draw
40 \param legend : the legend (to be drawn under the molecule)
41 \param width : width (in pixels) of the rendering
42 set this to -1 to have the canvas size set automatically
43 \param height : height (in pixels) of the rendering
44 set this to -1 to have the canvas size set automatically
45 \param drawOptions : a MolDrawOptions object from the owning MolDraw2D
46 \param textDrawer : a DrawText object from the owning MolDraw2D
47 \param highlight_atom_map : indexed on atom idx, the colours to be used to
48 highlight atoms. Not all atoms need to be mentioned.
49 \param highlight_bond_map : If this is empty, then the lassos will be between
50 all bonded atoms in the highlight_atom_map, in
51 the appropriate colours. If it is given, the lasso
52 will be in more than one part if there is a bond
53 between 2 highlighted atoms that isn't in the
54 highlight_bond_map. The colours in
55 highlight_bond_map will be NOT used for the lines
56 between the atoms - the lasso will be one colour,
57 taken from the atoms.
58 \param highlightRadii : ignored in this molecule representation.
59 \param highlight_linewidth_multipliers : ignored in this molecule
60 representation. \param confId : (optional) conformer ID to be used for
61 atomic coordinates
62 */
64 const ROMol &mol, const std::string &legend, int width, int height,
65 MolDrawOptions &drawOptions, DrawText &textDrawer,
66 const std::map<int, std::vector<DrawColour>> &highlight_atom_map,
67 const std::map<int, std::vector<DrawColour>> &highlight_bond_map,
68 const std::map<int, double> &highlight_radii,
69 const std::map<int, int> &highlight_linewidth_multipliers,
70 int confId = -1);
71 DrawMolMCHLasso(const DrawMol &) = delete;
73 DrawMolMCHLasso &operator=(const DrawMol &) = delete;
75
76 void extractHighlights(double scale) override;
77 void extractMCHighlights() override;
78 // turn mcHighlightAtomMap_ into a mapping of vectors of atoms of a particular
79 // colour, indexed by the colour.
80 void extractAtomColourLists(std::vector<DrawColour> &colours,
81 std::vector<std::vector<int>> &colourAtoms,
82 std::vector<std::vector<int>> &colourLists) const;
83 void drawLasso(size_t lassoNum, const DrawColour &col,
84 const std::vector<int> &colAtoms);
86 size_t lassoNum, const DrawColour &col, const std::vector<int> &colAtoms,
87 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines,
88 std::vector<std::vector<LinePair>> &atomLines) const;
89 void extractAtomArcs(std::vector<std::vector<LinePair>> &atomLines,
90 std::vector<std::unique_ptr<DrawShapeArc>> &arcs) const;
92 const std::vector<int> &colAtoms, size_t lassoNum,
94 const std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines,
95 std::vector<std::unique_ptr<DrawShapeArc>> &arcs) const;
97 const std::vector<std::vector<unsigned int>> &intersects, int lassoNum,
99 std::vector<std::unique_ptr<DrawShapeArc>> &currArcs,
100 std::vector<DrawShapeArc *> &arcs) const;
101 // Put the start points of each pair of atoms in order so that going in
102 // an anti-clockwise direction the bond that the lines straddle is in
103 // between them such that the arc between the first and second is always
104 // the bit that isn't drawn. And then order the pairs so that the bonds
105 // are moving round in an anti-clockwise direction.
106 void orderAtomLines(std::vector<std::vector<LinePair>> &atomLines) const;
107};
108} // namespace MolDraw2D_detail
109} // namespace RDKit
110
111#endif // DRAWMOLMCHLASSO_H
DrawMolMCHLasso & operator=(DrawMol &&)=delete
void orderAtomLines(std::vector< std::vector< LinePair > > &atomLines) const
void addNoLineArcs(const std::vector< int > &colAtoms, size_t lassoNum, const RDKit::DrawColour &col, const std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines, std::vector< std::unique_ptr< DrawShapeArc > > &arcs) const
void makeIntersectingArcs(const std::vector< std::vector< unsigned int > > &intersects, int lassoNum, const RDKit::DrawColour &col, std::vector< std::unique_ptr< DrawShapeArc > > &currArcs, std::vector< DrawShapeArc * > &arcs) const
DrawMolMCHLasso(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)
DrawMolMCHLasso(const DrawMol &)=delete
DrawMolMCHLasso & operator=(const DrawMol &)=delete
void drawLasso(size_t lassoNum, const DrawColour &col, const std::vector< int > &colAtoms)
void extractAtomColourLists(std::vector< DrawColour > &colours, std::vector< std::vector< int > > &colourAtoms, std::vector< std::vector< int > > &colourLists) const
void extractAtomArcs(std::vector< std::vector< LinePair > > &atomLines, std::vector< std::unique_ptr< DrawShapeArc > > &arcs) const
void extractBondLines(size_t lassoNum, const DrawColour &col, const std::vector< int > &colAtoms, std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines, std::vector< std::vector< LinePair > > &atomLines) const
void extractHighlights(double scale) override
Std stuff.
bool rdvalue_is(const RDValue_cast_t)