Changeset 73b13c for src/UIElements/Views
- Timestamp:
- Jul 25, 2015, 1:01:44 PM (9 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:
- 9b56f0a
- Parents:
- 9737db
- git-author:
- Frederik Heber <heber@…> (06/17/15 16:59:19)
- git-committer:
- Frederik Heber <heber@…> (07/25/15 13:01:44)
- Location:
- src/UIElements/Views/Qt4/Qt3D
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r9737db r73b13c 156 156 hoverAtomId(-1) 157 157 { 158 setMaterial(getMaterial(1)); 159 updateBoundingBox(); 160 161 // initially, atoms and bonds should be visible 162 m_visible = false; 163 164 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *))); 165 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed())); 166 167 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked())); 168 } 169 170 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid) : 171 GLMoleculeObject(mesh, parent), 172 Observer(std::string("GLMoleculeObject_molecule")+toString(molid)), 173 isBoundingBoxUptodate(true), 174 isSignedOn(false), 175 moleculeid(molid), 176 TesselationHullUptodate(true), 177 hoverAtomId(-1) 178 { 179 setMaterial(getMaterial(1)); 180 updateBoundingBox(); 181 182 // initially, atoms and bonds should be visible 183 m_visible = false; 184 185 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *))); 186 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed())); 187 188 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked())); 189 } 190 191 GLMoleculeObject_molecule::~GLMoleculeObject_molecule() 192 { 193 if (isSignedOn) { 194 const molecule *_molecule = const_cast<const World &>(World::getInstance()). 195 getMolecule(MoleculeById(moleculeid)); 196 if (_molecule != NULL) { 197 _molecule->signOff(this, molecule::AtomInserted); 198 _molecule->signOff(this, molecule::AtomRemoved); 199 _molecule->signOff(this, molecule::AtomMoved); 200 } else { 201 ELOG(1, "GLMoleculeObject_molecule cannot sign off, molecule with " 202 << moleculeid << " has disappeared."); 203 } 204 } 205 /*_atom->signOff(this, AtomObservable::IndexChanged); 206 _atom->signOff(this, AtomObservable::PositionChanged); 207 _atom->signOff(this, AtomObservable::ElementChanged); 208 _atom->signOff(this, AtomObservable::BondsAdded);*/ 209 World::getInstance().signOff(this, World::SelectionChanged); 210 } 211 212 void GLMoleculeObject_molecule::activateObserver() 213 { 158 214 // sign on as observer (obtain non-const instance before) 159 215 const molecule *_molecule = const_cast<const World &>(World::getInstance()). … … 171 227 molref->signOn(this, AtomObservable::ElementChanged); 172 228 molref->signOn(this, AtomObservable::BondsAdded);*/ 173 setMaterial(getMaterial(1));174 229 World::getInstance().signOn(this, World::SelectionChanged); 175 updateBoundingBox();176 177 // initially, atoms and bonds should be visible178 m_visible = false;179 180 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));181 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));182 183 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked()));184 }185 186 GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const moleculeId_t molid) :187 GLMoleculeObject(mesh, parent),188 Observer(std::string("GLMoleculeObject_molecule")+toString(molid)),189 isBoundingBoxUptodate(true),190 isSignedOn(false),191 moleculeid(molid),192 TesselationHullUptodate(true),193 hoverAtomId(-1)194 {195 // sign on as observer (obtain non-const instance before)196 const molecule *_molecule = const_cast<const World &>(World::getInstance()).197 getMolecule(MoleculeById(moleculeid));198 if (_molecule != NULL) {199 _molecule->signOn(this, molecule::AtomInserted);200 _molecule->signOn(this, molecule::AtomRemoved);201 _molecule->signOn(this, molecule::AtomMoved);202 isSignedOn = true;203 } else {204 ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << moleculeid);205 }206 /*molref->signOn(this, AtomObservable::IndexChanged);207 molref->signOn(this, AtomObservable::PositionChanged);208 molref->signOn(this, AtomObservable::ElementChanged);209 molref->signOn(this, AtomObservable::BondsAdded);*/210 setMaterial(getMaterial(1));211 World::getInstance().signOn(this, World::SelectionChanged);212 updateBoundingBox();213 214 // initially, atoms and bonds should be visible215 m_visible = false;216 217 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));218 connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));219 220 connect( this, SIGNAL(clicked()), this, SLOT(wasClicked()));221 }222 223 GLMoleculeObject_molecule::~GLMoleculeObject_molecule()224 {225 if (isSignedOn) {226 const molecule *_molecule = const_cast<const World &>(World::getInstance()).227 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 }236 }237 /*_atom->signOff(this, AtomObservable::IndexChanged);238 _atom->signOff(this, AtomObservable::PositionChanged);239 _atom->signOff(this, AtomObservable::ElementChanged);240 _atom->signOff(this, AtomObservable::BondsAdded);*/241 World::getInstance().signOff(this, World::SelectionChanged);242 230 } 243 231 … … 534 522 AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id); 535 523 ASSERT(iter != AtomsinSceneMap.end(), 536 "GL WorldScene::atomRemoved() - atom "+toString(_id)+" not on display.");524 "GLMoleculeObject_molecule::atomRemoved() - atom "+toString(_id)+" not on display."); 537 525 GLMoleculeObject_atom *atomObject = iter->second; 538 526 AtomsinSceneMap.erase(iter); -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp
r9737db r73b13c 76 76 void setVisible(bool value); 77 77 78 void activateObserver(); 79 78 80 private: 79 81 void addAtomBonds( -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r9737db r73b13c 70 70 using namespace MoleCuilder; 71 71 72 GLWorldScene::GLWorldScene(QObject *parent) 73 : QObject(parent) 72 GLWorldScene::GLWorldScene(QObject *parent) : 73 QObject(parent), 74 selectionMode(SelectAtom) 74 75 { 75 76 int sphereDetails[] = {5, 3, 2, 0}; … … 228 229 LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "+toString(_atomid)+"."); 229 230 231 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 232 230 233 // check of molecule is already present 231 234 if (MoleculesinSceneMap.count(_molid) != 0) { … … 248 251 LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+"."); 249 252 253 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 254 250 255 // check of molecule is already present 251 256 if (MoleculesinSceneMap.count(_molid) != 0) { … … 276 281 MoleculesinSceneMap.insert( make_pair(_id, molObject) ); 277 282 278 // now handle all state changes that came up before the instantiation 279 if(MoleculeMissedStateMap.count(_id) != 0) {283 // now handle all state changes that came up before the instantiation7 284 while (MoleculeMissedStateMap.count(_id) != 0) { 280 285 ASSERT( !MoleculeMissedStateMap[_id].empty(), 281 286 "GLWorldScene::moleculeInserted() - we have an empty state change map for molecule with id " 282 287 +toString(_id)); 288 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 283 289 for (StateChangeMap_t::iterator iter = MoleculeMissedStateMap[_id].begin(); 284 290 !MoleculeMissedStateMap[_id].empty(); … … 297 303 "GLWorldScene::moleculeInserted() - more atomRemoved states than atomInserted for atom " 298 304 +toString(iter->first)); 299 if (StateChangeAmounts[atomInsertedState] > StateChangeAmounts[atomRemovedState]) 305 if (StateChangeAmounts[atomInsertedState] > StateChangeAmounts[atomRemovedState]) { 306 LOG(1, "INFO: invoking atomInserted for atom " << iter->first); 300 307 QMetaObject::invokeMethod(molObject, // pointer to a QObject 301 308 "atomInserted", // member name (no parameters here) 302 309 Qt::DirectConnection, // connection type 303 310 Q_ARG(const atomId_t, iter->first)); // parameters 311 } else { 312 LOG(1, "INFO: Atom " << iter->first << " has been inserted and removed already."); 313 } 304 314 } else { 305 315 // can only be an insertion … … 311 321 break; 312 322 case atomInsertedState: 323 LOG(1, "INFO: invoking atomInserted for atom " << iter->first); 313 324 QMetaObject::invokeMethod(molObject, // pointer to a QObject 314 325 "atomInserted", // member name (no parameters here) … … 329 340 } 330 341 342 // now let the molObject sign on to molecule 343 molObject->activateObserver(); 344 331 345 connect (molObject, SIGNAL(changed()), this, SIGNAL(changed())); 332 346 connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured())); … … 359 373 360 374 // remove any possible state changes left 361 MoleculeMissedStateMap.erase(_id); 375 { 376 boost::recursive_mutex::scoped_lock lock(MoleculeMissedStateMap_mutex); 377 MoleculeMissedStateMap.erase(_id); 378 } 362 379 363 380 emit changed(); -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r9737db r73b13c 19 19 20 20 #include <iosfwd> 21 22 #include <boost/thread/recursive_mutex.hpp> 21 23 22 24 #include "Bond/bond.hpp" … … 116 118 //!> map of all missed state changes 117 119 MoleculeMissedStateMap_t MoleculeMissedStateMap; 120 //!> flag to indicate whether state map is currently worked on 121 boost::recursive_mutex MoleculeMissedStateMap_mutex; 118 122 119 123 SelectionModeType selectionMode;
Note:
See TracChangeset
for help on using the changeset viewer.