- Timestamp:
- Apr 6, 2012, 11:57:59 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:
- 53059e
- Parents:
- 1ce04b
- git-author:
- Michael Ankele <ankele@…> (04/04/12 14:00:53)
- git-committer:
- Frederik Heber <heber@…> (04/06/12 11:57:59)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp
r1ce04b r3927ef 97 97 painter->setFaceMaterial(QGL::AllFaces, m_selectionBoxMaterial); 98 98 QVector3DArray array; 99 qreal radius = 0.3f;99 qreal radius = 1.0; 100 100 array.append(-radius, -radius, -radius); array.append( radius, -radius, -radius); 101 101 array.append( radius, -radius, -radius); array.append( radius, radius, -radius); -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r1ce04b r3927ef 41 41 { 42 42 QGLBuilder builder; 43 builder << QGLSphere( 0.5);43 builder << QGLSphere(2.0); 44 44 QGLSceneNode *n = builder.finalizedSceneNode(); 45 45 n->setParent(parent); … … 114 114 radius = 0.5; 115 115 } 116 setScale( radius );116 setScale( radius / 4. ); 117 117 } 118 118 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r1ce04b r3927ef 60 60 molref->signOn(this, AtomObservable::ElementChanged); 61 61 molref->signOn(this, AtomObservable::BondsAdded);*/ 62 setMaterial(getMaterial(1)); 62 63 World::getInstance().signOn(this, World::SelectionChanged); 63 setPosition(QVector3D(0,0,0)); 64 setScale(5.0f); 65 setMaterial(getMaterial(1)); 64 Shape shape = _molecule->getBoundingShape(); 65 Vector v = shape.getCenter(); 66 setPosition(QVector3D(v[0], v[1], v[2])); 67 setScale(shape.getRadius() + 0.3); // getBoundingShape() only sees atoms as points, so make the box a bit bigger 66 68 } 67 69 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r1ce04b r3927ef 75 75 Runner != molecules.end(); 76 76 Runner++) { 77 78 // create molecule79 moleculeInserted(*Runner);80 77 81 78 for (molecule::const_iterator atomiter = (*Runner)->begin(); … … 140 137 } 141 138 142 /** Adds a molecule to the scene. 143 * 144 * @param _molecule molecule to add 145 */ 146 void GLWorldScene::moleculeInserted(const molecule*_molecule) 147 { 148 LOG(3, "INFO: GLWorldScene: Received signal moleculeInserted for atom "+toString(_molecule->getId())+"."); 149 GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(this, _molecule); 139 /** .... 140 * 141 */ 142 void GLWorldScene::worldSelectionChanged() 143 { 144 LOG(3, "INFO: GLWorldScene: Received signal selectionChanged."); 145 146 const std::vector<molecule*> &molecules = World::getInstance().getAllMolecules(); 147 148 if (molecules.size() > 0) { 149 for (std::vector<molecule*>::const_iterator Runner = molecules.begin(); 150 Runner != molecules.end(); 151 Runner++) { 152 153 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find((*Runner)->getId()); 154 bool isSelected = World::getInstance().isSelected(*Runner); 155 156 // molecule selected but not in scene? 157 if (isSelected && (iter == MoleculesinSceneMap.end())){ 158 // -> create new mesh 159 GLMoleculeObject_molecule *molObject = new GLMoleculeObject_molecule(this, *Runner); 160 MoleculesinSceneMap.insert( make_pair((*Runner)->getId(), molObject) ); 161 connect (molObject, SIGNAL(changed()), this, SIGNAL(changed())); 162 connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed())); 163 connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed())); 164 emit changed(); 165 emit changeOccured(); 166 } 167 168 // molecule not selected but in scene? 169 if (!isSelected && (iter != MoleculesinSceneMap.end())){ 170 // -> remove from scene 171 moleculeRemoved(*Runner); 172 } 173 174 } 175 } 176 } 177 178 /** Removes a molecule from the scene. 179 * 180 * @param _molecule molecule to remove 181 */ 182 void GLWorldScene::moleculeRemoved(const molecule *_molecule) 183 { 184 LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_molecule->getId())+"."); 150 185 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molecule->getId()); 151 ASSERT(iter == MoleculesinSceneMap.end(), 152 "GLWorldScene::moleculeInserted() - same molecule "+_molecule->getName()+" added again."); 153 MoleculesinSceneMap.insert( make_pair(_molecule->getId(), molObject) ); 154 connect (molObject, SIGNAL(changed()), this, SIGNAL(changed())); 155 connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed())); 156 connect (molObject, SIGNAL(selectionChanged()), this, SIGNAL(changed())); 157 emit changeOccured(); 158 } 159 160 /** Removes a molecule from the scene. 161 * 162 * @param _molecule molecule to remove 163 */ 164 void GLWorldScene::moleculeRemoved(const molecule *_molecule) 165 { 166 LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for atom "+toString(_molecule->getId())+"."); 167 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molecule->getId()); 168 ASSERT(iter != MoleculesinSceneMap.end(), 169 "GLWorldScene::moleculeRemoved() - molecule "+_molecule->getName()+" not on display."); 170 GLMoleculeObject_molecule *molObject = iter->second; 171 molObject->disconnect(); 172 MoleculesinSceneMap.erase(iter); 173 delete molObject; 174 emit changeOccured(); 186 187 // only remove if the molecule is in the scene 188 // (= is selected) 189 if (iter != MoleculesinSceneMap.end()){ 190 GLMoleculeObject_molecule *molObject = iter->second; 191 molObject->disconnect(); 192 MoleculesinSceneMap.erase(iter); 193 delete molObject; 194 emit changed(); 195 emit changeOccured(); 196 } 175 197 } 176 198 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r1ce04b r3927ef 72 72 void atomInserted(const atom *_atom); 73 73 void atomRemoved(const atom *_atom); 74 void moleculeInserted(const molecule *_molecule);75 74 void moleculeRemoved(const molecule *_molecule); 75 void worldSelectionChanged(); 76 76 void bondInserted(const bond *_bond, const GLMoleculeObject_bond::SideOfBond side); 77 77 void bondRemoved(const atomId_t leftnr, const atomId_t rightnr); -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r1ce04b r3927ef 42 42 connect(this, SIGNAL(atomInserted(const atom *)), worldscene, SLOT(atomInserted(const atom *))); 43 43 connect(this, SIGNAL(atomRemoved(const atom *)), worldscene, SLOT(atomRemoved(const atom *))); 44 connect(this, SIGNAL( moleculeInserted(const molecule *)), worldscene, SLOT(moleculeInserted(const molecule *)));44 connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged())); 45 45 connect(this, SIGNAL(moleculeRemoved(const molecule *)), worldscene, SLOT(moleculeRemoved(const molecule *))); 46 46 connect(this, SIGNAL(changed()), this, SLOT(updateGL())); … … 51 51 World::getInstance().signOn(this, World::AtomRemoved); 52 52 World::getInstance().signOn(this, World::AtomPositionChanged); 53 World::getInstance().signOn(this, World::MoleculeInserted);54 53 World::getInstance().signOn(this, World::MoleculeRemoved); 54 World::getInstance().signOn(this, World::SelectionChanged); 55 55 } 56 56 … … 61 61 World::getInstance().signOff(this, World::AtomRemoved); 62 62 World::getInstance().signOff(this, World::AtomPositionChanged); 63 World::getInstance().signOff(this, World::MoleculeInserted);64 63 World::getInstance().signOff(this, World::MoleculeRemoved); 64 World::getInstance().signOff(this, World::SelectionChanged); 65 65 delete worldscene; 66 66 } … … 115 115 break; 116 116 } 117 case World:: MoleculeInserted:117 case World::SelectionChanged: 118 118 { 119 const molecule *_molecule = World::getInstance().lastChanged<molecule>();120 119 #ifdef LOG_OBSERVER 121 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that molecule "+toString(_molecule->getId())+" has been inserted.";120 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that selection has changed."; 122 121 #endif 123 emit moleculeInserted(_molecule);122 emit worldSelectionChanged(); 124 123 break; 125 124 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r1ce04b r3927ef 47 47 void atomInserted(const atom *_atom); 48 48 void atomRemoved(const atom *_atom); 49 void moleculeInserted(const molecule *_molecule);50 49 void moleculeRemoved(const molecule *_molecule); 50 void worldSelectionChanged(); 51 51 52 52 protected: … … 59 59 60 60 bool changesPresent; 61 bool processingSelectionChanged; // workaround to prevent a loop in (atom_iterator <-> observer) 61 62 }; 62 63
Note:
See TracChangeset
for help on using the changeset viewer.