Changeset 015f8c for src


Ignore:
Timestamp:
Aug 5, 2015, 5:32:11 PM (10 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:
a39d72
Parents:
e5a477
git-author:
Frederik Heber <heber@…> (07/19/15 07:08:38)
git-committer:
Frederik Heber <heber@…> (08/05/15 17:32:11)
Message:

QtMainWindow uses QtSelectionChangedAgent.

  • QtMoleculeListView and GLWorldView receive its signals. The latter passes it on to GLWorldScene.
  • QtMoleculeList has new MoleculeIdToIndex to allow QtMoleculeListView to (un)select specific rows on a given index.
  • GLWorldScene passes atom and molecule selection to GLMoleculeObject_molecule.
  • GLMoleculeObject_molecule passes atom selection to respective GLMoleculeObject_atom.
Location:
src/UIElements
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtMainWindow.cpp

    re5a477 r015f8c  
    6161#include "Views/Qt4/QtShapeController.hpp"
    6262#include "Views/Qt4/QtInfoBox.hpp"
     63#include "Views/Qt4/QtSelectionChangedAgent.hpp"
    6364#include "Views/Qt4/QtStatusBar.hpp"
    6465#include "Views/Qt4/QtTimeLine.hpp"
     
    101102  QVBoxLayout *layout = new QVBoxLayout(layoutwidget);
    102103
     104  selectionagent = new QtSelectionChangedAgent(this);
     105
    103106  QtMoleculeListView *moleculeListView = new QtMoleculeListView(worldTab);
    104107  moleculeList = new QtMoleculeList;
    105108  moleculeListView->setModel(moleculeList);
     109  moleculeListView->setSelectionChangedAgent(selectionagent);
    106110
    107111  elementList = new QtElementList(worldTab);
     
    119123//  glWorldView->setFocus();
    120124  glWorldView->camera()->setEye( QVector3D(0,3,10));
     125  glWorldView->setSelectionChangedAgent(selectionagent);
    121126
    122127  MainMenu = new QtMenu<QMenuBar>(menuBar(), "");
  • src/UIElements/Qt4/QtMainWindow.hpp

    re5a477 r015f8c  
    2828class QtLogBox;
    2929class QtMoleculeList;
     30class QtSelectionChangedAgent;
    3031class QtShapeController;
    3132class StringView;
     
    5859  QtHomologyList *homologyList;
    5960  QtFragmentList *fragmentList;
     61  QtSelectionChangedAgent *selectionagent;
    6062  QtShapeController *shapeController;
    6163  GLWorldView *glWorldView;
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp

    re5a477 r015f8c  
    178178}
    179179
     180const QModelIndex QtMoleculeList::MoleculeIdToIndex(const moleculeId_t _id) const
     181{
     182  boost::recursive_mutex::scoped_lock lock(refill_mutex);
     183  QtMoleculeItem * const item = MoleculeIdToItem(_id);
     184  ASSERT(item != NULL,
     185      "QtMoleculeList::MoleculeIdToIndex() - could not find item to "
     186      +toString(_id));
     187  return indexFromItem(item);
     188}
    180189
    181190const moleculeId_t QtMoleculeList::IndexToMoleculeId(const QModelIndex &_index) const
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp

    re5a477 r015f8c  
    8686  bool isMoleculeItemPresent(const moleculeId_t _molid) const;
    8787  QtMoleculeItem * MoleculeIdToItem(const moleculeId_t _molid) const;
     88  const moleculeId_t ItemToMoleculeId(const QtMoleculeItem * const _item) const;
     89  const QModelIndex MoleculeIdToIndex(const moleculeId_t _id) const;
    8890  const moleculeId_t IndexToMoleculeId(const QModelIndex &_index) const;
    89   const moleculeId_t ItemToMoleculeId(const QtMoleculeItem * const _item) const;
    9091  QtMoleculeItem * getSpecificMoleculeItem(
    9192      const QtMoleculeItem * const _item,
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.cpp

    re5a477 r015f8c  
    3737#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp"
    3838#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
     39#include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"
    3940
    4041#include "CodePatterns/MemDebug.hpp"
     
    5354{
    5455  setSelectionMode(QAbstractItemView::MultiSelection);
    55 
    56   World::getInstance().signOn(this, World::SelectionChanged);
    5756}
    5857
    5958QtMoleculeListView::~QtMoleculeListView()
    60 {
    61   World::getInstance().signOff(this, World::SelectionChanged);
    62 }
     59{}
    6360
    6461void QtMoleculeListView::setModel(QtMoleculeList *_moleculelist)
     
    6966      selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
    7067      this, SLOT(rowsSelected(const QItemSelection &, const QItemSelection &)), Qt::DirectConnection);
     68}
     69
     70
     71void QtMoleculeListView::setSelectionChangedAgent(QtSelectionChangedAgent *agent)
     72{
     73  connect(agent, SIGNAL(moleculeSelected(const moleculeId_t)),
     74      this, SLOT(MoleculeSelected(const moleculeId_t)));
     75  connect(agent, SIGNAL(moleculeUnselected(const moleculeId_t)),
     76      this, SLOT(MoleculeUnselected(const moleculeId_t)));
    7177}
    7278
     
    148154  selecting = false;
    149155}
     156
     157void QtMoleculeListView::MoleculeSelected(const moleculeId_t _id)
     158{
     159  if (selecting)
     160    return;
     161
     162  selecting = true;
     163
     164  const QtMoleculeList *moleculelist = dynamic_cast<const QtMoleculeList *>(model());
     165  QModelIndex index = moleculelist->MoleculeIdToIndex(_id);
     166  ASSERT( !selectionModel()->isSelected(index),
     167      "QtMoleculeListView::MoleculeSelected() - row to molecule "
     168      +toString(_id)+" is already selected.");
     169
     170  // select the full row
     171  expand(index);
     172  selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
     173
     174  selecting = false;
     175}
     176
     177void QtMoleculeListView::MoleculeUnselected(const moleculeId_t _id)
     178{
     179  if (selecting)
     180    return;
     181
     182  selecting = true;
     183
     184  const QtMoleculeList *moleculelist = dynamic_cast<const QtMoleculeList *>(model());
     185  QModelIndex index = moleculelist->MoleculeIdToIndex(_id);
     186  ASSERT( selectionModel()->isSelected(index),
     187      "QtMoleculeListView::MoleculeSelected() - row to molecule "
     188      +toString(_id)+" is already unselected.");
     189
     190  // unselect the full row
     191  expand(index);
     192  selectionModel()->select(index, QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
     193
     194  selecting = false;
     195}
     196
    150197
    151198void QtMoleculeListView::recieveNotification(Observable *publisher, Notification_ptr notification)
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp

    re5a477 r015f8c  
    1919#include "CodePatterns/Observer/Observer.hpp"
    2020
     21#include "types.hpp"
     22
    2123class QtMoleculeList;
     24class QtSelectionChangedAgent;
    2225
    2326class QtMoleculeListView : public QTreeView, public Observer
     
    3134  void setModel(QtMoleculeList *_moleculelist);
    3235
     36  void setSelectionChangedAgent(QtSelectionChangedAgent *agent);
     37
    3338public slots:
    3439  void rowsSelected(const QItemSelection&, const QItemSelection&);
     40
     41  void MoleculeSelected(const moleculeId_t _id);
     42  void MoleculeUnselected(const moleculeId_t _id);
    3543
    3644protected:
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp

    re5a477 r015f8c  
    7575const Observable::channels_t
    7676GLMoleculeObject_atom::AtomBondsChannels(getAtomBondsChannels());
    77 const Observable::channels_t
    78 GLMoleculeObject_atom::AtomSelectionStatusChannels(World::SelectionChanged);
    7977
    8078GLMoleculeObject_atom::GLMoleculeObject_atom(QGLSceneNode *mesh[], QObject *parent, const atomId_t _id) :
     
    106104      updateBonds(),
    107105      AtomBondsChannels),
    108   AtomSelectionStatus(
    109       World::getPointer(),
    110       boost::bind(&GLMoleculeObject_atom::updateSelectionStatus, this),
    111       "AtomSelectionStatus_"+toString(_id),
    112       updateSelectionStatus(),
    113       AtomSelectionStatusChannels),
    114106  owner(NULL)
    115107{
     
    129121  connect( this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
    130122  connect( this, SIGNAL(bondsChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
    131   connect( this, SIGNAL(selectionstatusChanged()), this, SLOT(resetSelectionStatus()), Qt::QueuedConnection);
    132123}
    133124
     
    141132    owner->signOn(this, AtomObservable::BondsAdded);
    142133    owner->signOn(this, AtomObservable::BondsRemoved);
    143     World::getInstance().signOn(this, World::SelectionChanged);
    144134  }
    145135}
     
    155145    owner->signOff(this, AtomObservable::BondsAdded);
    156146    owner->signOff(this, AtomObservable::BondsRemoved);
    157     World::getInstance().signOff(this, World::SelectionChanged);
    158147    owner = NULL;
    159148  }
     
    241230}
    242231
    243 void GLMoleculeObject_atom::resetSelectionStatus()
    244 {
    245   setSelected(AtomSelectionStatus.get());
    246 }
     232void GLMoleculeObject_atom::Selected()
     233{
     234  ASSERT( !m_selected,
     235      "GLMoleculeObject_atom::Selected() - 3D rep of atom is already selected.");
     236  m_selected = true;
     237
     238  emit changed();
     239}
     240
     241void GLMoleculeObject_atom::Unselected()
     242{
     243  ASSERT( m_selected,
     244      "GLMoleculeObject_atom::Unselected() - 3D rep of atom is already unselected.");
     245  m_selected = false;
     246
     247  emit changed();
     248}
     249
    247250
    248251void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane)
     
    315318}
    316319
    317 bool GLMoleculeObject_atom::updateSelectionStatus() const
    318 {
    319   const atom * const _atom = getAtom(AtomIndex.get());
    320   if (_atom != NULL) {
    321     return const_cast<const World &>(World::getInstance()).isSelected(_atom);
    322   }
    323   return false;
    324 }
    325 
    326320void GLMoleculeObject_atom::update(Observable *publisher)
    327321{
     
    358352        break;
    359353    }
    360   } else if (publisher == static_cast<World *>(World::getPointer())) {
    361     switch (notification->getChannelNo()) {
    362       case World::SelectionChanged:
    363         emit selectionstatusChanged();
    364         break;
    365       default:
    366         ASSERT(0, "GLMoleculeObject_atom::recieveNotification() - we are not signed on to channel "
    367             +toString(notification->getChannelNo())+" of the World.");
    368         break;
    369     }
    370   }
    371 }
     354  } else
     355    ASSERT(0, "GLMoleculeObject_atom::recieveNotification() - received notification from unexpected source.");
     356}
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp

    re5a477 r015f8c  
    4141  void recieveNotification(Observable *publisher, Notification_ptr notification);
    4242
     43public slots:
     44  void Selected();
     45  void Unselected();
     46
    4347private slots:
    4448  void wasClicked();
     
    4751  void resetPosition();
    4852  void resetBonds();
    49   void resetSelectionStatus();
    5053
    5154signals:
     
    5861  void elementChanged();
    5962  void bondsChanged();
    60   void selectionstatusChanged();
    6163
    6264private:
     
    7476  atomicNumber_t updateElement() const;
    7577  ListOfBonds_t updateBonds() const;
    76   bool updateSelectionStatus() const;
    7778
    7879  void activateObserver();
     
    9596  //!> cached value of the atom's id
    9697  ObservedValue<ListOfBonds_t> AtomBonds;
    97   //!> cached value of the atom's selection status
    98   ObservedValue<bool> AtomSelectionStatus;
    9998
    10099  //!> list of channels when index needs to update
     
    106105  //!> list of channels when bonds needs to update
    107106  static const Observable::channels_t AtomBondsChannels;
    108   //!> list of channels when selection status needs to update
    109   static const Observable::channels_t AtomSelectionStatusChannels;
    110107
    111108  //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    re5a477 r015f8c  
    2828 *      Author: ankele
    2929 */
    30 
    31 
    32 
    3330
    3431
     
    114111  TesselationHullUpdater(
    115112      boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this)
    116       ),
    117   IsSelectedUpdater(
    118       boost::bind(&GLMoleculeObject_molecule::updateIsSelected, this)
    119113      ),
    120114  BoundingBoxUpdater(
     
    135129      "MoleculeTesselationHull_"+toString(_molid),
    136130      HullChannels),
    137   isSelected(
    138       const_cast<const World * const>(World::getPointer()),
    139       IsSelectedUpdater,
    140       "MoleculeBoundingBox_"+toString(_molid),
    141       updateIsSelected(),
    142       BoundingBoxChannels),
    143131  BoundingBox(
    144132      molref,
     
    189177  TesselationHullUpdater(
    190178      boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this)
    191       ),
    192   IsSelectedUpdater(
    193       boost::bind(&GLMoleculeObject_molecule::updateIsSelected, this)
    194179      ),
    195180  BoundingBoxUpdater(
     
    210195      "MoleculeTesselationHull_"+toString(_molid),
    211196      HullChannels),
    212   isSelected(
    213       const_cast<const World * const>(World::getPointer()),
    214       IsSelectedUpdater,
    215       "MoleculeBoundingBox_"+toString(_molid),
    216       updateIsSelected(),
    217       BoundingBoxChannels),
    218197  BoundingBox(
    219198      molref,
     
    240219  connect (this, SIGNAL(TesselationHullChanged()), this, SLOT(resetTesselationHull()), Qt::QueuedConnection);
    241220  connect (this, SIGNAL(BoundingBoxChanged()), this, SLOT(resetBoundingBox()), Qt::QueuedConnection);
    242   connect (this, SIGNAL(IsSelectedChanged()), this, SLOT(resetIsSelected()), Qt::QueuedConnection);
    243221  connect (this, SIGNAL(IdChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection);
    244222  connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)), Qt::QueuedConnection);
     
    262240    owner->signOff(this, molecule::AtomMoved);
    263241    owner->signOff(this, molecule::IndexChanged);
    264     /*_atom->signOff(this, AtomObservable::IndexChanged);
    265     _atom->signOff(this, AtomObservable::PositionChanged);
    266     _atom->signOff(this, AtomObservable::ElementChanged);
    267     _atom->signOff(this, AtomObservable::BondsAdded);*/
    268     World::getInstance().signOff(this, World::SelectionChanged);
    269242    owner = NULL;
    270243  }
     
    281254    owner->signOn(this, molecule::AtomMoved);
    282255    owner->signOn(this, molecule::IndexChanged);
    283     /*molref->signOn(this, AtomObservable::IndexChanged);
    284     molref->signOn(this, AtomObservable::PositionChanged);
    285     molref->signOn(this, AtomObservable::ElementChanged);
    286     molref->signOn(this, AtomObservable::BondsAdded);*/
    287     World::getInstance().signOn(this, World::SelectionChanged);
    288256  } else {
    289257    ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << MolIndex.get());
     
    407375}
    408376
    409 bool GLMoleculeObject_molecule::updateIsSelected() const
    410 {
    411   return const_cast<const World &>(World::getInstance()).isMoleculeSelected(MolIndex.get());
    412 }
    413 
    414377GLMoleculeObject_molecule::BoundingBoxInfo GLMoleculeObject_molecule::updateBoundingBox() const
    415378{
     
    448411  if (!TesselationHull.isValid())
    449412    updateMesh(createMoleculeMesh(*TesselationHull));
    450 }
    451 
    452 void GLMoleculeObject_molecule::resetIsSelected()
    453 {
    454   setSelected(isSelected.get());
    455413}
    456414
     
    496454
    497455  emit indexChanged(this, oldId, newId);
     456}
     457
     458void GLMoleculeObject_molecule::AtomSelected(const atomId_t _id)
     459{
     460  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
     461  ASSERT( iter != AtomsinSceneMap.end(),
     462      "GLMoleculeObject_molecule::AtomSelected() - atom "+toString(_id)
     463      +" unknown to GLMoleculeObject_molecule.");
     464  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     465                            "Selected",       // member name (no parameters here)
     466                            Qt::QueuedConnection);     // connection type
     467}
     468
     469void GLMoleculeObject_molecule::AtomUnselected(const atomId_t _id)
     470{
     471  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
     472  ASSERT( iter != AtomsinSceneMap.end(),
     473      "GLMoleculeObject_molecule::AtomUnselected() - atom "+toString(_id)
     474      +" unknown to GLMoleculeObject_molecule.");
     475  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     476                            "Unselected",       // member name (no parameters here)
     477                            Qt::QueuedConnection);     // connection type
     478}
     479
     480void GLMoleculeObject_molecule::Selected()
     481{
     482  ASSERT( !m_selected,
     483      "GLMoleculeObject_molecule::Selected() - 3D rep of molecule is already selected.");
     484  m_selected = true;
     485
     486  emit changed();
     487}
     488
     489void GLMoleculeObject_molecule::Unselected()
     490{
     491  ASSERT( m_selected,
     492      "GLMoleculeObject_molecule::Unselected() - 3D rep of molecule is already unselected.");
     493  m_selected = false;
     494
     495  emit changed();
    498496}
    499497
     
    569567        break;
    570568    }
    571   }else{
    572     // notification from world
    573 #ifdef LOG_OBSERVER
    574     observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this))
    575           << " received notification from world for channel "
    576           << notification->getChannelNo() << ".";
    577 #endif
    578     switch (notification->getChannelNo()) {
    579       case World::SelectionChanged:
    580         emit IsSelectedChanged();
    581         break;
    582       default:
    583         break;
    584     }
    585   }
     569  } else
     570    ASSERT(0, "GLMoleculeObject_molecule::recieveNotification() - received notification from unexpected source.");
    586571}
    587572
     
    694679  connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
    695680  connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
    696   connect (atomObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    697681//  connect (atomObject, SIGNAL(bondsChanged()), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
    698   connect (atomObject, SIGNAL(BondsInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
     682  connect (atomObject, SIGNAL(BondsAdded(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
    699683  connect (atomObject, SIGNAL(BondsRemoved(const atomId_t, const atomId_t)), this, SLOT(bondRemoved(const atomId_t, const atomId_t)));
    700684  connect (atomObject, SIGNAL(indexChanged(GLMoleculeObject_atom*, const atomId_t, const atomId_t)), this, SLOT(changeAtomId(GLMoleculeObject_atom*, const atomId_t, const atomId_t)));
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    re5a477 r015f8c  
    8686
    8787  void resetTesselationHull();
    88   void resetIsSelected();
    8988  void resetBoundingBox();
    9089  void resetAtoms();
    9190  void resetIndex();
     91
     92  void AtomSelected(const atomId_t _id);
     93  void AtomUnselected(const atomId_t _id);
     94  void Selected();
     95  void Unselected();
    9296
    9397private:
     
    121125
    122126  QGeometryData updateTesselationHull() const;
    123   bool updateIsSelected() const;
    124127  BoundingBoxInfo updateBoundingBox() const;
    125128  atoms_t updateAtoms();
     
    136139  //!> list of channels when tesselation hull needs to update
    137140  static const Observable::channels_t HullChannels;
    138   //!> list of channels when selection status needs to update
    139   static const Observable::channels_t SelectionStatusChannels;
    140141  //!> list of channels when bounding box needs to update
    141142  static const Observable::channels_t BoundingBoxChannels;
     
    145146  boost::function<moleculeId_t ()> MolIndexUpdater;
    146147  boost::function<QGeometryData ()> TesselationHullUpdater;
    147   boost::function<bool ()> IsSelectedUpdater;
    148148  boost::function<BoundingBoxInfo ()> BoundingBoxUpdater;
    149149  boost::function<atoms_t ()> PresentAtomsUpdater;
     
    153153  //!> contains current version of the tesselation hull on request
    154154  Cacheable<QGeometryData> TesselationHull;
    155   //!> contains newest version of the selection status
    156   ObservedValue<bool> isSelected;
    157155  //!> contains newest version of the bounding box on request
    158156  ObservedValue<BoundingBoxInfo> BoundingBox;
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    re5a477 r015f8c  
    4343#include <Qt3D/qglcylinder.h>
    4444
    45 #include "GLMoleculeObject.hpp"
    46 #include "GLMoleculeObject_atom.hpp"
    47 #include "GLMoleculeObject_bond.hpp"
    48 #include "GLMoleculeObject_molecule.hpp"
    49 #include "GLMoleculeObject_shape.hpp"
     45#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp"
     46#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp"
     47#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp"
     48#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp"
     49#include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.hpp"
     50
     51#include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"
    5052
    5153#include "CodePatterns/MemDebug.hpp"
     
    417419}
    418420
     421void GLWorldScene::setSelectionChangedAgent(QtSelectionChangedAgent *agent)
     422{
     423  connect(agent, SIGNAL(atomSelected(const moleculeId_t, const atomId_t)),
     424      this, SLOT(AtomSelected(const moleculeId_t, const atomId_t)));
     425  connect(agent, SIGNAL(atomUnselected(const moleculeId_t, const atomId_t)),
     426      this, SLOT(AtomUnselected(const moleculeId_t, const atomId_t)));
     427
     428  connect(agent, SIGNAL(moleculeSelected(const moleculeId_t)),
     429      this, SLOT(MoleculeSelected(const moleculeId_t)));
     430  connect(agent, SIGNAL(moleculeUnselected(const moleculeId_t)),
     431      this, SLOT(MoleculeUnselected(const moleculeId_t)));
     432}
     433
    419434void GLWorldScene::setSelectionModeAtom()
    420435{
     
    463478  }
    464479}
     480
     481void GLWorldScene::AtomSelected(const moleculeId_t _molid, const atomId_t _id)
     482{
     483  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
     484  ASSERT( iter != MoleculesinSceneMap.end(),
     485      "GLWorldScene::AtomSelected() - molecule "+toString(_molid)
     486      +" unknown to GLWorldScene.");
     487  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     488                            "AtomSelected",       // member name (no parameters here)
     489                            Qt::QueuedConnection,     // connection type
     490                            Q_ARG(const atomId_t, _id));     // parameters
     491}
     492
     493void GLWorldScene::AtomUnselected(const moleculeId_t _molid, const atomId_t _id)
     494{
     495  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
     496  ASSERT( iter != MoleculesinSceneMap.end(),
     497      "GLWorldScene::AtomUnselected() - molecule "+toString(_molid)
     498      +" unknown to GLWorldScene.");
     499  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     500                            "AtomUnselected",       // member name (no parameters here)
     501                            Qt::QueuedConnection,     // connection type
     502                            Q_ARG(const atomId_t, _id));     // parameters
     503}
     504
     505void GLWorldScene::MoleculeSelected(const moleculeId_t _molid)
     506{
     507  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
     508  ASSERT( iter != MoleculesinSceneMap.end(),
     509      "GLWorldScene::MoleculeSelected() - molecule "+toString(_molid)
     510      +" unknown to GLWorldScene.");
     511  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     512                            "Selected",       // member name (no parameters here)
     513                            Qt::QueuedConnection);     // connection type
     514}
     515
     516void GLWorldScene::MoleculeUnselected(const moleculeId_t _molid)
     517{
     518  MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
     519  ASSERT( iter != MoleculesinSceneMap.end(),
     520      "GLWorldScene::MoleculeUnselected() - molecule "+toString(_molid)
     521      +" unknown to GLWorldScene.");
     522  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     523                            "Unselected",       // member name (no parameters here)
     524                            Qt::QueuedConnection);     // connection type
     525}
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    re5a477 r015f8c  
    3939class GLMoleculeObject_molecule;
    4040class GLMoleculeObject_shape;
     41class QtSelectionChangedAgent;
    4142
    4243/** This class contains a list of all molecules in the world.
     
    6869  void setSelectionMode(SelectionModeType mode);
    6970
     71  void setSelectionChangedAgent(QtSelectionChangedAgent *agent);
     72
    7073signals:
    7174  void changed();
     
    9497  void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible);
    9598  void changeMoleculeId(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
     99
     100  void AtomSelected(const moleculeId_t _molid, const atomId_t);
     101  void AtomUnselected(const moleculeId_t _molid, const atomId_t);
     102  void MoleculeSelected(const moleculeId_t);
     103  void MoleculeUnselected(const moleculeId_t);
    96104
    97105public:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    re5a477 r015f8c  
    317317
    318318  setdreiBeinStatus( status );
     319}
     320
     321void GLWorldView::setSelectionChangedAgent(QtSelectionChangedAgent *agent)
     322{
     323  worldscene->setSelectionChangedAgent(agent);
    319324}
    320325
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    re5a477 r015f8c  
    2626class QToolBar;
    2727class QTimer;
     28class QtSelectionChangedAgent;
    2829
    2930/** This class is the view on the 3D representation of the World, i.e. the whole
     
    4142  void createDomainBox();
    4243  void createDreiBein();
     44
     45  void setSelectionChangedAgent(QtSelectionChangedAgent *agent);
    4346
    4447  // Observer functions
Note: See TracChangeset for help on using the changeset viewer.