| 1 | /* |
| 2 | * lidia-core/svg-molecule.hh |
| 3 | * |
| 4 | * Copyright 2022 by Medical Research Council |
| 5 | * Author: Paul Emsley |
| 6 | * |
| 7 | * This file is part of Coot |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU Lesser General Public License as published |
| 11 | * by the Free Software Foundation; either version 3 of the License, or (at |
| 12 | * your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copies of the GNU General Public License and |
| 20 | * the GNU Lesser General Public License along with this program; if not, |
| 21 | * write to the Free Software Foundation, Inc., 51 Franklin Street, |
| 22 | * Fifth Floor, Boston, MA, 02110-1301, USA. |
| 23 | * See http://www.gnu.org/licenses/ |
| 24 | */ |
| 25 | |
| 26 | #ifndef SVG_MOLECULE_HH |
| 27 | #define SVG_MOLECULE_HHcxx . . $ `lidia-core/svg-molecule.hh:27:9`! |
| 28 | |
| 29 | #include "lig-build.hh"cxx . . $ `<file>/lidia-core/lig-build.hh`/ |
| 30 | #include "lbg-shared.hh"cxx . . $ `<file>/lidia-core/lbg-shared.hh`/ |
| 31 | #include "use-rdkit.hh"cxx . . $ `<file>/lidia-core/use-rdkit.hh`/ |
| 32 | #include "svg-container.hh"cxx . . $ `<file>/lidia-core/svg-container.hh`/ |
| 33 | |
| 34 | class svg_atom_tcxx . . $ svg_atom_t# : public lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t# { |
| 35 | // use self element to set the colour |
| 36 | stdcxx . . $ std/::stringcxx . . $ std/string# colourcxx . . $ svg_atom_t#colour.; |
| 37 | public: |
| 38 | svg_atom_tcxx . . $ svg_atom_t#svg_atom_t(521ead68a230a5b2).(const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &pos_in, const stdcxx . . $ std/::stringcxx . . $ std/string# &ele_in, int formal_charge_in) : |
| 39 | lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t#(pos_in, ele_in, formal_charge_in) { set_colourcxx . . $ svg_atom_t#set_colour(b45ddcbc8423892c).(); solvent_accessibilitycxx . . $ svg_atom_t#solvent_accessibility. = -1; } |
| 40 | |
| 41 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::bash_distance_tcxx . . $ coot/bash_distance_t#> bash_distancescxx . . $ svg_atom_t#bash_distances.; |
| 42 | double solvent_accessibilitycxx . . $ svg_atom_t#solvent_accessibility.; |
| 43 | double get_solvent_accessibilitycxx . . $ svg_atom_t#get_solvent_accessibility(21b6c25e127938e2).() const { return solvent_accessibilitycxx . . $ svg_atom_t#solvent_accessibility.; } |
| 44 | void add_solvent_accessibilitycxx . . $ svg_atom_t#add_solvent_accessibility(ba8836b59fb42830).(double sa) { |
| 45 | solvent_accessibilitycxx . . $ svg_atom_t#solvent_accessibility. = sa; |
| 46 | } |
| 47 | |
| 48 | void set_colourcxx . . $ svg_atom_t#set_colour(b45ddcbc8423892c).(bool against_a_dark_background=false); |
| 49 | stdcxx . . $ std/::stringcxx . . $ std/string# make_text_itemcxx . . $ svg_atom_t#make_text_item(d450c60feee82861).(const lig_buildcxx . . $ lig_build/::atom_id_info_tcxx . . $ lig_build/atom_id_info_t# &atom_id_info_in, |
| 50 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# ¢re, |
| 51 | double scale, double median_bond_length) const; |
| 52 | }; |
| 53 | |
| 54 | class svg_bond_tcxx . . $ svg_bond_t# : public lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t# { |
| 55 | stdcxx . . $ std/::stringcxx . . $ std/string# draw_sheared_or_darted_wedge_bondcxx . . $ svg_bond_t#draw_sheared_or_darted_wedge_bond(9eaa582a890405b5).(const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &pos_1, |
| 56 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &pos_2, |
| 57 | const stdcxx . . $ std/::stringcxx . . $ std/string# &bond_colour, |
| 58 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t#, lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#> > &other_connections_to_second_atom, |
| 59 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# ¢re, |
| 60 | double scale) const; |
| 61 | stdcxx . . $ std/::stringcxx . . $ std/string# make_bond_line_stringcxx . . $ svg_bond_t#make_bond_line_string(5e985c6c65708ac0).(const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &p1, const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &p2, |
| 62 | double scale_factor, |
| 63 | const stdcxx . . $ std/::stringcxx . . $ std/string# &bond_colour) const; |
| 64 | stdcxx . . $ std/::stringcxx . . $ std/string# make_dashed_bond_line_stringcxx . . $ svg_bond_t#make_dashed_bond_line_string(d4fef9f4e58d789e).(const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &p1, const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &p2, |
| 65 | const stdcxx . . $ std/::stringcxx . . $ std/string# &bond_colour) const; |
| 66 | public: |
| 67 | svg_bond_tcxx . . $ svg_bond_t#svg_bond_t(8d2381f1193700e8).(int first, int second, lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#::bond_type_tcxx . . $ lig_build/bond_t#bond_type_t# type) : |
| 68 | lig_buildcxx . . $ lig_build/bond_t#bond_t(db7639297eac3ed7).::bond_tcxx . . $ lig_build/bond_t#(first, second, type) {} |
| 69 | |
| 70 | stdcxx . . $ std/::stringcxx . . $ std/string# draw_bondcxx . . $ svg_bond_t#draw_bond(a1710c8231327cdc).(const svg_atom_tcxx . . $ svg_atom_t# &at_1, const svg_atom_tcxx . . $ svg_atom_t# &at_2, |
| 71 | bool at_1_in_ring_flag, bool at_2_in_ring_flag, |
| 72 | lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#::bond_type_tcxx . . $ lig_build/bond_t#bond_type_t# bt, |
| 73 | const stdcxx . . $ std/::stringcxx . . $ std/string# &bond_colour, |
| 74 | bool shorten_first, bool shorten_second, |
| 75 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t#, lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#> > &other_connections_to_first_atom, |
| 76 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t#, lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#> > &other_connections_to_second_atom, |
| 77 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# ¢re, double scale); |
| 78 | stdcxx . . $ std/::stringcxx . . $ std/string# draw_double_in_ring_bondcxx . . $ svg_bond_t#draw_double_in_ring_bond(10b79fea49a81a0e).(const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &pos_1, |
| 79 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &pos_2, |
| 80 | const stdcxx . . $ std/::stringcxx . . $ std/string# &bond_colour, |
| 81 | bool shorten_first, |
| 82 | bool shorten_second, |
| 83 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# ¢re, |
| 84 | double scale, bool dashed_inner=false); |
| 85 | stdcxx . . $ std/::stringcxx . . $ std/string# draw_double_bondcxx . . $ svg_bond_t#draw_double_bond(65fde18dec7a2b65).(const lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t# &at_1, |
| 86 | const lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t# &at_2, |
| 87 | const stdcxx . . $ std/::stringcxx . . $ std/string# &bond_colour, |
| 88 | bool shorten_first, bool shorten_second, |
| 89 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t#, lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#> > &other_connections_to_first_atom, |
| 90 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<lig_buildcxx . . $ lig_build/::atom_tcxx . . $ lig_build/atom_t#, lig_buildcxx . . $ lig_build/::bond_tcxx . . $ lig_build/bond_t#> > &other_connections_to_second_atom, |
| 91 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# ¢re, double scale); |
| 92 | }; |
| 93 | |
| 94 | class svg_molecule_tcxx . . $ svg_molecule_t# : public lig_buildcxx . . $ lig_build/::molecule_tcxx . . $ lig_build/molecule_t#<svg_atom_tcxx . . $ svg_atom_t#, svg_bond_tcxx . . $ svg_bond_t#> { |
| 95 | public: |
| 96 | svg_molecule_tcxx . . $ svg_molecule_t#svg_molecule_t(49f6e7a06ebc5aa8).() { median_bond_length_cxx . . $ svg_molecule_t#median_bond_length_. = 1.0; } |
| 97 | void import_rdkit_molcxx . . $ svg_molecule_t#import_rdkit_mol(c4c0a328fd52ead2).(RDKitcxx . . $ RDKit/::ROMolcxx . . $ RDKit/ROMol# *mol, int iconf); |
| 98 | stdcxx . . $ std/::stringcxx . . $ std/string# render_to_svg_stringcxx . . $ svg_molecule_t#render_to_svg_string(817715d4395b4988).(double scale_factor, bool dark_background_flag, bool add_background_rect); |
| 99 | svg_container_tcxx . . $ svg_container_t# make_svgcxx . . $ svg_molecule_t#make_svg(e3df72bcc4e23767).(double scale_factor, bool dark_background_flag, bool add_background_rect); |
| 100 | double median_bond_length_cxx . . $ svg_molecule_t#median_bond_length_.; |
| 101 | double get_scalecxx . . $ svg_molecule_t#get_scale(21b6c25e127938e2).() const; |
| 102 | |
| 103 | static lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# mol_coords_to_svg_coordscxx . . $ svg_molecule_t#mol_coords_to_svg_coords(f30de03cbb381acf).(const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# &pos_1, |
| 104 | const lig_buildcxx . . $ lig_build/::pos_tcxx . . $ lig_build/pos_t# ¢re, |
| 105 | double scale); |
| 106 | }; |
| 107 | |
| 108 | |
| 109 | #endif // SVG_MOLECULE_HH |