- Timestamp:
- Aug 5, 2015, 5:32:11 PM (10 years ago)
- 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)
- Location:
- src/UIElements
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/QtMainWindow.cpp
re5a477 r015f8c 61 61 #include "Views/Qt4/QtShapeController.hpp" 62 62 #include "Views/Qt4/QtInfoBox.hpp" 63 #include "Views/Qt4/QtSelectionChangedAgent.hpp" 63 64 #include "Views/Qt4/QtStatusBar.hpp" 64 65 #include "Views/Qt4/QtTimeLine.hpp" … … 101 102 QVBoxLayout *layout = new QVBoxLayout(layoutwidget); 102 103 104 selectionagent = new QtSelectionChangedAgent(this); 105 103 106 QtMoleculeListView *moleculeListView = new QtMoleculeListView(worldTab); 104 107 moleculeList = new QtMoleculeList; 105 108 moleculeListView->setModel(moleculeList); 109 moleculeListView->setSelectionChangedAgent(selectionagent); 106 110 107 111 elementList = new QtElementList(worldTab); … … 119 123 // glWorldView->setFocus(); 120 124 glWorldView->camera()->setEye( QVector3D(0,3,10)); 125 glWorldView->setSelectionChangedAgent(selectionagent); 121 126 122 127 MainMenu = new QtMenu<QMenuBar>(menuBar(), ""); -
src/UIElements/Qt4/QtMainWindow.hpp
re5a477 r015f8c 28 28 class QtLogBox; 29 29 class QtMoleculeList; 30 class QtSelectionChangedAgent; 30 31 class QtShapeController; 31 32 class StringView; … … 58 59 QtHomologyList *homologyList; 59 60 QtFragmentList *fragmentList; 61 QtSelectionChangedAgent *selectionagent; 60 62 QtShapeController *shapeController; 61 63 GLWorldView *glWorldView; -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp
re5a477 r015f8c 178 178 } 179 179 180 const 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 } 180 189 181 190 const moleculeId_t QtMoleculeList::IndexToMoleculeId(const QModelIndex &_index) const -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp
re5a477 r015f8c 86 86 bool isMoleculeItemPresent(const moleculeId_t _molid) const; 87 87 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; 88 90 const moleculeId_t IndexToMoleculeId(const QModelIndex &_index) const; 89 const moleculeId_t ItemToMoleculeId(const QtMoleculeItem * const _item) const;90 91 QtMoleculeItem * getSpecificMoleculeItem( 91 92 const QtMoleculeItem * const _item, -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.cpp
re5a477 r015f8c 37 37 #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp" 38 38 #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp" 39 #include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp" 39 40 40 41 #include "CodePatterns/MemDebug.hpp" … … 53 54 { 54 55 setSelectionMode(QAbstractItemView::MultiSelection); 55 56 World::getInstance().signOn(this, World::SelectionChanged);57 56 } 58 57 59 58 QtMoleculeListView::~QtMoleculeListView() 60 { 61 World::getInstance().signOff(this, World::SelectionChanged); 62 } 59 {} 63 60 64 61 void QtMoleculeListView::setModel(QtMoleculeList *_moleculelist) … … 69 66 selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), 70 67 this, SLOT(rowsSelected(const QItemSelection &, const QItemSelection &)), Qt::DirectConnection); 68 } 69 70 71 void 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))); 71 77 } 72 78 … … 148 154 selecting = false; 149 155 } 156 157 void 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 177 void 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 150 197 151 198 void QtMoleculeListView::recieveNotification(Observable *publisher, Notification_ptr notification) -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp
re5a477 r015f8c 19 19 #include "CodePatterns/Observer/Observer.hpp" 20 20 21 #include "types.hpp" 22 21 23 class QtMoleculeList; 24 class QtSelectionChangedAgent; 22 25 23 26 class QtMoleculeListView : public QTreeView, public Observer … … 31 34 void setModel(QtMoleculeList *_moleculelist); 32 35 36 void setSelectionChangedAgent(QtSelectionChangedAgent *agent); 37 33 38 public slots: 34 39 void rowsSelected(const QItemSelection&, const QItemSelection&); 40 41 void MoleculeSelected(const moleculeId_t _id); 42 void MoleculeUnselected(const moleculeId_t _id); 35 43 36 44 protected: -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
re5a477 r015f8c 75 75 const Observable::channels_t 76 76 GLMoleculeObject_atom::AtomBondsChannels(getAtomBondsChannels()); 77 const Observable::channels_t78 GLMoleculeObject_atom::AtomSelectionStatusChannels(World::SelectionChanged);79 77 80 78 GLMoleculeObject_atom::GLMoleculeObject_atom(QGLSceneNode *mesh[], QObject *parent, const atomId_t _id) : … … 106 104 updateBonds(), 107 105 AtomBondsChannels), 108 AtomSelectionStatus(109 World::getPointer(),110 boost::bind(&GLMoleculeObject_atom::updateSelectionStatus, this),111 "AtomSelectionStatus_"+toString(_id),112 updateSelectionStatus(),113 AtomSelectionStatusChannels),114 106 owner(NULL) 115 107 { … … 129 121 connect( this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection); 130 122 connect( this, SIGNAL(bondsChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection); 131 connect( this, SIGNAL(selectionstatusChanged()), this, SLOT(resetSelectionStatus()), Qt::QueuedConnection);132 123 } 133 124 … … 141 132 owner->signOn(this, AtomObservable::BondsAdded); 142 133 owner->signOn(this, AtomObservable::BondsRemoved); 143 World::getInstance().signOn(this, World::SelectionChanged);144 134 } 145 135 } … … 155 145 owner->signOff(this, AtomObservable::BondsAdded); 156 146 owner->signOff(this, AtomObservable::BondsRemoved); 157 World::getInstance().signOff(this, World::SelectionChanged);158 147 owner = NULL; 159 148 } … … 241 230 } 242 231 243 void GLMoleculeObject_atom::resetSelectionStatus() 244 { 245 setSelected(AtomSelectionStatus.get()); 246 } 232 void 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 241 void 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 247 250 248 251 void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane) … … 315 318 } 316 319 317 bool GLMoleculeObject_atom::updateSelectionStatus() const318 {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 326 320 void GLMoleculeObject_atom::update(Observable *publisher) 327 321 { … … 358 352 break; 359 353 } 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 41 41 void recieveNotification(Observable *publisher, Notification_ptr notification); 42 42 43 public slots: 44 void Selected(); 45 void Unselected(); 46 43 47 private slots: 44 48 void wasClicked(); … … 47 51 void resetPosition(); 48 52 void resetBonds(); 49 void resetSelectionStatus();50 53 51 54 signals: … … 58 61 void elementChanged(); 59 62 void bondsChanged(); 60 void selectionstatusChanged();61 63 62 64 private: … … 74 76 atomicNumber_t updateElement() const; 75 77 ListOfBonds_t updateBonds() const; 76 bool updateSelectionStatus() const;77 78 78 79 void activateObserver(); … … 95 96 //!> cached value of the atom's id 96 97 ObservedValue<ListOfBonds_t> AtomBonds; 97 //!> cached value of the atom's selection status98 ObservedValue<bool> AtomSelectionStatus;99 98 100 99 //!> list of channels when index needs to update … … 106 105 //!> list of channels when bonds needs to update 107 106 static const Observable::channels_t AtomBondsChannels; 108 //!> list of channels when selection status needs to update109 static const Observable::channels_t AtomSelectionStatusChannels;110 107 111 108 //!> 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 28 28 * Author: ankele 29 29 */ 30 31 32 33 30 34 31 … … 114 111 TesselationHullUpdater( 115 112 boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this) 116 ),117 IsSelectedUpdater(118 boost::bind(&GLMoleculeObject_molecule::updateIsSelected, this)119 113 ), 120 114 BoundingBoxUpdater( … … 135 129 "MoleculeTesselationHull_"+toString(_molid), 136 130 HullChannels), 137 isSelected(138 const_cast<const World * const>(World::getPointer()),139 IsSelectedUpdater,140 "MoleculeBoundingBox_"+toString(_molid),141 updateIsSelected(),142 BoundingBoxChannels),143 131 BoundingBox( 144 132 molref, … … 189 177 TesselationHullUpdater( 190 178 boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this) 191 ),192 IsSelectedUpdater(193 boost::bind(&GLMoleculeObject_molecule::updateIsSelected, this)194 179 ), 195 180 BoundingBoxUpdater( … … 210 195 "MoleculeTesselationHull_"+toString(_molid), 211 196 HullChannels), 212 isSelected(213 const_cast<const World * const>(World::getPointer()),214 IsSelectedUpdater,215 "MoleculeBoundingBox_"+toString(_molid),216 updateIsSelected(),217 BoundingBoxChannels),218 197 BoundingBox( 219 198 molref, … … 240 219 connect (this, SIGNAL(TesselationHullChanged()), this, SLOT(resetTesselationHull()), Qt::QueuedConnection); 241 220 connect (this, SIGNAL(BoundingBoxChanged()), this, SLOT(resetBoundingBox()), Qt::QueuedConnection); 242 connect (this, SIGNAL(IsSelectedChanged()), this, SLOT(resetIsSelected()), Qt::QueuedConnection);243 221 connect (this, SIGNAL(IdChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection); 244 222 connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)), Qt::QueuedConnection); … … 262 240 owner->signOff(this, molecule::AtomMoved); 263 241 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);269 242 owner = NULL; 270 243 } … … 281 254 owner->signOn(this, molecule::AtomMoved); 282 255 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);288 256 } else { 289 257 ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << MolIndex.get()); … … 407 375 } 408 376 409 bool GLMoleculeObject_molecule::updateIsSelected() const410 {411 return const_cast<const World &>(World::getInstance()).isMoleculeSelected(MolIndex.get());412 }413 414 377 GLMoleculeObject_molecule::BoundingBoxInfo GLMoleculeObject_molecule::updateBoundingBox() const 415 378 { … … 448 411 if (!TesselationHull.isValid()) 449 412 updateMesh(createMoleculeMesh(*TesselationHull)); 450 }451 452 void GLMoleculeObject_molecule::resetIsSelected()453 {454 setSelected(isSelected.get());455 413 } 456 414 … … 496 454 497 455 emit indexChanged(this, oldId, newId); 456 } 457 458 void 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 469 void 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 480 void 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 489 void 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(); 498 496 } 499 497 … … 569 567 break; 570 568 } 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."); 586 571 } 587 572 … … 694 679 connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed())); 695 680 connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *))); 696 connect (atomObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));697 681 // connect (atomObject, SIGNAL(bondsChanged()), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond))); 698 connect (atomObject, SIGNAL(Bonds Inserted(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))); 699 683 connect (atomObject, SIGNAL(BondsRemoved(const atomId_t, const atomId_t)), this, SLOT(bondRemoved(const atomId_t, const atomId_t))); 700 684 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 86 86 87 87 void resetTesselationHull(); 88 void resetIsSelected();89 88 void resetBoundingBox(); 90 89 void resetAtoms(); 91 90 void resetIndex(); 91 92 void AtomSelected(const atomId_t _id); 93 void AtomUnselected(const atomId_t _id); 94 void Selected(); 95 void Unselected(); 92 96 93 97 private: … … 121 125 122 126 QGeometryData updateTesselationHull() const; 123 bool updateIsSelected() const;124 127 BoundingBoxInfo updateBoundingBox() const; 125 128 atoms_t updateAtoms(); … … 136 139 //!> list of channels when tesselation hull needs to update 137 140 static const Observable::channels_t HullChannels; 138 //!> list of channels when selection status needs to update139 static const Observable::channels_t SelectionStatusChannels;140 141 //!> list of channels when bounding box needs to update 141 142 static const Observable::channels_t BoundingBoxChannels; … … 145 146 boost::function<moleculeId_t ()> MolIndexUpdater; 146 147 boost::function<QGeometryData ()> TesselationHullUpdater; 147 boost::function<bool ()> IsSelectedUpdater;148 148 boost::function<BoundingBoxInfo ()> BoundingBoxUpdater; 149 149 boost::function<atoms_t ()> PresentAtomsUpdater; … … 153 153 //!> contains current version of the tesselation hull on request 154 154 Cacheable<QGeometryData> TesselationHull; 155 //!> contains newest version of the selection status156 ObservedValue<bool> isSelected;157 155 //!> contains newest version of the bounding box on request 158 156 ObservedValue<BoundingBoxInfo> BoundingBox; -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
re5a477 r015f8c 43 43 #include <Qt3D/qglcylinder.h> 44 44 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" 50 52 51 53 #include "CodePatterns/MemDebug.hpp" … … 417 419 } 418 420 421 void 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 419 434 void GLWorldScene::setSelectionModeAtom() 420 435 { … … 463 478 } 464 479 } 480 481 void 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 493 void 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 505 void 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 516 void 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 39 39 class GLMoleculeObject_molecule; 40 40 class GLMoleculeObject_shape; 41 class QtSelectionChangedAgent; 41 42 42 43 /** This class contains a list of all molecules in the world. … … 68 69 void setSelectionMode(SelectionModeType mode); 69 70 71 void setSelectionChangedAgent(QtSelectionChangedAgent *agent); 72 70 73 signals: 71 74 void changed(); … … 94 97 void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible); 95 98 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); 96 104 97 105 public: -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
re5a477 r015f8c 317 317 318 318 setdreiBeinStatus( status ); 319 } 320 321 void GLWorldView::setSelectionChangedAgent(QtSelectionChangedAgent *agent) 322 { 323 worldscene->setSelectionChangedAgent(agent); 319 324 } 320 325 -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
re5a477 r015f8c 26 26 class QToolBar; 27 27 class QTimer; 28 class QtSelectionChangedAgent; 28 29 29 30 /** This class is the view on the 3D representation of the World, i.e. the whole … … 41 42 void createDomainBox(); 42 43 void createDreiBein(); 44 45 void setSelectionChangedAgent(QtSelectionChangedAgent *agent); 43 46 44 47 // Observer functions
Note:
See TracChangeset
for help on using the changeset viewer.