Index: src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp	(revision 4a187da588168135074399b9ba5c32060010ab65)
+++ src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp	(revision f91ef6007a43260154696025a6213300e1067126)
@@ -95,12 +95,10 @@
   connect(board, SIGNAL(moleculeInserted(QtObservedMolecule::ptr)),
       this, SLOT(moleculeSignOn(QtObservedMolecule::ptr)), Qt::DirectConnection);
-  connect(board, SIGNAL(moleculeRemoved(const moleculeId_t)),
-      this, SLOT(moleculeSignOff(const moleculeId_t)), Qt::DirectConnection);
-  connect(board, SIGNAL(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)),
-      this, SLOT(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)));
+  connect(board, SIGNAL(moleculeRemoved(ObservedValue_Index_t)),
+      this, SLOT(moleculeSignOff(ObservedValue_Index_t)), Qt::DirectConnection);
   connect(board, SIGNAL(atomInserted(QtObservedAtom::ptr)),
       this, SLOT(atomInserted(QtObservedAtom::ptr)));
-  connect(board, SIGNAL(atomRemoved(const atomId_t)),
-      this, SLOT(atomRemoved(const atomId_t)));
+  connect(board, SIGNAL(atomRemoved(ObservedValue_Index_t)),
+      this, SLOT(atomRemoved(ObservedValue_Index_t)));
   connect(this, SIGNAL(insertMolecule(QtObservedMolecule::ptr)),
       this, SLOT(moleculeInserted(QtObservedMolecule::ptr)) );
@@ -164,11 +162,9 @@
 void GLWorldScene::atomInserted(QtObservedAtom::ptr _atom)
 {
-  const atomId_t atomid = _atom->getAtomIndex();
+  const ObservedValue_Index_t atomid = _atom->getIndex();
   ASSERT( QtObservedAtomMap.find(atomid) == QtObservedAtomMap.end(),
-      "GLWorldScene::AtomInserted() - atom with id "+toString(atomid)
+      "GLWorldScene::AtomInserted() - atom with id "+toString(_atom->getAtomIndex())
       +" is already present in QtObservedAtomMap.");
   QtObservedAtomMap[atomid] = _atom;
-  connect(_atom.get(), SIGNAL(indexChanged(const atomId_t,const atomId_t)),
-      this, SLOT(atomIndexChanged(const atomId_t,const atomId_t)) );
 }
 
@@ -179,5 +175,5 @@
  * @param _atom atom to remove
  */
-void GLWorldScene::atomRemoved(const atomId_t _atomid)
+void GLWorldScene::atomRemoved(ObservedValue_Index_t _atomid)
 {
   const QtObservedAtomMap_t::iterator eraseiter = QtObservedAtomMap.find(_atomid);
@@ -185,6 +181,4 @@
       "GLWorldScene::AtomRemoved() - atom with id "+toString(_atomid)
       +" is not present in QtObservedAtomMap.");
-  disconnect(eraseiter->second.get(), SIGNAL(indexChanged(const atomId_t,const atomId_t)),
-      this, SLOT(atomIndexChanged(const atomId_t,const atomId_t)) );
   QtObservedAtomMap.erase(eraseiter);
 }
@@ -196,6 +190,5 @@
 void GLWorldScene::moleculesAtomInserted(QtObservedAtom::ptr _atom, QtObservedMolecule * _mol)
 {
-  const atomId_t atomid = _atom->getAtomIndex();
-  QtObservedMolecule* const atommol = _atom->getAtomMolecule();
+  const ObservedValue_Index_t atomid = _atom->getIndex();
   // this ASSERT cannot work: The same molecule may get reassigned to a different
   // molecule, when e.g. the time step changes (which triggers an update-molecules).
@@ -206,6 +199,6 @@
 //      +" claims to belong to QtObservedMolecule "+toString(atommol)
 //      +" but signal came from QtObservedMolecule "+toString(_mol)+".");
-  LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(atomid)+".");
-  const moleculeId_t molid = _mol->getMolIndex();
+  LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom " << _atom->getAtomIndex());
+  const ObservedValue_Index_t molid = _mol->getIndex();
 
   // check of molecule is already present
