Ignore:
Timestamp:
Jan 10, 2015, 5:14:32 PM (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:
9a7ef9
Parents:
7b5984
git-author:
Frederik Heber <heber@…> (11/12/14 22:26:05)
git-committer:
Frederik Heber <heber@…> (01/10/15 17:14:32)
Message:

Hovering over molecules is working including update of QtInfoBox.

Location:
src/UIElements/Views/Qt4/Qt3D
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp

    r7b5984 r2b596f  
    166166   painter->modelViewMatrix().push();
    167167   painter->modelViewMatrix().translate(m_position);
     168   if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
     169     painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
    168170   if (m_rotationAngle != 0.0f)
    169171     painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);
    170    painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
    171172
    172173   // Apply the material and effect to the painter.
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r7b5984 r2b596f  
    133133  GLMoleculeObject(createMoleculeMesh(molref, parent), parent),
    134134  Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())),
     135  isBoundingBoxUptodate(true),
    135136  isSignedOn(false),
    136137  _molecule(molref),
     
    155156
    156157  init();
     158
     159  connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
     160  connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
    157161}
    158162
     
    160164  GLMoleculeObject(mesh, parent),
    161165  Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())),
     166  isBoundingBoxUptodate(true),
    162167  isSignedOn(false),
    163168  _molecule(molref),
     
    182187
    183188  init();
     189
     190  connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
     191  connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
    184192}
    185193
     
    204212{
    205213  if (_molecule->begin() != _molecule->end()) {
     214    int atomicid = -1;
    206215    for (molecule::const_iterator atomiter = _molecule->begin();
    207216        atomiter != _molecule->end();
    208217        atomiter++) {
    209218      // create atom objects in scene
    210       atomInserted((*atomiter)->getId());
     219      atomicid = (*atomiter)->getId();
     220      atomInserted(atomicid);
    211221
    212222      // create bond objects in scene
     
    221231      }
    222232    }
     233    // set id to one of the atom's as either mol or atoms is present at the same time
     234    setObjectId(atomicid);
    223235  }
    224236}
     
    287299void GLMoleculeObject_molecule::updateBoundingBox()
    288300{
     301  isBoundingBoxUptodate = true;
    289302  Shape shape = _molecule->getBoundingSphere();
    290303  Vector v = shape.getCenter();
     
    323336  #endif
    324337        TesselationHullUptodate = false;
     338        isBoundingBoxUptodate = false;
    325339        atomInserted(_id);
    326340        break;
     
    333347  #endif
    334348        TesselationHullUptodate = false;
     349        isBoundingBoxUptodate = false;
    335350        atomRemoved(_id);
    336351        break;
     
    338353      case molecule::AtomMoved:
    339354      {
     355  #ifdef LOG_OBSERVER
    340356        const atomId_t _id = _molecule->lastChanged()->getId();
    341   #ifdef LOG_OBSERVER
    342357        observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been inserted.";
    343358  #endif
    344359        TesselationHullUptodate = false;
     360        isBoundingBoxUptodate = false;
    345361        break;
    346362      }
     
    368384{
    369385  // Initialize all of the mesh objects that we have as children.
    370   GLMoleculeObject::initialize(view, painter);
     386  if (m_visible) {
     387    GLMoleculeObject::initialize(view, painter);
     388  } else {
    371389   foreach (QObject *obj, children()) {
    372390     GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
     
    374392         meshobj->initialize(view, painter);
    375393   }
     394  }
    376395}
    377396
     
    409428    m_mesh[0]->draw(painter);
    410429
    411     // Draw a box around the mesh, if selected.
    412     if (m_selected)
    413       drawSelectionBox(painter);
    414 
    415430    // Turn off the user effect, if present.
    416431    if (m_effect)
     
    431446        meshobj->draw(painter, cameraPlane);
    432447    }
     448
     449    // update bounding box prior to selection
     450    if (!isBoundingBoxUptodate)
     451      updateBoundingBox();
     452
     453    painter->modelViewMatrix().push();
     454    painter->modelViewMatrix().translate(m_position);
     455    if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
     456      painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
     457    if (m_rotationAngle != 0.0f)
     458      painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);
     459
     460    // Draw a box around the mesh, if selected.
     461    if (m_selected)
     462      drawSelectionBox(painter);
     463
     464    // Restore the modelview matrix.
     465    painter->modelViewMatrix().pop();
    433466  }
    434467}
     
    458491  connect (atomObject, SIGNAL(indexChanged(GLMoleculeObject_atom*, int, int)), this, SIGNAL(changeAtomId(GLMoleculeObject_atom*, int, int)));
    459492
    460   updateBoundingBox();
     493  isBoundingBoxUptodate = false;
     494
     495  if (m_objectId  == -1)
     496    setObjectId(_id);
    461497
    462498  //bondsChanged(_atom);
     
    474510  LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_id)+".");
    475511  // bonds are removed by signal coming from ~bond
     512
     513  if (m_objectId == _id)
     514    setObjectId(-1);
     515
    476516  // remove atoms
    477517  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
     
    483523  delete atomObject;
    484524
    485   updateBoundingBox();
     525  isBoundingBoxUptodate = false;
    486526
    487527  emit changeOccured();
     
    498538        hoverAtom = World::getInstance().getAtom(AtomById(iter->first));
    499539    }
    500   }
    501 
    502   // Propagate signal.
    503   emit hoverChanged(hoverAtom);
     540
     541    // Propagate signal.
     542    emit hoverChanged(*hoverAtom);
     543  } else {
     544    // Find the atom, ob corresponds to.
     545    GLMoleculeObject_molecule *moleculeObject = dynamic_cast<GLMoleculeObject_molecule *>(ob);
     546    if (moleculeObject == this){
     547      // Propagate signal.
     548      emit hoverChanged(*_molecule, 0);
     549    }
     550  }
    504551}
    505552
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    r7b5984 r2b596f  
    5757  void changed();
    5858  void changeOccured();
    59   void hoverChanged(const atom*);
     59  void hoverChanged(const atom&);
     60  void hoverChanged(const molecule&, int);
    6061  void atomClicked(atomId_t no);
    6162  void changeAtomId(GLMoleculeObject_atom *, int, int);
     
    8788  //!> states whether selection box is additionally drawn or not
    8889  bool isSelected;
     90  bool isBoundingBoxUptodate;
    8991
    9092  //!> whether we are signed on to the associated molecule
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r7b5984 r2b596f  
    262262  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    263263  connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    264   connect (molObject, SIGNAL(hoverChanged(const atom *)), this, SIGNAL(hoverChanged(const atom *)));
     264  connect (molObject, SIGNAL(hoverChanged(const atom &)), this, SIGNAL(hoverChanged(const atom &)));
     265  connect (molObject, SIGNAL(hoverChanged(const molecule &, int)), this, SIGNAL(hoverChanged(const molecule &, int)));
    265266  emit changed();
    266267  emit changeOccured();
     
    460461  molObject->atomInserted(oldId);
    461462}
    462 
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r7b5984 r2b596f  
    7575  void clicked(atomId_t);
    7676  void doubleClicked();
    77   void hoverChanged(const atom *);
     77  void hoverChanged(const atom &);
     78  void hoverChanged(const molecule &, int);
    7879
    7980private slots:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r7b5984 r2b596f  
    8686  connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
    8787  connect(worldscene, SIGNAL(changed()), this, SIGNAL(changed()));
    88   connect(worldscene, SIGNAL(hoverChanged(const atom *)), this, SLOT(sceneHoverSignalled(const atom *)));
     88  connect(worldscene, SIGNAL(hoverChanged(const atom &)), this, SLOT(sceneHoverSignalled(const atom &)));
     89  connect(worldscene, SIGNAL(hoverChanged(const molecule &, int)), this, SLOT(sceneHoverSignalled(const molecule &, int)));
    8990  connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged()));
    9091  connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculeRemoved(const moleculeId_t)));
     
    730731}
    731732
    732 void GLWorldView::sceneHoverSignalled(const atom *_atom)
     733void GLWorldView::sceneHoverSignalled(const atom &_atom)
    733734{
    734735  emit hoverChanged(_atom);
    735736}
     737
     738void GLWorldView::sceneHoverSignalled(const molecule &_mol, int _i)
     739{
     740  emit hoverChanged(_mol, _i);
     741}
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r7b5984 r2b596f  
    5151  void checkChanges();
    5252  void sceneChangeSignalled();
    53   void sceneHoverSignalled(const atom *_atom);
     53  void sceneHoverSignalled(const atom &_atom);
     54  void sceneHoverSignalled(const molecule &_mol, int);
    5455  void changeDreiBein();
    5556  void changeDomain();
     
    6162  void moleculeRemoved(const moleculeId_t _id);
    6263  void worldSelectionChanged();
    63   void hoverChanged(const atom *_atom);
     64  void hoverChanged(const atom &_atom);
     65  void hoverChanged(const molecule &_mol, int);
    6466  void ShapeAdded();
    6567  void ShapeRemoved();
Note: See TracChangeset for help on using the changeset viewer.