Overview     Modules     Class Hierarchy     Classes     Members  

tlp::View Class Reference

Tulip view interface class. More...

#include <View.h>

Inheritance diagram for tlp::View:

List of all members.

Public Slots

  • virtual void setGraph (Graph *graph)=0
    Sets the Graph on this View.
  • virtual void draw ()=0
    Draws the View from scratch, i.e. reading the Graph, and drawind all the nodes and edges depending on their position, colors, etc... This drawing is then stored to be re-used when a refresh is all you need. Then, the interactors are drawn. This is pretty resource-hungry, if you just need to redraw the interactors or only the selection changed, use refresh.
  • virtual void refresh ()=0
    Refreshes the view, using the backed up drawing that draw stored. Then the interactors are drawn. This is usefull when the selection changed, but nothing else in the Graph changed (color, size, layout, ...), or when an interactor changed and needs re-drawing. This is way less resource-hungry than draw().
  • virtual void init ()=0
    Centers and draws the view. Calls centerview() [where applicable], then draw(). This might be removed in a future version (3.6 or later) as all this does is calling centerview on the GlMainWidget if this is a GlMainView. Adding a centerView function in View would allow to remove this function.

Signals

  • void elementSelected (unsigned int eltId, bool isNode)
    This signal is emitted when a specific element is selected in the view.
  • void requestChangeGraph (tlp::View *view, tlp::Graph *graph)
    This signal is emitted when the view wants to change its graph.

Public Member Functions

  • virtual ~View ()
  • virtual QWidget * construct (QWidget *parent)=0
    Construct GUI of the view.
  • virtual QWidget * getWidget ()=0
    A getter on the main widget of the view.
  • virtual void setData (Graph *graph, DataSet dataSet)=0
    Set the View's Graph and DataSet.
  • virtual void getData (Graph **graph, DataSet *dataSet)=0
    Gets the Graph and DataSet of the view.
  • virtual Graph * getGraph ()=0
    A getter on this view's Graph.
  • virtual std::list< std::pair
    < QWidget *, std::string > > getConfigurationWidget ()
    Returns the configuration widgets this view should use. These widgets will be displayed in the left dock of the MainController, in the View Editor tab. Each widget will be in a tab whose text is the string of the pair.
  • virtual void setInteractors (const std::list< Interactor * > &interactors)=0
    Set the interactors on this view. The Interactors are created, but now the View has ownership on them (responsibility for their destruction).
  • virtual std::list< Interactor * > getInteractors ()=0
    Returns the interactors this view uses.
  • virtual void setActiveInteractor (Interactor *interactor)=0
    Sets the active interactor on this view. The interactor must be in the interactors list of this View.
  • virtual Interactor * getActiveInteractor ()=0
    Gets the active interactor of this view.
  • virtual void _DEPRECATED createPicture (const std::string &pictureName, int width=0, int height=0)
    Take a snapshot of the view and put it in a picture.
  • virtual bool _DEPRECATED createPicture (const std::string &pictureName, int width, int height, bool center, int zoom=1, int xOffset=0, int yOffset=0)
    Take a snapshot of the view, and save it to a picture on disk.
  • virtual bool savePicture (const std::string &pictureName, int width, int height, bool center, int zoom=1, int xOffset=0, int yOffset=0)
    Take a snapshot of the view, and save it to a picture on disk.
  • virtual QImage createPicture (int width, int height, bool center, int zoom=1, int xOffset=0, int yOffset=0)
    Take a snapshot of the view, and return a QImage.
  • virtual std::string getRealViewName () const
    Return the real view name (if "" the real name is the name given by the plugin).
  • virtual void undoIsDone ()
    This function is called when an undo is performed by the controller.

Detailed Description

Tulip view interface class.

The View class provides the skeleton of a view. You normally never have to construct a View object yourself, the Controller takes care of this (and manages the interactors, etc...).


Constructor & Destructor Documentation

virtual tlp::View::~View (  )  [inline, virtual]

empty destructor : for inheritance


Member Function Documentation

virtual QWidget* tlp::View::construct ( QWidget *  parent  )  [pure virtual]

Construct GUI of the view.

Parameters:
parent The parent widget of this view.
Returns:
QWidget* the main widget of the view (in MainController this widget will be added to the workspace).

Implemented in tlp::AbstractView, tlp::BaseGraphicsViewComponent, tlp::GlMainView, and tlp::NodeLinkDiagramComponent.

virtual QImage tlp::View::createPicture ( int  width,
int  height,
bool  center,
int  zoom = 1,
int  xOffset = 0,
int  yOffset = 0 
) [virtual]

