Changeset 897a01 for src/UIElements/Qt4
- Timestamp:
- Apr 11, 2018, 6:29:56 AM (7 years ago)
- Branches:
- Candidate_v1.6.1, ChemicalSpaceEvaluator, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, TremoloParser_IncreasedPrecision
- Children:
- 8ac6d0e
- Parents:
- 8450da
- git-author:
- Frederik Heber <frederik.heber@…> (08/08/17 21:26:57)
- git-committer:
- Frederik Heber <frederik.heber@…> (04/11/18 06:29:56)
- Location:
- src/UIElements/Qt4/InstanceBoard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
r8450da r897a01 89 89 QtObservedAtom::AtomPositionChannels(1, AtomObservable::PositionChanged); 90 90 const Observable::channels_t 91 QtObservedAtom::AtomVelocityChannels(1, AtomObservable::VelocityChanged); 92 const Observable::channels_t 93 QtObservedAtom::AtomForceChannels(1, AtomObservable::ForceChanged); 94 const Observable::channels_t 91 95 QtObservedAtom::AtomSelectedChannels(1, AtomObservable::SelectionChanged); 92 96 … … 124 128 boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[AtomName])->noteCallBackIsGone(); 125 129 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomPosition])->noteCallBackIsGone(); 130 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomVelocity])->noteCallBackIsGone(); 131 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomForce])->noteCallBackIsGone(); 126 132 boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(ObservedValues[AtomSelected])->noteCallBackIsGone(); 127 133 … … 215 221 inline 216 222 #endif 223 Vector QtObservedAtom::updateVelocity( 224 const atom &_atom) 225 { 226 return _atom.getAtomicVelocity(); 227 } 228 229 #ifdef HAVE_INLINE 230 inline 231 #endif 232 Vector QtObservedAtom::updateForce( 233 const atom &_atom) 234 { 235 return _atom.getAtomicForce(); 236 } 237 238 #ifdef HAVE_INLINE 239 inline 240 #endif 217 241 bool QtObservedAtom::updateSelected( 218 242 const atom &_atom) … … 269 293 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>( 270 294 ObservedValues[AtomPosition])->forceUpdate(); 295 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>( 296 ObservedValues[AtomVelocity])->forceUpdate(); 297 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>( 298 ObservedValues[AtomForce])->forceUpdate(); 271 299 boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>( 272 300 ObservedValues[MoleculeRef])->forceUpdate(); 273 301 // then tell Qt part about updates 274 302 emit positionChanged(); 303 emit velocityChanged(); 304 emit forceChanged(); 275 305 emit moleculeChanged(); 276 306 } else { … … 296 326 case AtomObservable::PositionChanged: 297 327 emit positionChanged(); 328 break; 329 case AtomObservable::VelocityChanged: 330 emit velocityChanged(); 331 break; 332 case AtomObservable::ForceChanged: 333 emit forceChanged(); 298 334 break; 299 335 case AtomObservable::SelectionChanged: … … 362 398 const boost::function<Vector ()> AtomPositionUpdater( 363 399 boost::bind(&QtObservedAtom::updatePosition, boost::cref(*_atomref))); 400 const boost::function<Vector ()> AtomVelocityUpdater( 401 boost::bind(&QtObservedAtom::updateVelocity, boost::cref(*_atomref))); 402 const boost::function<Vector ()> AtomForceUpdater( 403 boost::bind(&QtObservedAtom::updateForce, boost::cref(*_atomref))); 364 404 const boost::function<bool ()> AtomSelectedUpdater( 365 405 boost::bind(&QtObservedAtom::updateSelected, boost::cref(*_atomref))); … … 401 441 AtomPositionUpdater(), 402 442 AtomPositionChannels, 443 _subjectKilled); 444 _ObservedValues[AtomVelocity] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>( 445 _atomref, 446 AtomVelocityUpdater, 447 "AtomVelocity_"+toString(_id), 448 AtomVelocityUpdater(), 449 AtomVelocityChannels, 450 _subjectKilled); 451 _ObservedValues[AtomForce] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>( 452 _atomref, 453 AtomForceUpdater, 454 "AtomForce_"+toString(_id), 455 AtomForceUpdater(), 456 AtomForceChannels, 403 457 _subjectKilled); 404 458 _ObservedValues[AtomSelected] = new ObservedValue_wCallback<bool, ObservedValue_Index_t>( … … 426 480 delete boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(_ObservedValues[AtomName]); 427 481 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomPosition]); 482 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomVelocity]); 483 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomForce]); 428 484 delete boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(_ObservedValues[AtomSelected]); 429 485 delete boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(_ObservedValues[MoleculeRef]); … … 463 519 } 464 520 521 const Vector& QtObservedAtom::getAtomVelocity() const 522 { 523 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomVelocity])->get(); 524 } 525 526 const Vector& QtObservedAtom::getAtomForce() const 527 { 528 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomForce])->get(); 529 } 530 465 531 const bool QtObservedAtom::getAtomSelected() const 466 532 { -
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp
r8450da r897a01 136 136 const Vector& getAtomPosition() const; 137 137 138 /** Getter to atom velocity contained in \a ObservedValues. 139 * 140 * \return atom's velocity 141 */ 142 const Vector& getAtomVelocity() const; 143 144 /** Getter to atom force contained in \a ObservedValues. 145 * 146 * \return atom's force 147 */ 148 const Vector& getAtomForce() const; 149 138 150 /** Getter to the observed state of the associated molecule. 139 151 * … … 155 167 void nameChanged(); 156 168 void positionChanged(); 169 void velocityChanged(); 170 void forceChanged(); 157 171 void atomRemoved(); 158 172 void selectedChanged(); … … 174 188 static std::string updateName(const atom &_atom); 175 189 static Vector updatePosition(const atom &_atom); 190 static Vector updateVelocity(const atom &_atom); 191 static Vector updateForce(const atom &_atom); 176 192 static bool updateSelected(const atom &_atom); 177 193 … … 188 204 //!> contains the current atom position 189 205 AtomPosition, 206 //!> contains the current atom velocity 207 AtomVelocity, 208 //!> contains the current atom force 209 AtomForce, 190 210 //!> contains the current atom's selection status 191 211 AtomSelected, … … 253 273 //!> list of channels when position needs to update 254 274 static const Observable::channels_t AtomPositionChannels; 275 //!> list of channels when velocity needs to update 276 static const Observable::channels_t AtomVelocityChannels; 277 //!> list of channels when force needs to update 278 static const Observable::channels_t AtomForceChannels; 255 279 //!> list of channels when selection needs to update 256 280 static const Observable::channels_t AtomSelectedChannels;
Note:
See TracChangeset
for help on using the changeset viewer.