OpenMS
TOPPASEdge.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Johannes Veit $
6 // $Authors: Johannes Junker, Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 #include <QtWidgets/QGraphicsItem>
15 
16 namespace OpenMS
17 {
18  class TOPPASVertex;
19  class TOPPASToolVertex;
20  class TOPPASInputFileListVertex;
21 
22  class String;
23 
33  class OPENMS_GUI_DLLAPI TOPPASEdge :
34  public QObject,
35  public QGraphicsItem
36  {
37  Q_OBJECT
38  Q_INTERFACES(QGraphicsItem)
39 public:
40 
43  {
50  ES_NOT_READY_YET, // no input files given. We cannot know if the types will match.
52  ES_UNKNOWN
53  };
54 
58  TOPPASEdge(TOPPASVertex * from, const QPointF & hover_pos);
60  TOPPASEdge(const TOPPASEdge & rhs);
62  ~TOPPASEdge() override;
65 
68 
70  QRectF boundingRect() const override;
72  QPainterPath shape() const override;
74  void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) override;
76  QPointF startPos() const;
78  QPointF endPos() const;
80  void setHoverPos(const QPointF & pos);
90  void prepareResize();
92  void setColor(const QColor & color);
96  void setSourceOutParam(int out);
98  int getSourceOutParam() const;
102  void setTargetInParam(int in);
104  int getTargetInParam() const;
108  void updateColor();
110  void emitChanged();
113 
114 public slots:
115 
118 
119 signals:
120 
123 
124 protected:
125 
127 
128  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e) override;
129  void contextMenuEvent(QGraphicsSceneContextMenuEvent * event) override;
131 
133 
134  EdgeStatus getToolToolStatus_(TOPPASToolVertex * source, int source_param_index, TOPPASToolVertex * target, int target_param_index);
135  EdgeStatus getListToolStatus_(TOPPASInputFileListVertex * source, TOPPASToolVertex * target, int target_param_index);
137 
139  QPointF borderPoint_(bool atTargetVertex = true) const;
140 
146  QPointF hover_pos_;
148  QColor color_;
153  };
154 }
155 
A more convenient string class.
Definition: String.h:34
An edge representing a data flow in TOPPAS.
Definition: TOPPASEdge.h:36
QPointF borderPoint_(bool atTargetVertex=true) const
point where the current edge touches the source or target (default) vertex
QPainterPath shape() const override
Returns a more precise shape.
QPointF hover_pos_
Position of hovering end while edge is being created.
Definition: TOPPASEdge.h:146
void sourceHasChanged()
Called by the source vertex when it has changed.
void showIOMappingDialog()
Shows the I/O mapping dialog.
~TOPPASEdge() override
Destructor.
void prepareResize()
Call this before changing the item geometry.
EdgeStatus getToolToolStatus_(TOPPASToolVertex *source, int source_param_index, TOPPASToolVertex *target, int target_param_index)
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override
EdgeStatus getListToolStatus_(TOPPASInputFileListVertex *source, TOPPASToolVertex *target, int target_param_index)
QString getSourceOutParamName()
Returns the source output parameter name.
EdgeStatus getEdgeStatus()
Returns the status of this edge.
void updateColor()
Updates the edge color.
int target_in_param_
The target input parameter index.
Definition: TOPPASEdge.h:152
int getSourceOutParam() const
Returns the source output parameter index.
TOPPASEdge & operator=(const TOPPASEdge &rhs)
Assignment operator.
EdgeStatus
The status of this edge.
Definition: TOPPASEdge.h:43
@ ES_MERGER_EXT_MISMATCH
Definition: TOPPASEdge.h:48
@ ES_VALID
Definition: TOPPASEdge.h:44
@ ES_NOT_READY_YET
Definition: TOPPASEdge.h:50
@ ES_TOOL_API_CHANGED
Definition: TOPPASEdge.h:51
@ ES_NO_TARGET_PARAM
Definition: TOPPASEdge.h:45
@ ES_MERGER_WITHOUT_TOOL
Definition: TOPPASEdge.h:49
@ ES_FILE_EXT_MISMATCH
Definition: TOPPASEdge.h:47
@ ES_NO_SOURCE_PARAM
Definition: TOPPASEdge.h:46
QString getTargetInParamName()
Returns the target input parameter index.
QPointF startPos() const
Returns the start position of this edge.
int getTargetInParam() const
Returns the target input parameter index.
QColor color_
The color.
Definition: TOPPASEdge.h:148
TOPPASEdge(const TOPPASEdge &rhs)
Copy constructor.
TOPPASEdge(TOPPASVertex *from, const QPointF &hover_pos)
Constructor.
TOPPASVertex * getTargetVertex()
Returns the target vertex.
TOPPASVertex * to_
Pointer to the target of this edge.
Definition: TOPPASEdge.h:144
TOPPASVertex * from_
Pointer to the source of this edge.
Definition: TOPPASEdge.h:142
int source_out_param_
The source output parameter index.
Definition: TOPPASEdge.h:150
void setColor(const QColor &color)
Sets the color.
QPointF endPos() const
Returns the end position of this edge.
TOPPASEdge()
Standard constructor.
void setSourceVertex(TOPPASVertex *tv)
Sets the source vertex of this edge.
void setTargetVertex(TOPPASVertex *tv)
Sets the target vertex of this edge.
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) override
TOPPASVertex * getSourceVertex()
Returns the source vertex.
void setHoverPos(const QPointF &pos)
Sets the position of the hovering end while edge is being created.
void setTargetInParam(int in)
Sets the target input parameter index.
QRectF boundingRect() const override
Returns the bounding rectangle of this item.
void somethingHasChanged()
Emitted when something has changed.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints the item.
String toString()
for debug output
void setSourceOutParam(int out)
Sets the source output parameter index.
void emitChanged()
Emits the somethingHasChanged() signal.
A vertex representing an input file list.
Definition: TOPPASInputFileListVertex.h:25
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:36
The base class of the different vertex classes.
Definition: TOPPASVertex.h:77
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22