Take a snapshot of the view, and return a QImage.

Parameters:
width : width of the picture
height : height of the picture
center : whether we should center the view before creating the picture, or use the current zoom and pan.
zoom : creates a picture of a sub part of the view. With zoom=1 creates only one picture with entire view; with zoom=N : the view is cut into 2^(N-1) part in width and height. Defaults to 1.
xOffset : which part of the view to render if zoom!=1. xOffset must be 0 <= xOffset < 2^(zoom-1). Defaults to 0.
yOffset : which part of the view to render if zoom!=1. yOffset must be 0 <= yOffset < 2^(zoom-1). Defaults to 0.
Returns:
Qimage : snapshot image.

Reimplemented in tlp::GlMainView.

virtual bool _DEPRECATED tlp::View::createPicture ( const std::string &  pictureName,
int  width,
int  height,
bool  center,
int  zoom = 1,
int  xOffset = 0,
int  yOffset = 0 
) [virtual]

Take a snapshot of the view, and save it to a picture on disk.

Deprecated:
In Tulip 4.x.y this function will be replaced by bool savePicture(const string &pictureName,int width, int height, bool center, int zoom, int xOffset, int yOffset).
Parameters:
pictureName : filename to use for the picture, with extension (extension is used to infer image type).
width : width of the picture
height : height of the picture
center : whether we should center the view before creating the picture, or use the current zoom and pan.
zoom : creates a picture of a sub part of the view. With zoom=1 creates only one picture with entire view; with zoom=N : the view is cut into 2^(N-1) part in width and height. Defaults to 1.
xOffset : which part of the view to render if zoom!=1. xOffset must be 0 <= xOffset < 2^(zoom-1). Defaults to 0.
yOffset : which part of the view to render if zoom!=1. yOffset must be 0 <= yOffset < 2^(zoom-1). Defaults to 0.
Returns:
bool : Whether the picture can be created or not.

Reimplemented in tlp::GlMainView.

virtual void _DEPRECATED tlp::View::createPicture ( const std::string &  pictureName,
int  width = 0,
int  height = 0 
) [virtual]

Take a snapshot of the view and put it in a picture.

Deprecated:
In Tulip 4.x.y this function will be replaced by void createPicture(const string &pictureName,int width, int height, bool center, int zoom, int xOffset, int yOffset)
Parameters:
pictureName filename to use for the picture, with extension (extension is used to infer image type).
width width of the picture Defaults to 0.
height height of the picture Defaults to 0.
Returns:
void

Reimplemented in tlp::BaseGraphicsViewComponent, and tlp::GlMainView.

virtual void tlp::View::draw (  )  [pure virtual, slot]

Draws the View from scratch, i.e. reading the Graph, and drawind all the nodes and edges depending on their position, colors, etc... This drawing is then stored to be re-used when a refresh is all you need. Then, the interactors are drawn. This is pretty resource-hungry, if you just need to redraw the interactors or only the selection changed, use refresh.

Returns:
void

Implemented in tlp::BaseGraphicsViewComponent, tlp::GlMainView, and tlp::NodeLinkDiagramComponent.

void tlp::View::elementSelected ( unsigned int  eltId,
bool  isNode 
) [signal]

This signal is emitted when a specific element is selected in the view.

Parameters:
eltId The identifier of the selected element.
isNode Whether or not the selected element is a node. It can only be a node or an edge.
Returns:
void
virtual Interactor* tlp::View::getActiveInteractor (  )  [pure virtual]

Gets the active interactor of this view.

Returns:
:Interactor* The active Interactor of this View.

Implemented in tlp::AbstractView.

virtual std::list<std::pair<QWidget *,std::string> > tlp::View::getConfigurationWidget (  )  [inline, virtual]

Returns the configuration widgets this view should use. These widgets will be displayed in the left dock of the MainController, in the View Editor tab. Each widget will be in a tab whose text is the string of the pair.

Returns:
:list< std::pair<QWidget* , std::string > > Each element of this list is a pair of configuration widget and widget title.

Reimplemented in tlp::NodeLinkDiagramComponent.

virtual void tlp::View::getData ( Graph **  graph,
DataSet *  dataSet 
) [pure virtual]

Gets the Graph and DataSet of the view.

Parameters:
graph A pointer whose value will be modified to point to the Graph* of the view.
dataSet A pointer whose value will be modified to point to the DataSet of the view.
Returns:
void

Implemented in tlp::BaseGraphicsViewComponent, and tlp::NodeLinkDiagramComponent.

virtual Graph* tlp::View::getGraph (  )  [pure virtual]

A getter on this view's Graph.