@@ -219,5 +212,6 @@
     QtObservedMolecule::ptr &checkmol = moliter->second->ObservedMolecule;
     if (checkmol.get() == _mol) {
-      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomInserted for atom "+toString(atomid)+".");
+      LOG(3, "INFO: GLWorldScene: Sending signal moleculesAtomInserted for atom "
+          << _atom->getAtomIndex());
       QMetaObject::invokeMethod(moliter->second,        // pointer to a QObject
                                 "atomInserted",       // member name (no parameters here)
@@ -254,8 +248,8 @@
         ASSERT( QtObservedAtomMap[atomid] == _atom,
             "GLWorldScene::moleculesAtomInserted() - atom "+toString(atomid)
-            +" inserted in molecule "+toString(molid)
+            +" inserted in molecule "+toString(_mol->getMolIndex())
             +" which does not match atom in QtObservedAtomMap.");
-        LOG(3, "INFO: GLWorldScene: Placing atomInserted for atom " << atomid
-             << " and molecule " << molid << " into missed state map.");
+        LOG(3, "INFO: GLWorldScene: Placing atomInserted for atom " << _atom->getAtomIndex()
+             << " and molecule " << _mol->getMolIndex() << " into missed state map.");
       }
     }
@@ -267,9 +261,9 @@
  * @param _atomid atom to remove
  */
-void GLWorldScene::moleculesAtomRemoved(const atomId_t _atomid, QtObservedMolecule * _mol)
+void GLWorldScene::moleculesAtomRemoved(ObservedValue_Index_t _atomid, QtObservedMolecule * _mol)
 {
   LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+".");
 
-  const moleculeId_t molid = _mol->getMolIndex();
+  const ObservedValue_Index_t molid = _mol->getIndex();
   // check of molecule is already present
   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
@@ -282,5 +276,5 @@
                                 "atomRemoved",       // member name (no parameters here)
                                 Qt::QueuedConnection,     // connection type
-                                Q_ARG(const atomId_t, _atomid));     // parameters
+                                Q_ARG(ObservedValue_Index_t, _atomid));     // parameters
     } else {
       // relay atomRemoved to GLMoleculeObject_molecule in RemovedMolecules
@@ -301,5 +295,5 @@
                                 "atomRemoved",       // member name (no parameters here)
                                 Qt::QueuedConnection,     // connection type
-                                Q_ARG(const atomId_t, _atomid));     // parameters
+                                Q_ARG(ObservedValue_Index_t, _atomid));     // parameters
     }
   } else {
@@ -319,5 +313,5 @@
                                 "atomRemoved",       // member name (no parameters here)
                                 Qt::QueuedConnection,     // connection type
-                                Q_ARG(const atomId_t, _atomid));     // parameters
+                                Q_ARG(ObservedValue_Index_t, _atomid));     // parameters
     } else {
       boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex);
@@ -341,30 +335,26 @@
   connect(_mol.get(), SIGNAL(atomInserted(QtObservedAtom::ptr, QtObservedMolecule *)),
       this, SLOT(moleculesAtomInserted(QtObservedAtom::ptr, QtObservedMolecule *)) );
-  connect(_mol.get(), SIGNAL(atomRemoved(const atomId_t, QtObservedMolecule *)),
-      this, SLOT(moleculesAtomRemoved(const atomId_t, QtObservedMolecule *)) );
-  const moleculeId_t molid = _mol->getMolIndex();
+  connect(_mol.get(), SIGNAL(atomRemoved(ObservedValue_Index_t, QtObservedMolecule *)),
+      this, SLOT(moleculesAtomRemoved(ObservedValue_Index_t, QtObservedMolecule *)) );
+  const ObservedValue_Index_t molid = _mol->getIndex();
   ASSERT( QtObservedMoleculeMap.find(molid) == QtObservedMoleculeMap.end(),
-      "GLWorldScene::moleculeSignOn() - molecule with id "+toString(molid)
+      "GLWorldScene::moleculeSignOn() - molecule with id "+toString(_mol->getMolIndex())
       +" is already present in QtObservedMoleculeMap.");
   QtObservedMoleculeMap[molid] = _mol;
-  connect(_mol.get(), SIGNAL(indexChanged(const moleculeId_t,const moleculeId_t)),
-      this, SLOT(moleculeIndexChanged(const moleculeId_t,const moleculeId_t)) );
-
-  LOG(3, "INFO: GLWorldScene: Received signal moleculeSignOn for molecule "+toString(molid)+".");
+
+  LOG(3, "INFO: GLWorldScene: Received signal moleculeSignOn for molecule " << _mol->getMolIndex());
 
   emit insertMolecule(_mol);
 }
 
