void GAPCExtension::reemitMoleculeChanged(Structure* s) { // Make copy of s to pass to editor GlobalSearch::Structure* newS = new GlobalSearch::Structure(*s); // Reset filename to something unique newS->setFileName(s->fileName() + "/usermodified.cml"); emit moleculeChanged(newS, Extension::DeleteOld); }
void ExampleSearchExtension::reemitMoleculeChanged(GlobalSearch::Structure *s) { // Make copy of s to pass to editor GlobalSearch::Structure *newS = new GlobalSearch::Structure (*s); // Reset filename to something unique newS->setFileName(s->fileName() + "/usermodified.cml"); // Make any pre-vis cleanup changes you'd like here. emit moleculeChanged(newS, Extension::DeleteOld); }
void StructureTest::perceiveBonds() { /**** Butane PDB ****/ QString butaneFileName = QString(TESTDATADIR) + "/data/butane.pdb"; QFile file(butaneFileName); QVERIFY(file.open(QIODevice::ReadOnly)); QByteArray butanePDBData(file.readAll()); // First, use OBConvert to convert it to cml QByteArray butaneCMLData; QVERIFY(GlobalSearch::OBConvert::convertFormat("pdb", "cml", butanePDBData, butaneCMLData)); std::stringstream css(butaneCMLData.data()); // Now read it GlobalSearch::Structure butane; QVERIFY(GlobalSearch::CmlFormat::read(butane, css)); QVERIFY(butane.numBonds() == 13); butane.clearBonds(); QVERIFY(butane.numBonds() == 0); butane.perceiveBonds(); QVERIFY(butane.numBonds() == 13); }