A container for all visual items of a TOPPAS workflow. More...
#include <OpenMS/VISUAL/TOPPASScene.h>
Classes | |
| struct | TOPPProcess |
| Stores the information for a TOPP process. More... | |
Public Types | |
| enum | ActionMode { AM_NEW_EDGE, AM_MOVE } |
The current action mode (creation of a new edge, or panning of the widget). More... | |
| enum | RefreshStatus { ST_REFRESH_NOCHANGE, ST_REFRESH_CHANGED, ST_REFRESH_CHANGEINVALID } |
Pipeline status after refreshParameters() was called. More... | |
| typedef QList< TOPPASEdge * > | EdgeContainer |
| The container for edges. | |
| typedef EdgeContainer::iterator | EdgeIterator |
| A mutable iterator for edges. | |
| typedef EdgeContainer::const_iterator | ConstEdgeIterator |
| A const iterator for edges. | |
| typedef QList< TOPPASVertex * > | VertexContainer |
| The container for vertices. | |
| typedef VertexContainer::iterator | VertexIterator |
| A mutable iterator for vertices. | |
| typedef VertexContainer::const_iterator | ConstVertexIterator |
| A const iterator for vertices. | |
Public Slots | |
| void | abortPipeline () |
| Terminates the currently running pipeline. | |
| void | itemClicked () |
| Called when an item is clicked. | |
| void | itemReleased () |
| Called when an item is released. | |
| void | updateHoveringEdgePos (const QPointF &new_pos) |
| Called when the position of the hovering edge changes. | |
| void | addHoveringEdge (const QPointF &pos) |
| Called when a new out edge is supposed to be created. | |
| void | finishHoveringEdge () |
| Called when the new edge is being "released". | |
| void | pipelineErrorSlot (const QString msg="") |
| Called by vertices at which an error occurred during pipeline execution. | |
| void | moveSelectedItems (qreal dx, qreal dy) |
| Moves all selected items by dx, dy. | |
| void | snapToGrid () |
| Makes all vertices snap to the grid. | |
| void | setPipelineRunning (bool b=true) |
| void | changedParameter (const bool invalidates_running_pipeline) |
| Invoked by TTV or other vectices if a parameter was edited. | |
| void | processFinished () |
| Called by a finished QProcess to indicate that we are free to start a new one. | |
| void | quitWithError () |
| dirty solution: when using ExecutePipeline this slot is called when the pipeline crashes. This will quit the app | |
Slots for printing log/error output when no GUI is available | |
| void | logTOPPOutput (const QString &out) |
| Writes the TOPP tool output to the logfile (and to stdout if no gui available). | |
| void | logToolStarted () |
| Writes the "tool started" message to the logfile (and to stdout if no gui available). | |
| void | logToolFinished () |
| Writes the "tool finished" message to the logfile (and to stdout if no gui available). | |
| void | logToolFailed () |
| Writes the "tool failed" message to the logfile (and to stdout if no gui available). | |
| void | logToolCrashed () |
| Writes the "tool crashed" message to the logfile (and to stdout if no gui available). | |
| void | logOutputFileWritten (const String &file) |
| Writes the "output file written" message to the logfile (and to stdout if no gui available). | |
Signals | |
| void | entirePipelineFinished () |
| Emitted when the entire pipeline execution is finished. | |
| void | pipelineExecutionFailed () |
| Emitted when the pipeline execution has failed. | |
| void | saveMe () |
| Emitted when the pipeline should be saved (showing a save as file dialog and so on). | |
| void | terminateCurrentPipeline () |
| Kills all connected TOPP processes. | |
| void | selectionCopied (TOPPASScene *ts) |
| Emitted when a selection is copied to the clipboard. | |
| void | requestClipboardContent () |
| Requests the clipboard content from TOPPASBase, will be stored in clipboard_. | |
| void | mainWindowNeedsUpdate () |
| Emitted when the main window needs to be updated. | |
| void | openInTOPPView (QStringList all_files) |
| Emitted when files are triggered for opening in TOPPView. | |
| void | dryRunFinished (int, QProcess::ExitStatus) |
| Emitted when in dry run mode and asked to run a TOPP tool (to fake success). | |
| void | messageReady (const QString &msg) |
| Emitted when there is an important message that needs to be printed in TOPPAS. | |
Public Member Functions | |
| TOPPASScene (QObject *parent, const QString &tmp_path, bool gui=true) | |
| Constructor. | |
| virtual | ~TOPPASScene () |
| Destructor. | |
| void | addVertex (TOPPASVertex *tv) |
| Adds a vertex. | |
| void | addEdge (TOPPASEdge *te) |
| Adds an edge. | |
| void | setActionMode (ActionMode mode) |
| Sets the action mode. | |
| ActionMode | getActionMode () |
| Returns the action mode. | |
| VertexIterator | verticesBegin () |
| Returns begin() iterator of all vertices. | |
| VertexIterator | verticesEnd () |
| Returns end() iterator of all vertices. | |
| EdgeIterator | edgesBegin () |
| Returns begin() iterator of all edges. | |
| EdgeIterator | edgesEnd () |
| Returns end() iterator of all edges. | |
| void | copySelected () |
| Copies all currently selected edges and vertices. | |
| void | paste (QPointF pos=QPointF()) |
| Pastes the copied items. | |
| void | removeSelected () |
| Removes all currently selected edges and vertices. | |
| void | unselectAll () |
| Unselects all items. | |
| void | updateEdgeColors () |
| Updates all edge colors (color of green and yellow edges can change when edges are added/removed). | |
| void | resetDownstream (TOPPASVertex *vertex) |
| Called when user fires "Resume" action, to clear downstream nodes from previous results. | |
| void | runPipeline () |
| Runs the pipeline. | |
| bool | store (const String &file) |
Stores the pipeline to file, returns true on success. | |
| void | load (const String &file) |
Loads the pipeline from file. | |
| void | include (TOPPASScene *new_scene, QPointF pos=QPointF()) |
Includes the pipeline scene. | |
| const String & | getSaveFileName () |
| Returns the file name. | |
| void | setSaveFileName (const String &name) |
| Sets the file name. | |
| void | topoSort () |
| Performs a topological sort of all vertices. | |
| const QString & | getOutDir () |
| Returns the name of the directory for output files. | |
| const QString & | getTempDir () |
| Returns the name of the directory for temporary files. | |
| void | setOutDir (const QString &dir) |
| Sets the name of the directory for output files. | |
| bool | saveIfChanged () |
| Saves the pipeline if it has been changed since the last save. | |
| void | setChanged (bool b) |
| Sets the changed flag. | |
| bool | isPipelineRunning () |
| Returns if a pipeline is currently running. | |
| bool | askForOutputDir (bool always_ask=true) |
Shows a dialog that allows to specify the output directory. If always_ask == false, the dialog won't be shown if a directory has been set, already. | |
| void | enqueueProcess (const TOPPProcess &process) |
| Enqueues the process, it will be run when the currently pending processes have finished. | |
| void | runNextProcess () |
| Runs the next process in the queue, if any. | |
| void | resetProcessesQueue () |
| Resets the processes queue. | |
| void | setClipboard (TOPPASScene *clipboard) |
| Sets the clipboard content. | |
| void | connectVertexSignals (TOPPASVertex *tv) |
| Connects the signals to slots. | |
| void | connectToolVertexSignals (TOPPASToolVertex *ttv) |
| Connects the signals to slots. | |
| void | connectOutputVertexSignals (TOPPASOutputFileListVertex *oflv) |
| Connects the signals to slots. | |
| void | connectMergerVertexSignals (TOPPASMergerVertex *tmv) |
| Connects the signals to slots. | |
| void | connectEdgeSignals (TOPPASEdge *e) |
| Connects the signals to slots. | |
| void | loadResources (const TOPPASResources &resources) |
Loads the resources into the input nodes of this workflow. | |
| void | createResources (TOPPASResources &resources) |
Create resources from the current workflow. | |
| bool | wasChanged () |
| Returns whether the workflow has been changed since the latest "save". | |
| RefreshStatus | refreshParameters () |
| Refreshes the parameters of the TOPP tools in this workflow. | |
| bool | isDryRun () const |
| determine dry run status (are tools actually called?) | |
| QString | getDescription () const |
| workflow description (to be displayed in TOPPAS window) | |
| void | setDescription (const QString &desc) |
| when description is updated by user, use this to update the description for later storage in file | |
| void | setAllowedThreads (int num_threads) |
| sets the maximum number of jobs | |
| TOPPASEdge * | getHoveringEdge () |
| returns the hovering edge | |
| void | checkIfWeAreDone () |
| Checks whether all output vertices are finished, and if yes, emits entirePipelineFinished() (called by finished output vertices). | |
Protected Member Functions | |
| TOPPASVertex * | getVertexAt_ (const QPointF &pos) |
Returns the vertex in the foreground at position pos , if existent, otherwise 0. | |
| bool | isEdgeAllowed_ (TOPPASVertex *u, TOPPASVertex *v) |
| Returns whether an edge between node u and v would be allowed. | |
| bool | dfsVisit_ (TOPPASVertex *vertex) |
| DFS helper method. Returns true, if a back edge has been discovered. | |
| bool | sanityCheck_ (bool allowUserOverride) |
| void | writeToLogFile_ (const QString &text) |
Writes the text to the logfile. | |
reimplemented Qt events | |
| void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) |
Protected Attributes | |
| ActionMode | action_mode_ |
| The current action mode. | |
| VertexContainer | vertices_ |
| The list of all vertices. | |
| EdgeContainer | edges_ |
| The list of all edges. | |
| TOPPASEdge * | hover_edge_ |
| The hovering edge which is currently being created. | |
| TOPPASVertex * | potential_target_ |
| The current potential target vertex of the hovering edge. | |
| String | file_name_ |
| The file name of this pipeline. | |
| QString | tmp_path_ |
| The path for temporary files. | |
| bool | gui_ |
| Are we in a GUI or is the scene used by ExecutePipeline (at the command line)? | |
| QString | out_dir_ |
| The directory where the output files will be written. | |
| bool | changed_ |
| Flag that indicates if the pipeline has been changed since the last save. | |
| bool | running_ |
| Indicates if a pipeline is currently running. | |
| bool | error_occured_ |
| true if an error occurred during pipeline execution | |
| bool | user_specified_out_dir_ |
| Indicates if the output directory has been specified by the user already. | |
| QList< TOPPProcess > | topp_processes_queue_ |
| The queue of pending TOPP processes. | |
| TOPPASScene * | clipboard_ |
| Stores the clipboard content when requested from TOPPASBase. | |
| bool | dry_run_ |
| dry run mode (no tools are actually called) | |
| int | threads_active_ |
| currently running processes... | |
| QString | description_text_ |
| description text | |
| int | allowed_threads_ |
| maximum number of allowed threads | |
| TOPPASToolVertex * | resume_source_ |
| last node where 'resume' was started | |
A container for all visual items of a TOPPAS workflow.
TOPPASScene is a subclass of QGraphicsScene and acts as a container for all visual items (i.e. all vertices and edges). It is visualized by a TOPPASWidget (a subclass of QGraphicsView). This class also provides large parts of the functionality of TOPPAS, e.g., the methods for loading, saving, running, and aborting pipelines are located here.
TOPPASScene can also be used without a visualizing TOPPASWidget (i.e., without a gui) which can be indicated via the constructor. In this case, the signals for log message output are connected to standard out. This is utilized for the ExecutePipeline tool.
Temporary files of the pipeline are stored in the member tmp_path_. Update it when loading a pipeline which has tmp data from an old run. TOPPASToolVertex will ask its parent scene() whenever it wants to know the tmp directory.
| typedef EdgeContainer::const_iterator ConstEdgeIterator |
A const iterator for edges.
| typedef VertexContainer::const_iterator ConstVertexIterator |
A const iterator for vertices.
| typedef QList<TOPPASEdge *> EdgeContainer |
The container for edges.
| typedef EdgeContainer::iterator EdgeIterator |
A mutable iterator for edges.
| typedef QList<TOPPASVertex *> VertexContainer |
The container for vertices.
| typedef VertexContainer::iterator VertexIterator |
A mutable iterator for vertices.
| enum ActionMode |
| enum RefreshStatus |
Pipeline status after refreshParameters() was called.
| TOPPASScene | ( | QObject * | parent, | |
| const QString & | tmp_path, | |||
| bool | gui = true | |||
| ) |
Constructor.
| virtual ~TOPPASScene | ( | ) | [virtual] |
Destructor.
| void abortPipeline | ( | ) | [slot] |
Terminates the currently running pipeline.
Referenced by TOPPASBase::abortPipeline().
| void addEdge | ( | TOPPASEdge * | te | ) |
Adds an edge.
| void addHoveringEdge | ( | const QPointF & | pos | ) | [slot] |
Called when a new out edge is supposed to be created.
| void addVertex | ( | TOPPASVertex * | tv | ) |
Adds a vertex.
Referenced by TOPPASBase::insertNewVertex_().
| bool askForOutputDir | ( | bool | always_ask = true |
) |
Shows a dialog that allows to specify the output directory. If always_ask == false, the dialog won't be shown if a directory has been set, already.
| void changedParameter | ( | const bool | invalidates_running_pipeline | ) | [slot] |
Invoked by TTV or other vectices if a parameter was edited.
| void checkIfWeAreDone | ( | ) |
Checks whether all output vertices are finished, and if yes, emits entirePipelineFinished() (called by finished output vertices).
| void connectEdgeSignals | ( | TOPPASEdge * | e | ) |
Connects the signals to slots.
| void connectMergerVertexSignals | ( | TOPPASMergerVertex * | tmv | ) |
Connects the signals to slots.
| void connectOutputVertexSignals | ( | TOPPASOutputFileListVertex * | oflv | ) |
Connects the signals to slots.
Referenced by TOPPASBase::insertNewVertex_().
| void connectToolVertexSignals | ( | TOPPASToolVertex * | ttv | ) |
Connects the signals to slots.
Referenced by TOPPASBase::insertNewVertex_().
| void connectVertexSignals | ( | TOPPASVertex * | tv | ) |
Connects the signals to slots.
Referenced by TOPPASBase::insertNewVertex_().
| void contextMenuEvent | ( | QGraphicsSceneContextMenuEvent * | event | ) | [protected] |
| void copySelected | ( | ) |
Copies all currently selected edges and vertices.
| void createResources | ( | TOPPASResources & | resources | ) |
Create resources from the current workflow.
Referenced by TOPPASBase::savePipelineResourceFile().
| bool dfsVisit_ | ( | TOPPASVertex * | vertex | ) | [protected] |
DFS helper method. Returns true, if a back edge has been discovered.
| void dryRunFinished | ( | int | , | |
| QProcess::ExitStatus | ||||
| ) | [signal] |
Emitted when in dry run mode and asked to run a TOPP tool (to fake success).
| EdgeIterator edgesBegin | ( | ) |
Returns begin() iterator of all edges.
| EdgeIterator edgesEnd | ( | ) |
Returns end() iterator of all edges.
| void enqueueProcess | ( | const TOPPProcess & | process | ) |
Enqueues the process, it will be run when the currently pending processes have finished.
| void entirePipelineFinished | ( | ) | [signal] |
Emitted when the entire pipeline execution is finished.
| void finishHoveringEdge | ( | ) | [slot] |
Called when the new edge is being "released".
| ActionMode getActionMode | ( | ) |
Returns the action mode.
| QString getDescription | ( | ) | const |
workflow description (to be displayed in TOPPAS window)
Referenced by TOPPASBase::focusByTab(), and TOPPASBase::showAsWindow_().
| TOPPASEdge* getHoveringEdge | ( | ) |
returns the hovering edge
| const QString& getOutDir | ( | ) |
Returns the name of the directory for output files.
| const String& getSaveFileName | ( | ) |
Returns the file name.
Referenced by TOPPASBase::savePipeline().
| const QString& getTempDir | ( | ) |
Returns the name of the directory for temporary files.
| TOPPASVertex* getVertexAt_ | ( | const QPointF & | pos | ) | [protected] |
Returns the vertex in the foreground at position pos , if existent, otherwise 0.
| void include | ( | TOPPASScene * | new_scene, | |
| QPointF | pos = QPointF() | |||
| ) |
Includes the pipeline scene.
Referenced by TOPPASBase::addTOPPASFile().
| bool isDryRun | ( | ) | const |
determine dry run status (are tools actually called?)
| bool isEdgeAllowed_ | ( | TOPPASVertex * | u, | |
| TOPPASVertex * | v | |||
| ) | [protected] |
Returns whether an edge between node u and v would be allowed.
| bool isPipelineRunning | ( | ) |
Returns if a pipeline is currently running.
Referenced by TOPPASBase::updateMenu().
| void itemClicked | ( | ) | [slot] |
Called when an item is clicked.
| void itemReleased | ( | ) | [slot] |
Called when an item is released.
| void load | ( | const String & | file | ) |
Loads the pipeline from file.
Referenced by TOPPASBase::addTOPPASFile().
| void loadResources | ( | const TOPPASResources & | resources | ) |
Loads the resources into the input nodes of this workflow.
Referenced by TOPPASBase::loadPipelineResourceFile().
| void logOutputFileWritten | ( | const String & | file | ) | [slot] |
Writes the "output file written" message to the logfile (and to stdout if no gui available).
| void logToolCrashed | ( | ) | [slot] |
Writes the "tool crashed" message to the logfile (and to stdout if no gui available).
| void logToolFailed | ( | ) | [slot] |
Writes the "tool failed" message to the logfile (and to stdout if no gui available).
| void logToolFinished | ( | ) | [slot] |
Writes the "tool finished" message to the logfile (and to stdout if no gui available).
| void logToolStarted | ( | ) | [slot] |
Writes the "tool started" message to the logfile (and to stdout if no gui available).
| void logTOPPOutput | ( | const QString & | out | ) | [slot] |
Writes the TOPP tool output to the logfile (and to stdout if no gui available).
| void mainWindowNeedsUpdate | ( | ) | [signal] |
Emitted when the main window needs to be updated.
| void messageReady | ( | const QString & | msg | ) | [signal] |
Emitted when there is an important message that needs to be printed in TOPPAS.
| void moveSelectedItems | ( | qreal | dx, | |
| qreal | dy | |||
| ) | [slot] |
Moves all selected items by dx, dy.
| void openInTOPPView | ( | QStringList | all_files | ) | [signal] |
Emitted when files are triggered for opening in TOPPView.
| void paste | ( | QPointF | pos = QPointF() |
) |
Pastes the copied items.
| void pipelineErrorSlot | ( | const QString | msg = "" |
) | [slot] |
Called by vertices at which an error occurred during pipeline execution.
| void pipelineExecutionFailed | ( | ) | [signal] |
Emitted when the pipeline execution has failed.
| void processFinished | ( | ) | [slot] |
Called by a finished QProcess to indicate that we are free to start a new one.
| void quitWithError | ( | ) | [slot] |
dirty solution: when using ExecutePipeline this slot is called when the pipeline crashes. This will quit the app
| RefreshStatus refreshParameters | ( | ) |
Refreshes the parameters of the TOPP tools in this workflow.
Referenced by TOPPASBase::refreshPipelineParameters().
| void removeSelected | ( | ) |
Removes all currently selected edges and vertices.
| void requestClipboardContent | ( | ) | [signal] |
Requests the clipboard content from TOPPASBase, will be stored in clipboard_.
| void resetDownstream | ( | TOPPASVertex * | vertex | ) |
Called when user fires "Resume" action, to clear downstream nodes from previous results.
| void resetProcessesQueue | ( | ) |
Resets the processes queue.
| void runNextProcess | ( | ) |
Runs the next process in the queue, if any.
| void runPipeline | ( | ) |
Runs the pipeline.
Referenced by TOPPASBase::keyPressEvent(), and TOPPASBase::runPipeline().
| bool sanityCheck_ | ( | bool | allowUserOverride | ) | [protected] |
Performs a sanity check of the pipeline and notifies user when it finds something strange. Returns if pipeline OK. if 'allowUserOverride' is true, some dialogs are shown which allow the user to ignore some warnings (e.g. disconnected nodes)
| bool saveIfChanged | ( | ) |
Saves the pipeline if it has been changed since the last save.
| void saveMe | ( | ) | [signal] |
Emitted when the pipeline should be saved (showing a save as file dialog and so on).
| void selectionCopied | ( | TOPPASScene * | ts | ) | [signal] |
Emitted when a selection is copied to the clipboard.
| void setActionMode | ( | ActionMode | mode | ) |
Sets the action mode.
| void setAllowedThreads | ( | int | num_threads | ) |
sets the maximum number of jobs
| void setChanged | ( | bool | b | ) |
Sets the changed flag.
Referenced by TOPPASBase::descriptionUpdated_(), TOPPASBase::insertNewVertex_(), and TOPPASBase::refreshPipelineParameters().
| void setClipboard | ( | TOPPASScene * | clipboard | ) |
Sets the clipboard content.
Referenced by TOPPASBase::sendClipboardContent().
| void setDescription | ( | const QString & | desc | ) |
when description is updated by user, use this to update the description for later storage in file
Referenced by TOPPASBase::descriptionUpdated_(), and TOPPASBase::exportAsImage().
| void setOutDir | ( | const QString & | dir | ) |
Sets the name of the directory for output files.
| void setPipelineRunning | ( | bool | b = true |
) | [slot] |
Sets if the running_ flag to true, or false If set to false, the application emits an 'alert' sign, demanding user attention (to let him know it finished)
| void setSaveFileName | ( | const String & | name | ) |
Sets the file name.
| void snapToGrid | ( | ) | [slot] |
Makes all vertices snap to the grid.
| bool store | ( | const String & | file | ) |
Stores the pipeline to file, returns true on success.
Referenced by TOPPASBase::savePipeline(), and TOPPASBase::savePipelineAs().
| void terminateCurrentPipeline | ( | ) | [signal] |
Kills all connected TOPP processes.
| void topoSort | ( | ) |
Performs a topological sort of all vertices.
Referenced by TOPPASBase::insertNewVertex_().
| void unselectAll | ( | ) |
Unselects all items.
| void updateEdgeColors | ( | ) |
Updates all edge colors (color of green and yellow edges can change when edges are added/removed).
Referenced by TOPPASBase::refreshPipelineParameters().
| void updateHoveringEdgePos | ( | const QPointF & | new_pos | ) | [slot] |
Called when the position of the hovering edge changes.
| VertexIterator verticesBegin | ( | ) |
Returns begin() iterator of all vertices.
Referenced by TOPPASBase::addTOPPASFile().
| VertexIterator verticesEnd | ( | ) |
Returns end() iterator of all vertices.
Referenced by TOPPASBase::addTOPPASFile().
| bool wasChanged | ( | ) |
Returns whether the workflow has been changed since the latest "save".
Referenced by TOPPASBase::addTOPPASFile(), and TOPPASBase::updateMenu().
| void writeToLogFile_ | ( | const QString & | text | ) | [protected] |
Writes the text to the logfile.
ActionMode action_mode_ [protected] |
The current action mode.
int allowed_threads_ [protected] |
maximum number of allowed threads
bool changed_ [protected] |
Flag that indicates if the pipeline has been changed since the last save.
TOPPASScene* clipboard_ [protected] |
Stores the clipboard content when requested from TOPPASBase.
QString description_text_ [protected] |
description text
bool dry_run_ [protected] |
dry run mode (no tools are actually called)
EdgeContainer edges_ [protected] |
The list of all edges.
bool error_occured_ [protected] |
true if an error occurred during pipeline execution
String file_name_ [protected] |
The file name of this pipeline.
bool gui_ [protected] |
Are we in a GUI or is the scene used by ExecutePipeline (at the command line)?
TOPPASEdge* hover_edge_ [protected] |
The hovering edge which is currently being created.
QString out_dir_ [protected] |
The directory where the output files will be written.
TOPPASVertex* potential_target_ [protected] |
The current potential target vertex of the hovering edge.
TOPPASToolVertex* resume_source_ [protected] |
last node where 'resume' was started
bool running_ [protected] |
Indicates if a pipeline is currently running.
int threads_active_ [protected] |
currently running processes...
QString tmp_path_ [protected] |
The path for temporary files.
QList<TOPPProcess> topp_processes_queue_ [protected] |
The queue of pending TOPP processes.
bool user_specified_out_dir_ [protected] |
Indicates if the output directory has been specified by the user already.
VertexContainer vertices_ [protected] |
The list of all vertices.
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:58 using doxygen 1.7.1 |