-void GLWorldScene::moleculeSignOff(const moleculeId_t _id)
+void GLWorldScene::moleculeSignOff(ObservedValue_Index_t _id)
 {
   const QtObservedMoleculeMap_t::iterator eraseiter = QtObservedMoleculeMap.find(_id);
   ASSERT( eraseiter != QtObservedMoleculeMap.end(),
       "GLWorldScene::moleculeSignOff() - cannot find id "+toString(_id)+" in map.");
-  disconnect(eraseiter->second.get(), SIGNAL(indexChanged(const moleculeId_t,const moleculeId_t)),
-      this, SLOT(moleculeIndexChanged(const moleculeId_t,const moleculeId_t)) );
   QtObservedMolecule * mol = eraseiter->second.get();
   QtObservedMoleculeMap.erase(eraseiter);
 
-  LOG(3, "INFO: GLWorldScene: Received signal moleculeSignOff for molecule "+toString(_id)+".");
+  LOG(3, "INFO: GLWorldScene: Received signal moleculeSignOff for molecule " << mol->getMolIndex());
 
   emit removeMolecule(mol);
@@ -379,6 +369,7 @@
   ASSERT (_mol,
       "GLWorldScene::moleculeInserted() - received shared_ptr for molecule is empty?");
-  const moleculeId_t molid = _mol->getMolIndex();
-  LOG(3, "INFO: GLWorldScene: Received signal moleculeInserted for molecule "+toString(molid)+".");
+  const ObservedValue_Index_t molid = _mol->getIndex();
+  LOG(3, "INFO: GLWorldScene: Received signal moleculeInserted for molecule "
+      << _mol->getMolIndex());
 
   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
@@ -386,8 +377,9 @@
   MoleculeNodeMap::const_iterator iter = MoleculesinSceneMap.find(molid);
   ASSERT( iter == MoleculesinSceneMap.end(),
-      "GLWorldScene::moleculeInserted() - molecule's id "+toString(molid)+" already present.");
+      "GLWorldScene::moleculeInserted() - molecule's id "+toString(_mol->getMolIndex())
+      +" already present.");
 
   // add new object
-  LOG(1, "DEBUG: Adding GLMoleculeObject_molecule to id " << molid);
+  LOG(1, "DEBUG: Adding GLMoleculeObject_molecule to id " << _mol->getMolIndex());
   GLMoleculeObject_molecule *molObject =
       new GLMoleculeObject_molecule(
@@ -397,5 +389,6 @@
           _mol);
   ASSERT( molObject != NULL,
-      "GLWorldScene::moleculeInserted - could not create molecule object for "+toString(molid));
+      "GLWorldScene::moleculeInserted - could not create molecule object for "
+      +toString(_mol->getMolIndex()));
 #ifndef NDEBUG
   std::pair<MoleculeNodeMap::iterator, bool> inserter =
@@ -403,5 +396,6 @@
   MoleculesinSceneMap.insert( make_pair(molid, molObject) );
   ASSERT(inserter.second,
-      "GLWorldScene::moleculeInserted() - molecule "+toString(molid)+" already present in scene.");
+      "GLWorldScene::moleculeInserted() - molecule "+toString(_mol->getMolIndex())
+      +" already present in scene.");
 
   // now handle all state changes that came up before the instantiation
@@ -494,5 +488,5 @@
 void GLWorldScene::moleculeRemoved(QtObservedMolecule* _mol)
 {
-  const moleculeId_t molid = _mol->getMolIndex();
+  const ObservedValue_Index_t molid = _mol->getIndex();
   LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(molid)+".");
 
