Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
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-2015.
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 Junker $
32 // $Authors: Johannes Junker, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_TOPPASEDGE_H
36 #define OPENMS_VISUAL_TOPPASEDGE_H
37 
38 // OpenMS_GUI config
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
41 #include <QtGui/QGraphicsItem>
42 
43 namespace OpenMS
44 {
45  class TOPPASVertex;
46  class TOPPASToolVertex;
47  class TOPPASInputFileListVertex;
48 
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 
82  TOPPASEdge();
84  TOPPASEdge(TOPPASVertex * from, const QPointF & hover_pos);
86  TOPPASEdge(const TOPPASEdge & rhs);
88  virtual ~TOPPASEdge();
90  TOPPASEdge & operator=(const TOPPASEdge & rhs);
91 
93  QRectF boundingRect() const;
95  QPainterPath shape() const;
97  void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
99  QPointF startPos() const;
101  QPointF endPos() const;
103  void setHoverPos(const QPointF & pos);
105  void setSourceVertex(TOPPASVertex * tv);
107  void setTargetVertex(TOPPASVertex * tv);
109  TOPPASVertex * getSourceVertex();
111  TOPPASVertex * getTargetVertex();
113  void prepareResize();
115  void setColor(const QColor & color);
117  EdgeStatus getEdgeStatus();
119  void setSourceOutParam(int out);
121  int getSourceOutParam();
123  QString getSourceOutParamName();
125  void setTargetInParam(int in);
127  int getTargetInParam();
129  QString getTargetInParamName();
131  void updateColor();
133  void emitChanged();
135  void showIOMappingDialog();
136 
137 public slots:
138 
140  void sourceHasChanged();
141 
142 signals:
143 
145  void somethingHasChanged();
146 
147 protected:
148 
150 
151  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e);
152  void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
154 
156 
157  EdgeStatus getToolToolStatus_(TOPPASToolVertex * source, int source_param_index, TOPPASToolVertex * target, int target_param_index);
158  EdgeStatus getListToolStatus_(TOPPASInputFileListVertex * source, TOPPASToolVertex * target, int target_param_index);
160 
162  QPointF borderPoint_(bool atTargetVertex = true) const;
163 
165  QPointF nearestPoint_(const QPointF & origin, const QList<QPointF> & list) const;
171  QPointF hover_pos_;
173  QColor color_;
178  };
179 }
180 
181 #endif
Definition: TOPPASEdge.h:77
QPointF hover_pos_
Position of hovering end while edge is being created.
Definition: TOPPASEdge.h:171
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:58
The base class of the different vertex classes.
Definition: TOPPASVertex.h:101
TOPPASVertex * from_
Pointer to the source of this edge.
Definition: TOPPASEdge.h:167
Definition: TOPPASEdge.h:73
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
An edge representing a data flow in TOPPAS.
Definition: TOPPASEdge.h:59
Definition: TOPPASEdge.h:70
A vertex representing an input file list.
Definition: TOPPASInputFileListVertex.h:50
int source_out_param_
The source output parameter index.
Definition: TOPPASEdge.h:175
QColor color_
The color.
Definition: TOPPASEdge.h:173
EdgeStatus
The status of this edge.
Definition: TOPPASEdge.h:68
Definition: TOPPASEdge.h:72
TOPPASVertex * to_
Pointer to the target of this edge.
Definition: TOPPASEdge.h:169
Definition: TOPPASEdge.h:71
int target_in_param_
The target input parameter index.
Definition: TOPPASEdge.h:177
Definition: TOPPASEdge.h:76

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Nov 1 2016 16:34:46 using doxygen 1.8.11