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-2013.
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 #include <OpenMS/config.h>
39 
40 #include <QtGui/QGraphicsItem>
41 
42 namespace OpenMS
43 {
44  class TOPPASVertex;
45  class TOPPASToolVertex;
46  class TOPPASInputFileListVertex;
47 
48 
58  class OPENMS_GUI_DLLAPI TOPPASEdge :
59  public QObject,
60  public QGraphicsItem
61  {
62  Q_OBJECT
63 
64 public:
65 
68  {
75  ES_NOT_READY_YET, // no input files given. We cannot know if the types will match.
77  ES_UNKNOWN
78  };
79 
81  TOPPASEdge();
83  TOPPASEdge(TOPPASVertex * from, const QPointF & hover_pos);
85  TOPPASEdge(const TOPPASEdge & rhs);
87  virtual ~TOPPASEdge();
89  TOPPASEdge & operator=(const TOPPASEdge & rhs);
90 
92  QRectF boundingRect() const;
94  QPainterPath shape() const;
96  void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
98  QPointF startPos() const;
100  QPointF endPos() const;
102  void setHoverPos(const QPointF & pos);
104  void setSourceVertex(TOPPASVertex * tv);
106  void setTargetVertex(TOPPASVertex * tv);
108  TOPPASVertex * getSourceVertex();
110  TOPPASVertex * getTargetVertex();
112  void prepareResize();
114  void setColor(const QColor & color);
116  EdgeStatus getEdgeStatus();
118  void setSourceOutParam(int out);
120  int getSourceOutParam();
122  QString getSourceOutParamName();
124  void setTargetInParam(int in);
126  int getTargetInParam();
128  QString getTargetInParamName();
130  void updateColor();
132  void emitChanged();
134  void showIOMappingDialog();
135 
136 public slots:
137 
139  void sourceHasChanged();
140 
141 signals:
142 
144  void somethingHasChanged();
145 
146 protected:
147 
149 
150  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e);
151  void contextMenuEvent(QGraphicsSceneContextMenuEvent * event);
153 
155 
156  EdgeStatus getToolToolStatus_(TOPPASToolVertex * source, int source_param_index, TOPPASToolVertex * target, int target_param_index);
157  EdgeStatus getListToolStatus_(TOPPASInputFileListVertex * source, TOPPASToolVertex * target, int target_param_index);
159 
161  QPointF borderPoint_(bool atTargetVertex = true) const;
162 
164  QPointF nearestPoint_(const QPointF & origin, const QList<QPointF> & list) const;
170  QPointF hover_pos_;
172  QColor color_;
177  };
178 }
179 
180 #endif
Definition: TOPPASEdge.h:76
QPointF hover_pos_
Position of hovering end while edge is being created.
Definition: TOPPASEdge.h:170
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:55
The base class of the different vertex classes.
Definition: TOPPASVertex.h:98
TOPPASVertex * from_
Pointer to the source of this edge.
Definition: TOPPASEdge.h:166
Definition: TOPPASEdge.h:72
An edge representing a data flow in TOPPAS.
Definition: TOPPASEdge.h:58
Definition: TOPPASEdge.h:69
A vertex representing an input file list.
Definition: TOPPASInputFileListVertex.h:47
int source_out_param_
The source output parameter index.
Definition: TOPPASEdge.h:174
QColor color_
The color.
Definition: TOPPASEdge.h:172
EdgeStatus
The status of this edge.
Definition: TOPPASEdge.h:67
Definition: TOPPASEdge.h:71
TOPPASVertex * to_
Pointer to the target of this edge.
Definition: TOPPASEdge.h:168
Definition: TOPPASEdge.h:70
int target_in_param_
The target input parameter index.
Definition: TOPPASEdge.h:176
Definition: TOPPASEdge.h:75

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:22 using doxygen 1.8.5