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
19 public:
20 /*!
21 Make a DrawMol that does multi-coloured highlights. Both atoms and
22 bonds can have more than 1 highlight. There's no maximum although more
23 than 4 is very cluttered.
24 \param mol : the molecule to draw
25 \param legend : the legend (to be drawn under the molecule)
26 \param width : width (in pixels) of the rendering
27 set this to -1 to have the canvas size set automatically
28 \param height : height (in pixels) of the rendering
29 set this to -1 to have the canvas size set automatically
30 \param drawOptions : a MolDrawOptions object from the owning MolDraw2D
31 \param textDrawer : a DrawText object from the owning MolDraw2D
32 \param highlight_atom_map : indexed on atom idx, the colours to be used to
33 highlight atoms. Not all atoms need to be mentioned.
34 \param highlight_bond_map : If this is empty, then the lassos will be between
35 all bonded atoms in the highlight_atom_map, in
36 the appropriate colours. If it is given, the lasso
37 will be in more than one part if there is a bond
38 between 2 highlighted atoms that isn't in the
39 highlight_bond_map. The colours in
40 highlight_bond_map will be NOT used for the lines
41 between the atoms - the lasso will be one colour,
42 taken from the atoms.
43 \param highlightRadii : ignored in this molecule representation.
44 \param highlight_linewidth_multipliers : ignored in this molecule
45 representation. \param confId : (optional) conformer ID to be used for
46 atomic coordinates
47 */
49 const ROMol &mol, const std::string &legend, int width, int height,
50 MolDrawOptions &drawOptions, DrawText &textDrawer,
51 const std::map<int, std::vector<DrawColour>> &highlight_atom_map,
52 const std::map<int, std::vector<DrawColour>> &highlight_bond_map,
53 const std::map<int, double> &highlight_radii,
54 const std::map<int, int> &highlight_linewidth_multipliers,
55 int confId = -1);
56 DrawMolMCHLasso(const DrawMol &) = delete;
58 DrawMolMCHLasso &operator=(const DrawMol &) = delete;
60
61 void extractHighlights(double scale) override;
62 void extractMCHighlights() override;
63 // turn mcHighlightAtomMap_ into a mapping of vectors of atoms of a particular
64 // colour, indexed by the colour.
65 void extractAtomColourLists(std::vector<DrawColour> &colours,
66 std::vector<std::vector<int>> &colourAtoms,
67 std::vector<std::vector<int>> &colourLists) const;
68 void drawLasso(size_t lassoNum, const DrawColour &col,
69 const std::vector<int> &colAtoms);
71 const std::vector<int> &colAtoms,
72 std::vector<std::unique_ptr<DrawShapeArc>> &arcs) const;
74 size_t lassoNum, const DrawColour &col, const std::vector<int> &colAtoms,
75 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines) const;
77 std::vector<std::unique_ptr<DrawShapeArc>> &arcs,
78 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines) const;
80 const std::vector<std::unique_ptr<DrawShapeArc>> &arcs,
81 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines) const;
83 std::vector<std::unique_ptr<DrawShapeArc>> &arcs,
84 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines) const;
86 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines) const;
87 // Orphan lines are ones where at least one end isn't close to the end
88 // of any line or arc.
89 void fixOrphanLines(std::vector<std::unique_ptr<DrawShapeArc>> &arcs,
90 std::vector<std::unique_ptr<DrawShapeSimpleLine>> &lines);
91};
92} // namespace MolDraw2D_detail
93} // namespace RDKit
94
95#endif // DRAWMOLMCHLASSO_H
DrawMolMCHLasso & operator=(DrawMol &&)=delete
void fixIntersectingArcsAndLines(std::vector< std::unique_ptr< DrawShapeArc > > &arcs, std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines) const
void fixIntersectingLines(const std::vector< std::unique_ptr< DrawShapeArc > > &arcs, std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines) 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
void fixProtrudingLines(std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines) const
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 fixArcsAndLines(std::vector< std::unique_ptr< DrawShapeArc > > &arcs, std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines) const
void extractAtomArcs(size_t lassoNum, const DrawColour &col, const std::vector< int > &colAtoms, std::vector< std::unique_ptr< DrawShapeArc > > &arcs) const
void extractHighlights(double scale) override
void extractBondLines(size_t lassoNum, const DrawColour &col, const std::vector< int > &colAtoms, std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines) const
void fixOrphanLines(std::vector< std::unique_ptr< DrawShapeArc > > &arcs, std::vector< std::unique_ptr< DrawShapeSimpleLine > > &lines)
Std stuff.
bool rdvalue_is(const RDValue_cast_t)