Salome HOME
60f845caa5d1c2573896be3bedd68d5f51e27278
[modules/geom.git] / src / DependencyTree / DependencyTree_Arrow.h
1 // Copyright (C) 2014-2020  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef DEPENDENCYTREE_ARROW_H
21 #define DEPENDENCYTREE_ARROW_H
22
23 #include <QGraphicsLineItem>
24
25 #include "DependencyTree.h"
26
27 class DependencyTree_Object;
28
29 class DEPENDENCYTREE_EXPORT DependencyTree_Arrow : public QGraphicsLineItem
30 {
31
32 public:
33
34   DependencyTree_Arrow( DependencyTree_Object* startItem, DependencyTree_Object* endItem,
35                         QGraphicsItem* parent = 0, QGraphicsScene* scene = 0 );
36   ~DependencyTree_Arrow();
37
38   virtual QRectF          boundingRect() const;
39   virtual QPainterPath    shape() const;
40
41   void                    setColor(const QColor& );
42   void                    setHighlightColor(const QColor& );
43   void                    setSelectColor(const QColor& );
44
45   DependencyTree_Object*  getStartItem() const;
46   DependencyTree_Object*  getEndItem() const;
47
48   void                    setIsBiLink( bool );
49
50 protected:
51
52   void                    paint( QPainter*, const QStyleOptionGraphicsItem*, QWidget* = 0 );
53
54 private:
55
56   QPolygonF               createArrowHead( QPointF , QPointF, bool = true );
57
58   DependencyTree_Object*  myStartItem;
59   DependencyTree_Object*  myEndItem;
60
61   QColor                  myColor;
62   QColor                  mySelectColor;
63   QColor                  myHighlightColor;
64
65   QPolygonF               myArrowHead;
66   QPolygonF               myReverseArrowHead;
67
68   bool                    myIsBiLink;
69
70   QRectF                  mySelfDependencyArrow;
71
72   QLineF                  myLine;
73
74 };
75
76 #endif