~ubuntu-branches/ubuntu/trusty/avogadro/trusty-proposed

« back to all changes in this revision

Viewing changes to libavogadro/src/residue.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Rohan Garg
  • Date: 2011-05-20 18:55:49 UTC
  • mfrom: (3.2.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110520185549-berzu8h9f9330xji
Tags: 1.0.3-1ubuntu1
* Merge from debian, remaining changes (LP: #787458, #784267)
  - Disable builds for ARM as build dependency on libOpenGL and 
    libQtOpenGL

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
  void Residue::addAtom(unsigned long id)
44
44
  {
45
 
    if (!m_molecule->atomById(id))
46
 
      return;
 
45
    if (!m_molecule) {
 
46
      qWarning() << Q_FUNC_INFO << "Parent molecule was not set!";
 
47
      return;
 
48
    }
 
49
    if(!m_molecule->atomById(id)){
 
50
      qWarning() << Q_FUNC_INFO << QString("Atom with id=%1 was not found in the parent molecule!").arg(id);
 
51
      return;
 
52
    }
47
53
    if (!m_atoms.contains(id))
48
54
      m_atoms.push_back(id);
49
55
    m_molecule->atomById(id)->setResidue(m_id);
52
58
 
53
59
  void Residue::removeAtom(unsigned long id)
54
60
  {
 
61
    if (!m_molecule) {
 
62
      qWarning() << Q_FUNC_INFO << "Parent molecule was not set!";
 
63
      return;
 
64
    }
 
65
    if(!m_molecule->atomById(id)){
 
66
      qWarning() << Q_FUNC_INFO << QString("Atom with id=%1 was not found in the parent molecule!").arg(id);
 
67
      return;
 
68
    }
55
69
    int index = m_atoms.indexOf(id);
56
70
    if (index != -1 ) {
57
71
      m_atoms.removeAt(index);
58
72
    }
59
 
    if (!m_molecule->atomById(id))
60
 
      return;
61
 
 
62
73
    m_molecule->atomById(id)->setResidue(FALSE_ID);
63
74
    disconnect(m_molecule->atomById(id), SIGNAL(updated()), this, SLOT(updateAtom()));
64
75
  }