- Timestamp:
- Nov 5, 2014, 9:41:13 PM (10 years ago)
- Parents:
- 7b38d3
- git-author:
- Frederik Heber <heber@…> (11/05/14 20:49:45)
- git-committer:
- Frederik Heber <heber@…> (11/05/14 21:41:13)
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r7b38d3 r15c75f8 146 146 OBSERVE; 147 147 if(atomIdPool.reserveId(newNr)){ 148 _lastchangedatom = target; 148 149 NOTIFY(AtomNrChanged); 149 150 if (oldNr != -1) // -1 is reserved and indicates no number … … 207 208 { 208 209 OBSERVE; 209 NOTIFY(AtomRemoved);210 210 const_iterator iter = loc; 211 211 ++iter; 212 212 atom * const _atom = const_cast<atom *>(*loc); 213 { 214 _lastchangedatom = _atom; 215 NOTIFY(AtomRemoved); 216 } 213 217 atomIds.erase( _atom->getId() ); 214 218 { … … 226 230 { 227 231 OBSERVE; 228 NOTIFY(AtomRemoved); 232 { 233 _lastchangedatom = key; 234 NOTIFY(AtomRemoved); 235 } 229 236 const_iterator iter = find(key); 230 237 if (iter != end()){ … … 247 254 OBSERVE; 248 255 NOTIFY(AtomInserted); 256 _lastchangedatom = key; 249 257 std::pair<iterator,bool> res = atomIds.insert(key->getId()); 250 258 if (res.second) { // push atom if went well … … 974 982 for(const_iterator iter = begin(); iter != end(); ++iter) 975 983 center += (*iter)->getPosition(); 976 center *= 1./(double)size(); 984 if (begin() != end()) 985 center *= 1./(double)size(); 977 986 for(const_iterator iter = begin(); iter != end(); ++iter) { 978 987 const Vector &position = (*iter)->getPosition(); -
src/molecule.hpp
r7b38d3 r15c75f8 108 108 NotificationType_MAX 109 109 }; 110 111 //>! access to last changed element (atom) 112 const atom* lastChanged() const 113 { return _lastchangedatom; } 110 114 111 115 public: … … 319 323 320 324 private: 325 friend const atom *detail::lastChanged<atom>(); 326 atom *_lastchangedatom; 327 321 328 int last_atom; //!< number given to last atom 322 329 };
Note:
See TracChangeset
for help on using the changeset viewer.