- Timestamp:
- Jan 10, 2015, 5:14:32 PM (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:
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r7b5984 r2b596f 133 133 GLMoleculeObject(createMoleculeMesh(molref, parent), parent), 134 134 Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())), 135 isBoundingBoxUptodate(true), 135 136 isSignedOn(false), 136 137 _molecule(molref), … … 155 156 156 157 init(); 158 159 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *))); 160 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed())); 157 161 } 158 162 … … 160 164 GLMoleculeObject(mesh, parent), 161 165 Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())), 166 isBoundingBoxUptodate(true), 162 167 isSignedOn(false), 163 168 _molecule(molref), … … 182 187 183 188 init(); 189 190 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *))); 191 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed())); 184 192 } 185 193 … … 204 212 { 205 213 if (_molecule->begin() != _molecule->end()) { 214 int atomicid = -1; 206 215 for (molecule::const_iterator atomiter = _molecule->begin(); 207 216 atomiter != _molecule->end(); 208 217 atomiter++) { 209 218 // create atom objects in scene 210 atomInserted((*atomiter)->getId()); 219 atomicid = (*atomiter)->getId(); 220 atomInserted(atomicid); 211 221 212 222 // create bond objects in scene … … 221 231 } 222 232 } 233 // set id to one of the atom's as either mol or atoms is present at the same time 234 setObjectId(atomicid); 223 235 } 224 236 } … … 287 299 void GLMoleculeObject_molecule::updateBoundingBox() 288 300 { 301 isBoundingBoxUptodate = true; 289 302 Shape shape = _molecule->getBoundingSphere(); 290 303 Vector v = shape.getCenter(); … … 323 336 #endif 324 337 TesselationHullUptodate = false; 338 isBoundingBoxUptodate = false; 325 339 atomInserted(_id); 326 340 break; … … 333 347 #endif 334 348 TesselationHullUptodate = false; 349 isBoundingBoxUptodate = false; 335 350 atomRemoved(_id); 336 351 break; … … 338 353 case molecule::AtomMoved: 339 354 { 355 #ifdef LOG_OBSERVER 340 356 const atomId_t _id = _molecule->lastChanged()->getId(); 341 #ifdef LOG_OBSERVER342 357 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been inserted."; 343 358 #endif 344 359 TesselationHullUptodate = false; 360 isBoundingBoxUptodate = false; 345 361 break; 346 362 } … … 368 384 { 369 385 // 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 { 371 389 foreach (QObject *obj, children()) { 372 390 GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj); … … 374 392 meshobj->initialize(view, painter); 375 393 } 394 } 376 395 } 377 396 … … 409 428 m_mesh[0]->draw(painter); 410 429 411 // Draw a box around the mesh, if selected.412 if (m_selected)413 drawSelectionBox(painter);414 415 430 // Turn off the user effect, if present. 416 431 if (m_effect) … … 431 446 meshobj->draw(painter, cameraPlane); 432 447 } 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(); 433 466 } 434 467 } … … 458 491 connect (atomObject, SIGNAL(indexChanged(GLMoleculeObject_atom*, int, int)), this, SIGNAL(changeAtomId(GLMoleculeObject_atom*, int, int))); 459 492 460 updateBoundingBox(); 493 isBoundingBoxUptodate = false; 494 495 if (m_objectId == -1) 496 setObjectId(_id); 461 497 462 498 //bondsChanged(_atom); … … 474 510 LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_id)+"."); 475 511 // bonds are removed by signal coming from ~bond 512 513 if (m_objectId == _id) 514 setObjectId(-1); 515 476 516 // remove atoms 477 517 AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id); … … 483 523 delete atomObject; 484 524 485 updateBoundingBox();525 isBoundingBoxUptodate = false; 486 526 487 527 emit changeOccured(); … … 498 538 hoverAtom = World::getInstance().getAtom(AtomById(iter->first)); 499 539 } 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 } 504 551 } 505 552
Note:
See TracChangeset
for help on using the changeset viewer.