Changeset 343a4b for src/UIElements/Views/Qt4
- Timestamp:
- Apr 6, 2012, 11:57:22 AM (13 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, 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:
- fbb1f1
- Parents:
- 8a77ac
- git-author:
- Michael Ankele <ankele@…> (03/29/12 12:37:44)
- git-committer:
- Frederik Heber <heber@…> (04/06/12 11:57:22)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
r8a77ac r343a4b 61 61 // sign on as observer (obtain non-const instance before) 62 62 _bond->signOn(this, BondObservable::BondRemoved); 63 64 Vector Position;65 Vector OtherPosition; 63 _bond->leftatom->signOn(this, AtomObservable::PositionChanged); 64 _bond->rightatom->signOn(this, AtomObservable::PositionChanged); 65 66 66 size_t elementno = 0; 67 67 switch (BondSide) { 68 68 case left: 69 Position = _bond->leftatom->getPosition();70 OtherPosition = _bond->rightatom->getPosition();71 69 if (_bond->leftatom->getType() != NULL) { 72 70 elementno = _bond->leftatom->getType()->getAtomicNumber(); … … 76 74 break; 77 75 case right: 78 Position = _bond->rightatom->getPosition();79 OtherPosition = _bond->leftatom->getPosition();80 76 if (_bond->rightatom->getType() != NULL) { 81 77 elementno = _bond->rightatom->getType()->getAtomicNumber(); … … 93 89 QGLMaterial *elementmaterial = getMaterial(elementno); 94 90 setMaterial(elementmaterial); 91 92 resetPosition(); 93 } 94 95 GLMoleculeObject_bond::~GLMoleculeObject_bond() 96 { 97 // sign on as observer (obtain non-const instance before) 98 _bond->signOff(this, BondObservable::BondRemoved); 99 _bond->leftatom->signOff(this, AtomObservable::PositionChanged); 100 _bond->rightatom->signOff(this, AtomObservable::PositionChanged); 101 102 LOG(2, "INFO: Destroying GLMoleculeObject_bond to bond " << *_bond << " and side " << BondSide << "."); 103 } 104 105 void GLMoleculeObject_bond::update(Observable *publisher) 106 { 107 #ifdef LOG_OBSERVER 108 observerLog().addMessage() << "++ Update of Observer " << observerLog().getName(this) << " from bond " << *_bond << "."; 109 #endif 110 } 111 112 void GLMoleculeObject_bond::subjectKilled(Observable *publisher) 113 { 114 LOG(2, "INFO: Received subjectKilled from " << *_bond << "."); 115 switch (BondSide) { 116 case left: 117 emit BondRemoved(_bond->leftatom->getId(), _bond->rightatom->getId()); 118 break; 119 case right: 120 emit BondRemoved(_bond->rightatom->getId(), _bond->leftatom->getId()); 121 break; 122 default: 123 ASSERT(0, 124 "GLMoleculeObject_bond::subjectKilled() - side is not a valid argument: "+toString(BondSide)+"."); 125 break; 126 } 127 delete this; 128 } 129 130 void GLMoleculeObject_bond::recieveNotification(Observable *publisher, Notification_ptr notification) 131 { 132 #ifdef LOG_OBSERVER 133 observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(this) 134 << " received notification from bond " << *_bond << " for channel " 135 << notification->getChannelNo() << "."; 136 #endif 137 if (publisher == dynamic_cast<const Observable*>(_bond)){ 138 // from the bond 139 switch (notification->getChannelNo()) { 140 case BondObservable::BondRemoved: 141 LOG(2, "INFO: Received notification of BondRemoved from " << *_bond << "."); 142 switch (BondSide) { 143 case left: 144 emit BondRemoved(_bond->leftatom->getId(), _bond->rightatom->getId()); 145 break; 146 case right: 147 emit BondRemoved(_bond->rightatom->getId(), _bond->leftatom->getId()); 148 break; 149 default: 150 ASSERT(0, 151 "GLMoleculeObject_bond::recieveNotification() - side is not a valid argument: "+toString(BondSide)+"."); 152 break; 153 } 154 delete this; 155 break; 156 default: 157 break; 158 } 159 }else{ 160 // from an atom 161 switch (notification->getChannelNo()) { 162 case AtomObservable::PositionChanged: 163 LOG(2, "INFO: Received notification of PositionChanged."); 164 resetPosition(); 165 } 166 } 167 } 168 169 void GLMoleculeObject_bond::resetPosition() 170 { 171 Vector Position; 172 Vector OtherPosition; 173 switch (BondSide) { 174 case left: 175 Position = _bond->leftatom->getPosition(); 176 OtherPosition = _bond->rightatom->getPosition(); 177 break; 178 case right: 179 Position = _bond->rightatom->getPosition(); 180 OtherPosition = _bond->leftatom->getPosition(); 181 break; 182 default: 183 ASSERT(0, 184 "GLMoleculeObject_bond::resetPosition() - side is not a valid argument: "+toString(BondSide)+"."); 185 break; 186 } 95 187 96 188 // calculate position … … 123 215 setRotationAngle(alpha/M_PI*180.); 124 216 } 125 126 GLMoleculeObject_bond::~GLMoleculeObject_bond()127 {128 // sign on as observer (obtain non-const instance before)129 _bond->signOff(this, BondObservable::BondRemoved);130 131 LOG(2, "INFO: Destroying GLMoleculeObject_bond to bond " << *_bond << " and side " << BondSide << ".");132 }133 134 void GLMoleculeObject_bond::update(Observable *publisher)135 {136 #ifdef LOG_OBSERVER137 observerLog().addMessage() << "++ Update of Observer " << observerLog().getName(this) << " from bond " << *_bond << ".";138 #endif139 }140 141 void GLMoleculeObject_bond::subjectKilled(Observable *publisher)142 {143 LOG(2, "INFO: Received subjectKilled from " << *_bond << ".");144 switch (BondSide) {145 case left:146 emit BondRemoved(_bond->leftatom->getId(), _bond->rightatom->getId());147 break;148 case right:149 emit BondRemoved(_bond->rightatom->getId(), _bond->leftatom->getId());150 break;151 default:152 ASSERT(0,153 "GLMoleculeObject_bond::subjectKilled() - side is not a valid argument: "+toString(BondSide)+".");154 break;155 }156 delete this;157 }158 159 void GLMoleculeObject_bond::recieveNotification(Observable *publisher, Notification_ptr notification)160 {161 #ifdef LOG_OBSERVER162 observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(this)163 << " received notification from bond " << *_bond << " for channel "164 << notification->getChannelNo() << ".";165 #endif166 switch (notification->getChannelNo()) {167 case BondObservable::BondRemoved:168 LOG(2, "INFO: Received notification of BondRemoved from " << *_bond << ".");169 switch (BondSide) {170 case left:171 emit BondRemoved(_bond->leftatom->getId(), _bond->rightatom->getId());172 break;173 case right:174 emit BondRemoved(_bond->rightatom->getId(), _bond->leftatom->getId());175 break;176 default:177 ASSERT(0,178 "GLMoleculeObject_bond::recieveNotification() - side is not a valid argument: "+toString(BondSide)+".");179 break;180 }181 delete this;182 break;183 default:184 break;185 }186 } -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp
r8a77ac r343a4b 40 40 41 41 private: 42 void resetPosition(); 42 43 const bond *_bond; 43 44 const enum SideOfBond BondSide; -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r8a77ac r343a4b 205 205 void GLWorldScene::draw(QGLPainter *painter) const 206 206 { 207 std::cout << "scene draw\n";208 207 // Draw all of the mesh objects that we have as children. 209 208 foreach (QObject *obj, children()) { -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r8a77ac r343a4b 102 102 case World::AtomPositionChanged: 103 103 { 104 std::cout << "view pos changed\n";105 104 const atom *_atom = World::getInstance().lastChanged<atom>(); 106 105 #ifdef LOG_OBSERVER
Note:
See TracChangeset
for help on using the changeset viewer.