[0070aa] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2015 Frederik Heber. All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | *
|
---|
| 7 | * This file is part of MoleCuilder.
|
---|
| 8 | *
|
---|
| 9 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
| 10 | * it under the terms of the GNU General Public License as published by
|
---|
| 11 | * the Free Software Foundation, either version 2 of the License, or
|
---|
| 12 | * (at your option) any later version.
|
---|
| 13 | *
|
---|
| 14 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | * GNU General Public License for more details.
|
---|
| 18 | *
|
---|
| 19 | * You should have received a copy of the GNU General Public License
|
---|
| 20 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /*
|
---|
| 24 | * QtObservedAtom.cpp
|
---|
| 25 | *
|
---|
| 26 | * Created on: Oct 28, 2015
|
---|
| 27 | * Author: heber
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | // include config.h
|
---|
| 32 | #ifdef HAVE_CONFIG_H
|
---|
| 33 | #include <config.h>
|
---|
| 34 | #endif
|
---|
| 35 |
|
---|
| 36 | #include "QtObservedAtom.hpp"
|
---|
| 37 |
|
---|
[65c323] | 38 | #include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp"
|
---|
| 39 |
|
---|
[0070aa] | 40 | #include "CodePatterns/MemDebug.hpp"
|
---|
| 41 |
|
---|
[65c323] | 42 | #include <boost/assign.hpp>
|
---|
| 43 |
|
---|
| 44 | #include "Atom/atom.hpp"
|
---|
| 45 | #include "Bond/bond.hpp"
|
---|
| 46 | #include "Descriptors/AtomIdDescriptor.hpp"
|
---|
| 47 | #include "Element/element.hpp"
|
---|
| 48 | #include "World.hpp"
|
---|
| 49 |
|
---|
[494478] | 50 | #include "UIElements/Qt4/InstanceBoard/ObservedValue_wCallback.hpp"
|
---|
[65c323] | 51 |
|
---|
| 52 | using namespace boost::assign;
|
---|
| 53 |
|
---|
| 54 | static const Observable::channels_t getAtomBondsChannels()
|
---|
| 55 | {
|
---|
| 56 | Observable::channels_t channels;
|
---|
| 57 | channels += AtomObservable::BondsAdded, AtomObservable::BondsRemoved;
|
---|
| 58 | return channels;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | static const Observable::channels_t getAllObservedChannels()
|
---|
| 62 | {
|
---|
| 63 | Observable::channels_t channels;
|
---|
| 64 | channels +=
|
---|
| 65 | AtomObservable::IndexChanged,
|
---|
| 66 | AtomObservable::BondsAdded,
|
---|
[fe493f] | 67 | AtomObservable::BondsRemoved,
|
---|
| 68 | AtomObservable::MoleculeChanged,
|
---|
| 69 | AtomObservable::NameChanged,
|
---|
| 70 | AtomObservable::ElementChanged,
|
---|
| 71 | AtomObservable::PositionChanged;
|
---|
[65c323] | 72 | return channels;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | // static entities
|
---|
| 76 | const Observable::channels_t
|
---|
| 77 | QtObservedAtom::AtomIndexChannels(1, AtomObservable::IndexChanged);
|
---|
| 78 | const Observable::channels_t
|
---|
[fe493f] | 79 | QtObservedAtom::AtomBondsChannels(getAtomBondsChannels());
|
---|
[65c323] | 80 | const Observable::channels_t
|
---|
| 81 | QtObservedAtom::AtomElementChannels(1, AtomObservable::ElementChanged);
|
---|
| 82 | const Observable::channels_t
|
---|
[fe493f] | 83 | QtObservedAtom::AtomMoleculeIndexChannels(1, AtomObservable::MoleculeChanged);
|
---|
| 84 | const Observable::channels_t
|
---|
| 85 | QtObservedAtom::AtomNameChannels(1, AtomObservable::NameChanged);
|
---|
| 86 | const Observable::channels_t
|
---|
| 87 | QtObservedAtom::AtomPositionChannels(1, AtomObservable::PositionChanged);
|
---|
[65c323] | 88 |
|
---|
[98c35c] | 89 | QtObservedAtom::QtObservedAtom(
|
---|
[65c323] | 90 | const ObservedValues_t &_ObservedValues,
|
---|
| 91 | QtObservedInstanceBoard &_board,
|
---|
[98c35c] | 92 | QWidget * _parent) :
|
---|
[0070aa] | 93 | QWidget(_parent),
|
---|
[98c35c] | 94 | Observer("QtObservedAtom"),
|
---|
[65c323] | 95 | subjectKilledCount(0),
|
---|
| 96 | AllsignedOnChannels(getAllObservedChannels().size()),
|
---|
| 97 | signedOffChannels(0),
|
---|
| 98 | owner(NULL),
|
---|
| 99 | board(_board),
|
---|
[04c3a3] | 100 | BoardIsGone(false),
|
---|
[65c323] | 101 | ObservedValues(_ObservedValues)
|
---|
| 102 | {
|
---|
[68418e] | 103 | // activating Observer is done by ObservedValueContainer when it's prepared
|
---|
[65c323] | 104 | }
|
---|
[0070aa] | 105 |
|
---|
| 106 | QtObservedAtom::~QtObservedAtom()
|
---|
[65c323] | 107 | {
|
---|
[04c3a3] | 108 | boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[AtomIndex])->noteCallBackIsGone();
|
---|
| 109 | boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, atomId_t> *>(ObservedValues[AtomBonds])->noteCallBackIsGone();
|
---|
| 110 | boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[AtomElement])->noteCallBackIsGone();
|
---|
| 111 | boost::any_cast<ObservedValue_wCallback<moleculeId_t, atomId_t> *>(ObservedValues[AtomMoleculeIndex])->noteCallBackIsGone();
|
---|
| 112 | boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(ObservedValues[AtomName])->noteCallBackIsGone();
|
---|
| 113 | boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->noteCallBackIsGone();
|
---|
| 114 |
|
---|
[65c323] | 115 | deactivateObserver();
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | const atom * const QtObservedAtom::getAtomConst(const atomId_t _id)
|
---|
| 119 | {
|
---|
| 120 | const atom * const _atom = const_cast<const World &>(World::getInstance()).
|
---|
| 121 | getAtom(AtomById(_id));
|
---|
| 122 | return _atom;
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | atom * const QtObservedAtom::getAtom(const atomId_t _id)
|
---|
| 126 | {
|
---|
| 127 | atom * const _atom = World::getInstance().getAtom(AtomById(_id));
|
---|
| 128 | return _atom;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | atomId_t QtObservedAtom::updateIndex()
|
---|
| 132 | {
|
---|
| 133 | return const_cast<const World &>(World::getInstance()).lastChangedAtomId();
|
---|
| 134 | }
|
---|
| 135 |
|
---|
[fe493f] | 136 | QtObservedAtom::ListOfBonds_t QtObservedAtom::updateBonds(
|
---|
[65c323] | 137 | const boost::function<const atomId_t ()> &_getAtomIndex)
|
---|
| 138 | {
|
---|
[fe493f] | 139 | ListOfBonds_t ListOfBonds;
|
---|
[65c323] | 140 | const atom * const _atom = getAtomConst(_getAtomIndex());
|
---|
| 141 | if (_atom != NULL) {
|
---|
[fe493f] | 142 | // make sure bonds is up-to-date
|
---|
| 143 | const BondList ListBonds = _atom->getListOfBonds();
|
---|
| 144 | for (BondList::const_iterator iter = ListBonds.begin();
|
---|
| 145 | iter != ListBonds.end();
|
---|
| 146 | ++iter)
|
---|
| 147 | ListOfBonds.insert( ListOfBonds.end(), std::make_pair(
|
---|
| 148 | (*iter)->leftatom->getId(),
|
---|
| 149 | (*iter)->rightatom->getId()) );
|
---|
[65c323] | 150 | }
|
---|
[fe493f] | 151 | return ListOfBonds;
|
---|
[65c323] | 152 | }
|
---|
| 153 |
|
---|
| 154 | atomicNumber_t QtObservedAtom::updateElement(
|
---|
| 155 | const boost::function<const atomId_t ()> &_getAtomIndex)
|
---|
| 156 | {
|
---|
| 157 | const atom * const _atom = getAtomConst(_getAtomIndex());
|
---|
| 158 | if (_atom != NULL) {
|
---|
| 159 | return _atom->getElementNo();
|
---|
| 160 | } else {
|
---|
| 161 | return (atomicNumber_t)-1;
|
---|
| 162 | }
|
---|
| 163 | }
|
---|
| 164 |
|
---|
[fe493f] | 165 | moleculeId_t QtObservedAtom::updateMoleculeIndex(
|
---|
| 166 | const boost::function<const atomId_t ()> &_getAtomIndex)
|
---|
| 167 | {
|
---|
| 168 | const atom * const _atom = getAtomConst(_getAtomIndex());
|
---|
| 169 | if ((_atom != NULL) && (_atom->getMolecule() != NULL)) {
|
---|
| 170 | return _atom->getMolecule()->getId();
|
---|
| 171 | } else {
|
---|
| 172 | return (moleculeId_t)0;
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | std::string QtObservedAtom::updateName(
|
---|
[65c323] | 177 | const boost::function<const atomId_t ()> &_getAtomIndex)
|
---|
| 178 | {
|
---|
| 179 | const atom * const _atom = getAtomConst(_getAtomIndex());
|
---|
| 180 | if (_atom != NULL) {
|
---|
[fe493f] | 181 | return _atom->getName();
|
---|
| 182 | } else {
|
---|
| 183 | return std::string("");
|
---|
| 184 | }
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | Vector QtObservedAtom::updatePosition(
|
---|
| 188 | const boost::function<const atomId_t ()> &_getAtomIndex)
|
---|
| 189 | {
|
---|
| 190 | const atom * const _atom = getAtomConst(_getAtomIndex());
|
---|
| 191 | if (_atom != NULL) {
|
---|
| 192 | return _atom->getPosition();
|
---|
| 193 | } else {
|
---|
| 194 | return zeroVec;
|
---|
[65c323] | 195 | }
|
---|
| 196 | }
|
---|
[98c35c] | 197 |
|
---|
| 198 | void QtObservedAtom::update(Observable *publisher)
|
---|
[65c323] | 199 | {
|
---|
| 200 | ASSERT(0, "QtObservedAtom::update() - we are not signed on for global updates.");
|
---|
| 201 | }
|
---|
[98c35c] | 202 |
|
---|
| 203 | void QtObservedAtom::subjectKilled(Observable *publisher)
|
---|
[65c323] | 204 | {
|
---|
| 205 | ++signedOffChannels;
|
---|
| 206 |
|
---|
| 207 | if (signedOffChannels == AllsignedOnChannels) {
|
---|
| 208 | // remove owner: no more signOff needed
|
---|
| 209 | owner = NULL;
|
---|
| 210 |
|
---|
[fe493f] | 211 | emit atomRemoved();
|
---|
[4e6ffe] | 212 |
|
---|
| 213 | if (!BoardIsGone) {
|
---|
| 214 | board.markObservedAtomAsDisconnected(getAtomIndex());
|
---|
| 215 | board.markObservedAtomForErase(getAtomIndex());
|
---|
| 216 | }
|
---|
[65c323] | 217 | }
|
---|
| 218 | }
|
---|
[98c35c] | 219 |
|
---|
| 220 | void QtObservedAtom::recieveNotification(Observable *publisher, Notification_ptr notification)
|
---|
[65c323] | 221 | {
|
---|
| 222 | // ObservedValues have been updated before, hence convert updates to Qt's signals
|
---|
| 223 | switch (notification->getChannelNo()) {
|
---|
| 224 | case AtomObservable::IndexChanged:
|
---|
| 225 | emit indexChanged();
|
---|
| 226 | break;
|
---|
[fe493f] | 227 | case AtomObservable::BondsAdded:
|
---|
| 228 | case AtomObservable::BondsRemoved:
|
---|
| 229 | emit bondsChanged();
|
---|
[65c323] | 230 | break;
|
---|
| 231 | case AtomObservable::ElementChanged:
|
---|
| 232 | emit elementChanged();
|
---|
| 233 | break;
|
---|
[fe493f] | 234 | case AtomObservable::MoleculeChanged:
|
---|
| 235 | emit moleculeindexChanged();
|
---|
| 236 | break;
|
---|
| 237 | case AtomObservable::NameChanged:
|
---|
| 238 | emit nameChanged();
|
---|
| 239 | break;
|
---|
| 240 | case AtomObservable::PositionChanged:
|
---|
| 241 | emit positionChanged();
|
---|
[65c323] | 242 | break;
|
---|
| 243 | default:
|
---|
| 244 | ASSERT(0, "QtObservedAtom::recieveNotification() - we are not signed on to channel "
|
---|
| 245 | +toString(notification->getChannelNo())+" of the atom.");
|
---|
| 246 | break;
|
---|
| 247 | }
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | void QtObservedAtom::activateObserver()
|
---|
| 251 | {
|
---|
| 252 | atom * atomref = getAtom(getAtomIndex());
|
---|
| 253 | if (atomref != NULL) {
|
---|
| 254 | Observable::channels_t channels = getAllObservedChannels();
|
---|
| 255 | owner = static_cast<const Observable *>(atomref);
|
---|
| 256 | for (Observable::channels_t::const_iterator iter = channels.begin();
|
---|
| 257 | iter != channels.end(); ++iter)
|
---|
| 258 | owner->signOn(this, *iter);
|
---|
[04c3a3] | 259 | if (!BoardIsGone)
|
---|
| 260 | board.markObservedAtomAsConnected(getAtomIndex());
|
---|
[65c323] | 261 | } else
|
---|
[04c3a3] | 262 | signedOffChannels = AllsignedOnChannels;
|
---|
[65c323] | 263 | }
|
---|
| 264 |
|
---|
| 265 | void QtObservedAtom::deactivateObserver()
|
---|
| 266 | {
|
---|
| 267 | // sign Off
|
---|
| 268 | if (owner != NULL) {
|
---|
| 269 | Observable::channels_t channels = getAllObservedChannels();
|
---|
| 270 | for (Observable::channels_t::const_iterator iter = channels.begin();
|
---|
| 271 | iter != channels.end(); ++iter)
|
---|
| 272 | owner->signOff(this, *iter);
|
---|
| 273 | owner = NULL;
|
---|
| 274 | signedOffChannels = AllsignedOnChannels;
|
---|
[04c3a3] | 275 | if (!BoardIsGone)
|
---|
| 276 | board.markObservedAtomAsDisconnected(getAtomIndex());
|
---|
[65c323] | 277 | }
|
---|
| 278 | }
|
---|
| 279 |
|
---|
| 280 | void QtObservedAtom::initObservedValues(
|
---|
| 281 | ObservedValues_t &_ObservedValues,
|
---|
| 282 | const atomId_t _id,
|
---|
| 283 | const atom * const _atomref,
|
---|
| 284 | const boost::function<void(const atomId_t)> &_subjectKilled)
|
---|
| 285 | {
|
---|
| 286 | /* This is an old note from when the code was still part of cstor's initializer body.
|
---|
| 287 | * TODO: Probably does not apply anymore but has not yet been tested.
|
---|
| 288 | *
|
---|
| 289 | * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
|
---|
| 290 | * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
|
---|
| 291 | * the class has not been fully constructed yet. "This" itself seems to be working fine.
|
---|
| 292 | */
|
---|
| 293 |
|
---|
| 294 | ASSERT( _ObservedValues.size() == MAX_ObservedTypes,
|
---|
| 295 | "QtObservedAtom::initObservedValues() - given ObservedValues has not correct size.");
|
---|
| 296 |
|
---|
| 297 | // fill ObservedValues: index first
|
---|
| 298 | const boost::function<atomId_t ()> AtomIndexUpdater(
|
---|
| 299 | boost::bind(&QtObservedAtom::updateIndex));
|
---|
| 300 |
|
---|
| 301 | ObservedValue_wCallback<atomId_t> * const IndexObservable =
|
---|
| 302 | new ObservedValue_wCallback<atomId_t>(
|
---|
| 303 | _atomref,
|
---|
| 304 | boost::bind(&QtObservedAtom::updateIndex),
|
---|
| 305 | "AtomIndex_"+toString(_id),
|
---|
| 306 | _id,
|
---|
| 307 | AtomIndexChannels,
|
---|
| 308 | _subjectKilled);
|
---|
| 309 | _ObservedValues[AtomIndex] = IndexObservable;
|
---|
| 310 |
|
---|
| 311 | const boost::function<const atomId_t ()> AtomIndexGetter =
|
---|
| 312 | boost::bind(&ObservedValue_wCallback<atomId_t>::get,
|
---|
| 313 | IndexObservable);
|
---|
| 314 |
|
---|
| 315 | // fill ObservedValues: then all the other that need index
|
---|
| 316 | const boost::function<ListOfBonds_t ()> AtomBondsUpdater(
|
---|
| 317 | boost::bind(&QtObservedAtom::updateBonds, AtomIndexGetter));
|
---|
[fe493f] | 318 | const boost::function<atomicNumber_t ()> AtomElementUpdater(
|
---|
| 319 | boost::bind(&QtObservedAtom::updateElement, AtomIndexGetter));
|
---|
| 320 | const boost::function<moleculeId_t ()> AtomMoleculeIndexUpdater(
|
---|
| 321 | boost::bind(&QtObservedAtom::updateMoleculeIndex, AtomIndexGetter));
|
---|
| 322 | const boost::function<std::string ()> AtomNameUpdater(
|
---|
| 323 | boost::bind(&QtObservedAtom::updateName, AtomIndexGetter));
|
---|
| 324 | const boost::function<Vector ()> AtomPositionUpdater(
|
---|
| 325 | boost::bind(&QtObservedAtom::updatePosition, AtomIndexGetter));
|
---|
[65c323] | 326 |
|
---|
[fe493f] | 327 | _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t, atomId_t>(
|
---|
[65c323] | 328 | _atomref,
|
---|
[fe493f] | 329 | AtomBondsUpdater,
|
---|
| 330 | "AtomBonds_"+toString(_id),
|
---|
| 331 | AtomBondsUpdater(),
|
---|
| 332 | AtomBondsChannels,
|
---|
[65c323] | 333 | _subjectKilled,
|
---|
| 334 | AtomIndexGetter);
|
---|
| 335 | _ObservedValues[AtomElement] = new ObservedValue_wCallback<atomicNumber_t, atomId_t>(
|
---|
| 336 | _atomref,
|
---|
| 337 | AtomElementUpdater,
|
---|
| 338 | "AtomElement"+toString(_id),
|
---|
| 339 | AtomElementUpdater(),
|
---|
| 340 | AtomElementChannels,
|
---|
| 341 | _subjectKilled,
|
---|
| 342 | AtomIndexGetter);
|
---|
[fe493f] | 343 | _ObservedValues[AtomMoleculeIndex] = new ObservedValue_wCallback<moleculeId_t, atomId_t>(
|
---|
[65c323] | 344 | _atomref,
|
---|
[fe493f] | 345 | AtomMoleculeIndexUpdater,
|
---|
| 346 | "AtomMoleculeIndex"+toString(_id),
|
---|
| 347 | AtomMoleculeIndexUpdater(),
|
---|
| 348 | AtomMoleculeIndexChannels,
|
---|
| 349 | _subjectKilled,
|
---|
| 350 | AtomIndexGetter);
|
---|
| 351 | _ObservedValues[AtomName] = new ObservedValue_wCallback<std::string, atomId_t>(
|
---|
| 352 | _atomref,
|
---|
| 353 | AtomNameUpdater,
|
---|
| 354 | "AtomName"+toString(_id),
|
---|
| 355 | AtomNameUpdater(),
|
---|
| 356 | AtomNameChannels,
|
---|
| 357 | _subjectKilled,
|
---|
| 358 | AtomIndexGetter);
|
---|
| 359 | _ObservedValues[AtomPosition] = new ObservedValue_wCallback<Vector, atomId_t>(
|
---|
| 360 | _atomref,
|
---|
| 361 | AtomPositionUpdater,
|
---|
| 362 | "AtomPosition_"+toString(_id),
|
---|
| 363 | AtomPositionUpdater(),
|
---|
| 364 | AtomPositionChannels,
|
---|
[65c323] | 365 | _subjectKilled,
|
---|
| 366 | AtomIndexGetter);
|
---|
| 367 | }
|
---|
| 368 |
|
---|
| 369 | void QtObservedAtom::destroyObservedValues(
|
---|
| 370 | std::vector<boost::any> &_ObservedValues)
|
---|
| 371 | {
|
---|
| 372 | delete boost::any_cast<ObservedValue_wCallback<atomId_t> *>(_ObservedValues[AtomIndex]);
|
---|
| 373 | delete boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, atomId_t> *>(_ObservedValues[AtomBonds]);
|
---|
[fe493f] | 374 | delete boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(_ObservedValues[AtomElement]);
|
---|
| 375 | delete boost::any_cast<ObservedValue_wCallback<moleculeId_t, atomId_t> *>(_ObservedValues[AtomMoleculeIndex]);
|
---|
| 376 | delete boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(_ObservedValues[AtomName]);
|
---|
| 377 | delete boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(_ObservedValues[AtomPosition]);
|
---|
[65c323] | 378 | _ObservedValues.clear();
|
---|
| 379 | }
|
---|
| 380 |
|
---|
[3b9aa1] | 381 | const atomId_t& QtObservedAtom::getAtomIndex() const
|
---|
[65c323] | 382 | {
|
---|
| 383 | return boost::any_cast<ObservedValue_wCallback<atomId_t> *>(ObservedValues[AtomIndex])->get();
|
---|
| 384 | }
|
---|
| 385 |
|
---|
[3b9aa1] | 386 | const QtObservedAtom::ListOfBonds_t& QtObservedAtom::getAtomBonds() const
|
---|
[65c323] | 387 | {
|
---|
[fe493f] | 388 | return boost::any_cast<ObservedValue_wCallback<ListOfBonds_t, atomId_t> *>(ObservedValues[AtomBonds])->get();
|
---|
[65c323] | 389 | }
|
---|
| 390 |
|
---|
[3b9aa1] | 391 | const atomicNumber_t& QtObservedAtom::getAtomElement() const
|
---|
[65c323] | 392 | {
|
---|
| 393 | return boost::any_cast<ObservedValue_wCallback<atomicNumber_t, atomId_t> *>(ObservedValues[AtomElement])->get();
|
---|
| 394 | }
|
---|
| 395 |
|
---|
[3b9aa1] | 396 | const moleculeId_t& QtObservedAtom::getAtomMoleculeIndex() const
|
---|
[65c323] | 397 | {
|
---|
[fe493f] | 398 | return boost::any_cast<ObservedValue_wCallback<moleculeId_t, atomId_t> *>(ObservedValues[AtomMoleculeIndex])->get();
|
---|
| 399 | }
|
---|
| 400 |
|
---|
[3b9aa1] | 401 | const std::string& QtObservedAtom::getAtomName() const
|
---|
[fe493f] | 402 | {
|
---|
| 403 | return boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(ObservedValues[AtomName])->get();
|
---|
| 404 | }
|
---|
| 405 |
|
---|
[3b9aa1] | 406 | const Vector& QtObservedAtom::getAtomPosition() const
|
---|
[fe493f] | 407 | {
|
---|
| 408 | return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->get();
|
---|
[65c323] | 409 | }
|
---|