Talk:SMObserver Abstraction: Difference between revisions

From ParaQ Wiki
Jump to navigationJump to search
No edit summary
 
Line 19: Line 19:
==Changes to the Redesign==
==Changes to the Redesign==
The overall design will remain the same. The pqServerManagerModel will build a tree instead of a graph. More signals will be added to the pqServerManagerModel to notify the pqPipelineModel of changes. The signals will notify the model when a link is created and a filter is moved. The pqPipelineBuilder will still be used to build and modify the model. The pqServerManagerModel will still respond to events from the server manager to make changes to the data structure. A selection model tied to the pqPipeline model will be used to coordinate the gui. It will determine which proxy is displayed in the object inspector. It will also determine what operations can be performed. The selection model and related behavior should not be part of pqApplicationCore. They can be available for use in other applications, but are not required components. Prism, for instance, will define it's own behavior.
The overall design will remain the same. The pqServerManagerModel will build a tree instead of a graph. More signals will be added to the pqServerManagerModel to notify the pqPipelineModel of changes. The signals will notify the model when a link is created and a filter is moved. The pqPipelineBuilder will still be used to build and modify the model. The pqServerManagerModel will still respond to events from the server manager to make changes to the data structure. A selection model tied to the pqPipeline model will be used to coordinate the gui. It will determine which proxy is displayed in the object inspector. It will also determine what operations can be performed. The selection model and related behavior should not be part of pqApplicationCore. They can be available for use in other applications, but are not required components. Prism, for instance, will define it's own behavior.
===pqServerManagerModel===
  /// \name Server List Methods
  //@{
  int getServerCount() const;
  pqPipelineServer *getServer(int index) const;
  int getServerIndexFor(pqPipelineServer *server) const;
  //@}
 
  /// \name Object Mapping Methods
  //@{
  pqPipelineServer *getServerFor(pqServer *server) const;
  pqPipelineServer *getServerFor(vtkIdType connectionId) const;
  pqPipelineSource *getSourceFor(vtkSMProxy *proxy) const;
  pqPipelineDisplay *getDisplayFor(vtkSMDisplayProxy *display) const;
  pqRenderModule *getRenderModuleFor(vtkSMRenderModuleProxy *module) const;
  //@}
 
  public slots:
  /// \name Model Modification Methods
  //@{
  void addServer(vtkIdType connectionId);
  void removeServer(vtkIdType connectionId);
 
  void addSource(QString name, vtkSMProxy *proxy);
  void addFilter(QString name, vtkSMProxy *proxy);
  void addBundle(QString name, vtkSMProxy *proxy);
  void removeSource(vtkSMProxy *proxy);
 
  //void addConnection(vtkSMProxy *source, vtkSMProxy *sink,
  //    const char *sourceOutput=0, const char *sinkInput=0);
  //void removeConnection(vtkSMProxy *source, vtkSMProxy *sink,
  //    const char *sourceOutput=0, const char *sinkInput=0);
  void addConnection(vtkSMProxy *source, vtkSMProxy *sink);
  void removeConnection(vtkSMProxy *source, vtkSMProxy *sink);
 
  void addDisplay(QString name, vtkSMDisplayProxy* proxy);
  void removeDisplay(vtkSMDisplayProxy *proxy);
 
  void addRenderModule(QString name, vtkSMRenderModuleProxy *module);
  void removeRenderModule(vtkSMRenderModuleProxy *module);
  //@}
 
  signals:
  void serverAdded(pqPipelineServer *server);
  void removingServer(pqPipelineServer *server);
 
  void sourceAdded(pqPipelineSource *source);
  void removingSource(pqPipelineSource *source);
 
  void temporarilyRemovingSource(pqPipelineSource *source);
  void sourceRestored(pqPipelineSource *source);
 
  void linkAdded(pqPipelineLink *link);
  void removingLink(pqPipelineLink *link);
 
  void displayAdded(pqPipelineDisplay *display);
  void removingDisplay(pqPipelineDisplay *display);
 
  void renderModuleAdded(pqRenderModule *module);
  void removingRenderModule(pqRenderModule *module);

Revision as of 16:39, 18 May 2006

