Changeset 704d59
- Timestamp:
- Jun 23, 2015, 6:29:02 AM (10 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:
- 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)
- Location:
- src/UIElements
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/QtMainWindow.cpp
r34641b r704d59 154 154 qRegisterMetaType<moleculeId_t>("moleculeId_t"); 155 155 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))); 158 158 connect(moleculeList,SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool)), glWorldView, SIGNAL(moleculesVisibilityChanged(const moleculeId_t,bool))); 159 159 } -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r34641b r704d59 241 241 switch (notification->getChannelNo()) { 242 242 case World::SelectionChanged: 243 setSelected(World::getInstance().isSelected(_atom)); 243 if (_atom != NULL) 244 setSelected(World::getInstance().isSelected(_atom)); 244 245 break; 245 246 default: -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r34641b r704d59 53 53 #include "molecule.hpp" 54 54 #include "Descriptors/AtomIdDescriptor.hpp" 55 #include "Descriptors/MoleculeIdDescriptor.hpp" 55 56 #include "Element/element.hpp" 56 57 #include "LinearAlgebra/Vector.hpp" … … 66 67 #include "GLMoleculeObject_atom.hpp" 67 68 68 static QGLSceneNode *createMoleculeMesh(const molecule *molref, QObject *parent) 69 { 69 static 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 } 70 76 // Shape shape = molref->getBoundingSphere(); 71 77 double minradius = 2.; // TODO: set to maximum bond length value … … 140 146 } 141 147 142 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QObject *parent, const molecule *molref) :143 GLMoleculeObject(createMoleculeMesh(mol ref, parent), parent),144 Observer(std::string("GLMoleculeObject_molecule")+toString(mol ref->getId())),148 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QObject *parent, const moleculeId_t molid) : 149 GLMoleculeObject(createMoleculeMesh(molid, parent), parent), 150 Observer(std::string("GLMoleculeObject_molecule")+toString(molid)), 145 151 isBoundingBoxUptodate(true), 146 152 isSignedOn(false), 147 _molecule(molref),153 moleculeid(molid), 148 154 TesselationHullUptodate(true), 149 hoverAtom (NULL)155 hoverAtomId(-1) 150 156 { 151 157 // 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 } 156 167 /*molref->signOn(this, AtomObservable::IndexChanged); 157 168 molref->signOn(this, AtomObservable::PositionChanged); … … 173 184 } 174 185 175 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const molecule *molref) :186 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid) : 176 187 GLMoleculeObject(mesh, parent), 177 Observer(std::string("GLMoleculeObject_molecule")+toString(mol ref->getId())),188 Observer(std::string("GLMoleculeObject_molecule")+toString(molid)), 178 189 isBoundingBoxUptodate(true), 179 190 isSignedOn(false), 180 _molecule(molref),191 moleculeid(molid), 181 192 TesselationHullUptodate(true), 182 hoverAtom (NULL)193 hoverAtomId(-1) 183 194 { 184 195 // 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 } 189 205 /*molref->signOn(this, AtomObservable::IndexChanged); 190 206 molref->signOn(this, AtomObservable::PositionChanged); … … 209 225 { 210 226 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 } 214 236 } 215 237 /*_atom->signOff(this, AtomObservable::IndexChanged); … … 225 247 void GLMoleculeObject_molecule::init() 226 248 { 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 } 227 255 if (_molecule->begin() != _molecule->end()) { 228 256 int atomicid = -1; … … 292 320 void GLMoleculeObject_molecule::reinit() 293 321 { 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 } 294 328 if (_molecule->getAtomCount() > 0) { 295 329 for (molecule::const_iterator atomiter = _molecule->begin(); … … 314 348 { 315 349 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 } 316 356 Shape shape = _molecule->getBoundingSphere(); 317 357 Vector v = shape.getCenter(); … … 335 375 void GLMoleculeObject_molecule::recieveNotification(Observable *publisher, Notification_ptr notification) 336 376 { 377 const molecule *_molecule = World::getInstance().getMolecule(MoleculeById(moleculeid)); 337 378 if (publisher == dynamic_cast<const Observable*>(_molecule)){ 338 379 // notofication from atom … … 387 428 switch (notification->getChannelNo()) { 388 429 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 } 390 436 break; 391 437 default: … … 489 535 LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(_id)+"."); 490 536 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)); 491 539 AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id); 492 540 ASSERT(iter == AtomsinSceneMap.end(), … … 512 560 // add all bonds 513 561 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."); 515 566 516 567 emit changeOccured(); … … 528 579 // bonds are removed by signal coming from ~bond 529 580 530 if ( m_objectId == _id)581 if ((unsigned int)m_objectId == _id) 531 582 setObjectId(-1); 532 583 … … 536 587 "GLWorldScene::atomRemoved() - atom "+toString(_id)+" not on display."); 537 588 GLMoleculeObject_atom *atomObject = iter->second; 589 AtomsinSceneMap.erase(iter); 538 590 atomObject->disconnect(); 539 AtomsinSceneMap.erase(iter);540 591 delete atomObject; 541 592 … … 548 599 { 549 600 // Find the atom, ob corresponds to. 550 hoverAtom = NULL;601 hoverAtomId = -1; 551 602 GLMoleculeObject_atom *atomObject = dynamic_cast<GLMoleculeObject_atom *>(ob); 552 603 if (atomObject){ 553 604 for (AtomNodeMap::iterator iter = AtomsinSceneMap.begin();iter != AtomsinSceneMap.end(); ++ iter){ 554 605 if (iter->second == atomObject) 555 hoverAtom = World::getInstance().getAtom(AtomById(iter->first));606 hoverAtomId = iter->first; 556 607 } 557 608 558 609 // Propagate signal. 559 emit hoverChanged( *hoverAtom);610 emit hoverChanged(hoverAtomId); 560 611 } else { 561 612 // Find the atom, ob corresponds to. … … 563 614 if (moleculeObject == this){ 564 615 // Propagate signal. 565 emit hoverChanged( *_molecule, 0);616 emit hoverChanged(moleculeid, 0); 566 617 } 567 618 } … … 653 704 { 654 705 if (!TesselationHullUptodate) { 655 updateMesh(createMoleculeMesh( _molecule, parent()));706 updateMesh(createMoleculeMesh(moleculeid, parent())); 656 707 TesselationHullUptodate = true; 657 708 } … … 666 717 void GLMoleculeObject_molecule::wasClicked() 667 718 { 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 30 30 Q_OBJECT 31 31 public: 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); 34 34 virtual ~GLMoleculeObject_molecule(); 35 35 … … 57 57 void changed(); 58 58 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); 61 61 void atomClicked(atomId_t no); 62 62 void moleculeClicked(moleculeId_t no); … … 95 95 bool isSignedOn; 96 96 97 const molecule *_molecule;97 const moleculeId_t moleculeid; 98 98 99 99 bool TesselationHullUptodate; … … 104 104 BondNodeMap BondsinSceneMap; 105 105 106 const atom *hoverAtom;106 atomId_t hoverAtomId; 107 107 }; 108 108 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r34641b r704d59 275 275 276 276 // 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(); 299 292 } 300 293 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r34641b r704d59 75 75 void clicked(atomId_t); 76 76 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); 79 79 80 80 private slots: -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r34641b r704d59 87 87 connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled())); 88 88 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))); 91 91 connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged())); 92 92 connect(this, SIGNAL(moleculeRemoved(const moleculeId_t)), worldscene, SLOT(moleculeRemoved(const moleculeId_t))); … … 762 762 } 763 763 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 } 764 void GLWorldView::sceneHoverSignalled(const atomId_t _id) 765 { 766 emit hoverChanged(_id); 767 } 768 769 void GLWorldView::sceneHoverSignalled(const moleculeId_t _id, int _i) 770 { 771 emit hoverChanged(_id, _i); 772 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r34641b r704d59 51 51 void checkChanges(); 52 52 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); 55 55 void changeDreiBein(); 56 56 void changeDomain(); … … 62 62 void moleculeRemoved(const moleculeId_t _id); 63 63 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); 66 66 void ShapeAdded(); 67 67 void ShapeRemoved();
Note:
See TracChangeset
for help on using the changeset viewer.