Changeset 704d59


Ignore:
Timestamp:
Jun 23, 2015, 6:29:02 AM (10 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
69b434
Parents:
34641b
git-author:
Frederik Heber <heber@…> (05/22/15 20:18:58)
git-committer:
Frederik Heber <heber@…> (06/23/15 06:29:02)
Message:

Changed hoverChanged() from mol* to moleculeId_t.

  • also changed signatures for atom.
Location:
src/UIElements
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtMainWindow.cpp

    r34641b r704d59  
    154154  qRegisterMetaType<moleculeId_t>("moleculeId_t");
    155155
    156   connect(glWorldView,SIGNAL(hoverChanged(const atom&)), infoBox,SLOT(atomHover(const atom&)));
    157   connect(glWorldView,SIGNAL(hoverChanged(const molecule&, int)), infoBox,SLOT(moleculeHover(const molecule&)));
     156  connect(glWorldView,SIGNAL(hoverChanged(const atomId_t)), infoBox,SLOT(atomHover(const atomId_t)));
     157  connect(glWorldView,SIGNAL(hoverChanged(const moleculeId_t, int)), infoBox,SLOT(moleculeHover(const moleculeId_t)));
    158158  connect(moleculeList,SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), glWorldView, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)));
    159159}
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp

    r34641b r704d59  
    241241    switch (notification->getChannelNo()) {
    242242      case World::SelectionChanged:
    243         setSelected(World::getInstance().isSelected(_atom));
     243        if (_atom != NULL)
     244          setSelected(World::getInstance().isSelected(_atom));
    244245        break;
    245246      default:
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r34641b r704d59  
    5353#include "molecule.hpp"
    5454#include "Descriptors/AtomIdDescriptor.hpp"
     55#include "Descriptors/MoleculeIdDescriptor.hpp"
    5556#include "Element/element.hpp"
    5657#include "LinearAlgebra/Vector.hpp"
     
    6667#include "GLMoleculeObject_atom.hpp"
    6768
    68 static QGLSceneNode *createMoleculeMesh(const molecule *molref, QObject *parent)
    69 {
     69static QGLSceneNode *createMoleculeMesh(const moleculeId_t molid, QObject *parent)
     70{
     71  const molecule *molref = World::getInstance().getMolecule(MoleculeById(molid));
     72  if (molref == NULL) {
     73    ELOG(1, "Could not createMoleculeMesh, molecule with id " << molid << " already gone.");
     74    return NULL;
     75  }
    7076//  Shape shape = molref->getBoundingSphere();
    7177  double minradius = 2.; // TODO: set to maximum bond length value
     
    140146}
    141147
    142 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QObject *parent, const molecule *molref) :
    143   GLMoleculeObject(createMoleculeMesh(molref, parent), parent),
    144   Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())),
     148GLMoleculeObject_molecule::GLMoleculeObject_molecule(QObject *parent, const moleculeId_t molid) :
     149  GLMoleculeObject(createMoleculeMesh(molid, parent), parent),
     150  Observer(std::string("GLMoleculeObject_molecule")+toString(molid)),
    145151  isBoundingBoxUptodate(true),
    146152  isSignedOn(false),
    147   _molecule(molref),
     153  moleculeid(molid),
    148154  TesselationHullUptodate(true),
    149   hoverAtom(NULL)
     155  hoverAtomId(-1)
    150156{
    151157  // sign on as observer (obtain non-const instance before)
    152   _molecule->signOn(this, molecule::AtomInserted);
    153   _molecule->signOn(this, molecule::AtomRemoved);
    154   _molecule->signOn(this, molecule::AtomMoved);
    155   isSignedOn = true;
     158  const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
     159  if (_molecule != NULL) {
     160    _molecule->signOn(this, molecule::AtomInserted);
     161    _molecule->signOn(this, molecule::AtomRemoved);
     162    _molecule->signOn(this, molecule::AtomMoved);
     163    isSignedOn = true;
     164  } else {
     165    ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << moleculeid);
     166  }
    156167  /*molref->signOn(this, AtomObservable::IndexChanged);
    157168  molref->signOn(this, AtomObservable::PositionChanged);
     
    173184}
    174185
    175 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const molecule *molref) :
     186GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid) :
    176187  GLMoleculeObject(mesh, parent),
    177   Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())),
     188  Observer(std::string("GLMoleculeObject_molecule")+toString(molid)),
    178189  isBoundingBoxUptodate(true),
    179190  isSignedOn(false),
    180   _molecule(molref),
     191  moleculeid(molid),
    181192  TesselationHullUptodate(true),
    182   hoverAtom(NULL)
     193  hoverAtomId(-1)
    183194{
    184195  // sign on as observer (obtain non-const instance before)
    185   _molecule->signOn(this, molecule::AtomInserted);
    186   _molecule->signOn(this, molecule::AtomRemoved);
    187   _molecule->signOn(this, molecule::AtomMoved);
    188   isSignedOn = true;
     196  const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
     197  if (_molecule != NULL) {
     198    _molecule->signOn(this, molecule::AtomInserted);
     199    _molecule->signOn(this, molecule::AtomRemoved);
     200    _molecule->signOn(this, molecule::AtomMoved);
     201    isSignedOn = true;
     202  } else {
     203    ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << moleculeid);
     204  }
    189205  /*molref->signOn(this, AtomObservable::IndexChanged);
    190206  molref->signOn(this, AtomObservable::PositionChanged);
     
    209225{
    210226  if (isSignedOn) {
    211     _molecule->signOff(this, molecule::AtomInserted);
    212     _molecule->signOff(this, molecule::AtomRemoved);
    213     _molecule->signOff(this, molecule::AtomMoved);
     227    const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
     228    if (_molecule != NULL) {
     229      _molecule->signOff(this, molecule::AtomInserted);
     230      _molecule->signOff(this, molecule::AtomRemoved);
     231      _molecule->signOff(this, molecule::AtomMoved);
     232    } else {
     233      ELOG(1, "GLMoleculeObject_molecule cannot sign off, molecule with "
     234          << moleculeid << " has disappeared.");
     235    }
    214236  }
    215237  /*_atom->signOff(this, AtomObservable::IndexChanged);
     
    225247void GLMoleculeObject_molecule::init()
    226248{
     249  const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
     250  if (_molecule == NULL) {
     251    ELOG(1, "GLMoleculeObject_molecule cannot init, molecule with "
     252        << moleculeid << " has disappeared.");
     253    return;
     254  }
    227255  if (_molecule->begin() != _molecule->end()) {
    228256    int atomicid = -1;
     
    292320void GLMoleculeObject_molecule::reinit()
    293321{
     322  const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
     323  if (_molecule == NULL) {
     324    ELOG(1, "GLMoleculeObject_molecule cannot reinit, molecule with "
     325        << moleculeid << " has disappeared.");
     326    return;
     327  }
    294328  if (_molecule->getAtomCount() > 0) {
    295329    for (molecule::const_iterator atomiter = _molecule->begin();
     
    314348{
    315349  isBoundingBoxUptodate = true;
     350  const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
     351  if (_molecule == NULL) {
     352    ELOG(1, "GLMoleculeObject_molecule cannot updateBoundingBox, molecule with "
     353        << moleculeid << " has disappeared.");
     354    return;
     355  }
    316356  Shape shape = _molecule->getBoundingSphere();
    317357  Vector v = shape.getCenter();
     
    335375void GLMoleculeObject_molecule::recieveNotification(Observable *publisher, Notification_ptr notification)
    336376{
     377  const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid));
    337378  if (publisher == dynamic_cast<const Observable*>(_molecule)){
    338379    // notofication from atom
     
    387428    switch (notification->getChannelNo()) {
    388429      case World::SelectionChanged:
    389         setSelected(World::getInstance().isSelected(_molecule));
     430        if (_molecule != NULL) {
     431          setSelected(World::getInstance().isSelected(_molecule));
     432        } else {
     433          ELOG(1, "GLMoleculeObject_molecule cannot change selection, molecule with "
     434              << moleculeid << " has disappeared.");
     435        }
    390436        break;
    391437      default:
     
    489535  LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(_id)+".");
    490536  GLMoleculeObject_atom *atomObject = new GLMoleculeObject_atom(GLMoleculeObject::meshSphere, this, _id);
     537  ASSERT( atomObject != NULL,
     538      "GLMoleculeObject_molecule::atomInserted - could not create atom object for "+toString(_id));
    491539  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
    492540  ASSERT(iter == AtomsinSceneMap.end(),
     
    512560  // add all bonds
    513561  const atom *Walker = World::getInstance().getAtom(AtomById(_id));
    514   addAtomBonds(Walker);
     562  if (Walker != NULL)
     563    addAtomBonds(Walker);
     564  else
     565    ELOG(1, "GLMoleculeObject_atom disappeared while about to add bonds.");
    515566
    516567  emit changeOccured();
     
    528579  // bonds are removed by signal coming from ~bond
    529580
    530   if (m_objectId == _id)
     581  if ((unsigned int)m_objectId == _id)
    531582    setObjectId(-1);
    532583
     
    536587      "GLWorldScene::atomRemoved() - atom "+toString(_id)+" not on display.");
    537588  GLMoleculeObject_atom *atomObject = iter->second;
     589  AtomsinSceneMap.erase(iter);
    538590  atomObject->disconnect();
    539   AtomsinSceneMap.erase(iter);
    540591  delete atomObject;
    541592
     
    548599{
    549600  // Find the atom, ob corresponds to.
    550   hoverAtom = NULL;
     601  hoverAtomId = -1;
    551602  GLMoleculeObject_atom *atomObject = dynamic_cast<GLMoleculeObject_atom *>(ob);
    552603  if (atomObject){
    553604    for (AtomNodeMap::iterator iter = AtomsinSceneMap.begin();iter != AtomsinSceneMap.end(); ++ iter){
    554605      if (iter->second == atomObject)
    555         hoverAtom = World::getInstance().getAtom(AtomById(iter->first));
     606        hoverAtomId = iter->first;
    556607    }
    557608
    558609    // Propagate signal.
    559     emit hoverChanged(*hoverAtom);
     610    emit hoverChanged(hoverAtomId);
    560611  } else {
    561612    // Find the atom, ob corresponds to.
     
    563614    if (moleculeObject == this){
    564615      // Propagate signal.
    565       emit hoverChanged(*_molecule, 0);
     616      emit hoverChanged(moleculeid, 0);
    566617    }
    567618  }
     
    653704{
    654705  if (!TesselationHullUptodate) {
    655     updateMesh(createMoleculeMesh(_molecule, parent()));
     706    updateMesh(createMoleculeMesh(moleculeid, parent()));
    656707    TesselationHullUptodate = true;
    657708  }
     
    666717void GLMoleculeObject_molecule::wasClicked()
    667718{
    668   LOG(4, "INFO: GLMoleculeObject_molecule: atom " << _molecule->getId() << " has been clicked");
    669   emit moleculeClicked(_molecule->getId());
    670 }
     719  LOG(4, "INFO: GLMoleculeObject_molecule: atom " << moleculeid << " has been clicked");
     720  emit moleculeClicked(moleculeid);
     721}
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    r34641b r704d59  
    3030  Q_OBJECT
    3131public:
    32   GLMoleculeObject_molecule(QObject *parent, const molecule *molref);
    33   GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const molecule *molref);
     32  GLMoleculeObject_molecule(QObject *parent, const moleculeId_t molid);
     33  GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid);
    3434  virtual ~GLMoleculeObject_molecule();
    3535
     
    5757  void changed();
    5858  void changeOccured();
    59   void hoverChanged(const atom&);
    60   void hoverChanged(const molecule&, int);
     59  void hoverChanged(const atomId_t);
     60  void hoverChanged(const moleculeId_t, int);
    6161  void atomClicked(atomId_t no);
    6262  void moleculeClicked(moleculeId_t no);
     
    9595  bool isSignedOn;
    9696
    97   const molecule *_molecule;
     97  const moleculeId_t moleculeid;
    9898
    9999  bool TesselationHullUptodate;
     
    104104  BondNodeMap BondsinSceneMap;
    105105
    106   const atom *hoverAtom;
     106  atomId_t hoverAtomId;
    107107};
    108108
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r34641b r704d59  
    275275
    276276  // add new object
    277   const molecule *_mol = World::getInstance().getMolecule(MoleculeById(_id));
    278   if (_mol != NULL) {
    279     GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(GLMoleculeObject::meshEmpty, this, _mol);
    280     MoleculesinSceneMap.insert( make_pair(_id, molObject) );
    281     connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
    282     connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured()));
    283     connect (molObject, SIGNAL(atomClicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
    284     connect (molObject, SIGNAL(moleculeClicked(moleculeId_t)), this, SLOT(moleculeClicked(moleculeId_t)));
    285     connect (molObject, SIGNAL(changeAtomId(GLMoleculeObject_atom *, int, int)), this, SLOT(changeAtomId(GLMoleculeObject_atom *, int, int)));
    286     connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    287     connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    288     connect (molObject, SIGNAL(hoverChanged(const atom &)), this, SIGNAL(hoverChanged(const atom &)));
    289     connect (molObject, SIGNAL(hoverChanged(const molecule &, int)), this, SIGNAL(hoverChanged(const molecule &, int)));
    290     emit changed();
    291     emit changeOccured();
    292   } else {
    293     // the molecule is already gone, we add it nonetheless as null object as
    294     // lateron moleculeRemoved wants to erase it.
    295     ELOG(1, "GLWorldScene::moleculeInserted() - added null object for not present mol id " << _id);
    296     GLMoleculeObject_molecule *molObject = NULL;
    297     MoleculesinSceneMap.insert( make_pair(_id, molObject) );
    298   }
     277  GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(GLMoleculeObject::meshEmpty, this, _id);
     278  ASSERT( molObject != NULL,
     279      "GLWorldScene::moleculeInserted - could not create molecule object for "+toString(_id));
     280  MoleculesinSceneMap.insert( make_pair(_id, molObject) );
     281  connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
     282  connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured()));
     283  connect (molObject, SIGNAL(atomClicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
     284  connect (molObject, SIGNAL(moleculeClicked(moleculeId_t)), this, SLOT(moleculeClicked(moleculeId_t)));
     285  connect (molObject, SIGNAL(changeAtomId(GLMoleculeObject_atom *, int, int)), this, SLOT(changeAtomId(GLMoleculeObject_atom *, int, int)));
     286  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     287  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
     288  connect (molObject, SIGNAL(hoverChanged(const atomId_t)), this, SIGNAL(hoverChanged(const atomId_t)));
     289  connect (molObject, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SIGNAL(hoverChanged(const moleculeId_t, int)));
     290  emit changed();
     291  emit changeOccured();
    299292}
    300293
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r34641b r704d59  
    7575  void clicked(atomId_t);
    7676  void doubleClicked();
    77   void hoverChanged(const atom &);
    78   void hoverChanged(const molecule &, int);
     77  void hoverChanged(const atomId_t);
     78  void hoverChanged(const moleculeId_t, int);
    7979
    8080private slots:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r34641b r704d59  
    8787  connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
    8888  connect(worldscene, SIGNAL(changed()), this, SIGNAL(changed()));
    89   connect(worldscene, SIGNAL(hoverChanged(const atom &)), this, SLOT(sceneHoverSignalled(const atom &)));
    90   connect(worldscene, SIGNAL(hoverChanged(const molecule &, int)), this, SLOT(sceneHoverSignalled(const molecule &, int)));
     89  connect(worldscene, SIGNAL(hoverChanged(const atomId_t)), this, SLOT(sceneHoverSignalled(const atomId_t)));
     90  connect(worldscene, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SLOT(sceneHoverSignalled(const moleculeId_t, int)));
    9191  connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged()));
    9292  connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculeRemoved(const moleculeId_t)));
     
    762762}
    763763
    764 void GLWorldView::sceneHoverSignalled(const atom &_atom)
    765 {
    766   emit hoverChanged(_atom);
    767 }
    768 
    769 void GLWorldView::sceneHoverSignalled(const molecule &_mol, int _i)
    770 {
    771   emit hoverChanged(_mol, _i);
    772 }
     764void GLWorldView::sceneHoverSignalled(const atomId_t _id)
     765{
     766  emit hoverChanged(_id);
     767}
     768
     769void GLWorldView::sceneHoverSignalled(const moleculeId_t _id, int _i)
     770{
     771  emit hoverChanged(_id, _i);
     772}
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r34641b r704d59  
    5151  void checkChanges();
    5252  void sceneChangeSignalled();
    53   void sceneHoverSignalled(const atom &_atom);
    54   void sceneHoverSignalled(const molecule &_mol, int);
     53  void sceneHoverSignalled(const atomId_t _id);
     54  void sceneHoverSignalled(const moleculeId_t _id, int);
    5555  void changeDreiBein();
    5656  void changeDomain();
     
    6262  void moleculeRemoved(const moleculeId_t _id);
    6363  void worldSelectionChanged();
    64   void hoverChanged(const atom &_atom);
    65   void hoverChanged(const molecule &_mol, int);
     64  void hoverChanged(const atomId_t _id);
     65  void hoverChanged(const moleculeId_t _id, int);
    6666  void ShapeAdded();
    6767  void ShapeRemoved();
Note: See TracChangeset for help on using the changeset viewer.