Returns:
:Graph* The Graph this View displays.

Implemented in tlp::BaseGraphicsViewComponent, and tlp::GlMainView.

virtual std::list<Interactor *> tlp::View::getInteractors (  )  [pure virtual]

Returns the interactors this view uses.

Returns:
:list< tlp::Interactor* > the interactors of this View

Implemented in tlp::AbstractView, and tlp::BaseGraphicsViewComponent.

virtual std::string tlp::View::getRealViewName (  )  const [inline, virtual]

Return the real view name (if "" the real name is the name given by the plugin).

Returns:
:string the View's real name.

Reimplemented in tlp::BaseGraphicsViewComponent.

virtual QWidget* tlp::View::getWidget (  )  [pure virtual]

A getter on the main widget of the view.

Returns:
QWidget* the main widget of this view.

Implemented in tlp::AbstractView.

virtual void tlp::View::init (  )  [pure virtual, slot]

Centers and draws the view. Calls centerview() [where applicable], then draw(). This might be removed in a future version (3.6 or later) as all this does is calling centerview on the GlMainWidget if this is a GlMainView. Adding a centerView function in View would allow to remove this function.

Returns:
void

Implemented in tlp::BaseGraphicsViewComponent, and tlp::NodeLinkDiagramComponent.

virtual void tlp::View::refresh (  )  [pure virtual, slot]

Refreshes the view, using the backed up drawing that draw stored. Then the interactors are drawn. This is usefull when the selection changed, but nothing else in the Graph changed (color, size, layout, ...), or when an interactor changed and needs re-drawing. This is way less resource-hungry than draw().

Returns:
void

Implemented in tlp::BaseGraphicsViewComponent, tlp::GlMainView, and tlp::NodeLinkDiagramComponent.

void tlp::View::requestChangeGraph ( tlp::View view,
tlp::Graph *  graph 
) [signal]

This signal is emitted when the view wants to change its graph.

Parameters:
view ...
graph ...
Returns:
void
virtual bool tlp::View::savePicture ( const std::string &  pictureName,
int  width,
int  height,
bool  center,
int  zoom = 1,
int  xOffset = 0,
int  yOffset = 0 
) [virtual]

Take a snapshot of the view, and save it to a picture on disk.

Parameters:
pictureName : filename to use for the picture, with extension (extension is used to infer image type).
width : width of the picture
height : height of the picture
center : whether we should center the view before creating the picture, or use the current zoom and pan.
zoom : creates a picture of a sub part of the view. With zoom=1 creates only one picture with entire view; with zoom=N : the view is cut into 2^(N-1) part in width and height. Defaults to 1.
xOffset : which part of the view to render if zoom!=1. xOffset must be 0 <= xOffset < 2^(zoom-1). Defaults to 0.
yOffset : which part of the view to render if zoom!=1. yOffset must be 0 <= yOffset < 2^(zoom-1). Defaults to 0.
Returns:
bool : Whether the picture can be created or not.

Reimplemented in tlp::AbstractView, and tlp::BaseGraphicsViewComponent.

virtual void tlp::View::setActiveInteractor ( Interactor interactor  )  [pure virtual]

Sets the active interactor on this view. The interactor must be in the interactors list of this View.

Parameters:
interactor The Interactor to render active.
Returns:
void

Implemented in tlp::AbstractView, and tlp::BaseGraphicsViewComponent.

virtual void tlp::View::setData ( Graph *  graph,
DataSet  dataSet 
) [pure virtual]

Set the View's Graph and DataSet.

Parameters:
graph The view's new Graph.
dataSet The view's new DataSet.
Returns:
void

Implemented in tlp::BaseGraphicsViewComponent, and tlp::NodeLinkDiagramComponent.

virtual void tlp::View::setGraph ( Graph *  graph  )  [pure virtual, slot]

Sets the Graph on this View.

Parameters:
graph the new Graph to be displayed by this View.
Returns:
void

Implemented in tlp::BaseGraphicsViewComponent, and tlp::NodeLinkDiagramComponent.

virtual void tlp::View::setInteractors ( const std::list< Interactor * > &  interactors  )  [pure virtual]

Set the interactors on this view. The Interactors are created, but now the View has ownership on them (responsibility for their destruction).

Parameters:
interactors The interactors that can be used with this View.
Returns:
void

Implemented in tlp::AbstractView, and tlp::BaseGraphicsViewComponent.

virtual void tlp::View::undoIsDone (  )  [inline, virtual]

This function is called when an undo is performed by the controller.

Returns:
void


Tulip Software by LaBRI Visualization Team    2001 - 2012