Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp	(revision 96f14ae4f021b1976486ad5658a68c30645c7467)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp	(revision 7f185f928e77138d9f68a9af929ddf86c7ed5bf1)
@@ -43,6 +43,4 @@
 
 #include "CodePatterns/MemDebug.hpp"
-
-#include <boost/assign.hpp>
 
 #include "CodePatterns/Assert.hpp"
@@ -61,15 +59,4 @@
 #include "World.hpp"
 
-using namespace boost::assign;
-
-static Observable::channels_t getAllAtomicChangesChannels()
-{
-  Observable::channels_t channels;
-  channels += molecule::AtomInserted, molecule::AtomRemoved, molecule::AtomMoved;
-  return channels;
-}
-
-const Observable::channels_t GLMoleculeObject_molecule::HullChannels(getAllAtomicChangesChannels());
-
 static QGLSceneNode *createMoleculeMesh(const QGeometryData &_geo)
 {
@@ -83,10 +70,7 @@
 GLMoleculeObject_molecule::GLMoleculeObject_molecule(
     QObject *parent,
-    QtObservedInstanceBoard &_board,
     QtObservedMolecule::ptr &_ObservedMolecule) :
   GLMoleculeObject((QGLSceneNode *)NULL, parent),
-  owner(NULL),
   hoverAtomId(-1),
-  board(_board),
   ObservedMolecule(_ObservedMolecule)
 {
@@ -97,10 +81,7 @@
     QGLSceneNode *mesh[],
     QObject *parent,
-    QtObservedInstanceBoard &_board,
     QtObservedMolecule::ptr &_ObservedMolecule) :
   GLMoleculeObject(mesh, parent),
-  owner(NULL),
   hoverAtomId(-1),
-  board(_board),
   ObservedMolecule(_ObservedMolecule)
 {
@@ -118,6 +99,4 @@
   m_visible = false;
 
-  connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
-  connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
   connect (ObservedMolecule.get(), SIGNAL(tesselationhullChanged()), this, SLOT(resetTesselationHull()));
   connect (ObservedMolecule.get(), SIGNAL(boundingboxChanged()), this, SLOT(resetBoundingBox()));
@@ -130,6 +109,4 @@
 //      this, SLOT(atomRemoved(const atomId_t)) );
   connect (ObservedMolecule.get(), SIGNAL(selectedChanged()), this, SLOT(resetSelected()));
-
-  connect( this, SIGNAL(clicked()), this, SLOT(wasClicked()));
 }
 
@@ -152,4 +129,5 @@
   // check minimum bond radius in molecule
   double minlength = std::numeric_limits<double>::max();
+  size_t NoAtoms = 0;
   for (molecule::const_iterator iter = molref->begin();
       iter != molref->end(); ++iter) {
@@ -160,9 +138,10 @@
       minlength = std::min(bond_distance, minlength);
     }
+    ++NoAtoms;
   }
   minradius = std::max( std::max(minradius, minlength), 1.);
 
   // we need at least three points for tesselation
