OpenMS  2.7.0
TOPPASEdge.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2021.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Johannes Veit $
32 // $Authors: Johannes Junker, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
40 #include <QtWidgets/QGraphicsItem>
41 
42 namespace OpenMS
43 {
44  class TOPPASVertex;
45  class TOPPASToolVertex;
46  class TOPPASInputFileListVertex;
47 
48  class String;
49 
59  class OPENMS_GUI_DLLAPI TOPPASEdge :
60  public QObject,
61  public QGraphicsItem
62  {
63  Q_OBJECT
64  Q_INTERFACES(QGraphicsItem)
65 public:
66 
69  {
76  ES_NOT_READY_YET, // no input files given. We cannot know if the types will match.
78  ES_UNKNOWN
79  };
80 
84  TOPPASEdge(TOPPASVertex * from, const QPointF & hover_pos);
86  TOPPASEdge(const TOPPASEdge & rhs);
88  ~TOPPASEdge() override;
91 
94 
96  QRectF boundingRect() const override;
98  QPainterPath shape() const override;
100  void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) override;
102  QPointF startPos() const;
104  QPointF endPos() const;
106  void setHoverPos(const QPointF & pos);
118  void setColor(const QColor & color);
122  void setSourceOutParam(int out);
128  void setTargetInParam(int in);
134  void updateColor();
136  void emitChanged();
139 
140 public slots:
141 
144 
145 signals:
146 
149 
150 protected:
151 
153 
154  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e) override;
155  void contextMenuEvent(QGraphicsSceneContextMenuEvent * event) override;
157 
159 
160  EdgeStatus getToolToolStatus_(TOPPASToolVertex * source, int source_param_index, TOPPASToolVertex * target, int target_param_index);
161  EdgeStatus getListToolStatus_(TOPPASInputFileListVertex * source, TOPPASToolVertex * target, int target_param_index);
163 
165  QPointF borderPoint_(bool atTargetVertex = true) const;
166 
168  QPointF nearestPoint_(const QPointF & origin, const QList<QPointF> & list) const;
174  QPointF hover_pos_;
176  QColor color_;
181  };
182 }
183 
A more convenient string class.
Definition: String.h:61
An edge representing a data flow in TOPPAS.
Definition: TOPPASEdge.h:62
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:174
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)
int getSourceOutParam()
Returns the source output parameter 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:180
TOPPASEdge & operator=(const TOPPASEdge &rhs)
Assignment operator.
EdgeStatus
The status of this edge.
Definition: TOPPASEdge.h:69
@ ES_MERGER_EXT_MISMATCH
Definition: TOPPASEdge.h:74
@ ES_VALID
Definition: TOPPASEdge.h:70
@ ES_NOT_READY_YET
Definition: TOPPASEdge.h:76
@ ES_TOOL_API_CHANGED
Definition: TOPPASEdge.h:77
@ ES_NO_TARGET_PARAM
Definition: TOPPASEdge.h:71
@ ES_MERGER_WITHOUT_TOOL
Definition: TOPPASEdge.h:75
@ ES_FILE_EXT_MISMATCH
Definition: TOPPASEdge.h:73
@ ES_NO_SOURCE_PARAM
Definition: TOPPASEdge.h:72
QString getTargetInParamName()
Returns the target input parameter index.
QPointF startPos() const
Returns the start position of this edge.
QPointF nearestPoint_(const QPointF &origin, const QList< QPointF > &list) const
Returns the point in the list that is nearest to origin.
QColor color_
The color.
Definition: TOPPASEdge.h:176
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:172
TOPPASVertex * from_
Pointer to the source of this edge.
Definition: TOPPASEdge.h:170
int source_out_param_
The source output parameter index.
Definition: TOPPASEdge.h:178
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.
int getTargetInParam()
Returns the target input parameter index.
A vertex representing an input file list.
Definition: TOPPASInputFileListVertex.h:51
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:62
The base class of the different vertex classes.
Definition: TOPPASVertex.h:104
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47