Selection In ParaQ: Difference between revisions
From ParaQ Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
* We define a Selection Adaptor. Given a pqPipelineModel and a QItemSelection for it, the Selection Adaptor generates a pqSelection object. This is quite trivial since it is very easy to obtain a pqServerManagerModelItem, given a pqPipelineModelItem. Additionally, the Selecion Adaptor can convert a pqSelection object to a QItemSelection object for the pqPipelineModel (again, a straight forward task). | * We define a Selection Adaptor. Given a pqPipelineModel and a QItemSelection for it, the Selection Adaptor generates a pqSelection object. This is quite trivial since it is very easy to obtain a pqServerManagerModelItem, given a pqPipelineModelItem. Additionally, the Selecion Adaptor can convert a pqSelection object to a QItemSelection object for the pqPipelineModel (again, a straight forward task). | ||
* Now, when user select elements in the Pipeline Browser, we have a QItemSelection. We take this selection, give it to the Selection Adaptor and obtain a pqSMSelection. The ServerManager can then be told to select the collection of proxies in pqSMSelection (once the selection mechanism is added to the Server Manager). | |||
* Similarly when the user does a rubber band select in the render window, the Server Manager will create a collection of selection proxies. pqServerManagerModel can build a pqSMSelection out of this collection of vtkSMProxies. The Selection Adaptor can translate pqSMSelection to QItemSelection suitable for any view on pqPipelineModel. |
Revision as of 16:29, 6 June 2006
This documents discusses a design for Selection in ParaQ.
Background
- pqServerManagerModel -- graph model for the vtkSMProxyManager state.
- pqPipelineModel -- tree model generated using pqServerManagerModel. This is QAbstractItemModel subclass.
Design
- Qt provides a QItemSelectionModel. As per the Trolltech documentation it keeps the indexes for items in a model. The same selection model object can be shared among several views that have use the same underlying model. QItemSelectionModel, generally speaking, keeps a QItemSelection object. QItemSelection can be thought of as a collection QModelIndex objects for the selected enties. These QModelIndex objects depend on the model. Given a QModelIndex, pqPipelineModel knows exactly which pqServerManagerModelItem (and in turn which vtkSMProxy) the index is refering to.
- pqServerManagerModel keeps a collection of pqServerManagerModelItems which represent source/filter/display proxies. We define a new class pqSMSelection which is a collection of pqServerManagerModelItems. Note pqSMSelection is not a subclass of QItemSelection nor does it use QModelIndex objects. Thus is due to the fact that QModelIndex use (row, column) to identify the model item, which doesn't apply to the graph model (pqServerManagerModel). Given a pqSMSelection object, pqServerManagerModel knows exactly what proxies are selected in the selection.
- We define a Selection Adaptor. Given a pqPipelineModel and a QItemSelection for it, the Selection Adaptor generates a pqSelection object. This is quite trivial since it is very easy to obtain a pqServerManagerModelItem, given a pqPipelineModelItem. Additionally, the Selecion Adaptor can convert a pqSelection object to a QItemSelection object for the pqPipelineModel (again, a straight forward task).
- Now, when user select elements in the Pipeline Browser, we have a QItemSelection. We take this selection, give it to the Selection Adaptor and obtain a pqSMSelection. The ServerManager can then be told to select the collection of proxies in pqSMSelection (once the selection mechanism is added to the Server Manager).
- Similarly when the user does a rubber band select in the render window, the Server Manager will create a collection of selection proxies. pqServerManagerModel can build a pqSMSelection out of this collection of vtkSMProxies. The Selection Adaptor can translate pqSMSelection to QItemSelection suitable for any view on pqPipelineModel.