Ignore:
Timestamp:
Jan 29, 2015, 7:37:57 AM (11 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, Candidate_v1.7.0, Candidate_v1.7.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:
27e464
Parents:
7b38d3 (diff), 4f2895 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'GUI_TesselatedLargeMolecules' into Candidate_v1.4.10

File:
1 edited

Legend:

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

    r7b38d3 r0ac85c3  
    7171  setOption(QGLView::ObjectPicking, true);
    7272  setOption(QGLView::CameraNavigation, false);
     73  setFocusPolicy(Qt::StrongFocus);
    7374  setCameraControlMode(Rotate);
    7475  defaultEyeSeparation = 4.0;
     
    7879  //changeMaterials(false);
    7980
    80   qRegisterMetaType<atomicNumber_t>("atomicNumber_t");
     81  qRegisterMetaType<atomId_t>("atomId_t");
     82  qRegisterMetaType<moleculeId_t>("moleculeId_t");
    8183
    8284  connect(this, SIGNAL(ShapeAdded()), worldscene, SLOT(addShape()));
     
    8587  connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
    8688  connect(worldscene, SIGNAL(changed()), this, SIGNAL(changed()));
    87   connect(worldscene, SIGNAL(hoverChanged(const atom *)), this, SLOT(sceneHoverSignalled(const atom *)));
    88   connect(this, SIGNAL(atomInserted(const atomicNumber_t)), worldscene, SLOT(atomInserted(const atomicNumber_t)));
    89   connect(this, SIGNAL(atomRemoved(const atomicNumber_t)), worldscene, SLOT(atomRemoved(const atomicNumber_t)));
     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)));
    9091  connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged()));
    91   connect(this, SIGNAL(moleculeRemoved(const molecule *)), worldscene, SLOT(moleculeRemoved(const molecule *)));
    92   //connect(this, SIGNAL(moleculeInserted(const molecule *)), worldscene, SLOT(moleculeInserted(const molecule *)));
     92  connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculeRemoved(const moleculeId_t)));
     93  connect(this, SIGNAL(moleculeInserted(const molecule *)), worldscene, SLOT(moleculeInserted(const molecule *)));
    9394  //connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    9495  connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
     96  connect(this, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), worldscene, SLOT(moleculesVisibilityChanged(const moleculeId_t,bool)));
    9597
    9698  // sign on to changes in the world
    9799  World::getInstance().signOn(this);
    98   World::getInstance().signOn(this, World::AtomInserted);
    99   World::getInstance().signOn(this, World::AtomRemoved);
    100100  World::getInstance().signOn(this, World::MoleculeInserted);
    101101  World::getInstance().signOn(this, World::MoleculeRemoved);
     
    338338  if (static_cast<World *>(publisher) == World::getPointer()) {
    339339    switch (notification->getChannelNo()) {
    340       case World::AtomInserted:
    341       {
    342         const atomicNumber_t _id = World::getInstance().lastChanged<atom>()->getId();
    343   #ifdef LOG_OBSERVER
    344         observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been inserted.";
    345   #endif
    346         emit atomInserted(_id);
    347         break;
    348       }
    349       case World::AtomRemoved:
    350       {
    351         const atomicNumber_t _id = World::getInstance().lastChanged<atom>()->getId();
    352   #ifdef LOG_OBSERVER
    353         observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been removed.";
    354   #endif
    355         emit atomRemoved(_id);
    356         break;
    357       }
    358340      case World::SelectionChanged:
    359341      {
     
    366348      case World::MoleculeInserted:
    367349      {
    368         const molecule *_molecule = World::getInstance().lastChanged<molecule>();
     350        const molecule * _mol = World::getInstance().lastChanged<molecule>();
    369351  #ifdef LOG_OBSERVER
    370         observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_molecule->getId())+" has been removed.";
     352        observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_mol->getId())+" has been removed.";
    371353  #endif
    372         emit moleculeInserted(_molecule);
     354        emit moleculeInserted(_mol);
    373355        break;
    374356      }
    375357      case World::MoleculeRemoved:
    376358      {
    377         const molecule *_molecule = World::getInstance().lastChanged<molecule>();
     359        const moleculeId_t _id = World::getInstance().lastChanged<molecule>()->getId();
    378360  #ifdef LOG_OBSERVER
    379         observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_molecule->getId())+" has been removed.";
     361        observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_id)+" has been removed.";
    380362  #endif
    381         emit moleculeRemoved(_molecule);
     363        emit moleculeRemoved(_id);
    382364        break;
    383365      }
     
    518500void GLWorldView::keyPressEvent(QKeyEvent *e)
    519501{
     502  // Find the distance between the eye and focus point.
     503  QVector3D d = camera()->eye() - camera()->center();
     504//  LOG(1, "Distance vector eye and center is "
     505//      << d.x() << "," << d.y() << "," << d.z());
     506  // scale the move unit by the eye <-> domain center distance
     507  const double key_move_unit = 0.04*(d.length()/50.);
     508
    520509  if (e->key() == Qt::Key_Tab) {
    521510    // The Tab key turns the ShowPicking option on and off,
     
    523512    setOption(QGLView::ShowPicking, ((options() & QGLView::ShowPicking) == 0));
    524513    updateGL();
     514  } else if ((e->key() == Qt::Key_Minus) || (e->key() == Qt::Key_Plus)) {
     515    // Scale the distance.
     516    if (e->key() == Qt::Key_Minus)
     517      d *= 1.2;
     518    else if (e->key() == Qt::Key_Plus)
     519      d /= 1.2;
     520    // Set new eye position.
     521    camera()->setEye(camera()->center() + d);
     522  } else if ((e->key() == Qt::Key_Left) || (e->key() == Qt::Key_Right)) {
     523    // Translate the camera.
     524    const double d = (e->key() == Qt::Key_Left) ? -key_move_unit : key_move_unit;
     525    camera()->translateCenter( d, 0., 0);
     526    camera()->translateEye( d, 0., 0);
     527  } else if ((e->key() == Qt::Key_Up) || (e->key() == Qt::Key_Down)) {
     528    // Translate the camera.
     529    const double d = (e->key() == Qt::Key_Up) ? -key_move_unit : key_move_unit;
     530    camera()->translateCenter( 0., d, 0);
     531    camera()->translateEye( 0., d, 0);
     532  } else if ((e->key() == Qt::Key_PageUp) || (e->key() == Qt::Key_PageDown)) {
     533    // Translate the camera.
     534    const double d = (e->key() == Qt::Key_PageUp) ? -key_move_unit : key_move_unit;
     535    camera()->translateCenter( 0., 0., d);
     536    camera()->translateEye( 0., 0., d);
    525537  }
    526538  QGLView::keyPressEvent(e);
     
    750762}
    751763
    752 void GLWorldView::sceneHoverSignalled(const atom *_atom)
     764void GLWorldView::sceneHoverSignalled(const atom &_atom)
    753765{
    754766  emit hoverChanged(_atom);
    755767}
     768
     769void GLWorldView::sceneHoverSignalled(const molecule &_mol, int _i)
     770{
     771  emit hoverChanged(_mol, _i);
     772}
Note: See TracChangeset for help on using the changeset viewer.