@@ -501,10 +495,11 @@
   MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(molid);
   ASSERT ( iter != MoleculesinSceneMap.end(),
-      "GLWorldScene::moleculeRemoved() - to be removed molecule "+toString(molid)
+      "GLWorldScene::moleculeRemoved() - to be removed molecule "+toString(_mol->getMolIndex())
       +" is already gone.");
   // check if it's already empty
   const RemovedMoleculesMap_t::iterator emptyiter = EmptyMolecules.find(_mol);
   if (emptyiter != EmptyMolecules.end()) {
-    LOG(1, "DEBUG: Removing empty GLMoleculeObject_molecule to id " << molid << " from scene.");
+    LOG(1, "DEBUG: Removing empty GLMoleculeObject_molecule to id " << _mol->getMolIndex()
+        << " from scene.");
     // it's already empty, remove it
     ASSERT( emptyiter->second == iter->second,
@@ -512,5 +507,5 @@
         +toString(emptyiter->second)+" and removed molecule "
         +toString(iter->second)+" don't match.");
-    LOG(1, "DEBUG: Deleting already empty GLMoleculeObject_molecule to id " << molid);
+    LOG(1, "DEBUG: Deleting already empty GLMoleculeObject_molecule to id " << _mol->getMolIndex());
     GLMoleculeObject_molecule *molObject = emptyiter->second;
     EmptyMolecules.erase(emptyiter);
@@ -535,17 +530,18 @@
 void GLWorldScene::moleculeEmpty(QtObservedMolecule::ptr _mol)
 {
-  const moleculeId_t molid = _mol->getMolIndex();
-  LOG(3, "INFO: GLWorldScene: Received signal moleculeEmpty for molecule "+toString(molid)+".");
+  LOG(3, "INFO: GLWorldScene: Received signal moleculeEmpty for molecule "
+      +toString(_mol->getMolIndex())+".");
 
   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
 
+  const ObservedValue_Index_t molid = _mol->getIndex();
   MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(molid);
   if ( iter == MoleculesinSceneMap.end()) {
     RemovedMoleculesMap_t::iterator removeiter = RemovedMolecules.find(_mol.get());
     ASSERT ( removeiter != RemovedMolecules.end(),
-        "GLWorldScene::moleculeEmpty() - to be removed molecule "+toString(molid)
+        "GLWorldScene::moleculeEmpty() - to be removed molecule "+toString(_mol->getMolIndex())
         +" is neither in MoleculesinSceneMap, nor in RemovedMolecules.");
     // it's noted for removal already, remove it
-    LOG(1, "DEBUG: Deleting empty GLMoleculeObject_molecule to id " << molid);
+    LOG(1, "DEBUG: Deleting empty GLMoleculeObject_molecule to id " << _mol->getMolIndex());
     GLMoleculeObject_molecule *molObject = removeiter->second;
     RemovedMolecules.erase(removeiter);
@@ -567,54 +563,11 @@
 }
 
-void GLWorldScene::atomIndexChanged(const atomId_t _oldid, const atomId_t _newid)
-{
-  if (QtObservedAtomMap.count(_oldid)) {
-    const QtObservedAtom::ptr atom = QtObservedAtomMap[_oldid];
-    QtObservedAtomMap.erase(_oldid);
-    QtObservedAtomMap.insert( std::make_pair(_newid, atom) );
-  }
-}
-
-void GLWorldScene::moleculeIndexChanged(const moleculeId_t _oldid, const moleculeId_t _newid)
-{
-  {
-    QtObservedMoleculeMap_t::iterator const olditer = QtObservedMoleculeMap.find(_oldid);
-    ASSERT ( olditer != QtObservedMoleculeMap.end(),
-        "GLWorldScene::moleculeIndexChanged() - molecule "
-        +toString(_oldid)+" not present in QtObservedMoleculeMap.");
-#ifndef NDEBUG
-    QtObservedMoleculeMap_t::iterator const newiter = QtObservedMoleculeMap.find(_newid);
-    ASSERT ( newiter == QtObservedMoleculeMap.end(),
-        "GLWorldScene::moleculeIndexChanged() - molecule "
-        +toString(_newid)+" already present in QtObservedMoleculeMap.");
-#endif
-    const QtObservedMolecule::ptr mol = olditer->second;
-    QtObservedMoleculeMap.erase(olditer);
-    QtObservedMoleculeMap[_newid] = mol;
-  }
-  {
-    MoleculeNodeMap::iterator const olditer = MoleculesinSceneMap.find(_oldid);
-    if ( olditer != MoleculesinSceneMap.end()) {
-#ifndef NDEBUG
-      MoleculeNodeMap::iterator const newiter = MoleculesinSceneMap.find(_newid);
-      ASSERT ( newiter == MoleculesinSceneMap.end(),
-          "GLWorldScene::moleculeIndexChanged() - molecule "
-          +toString(_newid)+" already present in MoleculesinSceneMap.");
-#endif
-      LOG(1, "DEBUG: Changing GLMoleculeObject_molecule in MoleculesinSceneMapfrom "
-          << _oldid << " to id " << _newid);
-      GLMoleculeObject_molecule* const molObject = olditer->second;
-      MoleculesinSceneMap.erase(olditer);
-      MoleculesinSceneMap[_newid] = molObject;
-    }
-  }
-}
-
-void GLWorldScene::moleculesVisibilityChanged(const moleculeId_t _id, bool _visible)
+void GLWorldScene::moleculesVisibilityChanged(ObservedValue_Index_t _id, bool _visible)
 {
   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
   MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id);
   ASSERT( iter != MoleculesinSceneMap.end(),
-      "GLWorldScene::moleculeInserted() - molecule's id "+toString(_id)+" is unknown.");
+      "GLWorldScene::moleculeInserted() - molecule's id "
+      +toString(board->getMoleculeIdToIndex(_id))+" is unknown.");
 
   GLMoleculeObject_molecule *molObject = iter->second;
