Ignore:
Timestamp:
Feb 14, 2016, 12:33:42 PM (9 years ago)
Author:
Frederik Heber <heber@…>
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:
5cd3a33
Parents:
6d4925
git-author:
Frederik Heber <heber@…> (12/28/15 11:43:34)
git-committer:
Frederik Heber <heber@…> (02/14/16 12:33:42)
Message:

Added ObservedValue for selection status of atoms and molecules to QtObserved...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp

    r6d4925 r9e9100  
    6969      AtomObservable::NameChanged,
    7070      AtomObservable::ElementChanged,
    71       AtomObservable::PositionChanged;
     71      AtomObservable::PositionChanged,
     72      AtomObservable::SelectionChanged;
    7273  return channels;
    7374}
     
    8687const Observable::channels_t
    8788QtObservedAtom::AtomPositionChannels(1, AtomObservable::PositionChanged);
     89const Observable::channels_t
     90QtObservedAtom::AtomSelectedChannels(1, AtomObservable::SelectionChanged);
    8891
    8992QtObservedAtom::QtObservedAtom(
     
    112115  boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(ObservedValues[AtomName])->noteCallBackIsGone();
    113116  boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->noteCallBackIsGone();
     117  boost::any_cast<ObservedValue_wCallback<bool, atomId_t> *>(ObservedValues[AtomSelected])->noteCallBackIsGone();
    114118
    115119  deactivateObserver();
     
    196200}
    197201
     202bool QtObservedAtom::updateSelected(
     203    const boost::function<const atomId_t ()> &_getAtomIndex)
     204{
     205  const atom * const _atom = getAtomConst(_getAtomIndex());
     206  if (_atom != NULL) {
     207    return _atom->getSelected();
     208  } else {
     209    return false;
     210  }
     211}
     212
    198213void QtObservedAtom::update(Observable *publisher)
    199214{
     
    240255    case AtomObservable::PositionChanged:
    241256      emit positionChanged();
     257      break;
     258    case AtomObservable::SelectionChanged:
     259      emit selectedChanged();
    242260      break;
    243261    default:
     
    324342  const boost::function<Vector ()> AtomPositionUpdater(
    325343      boost::bind(&QtObservedAtom::updatePosition, AtomIndexGetter));
     344  const boost::function<bool ()> AtomSelectedUpdater(
     345      boost::bind(&QtObservedAtom::updateSelected, AtomIndexGetter));
    326346
    327347  _ObservedValues[AtomBonds] = new ObservedValue_wCallback<ListOfBonds_t, atomId_t>(
     
    363383      AtomPositionUpdater(),
    364384      AtomPositionChannels,
     385      _subjectKilled,
     386      AtomIndexGetter);
     387  _ObservedValues[AtomSelected] = new ObservedValue_wCallback<bool, atomId_t>(
     388      _atomref,
     389      AtomSelectedUpdater,
     390      "AtomSelected_"+toString(_id),
     391      AtomSelectedUpdater(),
     392      AtomSelectedChannels,
    365393      _subjectKilled,
    366394      AtomIndexGetter);
     
    376404  delete boost::any_cast<ObservedValue_wCallback<std::string, atomId_t> *>(_ObservedValues[AtomName]);
    377405  delete boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(_ObservedValues[AtomPosition]);
     406  delete boost::any_cast<ObservedValue_wCallback<bool, atomId_t> *>(_ObservedValues[AtomSelected]);
    378407  _ObservedValues.clear();
    379408}
     
    408437  return boost::any_cast<ObservedValue_wCallback<Vector, atomId_t> *>(ObservedValues[AtomPosition])->get();
    409438}
     439
     440const bool QtObservedAtom::getAtomSelected() const
     441{
     442  return boost::any_cast<ObservedValue_wCallback<bool, atomId_t> *>(ObservedValues[AtomSelected])->get();
     443}
Note: See TracChangeset for help on using the changeset viewer.