-  if (AtomsinSceneMap.size() >= 3) {
+  if (NoAtoms >= 3) {
     // Tesselate the points.
     Tesselation T;
@@ -218,8 +197,6 @@
 void GLMoleculeObject_molecule::resetTesselationHull()
 {
-  if (owner != NULL) {
-    TesselationHull = updateTesselationHull();
-    updateMesh(createMoleculeMesh(TesselationHull));
-  }
+  TesselationHull = updateTesselationHull();
+  updateMesh(createMoleculeMesh(TesselationHull));
 }
 
@@ -334,152 +311,4 @@
 }
 
-/** Adds an atom of this molecule to the scene.
- *
- * @param _atom atom to add
- */
-void GLMoleculeObject_molecule::atomInserted(QtObservedAtom::ptr _atom)
-{
-  const ObservedValue_Index_t atomid = _atom->getIndex();
-  LOG(3, "INFO: GLMoleculeObject_molecule: Received signal atomInserted for atom "
-      << _atom->getAtomIndex());
-
-  if (_atom) {
-    GLMoleculeObject_atom *atomObject =
-        new GLMoleculeObject_atom(
-            GLMoleculeObject::meshSphere,
-            this,
-            _atom);
-    ASSERT( atomObject != NULL,
-        "GLMoleculeObject_molecule::atomInserted - could not create atom object for "
-        +toString(_atom->getAtomIndex()));
-    AtomNodeMap::iterator iter = AtomsinSceneMap.find(atomid);
-    ASSERT(iter == AtomsinSceneMap.end(),
-        "GLMoleculeObject_molecule::atomInserted - same atom with id "
-        +toString(_atom->getAtomIndex())+" added again.");
-    AtomsinSceneMap.insert( make_pair(atomid, atomObject) );
-
-    qRegisterMetaType<atomId_t>("atomId_t");
-    qRegisterMetaType<GLMoleculeObject_bond::SideOfBond>("GLMoleculeObject_bond::SideOfBond");
-    connect (atomObject, SIGNAL(clicked(atomId_t)), this, SIGNAL(atomClicked(atomId_t)));
-    connect (atomObject, SIGNAL(changed()), this, SIGNAL(changed()));
-    connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
-    connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
-
-    if (m_objectId  == -1)
-      setObjectId(_atom->getAtomIndex());
-
-    emit changed();
-    emit changeOccured();
-  }
-}
-
-/** Removes an atom of this molecule from the scene.
- *
- * We just the id as the atom might have already been destroyed.
- *
- * @param _id id of atom to remove
- */
-void GLMoleculeObject_molecule::atomRemoved(ObservedValue_Index_t _id)
-{
-  LOG(3, "INFO: GLMoleculeObject_molecule: Received signal atomRemoved for atom "+toString(_id)+".");
-  // bonds are removed by signal coming from ~bond
-
-  // remove atoms
-  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
-  ASSERT(iter != AtomsinSceneMap.end(),
-      "GLMoleculeObject_molecule::atomRemoved() - atom "+toString(_id)+" not on display.");
-  GLMoleculeObject_atom *atomObject = iter->second;
-  AtomsinSceneMap.erase(iter);
-  atomObject->disconnect();
-  delete atomObject;
-
-  emit changed();
-  emit changeOccured();
-
-  if (AtomsinSceneMap.empty())
-    emit moleculeEmptied(ObservedMolecule);
-}
-
-void GLMoleculeObject_molecule::hoverChangedSignalled(GLMoleculeObject *ob)
-{
-  // Find the atom, ob corresponds to.
-  hoverAtomId = -1;
-  GLMoleculeObject_atom *atomObject = dynamic_cast<GLMoleculeObject_atom *>(ob);
-  if (atomObject){
-    for (AtomNodeMap::iterator iter = AtomsinSceneMap.begin();iter != AtomsinSceneMap.end(); ++ iter){
-      if (iter->second == atomObject)
-        hoverAtomId = iter->second->objectId();
-    }
-
-    // Propagate signal.
-    emit hoverChanged(hoverAtomId);
-  } else {
-    // Find the atom, ob corresponds to.
-    GLMoleculeObject_molecule *moleculeObject = dynamic_cast<GLMoleculeObject_molecule *>(ob);
-    if (moleculeObject == this){
-      // Propagate signal.
-      emit hoverChanged(ObservedMolecule->getMolIndex(), 0);
-    }
-  }
-}
-
-/** Adds a bond to the scene.
- *
- * @param _bond bond to add
- */
-void GLMoleculeObject_molecule::bondInserted(
-    QtObservedBond::ptr _bond)
-{
-  static const std::vector< GLMoleculeObject_bond::SideOfBond > bondsides =
-      boost::assign::list_of<GLMoleculeObject_bond::SideOfBond>
-          (GLMoleculeObject_bond::left)
-          (GLMoleculeObject_bond::right);
-  LOG(3, "INFO: GLWorldScene::bondInserted() - Adding bonds " << _bond->getBondIndex());
-  //LOG(4, "INFO: Currently present bonds " << BondsinSceneMap << ".");
-
-  const ObservedValue_Index_t bondid = _bond->getIndex();
-  const std::pair<BondNodeMap::iterator, BondNodeMap::iterator> iters =
-      BondsinSceneMap.equal_range(bondid);
-  if (iters.first == iters.second) {
-    for (size_t i=0;i<2;++i) {
-      GLMoleculeObject_bond * bondObject =
-          new GLMoleculeObject_bond(GLMoleculeObject::meshCylinder, this, _bond, bondsides[i]);
-      connect (bondObject, SIGNAL(changed()), this, SIGNAL(changed()));
-      BondsinSceneMap.insert( std::make_pair(bondid, bondObject) );
-    }
-  } else {
-    for (BondNodeMap::iterator iter = iters.first; iter != iters.second; ++iter) {
-      iter->second->resetPosition();
-      iter->second->resetWidth();
-    }
-  }
-  emit changed();
-  emit changeOccured();
-}
-
-/** Removes a bond from the scene.
- *
- * @param _bond bond to remove
- */
-void GLMoleculeObject_molecule::bondRemoved(ObservedValue_Index_t _id)
-{
-  LOG(3, "INFO: GLWorldScene::bondRemoved() - Removing bond to id " << _id);
-  {
-    // left bond
-    const std::pair<BondNodeMap::iterator, BondNodeMap::iterator> iters =
-        BondsinSceneMap.equal_range(_id);
-    for (BondNodeMap::iterator iter = iters.first; iter != iters.second; ++iter) {
-      GLMoleculeObject_bond *bondObject = iter->second;
-      bondObject->disconnect();
-      delete bondObject; // is done by signal from bond itself
-      //LOG(4, "INFO: Still present bonds " << BondsinSceneMap << ".");
-    }
-    BondsinSceneMap.erase(_id);
-  }
-
-  emit changed();
-  emit changeOccured();
-}
-
 void GLMoleculeObject_molecule::setVisible(bool value)
 {
@@ -499,9 +328,2 @@
   return ost;
 }
-
-void GLMoleculeObject_molecule::wasClicked()
-{
-  LOG(4, "INFO: GLMoleculeObject_molecule: atom "
-      << ObservedMolecule->getMolIndex() << " has been clicked");
-  emit moleculeClicked(ObservedMolecule->getMolIndex());
-}