Points to consider

  • QAbstractItemView uses a QAbstractItemModel.
  • QAbstractItemModel interface requires a hierarchical table format.
    • To display a graph, a link object can be used to form a tree.
    • Having an object instance for the link is needed for the model.
  • Every QAbstractItemView that displays the pipeline will need a tree model.
    • Setting up the tree structure can be done in a separate model class that is reused by the various models, or it can be put in the pqServerManagerModel.
    • The argument for doing the work in another class is that the main model is kept as a pure representation of the connections.
    • The argument for puting the tree structure in the main model is convenience. The model can still be traversed like a graph. The link item is just an extra step when traversing the model.
    • The pipeline model is a convenience for the gui. The gui will most likely be using Qt model/views in order to unify selection of gui items. Qt's selection model will be used to accomplish this, which only works with a QAbstractItemModel.

Data Structure

The Following data structure is based on the data needed for each object. The lines represent inheritence.

PipelineStructure.png

The base class stores the object type. This is a convenience for the model. The type can also be determined by dynamically casting the the instance. The server has a list of source objects that can be a true source or a fan-in point. The source object has a list of outputs that can be a filter or a link item to a filter. The filter object has a list of input sources. The filter inherits the output list from the source object. The link has a pointer to its input source. It also has a pointer to the filter the source is connected to.

Changes to the Redesign

The overall design will remain the same. The pqServerManagerModel will build a tree instead of a graph. More signals will be added to the pqServerManagerModel to notify the pqPipelineModel of changes. The signals will notify the model when a link is created and a filter is moved. The pqPipelineBuilder will still be used to build and modify the model. The pqServerManagerModel will still respond to events from the server manager to make changes to the data structure. A selection model tied to the pqPipeline model will be used to coordinate the gui. It will determine which proxy is displayed in the object inspector. It will also determine what operations can be performed. The selection model and related behavior should not be part of pqApplicationCore. They can be available for use in other applications, but are not required components. Prism, for instance, will define it's own behavior.

pqServerManagerModel

 /// \name Server List Methods
 //@{
 int getServerCount() const;
 pqPipelineServer *getServer(int index) const;
 int getServerIndexFor(pqPipelineServer *server) const;
 //@}
 
 /// \name Object Mapping Methods
 //@{
 pqPipelineServer *getServerFor(pqServer *server) const;
 pqPipelineServer *getServerFor(vtkIdType connectionId) const;
 pqPipelineSource *getSourceFor(vtkSMProxy *proxy) const;
 pqPipelineDisplay *getDisplayFor(vtkSMDisplayProxy *display) const;
 pqRenderModule *getRenderModuleFor(vtkSMRenderModuleProxy *module) const;
 //@}
 
 public slots:
 /// \name Model Modification Methods
 //@{
 void addServer(vtkIdType connectionId);
 void removeServer(vtkIdType connectionId);
 
 void addSource(QString name, vtkSMProxy *proxy);
 void addFilter(QString name, vtkSMProxy *proxy);
 void addBundle(QString name, vtkSMProxy *proxy);
 void removeSource(vtkSMProxy *proxy);
 
 //void addConnection(vtkSMProxy *source, vtkSMProxy *sink,
 //    const char *sourceOutput=0, const char *sinkInput=0);
 //void removeConnection(vtkSMProxy *source, vtkSMProxy *sink,
 //    const char *sourceOutput=0, const char *sinkInput=0);
 void addConnection(vtkSMProxy *source, vtkSMProxy *sink);
 void removeConnection(vtkSMProxy *source, vtkSMProxy *sink);
 
 void addDisplay(QString name, vtkSMDisplayProxy* proxy);
 void removeDisplay(vtkSMDisplayProxy *proxy);
 
 void addRenderModule(QString name, vtkSMRenderModuleProxy *module);
 void removeRenderModule(vtkSMRenderModuleProxy *module);
 //@}
 
 signals:
 void serverAdded(pqPipelineServer *server);
 void removingServer(pqPipelineServer *server);
 
 void sourceAdded(pqPipelineSource *source);
 void removingSource(pqPipelineSource *source);
 
 void temporarilyRemovingSource(pqPipelineSource *source);
 void sourceRestored(pqPipelineSource *source);
 
 void linkAdded(pqPipelineLink *link);
 void removingLink(pqPipelineLink *link);
 
 void displayAdded(pqPipelineDisplay *display);
 void removingDisplay(pqPipelineDisplay *display);
 
 void renderModuleAdded(pqRenderModule *module);
 void removingRenderModule(pqRenderModule *module);