get the JS wrappers working again (#4056)

This commit is contained in:
Greg Landrum
2021-04-19 16:26:22 +02:00
committed by GitHub
parent 83aa4850bf
commit 319d7b872a
2 changed files with 16 additions and 11 deletions

View File

@@ -18,12 +18,17 @@
using namespace RDKit;
extern std::string process_details(const std::string &details,
unsigned int &width, unsigned int &height,
int &offsetx, int &offsety,
std::string &legend,
std::vector<int> &atomIds,
std::vector<int> &bondIds);
namespace RDKit {
namespace MinimalLib{
extern std::string process_details(const std::string &details, unsigned int &width,
unsigned int &height, int &offsetx, int &offsety,
std::string &legend, std::vector<int> &atomIds,
std::vector<int> &bondIds);
}
}
namespace {
std::string draw_to_canvas_with_offset(JSMol &self, emscripten::val canvas,
@@ -65,7 +70,7 @@ std::string draw_to_canvas_with_highlights(JSMol &self, emscripten::val canvas,
int offsetx = 0;
int offsety = 0;
std::string legend = "";
auto problems = process_details(details, w, h, offsetx, offsety, legend,
auto problems = MinimalLib::process_details(details, w, h, offsetx, offsety, legend,
atomIds, bondIds);
if (!problems.empty()) {
return problems;
@@ -146,4 +151,4 @@ EMSCRIPTEN_BINDINGS(RDKit_minimal) {
function("get_inchikey_for_inchi", &get_inchikey_for_inchi);
function("get_mol", &get_mol, allow_raw_pointers());
function("get_qmol", &get_qmol, allow_raw_pointers());
}
}

View File

@@ -83,7 +83,7 @@ std::string JSMol::get_substruct_match(const JSMol &q) const {
if (SubstructMatch(*d_mol, *(q.d_mol), match)) {
rj::Document doc;
doc.SetObject();
get_sss_json(*d_mol, *(q.d_mol), match, doc, doc);
MinimalLib::get_sss_json(*d_mol, *(q.d_mol), match, doc, doc);
rj::StringBuffer buffer;
rj::Writer<rj::StringBuffer> writer(buffer);
doc.Accept(writer);
@@ -104,7 +104,7 @@ std::string JSMol::get_substruct_matches(const JSMol &q) const {
for (const auto &match : matches) {
rj::Value rjMatch(rj::kObjectType);
get_sss_json(*d_mol, *(q.d_mol), match, rjMatch, doc);
MinimalLib::get_sss_json(*d_mol, *(q.d_mol), match, rjMatch, doc);
doc.PushBack(rjMatch, doc.GetAllocator());
}
@@ -305,7 +305,7 @@ std::string JSMol::generate_aligned_coords(const JSMol &templateMol,
if (!match.empty()) {
rj::Document doc;
doc.SetObject();
get_sss_json(d_mol.get(), templateMol.d_mol.get(), match, doc, doc);
MinimalLib::get_sss_json(*d_mol, *templateMol.d_mol, match, doc, doc);
rj::StringBuffer buffer;
rj::Writer<rj::StringBuffer> writer(buffer);
doc.Accept(writer);