source: src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp@ 1b07b1

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
Last change on this file since 1b07b1 was 1b07b1, checked in by Frederik Heber <heber@…>, 9 years ago

QtObservedInstanceBoard now sends QtObserved..::ptr around in signals.

  • this should get rid of the problem that we need to keep the QtObservedAtom until it was requested at least once. And we don't know for how long. Now, we simply place the shared_ptr into the signal (to which it seems to be copied) and hence a representation of the atoms remains valid.
  • cstor of GLMoleculeObject_.. take Observed.. as ref.
  • Property mode set to 100644
File size: 19.0 KB
Line 
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 * QtObservedMolecule.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 "QtObservedMolecule.hpp"
37
38#include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp"
39
40#include "CodePatterns/MemDebug.hpp"
41#include "CodePatterns/Assert.hpp"
42#include "CodePatterns/Log.hpp"
43
44#include <boost/assign.hpp>
45#include <boost/bind.hpp>
46
47#include "UIElements/Qt4/InstanceBoard/ObservedValue_wCallback.hpp"
48#include "UIElements/Qt4/InstanceBoard/ObservedValue_UpdateAtoms.hpp"
49
50#include "Atom/atom.hpp"
51#include "Descriptors/MoleculeIdDescriptor.hpp"
52#include "World.hpp"
53
54using namespace boost::assign;
55
56static const Observable::channels_t getAllObservedChannels()
57{
58 Observable::channels_t channels;
59 channels +=
60 molecule::AtomInserted,
61 molecule::AtomMoved,
62 molecule::AtomRemoved,
63 molecule::FormulaChanged,
64 molecule::IndexChanged,
65 molecule::MoleculeNameChanged,
66 molecule::BoundingBoxChanged,
67 molecule::SelectionChanged;
68 return channels;
69}
70
71static const Observable::channels_t getAllAtomCountChannels()
72{
73 Observable::channels_t channels;
74 channels +=
75 molecule::AtomInserted,
76 molecule::AtomRemoved;
77 return channels;
78}
79
80static const Observable::channels_t getAllCenterChannels()
81{
82 Observable::channels_t channels;
83 channels +=
84 molecule::AtomInserted,
85 molecule::AtomMoved,
86 molecule::AtomRemoved;
87 return channels;
88}
89
90// static instances
91const Observable::channels_t QtObservedMolecule::AtomCountChannels(getAllAtomCountChannels());
92const Observable::channels_t QtObservedMolecule::BondCountChannels(getAllAtomCountChannels());
93const Observable::channels_t QtObservedMolecule::BoundingBoxChannels(1, molecule::BoundingBoxChanged);
94const Observable::channels_t QtObservedMolecule::FormulaStringChannels(1, molecule::FormulaChanged);
95const Observable::channels_t QtObservedMolecule::CenterChannels(getAllCenterChannels());
96const Observable::channels_t QtObservedMolecule::IndexChannels(1, molecule::IndexChanged);
97const Observable::channels_t QtObservedMolecule::NameChannels(1, molecule::MoleculeNameChanged);
98const Observable::channels_t QtObservedMolecule::NonHydrogenCountChannels(1, molecule::FormulaChanged);
99const Observable::channels_t QtObservedMolecule::SelectedChannels(1, molecule::SelectionChanged);
100
101QtObservedMolecule::QtObservedMolecule(
102 const ObservedValues_t &_ObservedValues,
103 QtObservedInstanceBoard &_board,
104 QWidget * _parent) :
105 QWidget(_parent),
106 Observer("QtObservedMolecule"),
107 subjectKilledCount(0),
108 AllsignedOnChannels(getAllObservedChannels().size()),
109 signedOffChannels(0),
110 owner(NULL),
111 board(_board),
112 BoardIsGone(false),
113 ObservedValues(_ObservedValues)
114{
115 // activating Observer is done by ObservedValueContainer when it's prepared
116}
117
118QtObservedMolecule::~QtObservedMolecule()
119{
120 boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(ObservedValues[MolIndex])->noteCallBackIsGone();
121 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[AtomCount])->noteCallBackIsGone();
122 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[BondCount])->noteCallBackIsGone();
123 boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->noteCallBackIsGone();
124 boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[FormulaString])->noteCallBackIsGone();
125 boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(ObservedValues[MolCenter])->noteCallBackIsGone();
126 boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->noteCallBackIsGone();
127 boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->noteCallBackIsGone();
128 boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(ObservedValues[MolSelected])->noteCallBackIsGone();
129
130 deactivateObserver();
131}
132
133void QtObservedMolecule::deactivateObserver()
134{
135 if (owner != NULL) {
136 Observable::channels_t channels = getAllObservedChannels();
137 for (Observable::channels_t::const_iterator iter = channels.begin();
138 iter != channels.end(); ++iter)
139 owner->signOff(this, *iter);
140 owner = NULL;
141 signedOffChannels = AllsignedOnChannels;
142 if (!BoardIsGone)
143 board.markObservedMoleculeAsDisconnected(getMolIndex());
144 }
145}
146
147void QtObservedMolecule::activateObserver()
148{
149 // sign on as observer (obtain non-const instance before)
150 const molecule * const _molecule = getMolecule(getMolIndex());
151 if (_molecule != NULL) {
152 Observable::channels_t channels = getAllObservedChannels();
153 owner = static_cast<const Observable *>(_molecule);
154 for (Observable::channels_t::const_iterator iter = channels.begin();
155 iter != channels.end(); ++iter)
156 owner->signOn(this, *iter);
157 if (!BoardIsGone)
158 board.markObservedMoleculeAsConnected(getMolIndex());
159 } else
160 signedOffChannels = AllsignedOnChannels;
161}
162
163void QtObservedMolecule::update(Observable *publisher)
164{
165 ASSERT(0,
166 "QtObservedMolecule::update() - general update from unexpected source.");
167}
168
169void QtObservedMolecule::subjectKilled(Observable *publisher)
170{
171 ++signedOffChannels;
172
173 if (signedOffChannels == AllsignedOnChannels) {
174 // remove owner: no more signOff needed
175 owner = NULL;
176
177 emit moleculeRemoved();
178
179 if (!BoardIsGone) {
180 board.markObservedMoleculeAsDisconnected(getMolIndex());
181 board.markObservedMoleculeForErase(getMolIndex());
182 }
183 }
184}
185
186void QtObservedMolecule::recieveNotification(Observable *publisher, Notification_ptr notification)
187{
188 const molecule * const _molecule = getMolecule(getMolIndex());
189 // when molecule is NULL we will soon get destroyed anyway
190 if (_molecule == NULL)
191 return;
192 if (publisher == dynamic_cast<const Observable*>(_molecule)){
193 // notification from atom
194#ifdef LOG_OBSERVER
195 observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this))
196 << " received notification from molecule " << getMolIndex() << " for channel "
197 << notification->getChannelNo() << ".";
198#endif
199 switch (notification->getChannelNo()) {
200 case molecule::AtomInserted:
201 {
202 const atomId_t _id = _molecule->lastChangedAtomId();
203 QtObservedAtom::ptr _atom = board.getObservedAtom(_id);
204 emit atomcountChanged();
205 emit atomInserted(_atom);
206 emit bondcountChanged();
207 emit boundingboxChanged();
208 emit centerChanged();
209 emit tesselationhullChanged();
210 break;
211 }
212 case molecule::AtomMoved:
213 {
214 emit boundingboxChanged();
215 emit centerChanged();
216 emit tesselationhullChanged();
217 break;
218 }
219 case molecule::AtomRemoved:
220 {
221 const atomId_t _id = _molecule->lastChangedAtomId();
222 emit atomcountChanged();
223 emit atomRemoved(_id);
224 emit bondcountChanged();
225 emit boundingboxChanged();
226 emit centerChanged();
227 emit tesselationhullChanged();
228 break;
229 }
230 case molecule::BoundingBoxChanged:
231 {
232 #ifdef LOG_OBSERVER
233 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that bounding box has changed.";
234 #endif
235 emit tesselationhullChanged();
236 emit boundingboxChanged();
237 break;
238 }
239 case molecule::FormulaChanged:
240 {
241 emit formulaChanged();
242 emit nononhydrogenChanged();
243 break;
244 }
245 case molecule::IndexChanged:
246 {
247 #ifdef LOG_OBSERVER
248 const atomId_t _id = _molecule->lastChangedAtomId();
249 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+"'s index has changed.";
250 #endif
251 emit indexChanged();
252 break;
253 }
254 case molecule::MoleculeNameChanged:
255 {
256 #ifdef LOG_OBSERVER
257 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that name has changed.";
258 #endif
259 emit nameChanged();
260 break;
261 }
262 case molecule::SelectionChanged:
263 {
264 #ifdef LOG_OBSERVER
265 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that selected has changed.";
266 #endif
267 emit selectedChanged();
268 break;
269 }
270 default:
271 break;
272 }
273 }
274}
275
276const molecule * const QtObservedMolecule::getMolecule(const moleculeId_t _id)
277{
278 const molecule * const mol = const_cast<const World &>(World::getInstance()).
279 getMolecule(MoleculeById(_id));
280 return mol;
281}
282
283static molecule::BoundingBoxInfo initBoundingBox()
284{
285 molecule::BoundingBoxInfo info;
286 info.position = zeroVec;
287 info.radius = 0.;
288 return info;
289}
290
291void QtObservedMolecule::initObservedValues(
292 ObservedValues_t &_ObservedValues,
293 const moleculeId_t _molid,
294 const molecule * const _molref,
295 const boost::function<void(const moleculeId_t)> &_subjectKilled)
296{
297 /* This is an old note from when the code was still part of cstor's initializer body.
298 * TODO: Probably does not apply anymore but has not yet been tested.
299 *
300 * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
301 * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
302 * the class has not been fully constructed yet. "This" itself seems to be working fine.
303 */
304
305 ASSERT( _ObservedValues.size() == MAX_ObservedTypes,
306 "QtObservedMolecule::initObservedValues() - given ObservedValues has not correct size.");
307
308 // fill ObservedValues: index first
309 const boost::function<moleculeId_t ()> MolIndexUpdater(
310 boost::bind(&QtObservedMolecule::updateIndex));
311
312 ObservedValue_wCallback<moleculeId_t> * const IndexObservable =
313 new ObservedValue_wCallback<moleculeId_t>(
314 _molref,
315 MolIndexUpdater,
316 "MoleculeIndex_"+toString(_molid),
317 _molid,
318 IndexChannels,
319 _subjectKilled);
320 _ObservedValues[MolIndex] = IndexObservable;
321
322 const boost::function<const moleculeId_t ()> MolIndexGetter =
323 boost::bind(&ObservedValue_wCallback<moleculeId_t>::get,
324 IndexObservable);
325
326 // fill ObservedValues: then all the other that need index
327 const boost::function<int ()> AtomCountUpdater(
328 boost::bind(&QtObservedMolecule::updateAtomCount, MolIndexGetter));
329 const boost::function<int ()> BondCountUpdater(
330 boost::bind(&QtObservedMolecule::updateBondCount, MolIndexGetter));
331 const boost::function<Vector ()> MolCenterUpdater(
332 boost::bind(&QtObservedMolecule::updateCenter, MolIndexGetter));
333 const boost::function<std::string ()> MolFormulaUpdater(
334 boost::bind(&QtObservedMolecule::updateFormulaString, MolIndexGetter));
335 const boost::function<std::string ()> MolNameUpdater(
336 boost::bind(&QtObservedMolecule::updateName, MolIndexGetter));
337 const boost::function<int ()> NonHydrogenCountUpdater(
338 boost::bind(&QtObservedMolecule::updateNonHydrogenCount, MolIndexGetter));
339 const boost::function<molecule::BoundingBoxInfo ()> BoundingBoxUpdater(
340 boost::bind(&QtObservedMolecule::updateBoundingBox, MolIndexGetter));
341 const boost::function<bool ()> SelectedUpdater(
342 boost::bind(&QtObservedMolecule::updateSelected, MolIndexGetter));
343
344 _ObservedValues[AtomCount] = new ObservedValue_wCallback<int, moleculeId_t>(
345 _molref,
346 AtomCountUpdater,
347 "MoleculeAtomCount_"+toString(_molid),
348 AtomCountUpdater(),
349 AtomCountChannels,
350 _subjectKilled,
351 MolIndexGetter);
352 _ObservedValues[BondCount] = new ObservedValue_wCallback<int, moleculeId_t>(
353 _molref,
354 BondCountUpdater,
355 "MoleculeBondCount_"+toString(_molid),
356 BondCountUpdater(),
357 BondCountChannels,
358 _subjectKilled,
359 MolIndexGetter);
360 _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t>(
361 _molref,
362 BoundingBoxUpdater,
363 "MoleculeBoundingBox_"+toString(_molid),
364 initBoundingBox(),
365 BoundingBoxChannels,
366 _subjectKilled,
367 MolIndexGetter);
368 _ObservedValues[FormulaString] = new ObservedValue_wCallback<std::string, moleculeId_t>(
369 _molref,
370 MolFormulaUpdater,
371 "MoleculeFormula_"+toString(_molid),
372 MolFormulaUpdater(),
373 FormulaStringChannels,
374 _subjectKilled,
375 MolIndexGetter);
376 _ObservedValues[MolCenter] = new ObservedValue_wCallback<Vector, moleculeId_t>(
377 _molref,
378 MolCenterUpdater,
379 "MoleculeCenter_"+toString(_molid),
380 MolCenterUpdater(),
381 CenterChannels,
382 _subjectKilled,
383 MolIndexGetter);
384 _ObservedValues[MolName] = new ObservedValue_wCallback<std::string, moleculeId_t>(
385 _molref,
386 MolNameUpdater,
387 "MoleculeName_"+toString(_molid),
388 MolNameUpdater(),
389 NameChannels,
390 _subjectKilled,
391 MolIndexGetter);
392 _ObservedValues[NonHydrogenCount] = new ObservedValue_wCallback<int, moleculeId_t>(
393 _molref,
394 NonHydrogenCountUpdater,
395 "MoleculeNonHydrogenCount_"+toString(_molid),
396 NonHydrogenCountUpdater(),
397 NonHydrogenCountChannels,
398 _subjectKilled,
399 MolIndexGetter);
400 _ObservedValues[MolSelected] = new ObservedValue_wCallback<bool, moleculeId_t>(
401 _molref,
402 SelectedUpdater,
403 "MoleculeSelected_"+toString(_molid),
404 SelectedUpdater(),
405 SelectedChannels,
406 _subjectKilled,
407 MolIndexGetter);
408}
409
410void QtObservedMolecule::destroyObservedValues(
411 std::vector<boost::any> &_ObservedValues)
412{
413 delete boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(_ObservedValues[MolIndex]);
414 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[AtomCount]);
415 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[BondCount]);
416 delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(_ObservedValues[BoundingBox]);
417 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[FormulaString]);
418 delete boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(_ObservedValues[MolCenter]);
419 delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[MolName]);
420 delete boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(_ObservedValues[NonHydrogenCount]);
421 delete boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(_ObservedValues[MolSelected]);
422 _ObservedValues.clear();
423}
424
425int QtObservedMolecule::updateAtomCount(
426 const boost::function<const moleculeId_t ()> &_getMolIndex)
427{
428 const molecule * const mol = getMolecule(_getMolIndex());
429 if (mol != NULL)
430 return mol->getAtomCount();
431 else
432 return (int)0;
433}
434
435int QtObservedMolecule::updateBondCount(
436 const boost::function<const moleculeId_t ()> &_getMolIndex)
437{
438 const molecule * const mol = getMolecule(_getMolIndex());
439 if (mol != NULL)
440 return mol->getBondCount();
441 else
442 return (int)0;
443}
444
445molecule::BoundingBoxInfo QtObservedMolecule::updateBoundingBox(
446 const boost::function<const moleculeId_t ()> &_getMolIndex)
447{
448 const molecule * const mol = getMolecule(_getMolIndex());
449 if (mol != NULL)
450 return mol->getBoundingBox();
451 else
452 return molecule::BoundingBoxInfo();
453}
454
455std::string QtObservedMolecule::updateFormulaString(
456 const boost::function<const moleculeId_t ()> &_getMolIndex)
457{
458 const molecule * const mol = getMolecule(_getMolIndex());
459 if (mol != NULL)
460 return mol->getFormula().toString();
461 else
462 return std::string("");
463}
464
465Vector QtObservedMolecule::updateCenter(
466 const boost::function<const moleculeId_t ()> &_getMolIndex)
467{
468 const molecule * const mol = getMolecule(_getMolIndex());
469 if (mol != NULL)
470 return mol->DetermineCenterOfAll();
471 else
472 return zeroVec;
473}
474
475moleculeId_t QtObservedMolecule::updateIndex()
476{
477 return const_cast<const World &>(World::getInstance()).lastChangedMolId();
478}
479
480std::string QtObservedMolecule::updateName(
481 const boost::function<const moleculeId_t ()> &_getMolIndex)
482{
483 const molecule * const mol = getMolecule(_getMolIndex());
484 if (mol != NULL)
485 return mol->getName();
486 else
487 return std::string("");
488}
489
490int QtObservedMolecule::updateNonHydrogenCount(
491 const boost::function<const moleculeId_t ()> &_getMolIndex)
492{
493 const molecule * const mol = getMolecule(_getMolIndex());
494 if (mol != NULL)
495 return mol->getNoNonHydrogen();
496 else
497 return (int)0;
498}
499
500bool QtObservedMolecule::updateSelected(
501 const boost::function<const moleculeId_t ()> &_getMolIndex)
502{
503 const molecule * const mol = getMolecule(_getMolIndex());
504 if (mol != NULL)
505 return mol->getSelected();
506 else
507 return false;
508}
509
510const int& QtObservedMolecule::getAtomCount() const
511{
512 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[AtomCount])->get();
513}
514
515const int& QtObservedMolecule::getBondCount() const
516{
517 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[BondCount])->get();
518}
519
520const std::string& QtObservedMolecule::getMolFormula() const
521{
522 return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[FormulaString])->get();
523}
524
525const Vector& QtObservedMolecule::getMolCenter() const
526{
527 return boost::any_cast<ObservedValue_wCallback<Vector, moleculeId_t> *>(ObservedValues[MolCenter])->get();
528}
529
530const moleculeId_t& QtObservedMolecule::getMolIndex() const
531{
532 return boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(ObservedValues[MolIndex])->get();
533}
534
535const std::string& QtObservedMolecule::getMolName() const
536{
537 return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->get();
538}
539
540const int& QtObservedMolecule::getNonHydrogenCount() const
541{
542 return boost::any_cast<ObservedValue_wCallback<int, moleculeId_t> *>(ObservedValues[NonHydrogenCount])->get();
543}
544
545const molecule::BoundingBoxInfo& QtObservedMolecule::getBoundingBox() const
546{
547 return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->get();
548}
549
550const bool& QtObservedMolecule::getMolSelected() const
551{
552 return boost::any_cast<ObservedValue_wCallback<bool, moleculeId_t> *>(ObservedValues[MolSelected])->get();
553}
Note: See TracBrowser for help on using the repository browser.