void Residue::addAtom(unsigned long id) { if (!m_molecule->atomById(id)) return; if (!m_atoms.contains(id)) m_atoms.push_back(id); m_molecule->atomById(id)->setResidue(m_id); connect(m_molecule->atomById(id), SIGNAL(updated()), this, SLOT(updateAtom())); }
void Residue::removeAtom(unsigned long id) { int index = m_atoms.indexOf(id); if (index != -1 ) { m_atoms.removeAt(index); } if (!m_molecule->atomById(id)) return; m_molecule->atomById(id)->setResidue(FALSE_ID); disconnect(m_molecule->atomById(id), SIGNAL(updated()), this, SLOT(updateAtom())); }
void Molecule::removeAtom(Atom *atom) { if(atom) { // When deleting an atom this also implicitly deletes any bonds to the atom foreach (unsigned long bond, atom->bonds()) { removeBond(bond); } m_atoms[atom->id()] = 0; // 1 based arrays stored/shown to user int index = atom->index(); m_atomList.removeAt(index); for (int i = index; i < m_atomList.size(); ++i) m_atomList[i]->setIndex(i); atom->deleteLater(); disconnect(atom, SIGNAL(updated()), this, SLOT(updateAtom())); emit atomRemoved(atom); } }
void Dialog2::applied() { updateAtom(); canvas->updateGL(); }