Changeset 0ac85c3 for src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
- Timestamp:
- Jan 29, 2015, 7:37:57 AM (11 years ago)
- 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. - File:
-
- 1 edited
-
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r7b38d3 r0ac85c3 71 71 setOption(QGLView::ObjectPicking, true); 72 72 setOption(QGLView::CameraNavigation, false); 73 setFocusPolicy(Qt::StrongFocus); 73 74 setCameraControlMode(Rotate); 74 75 defaultEyeSeparation = 4.0; … … 78 79 //changeMaterials(false); 79 80 80 qRegisterMetaType<atomicNumber_t>("atomicNumber_t"); 81 qRegisterMetaType<atomId_t>("atomId_t"); 82 qRegisterMetaType<moleculeId_t>("moleculeId_t"); 81 83 82 84 connect(this, SIGNAL(ShapeAdded()), worldscene, SLOT(addShape())); … … 85 87 connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled())); 86 88 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))); 90 91 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 *))); 93 94 //connect(this, SIGNAL(changed()), this, SLOT(updateGL())); 94 95 connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled())); 96 connect(this, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), worldscene, SLOT(moleculesVisibilityChanged(const moleculeId_t,bool))); 95 97 96 98 // sign on to changes in the world 97 99 World::getInstance().signOn(this); 98 World::getInstance().signOn(this, World::AtomInserted);99 World::getInstance().signOn(this, World::AtomRemoved);100 100 World::getInstance().signOn(this, World::MoleculeInserted); 101 101 World::getInstance().signOn(this, World::MoleculeRemoved); … … 338 338 if (static_cast<World *>(publisher) == World::getPointer()) { 339 339 switch (notification->getChannelNo()) { 340 case World::AtomInserted:341 {342 const atomicNumber_t _id = World::getInstance().lastChanged<atom>()->getId();343 #ifdef LOG_OBSERVER344 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been inserted.";345 #endif346 emit atomInserted(_id);347 break;348 }349 case World::AtomRemoved:350 {351 const atomicNumber_t _id = World::getInstance().lastChanged<atom>()->getId();352 #ifdef LOG_OBSERVER353 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been removed.";354 #endif355 emit atomRemoved(_id);356 break;357 }358 340 case World::SelectionChanged: 359 341 { … … 366 348 case World::MoleculeInserted: 367 349 { 368 const molecule * _molecule= World::getInstance().lastChanged<molecule>();350 const molecule * _mol = World::getInstance().lastChanged<molecule>(); 369 351 #ifdef LOG_OBSERVER 370 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_mol ecule->getId())+" has been removed.";352 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that molecule "+toString(_mol->getId())+" has been removed."; 371 353 #endif 372 emit moleculeInserted(_mol ecule);354 emit moleculeInserted(_mol); 373 355 break; 374 356 } 375 357 case World::MoleculeRemoved: 376 358 { 377 const molecule *_molecule = World::getInstance().lastChanged<molecule>();359 const moleculeId_t _id = World::getInstance().lastChanged<molecule>()->getId(); 378 360 #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."; 380 362 #endif 381 emit moleculeRemoved(_ molecule);363 emit moleculeRemoved(_id); 382 364 break; 383 365 } … … 518 500 void GLWorldView::keyPressEvent(QKeyEvent *e) 519 501 { 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 520 509 if (e->key() == Qt::Key_Tab) { 521 510 // The Tab key turns the ShowPicking option on and off, … … 523 512 setOption(QGLView::ShowPicking, ((options() & QGLView::ShowPicking) == 0)); 524 513 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); 525 537 } 526 538 QGLView::keyPressEvent(e); … … 750 762 } 751 763 752 void GLWorldView::sceneHoverSignalled(const atom *_atom)764 void GLWorldView::sceneHoverSignalled(const atom &_atom) 753 765 { 754 766 emit hoverChanged(_atom); 755 767 } 768 769 void GLWorldView::sceneHoverSignalled(const molecule &_mol, int _i) 770 { 771 emit hoverChanged(_mol, _i); 772 }
Note:
See TracChangeset
for help on using the changeset viewer.
