1 #ifndef __INTERFACEITEM_H__
2 #define __INTERFACEITEM_H__
8 class ConnectedInterface;
22 InterfaceItem(double _position,
24 ConnectedInterface* _refInter,
25 AbstractBoxItem* _owner,
26 Parameters* _params, bool forceVisible = false);
28 QRectF boundingRect() const;
29 void paint(QPainter *painter);
32 inline int getId() { return id; }
34 inline double getPositionRatio() { return positionRatio; }
35 inline double getPosition() { return position; }
36 inline int getOrientation() { return orientation; }
37 inline AbstractBoxItem *getOwner() { return owner; }
38 inline int getNameWidth() { return nameWidth; }
39 inline int getNameHeight() { return nameHeight; }
40 QString getStrOrientation();
41 static int getIntOrientation(QString str);
42 QPointF getEndPosition();
43 QPointF getStartPosition();
46 void setOriginPoint();
47 inline void setId(int id){ this->id = id; }
48 inline void setPositionRatio(double ratio) { positionRatio = ratio; }
49 inline void setOrientation(int _orientation){ orientation = _orientation; }
52 void addConnectionItem(ConnectionItem* item);
53 void removeConnectionItem(ConnectionItem* item);
54 void updatePosition();
55 void updateName(QString name);
57 AbstractBoxItem* owner;
58 ConnectedInterface* refInter;
65 QList<ConnectionItem*> connections; // the connection items that are bounded to this interface item
71 int position; // position in pixels on the "orientation side" of the owner
72 int orientation; // north, south, east, west
73 QPointF originPoint; // the point where starts the drawing (along the box border) NB : in the owner coordinates
74 int nameWidth; // the graphical width of the name, computed from default font metrics
75 int nameHeight; // the graphical height of the name, computed from default font metrics
77 friend QDataStream &operator<<(QDataStream &out, InterfaceItem *b);
78 friend QDataStream &operator>>(QDataStream &in, InterfaceItem &b);
82 QDataStream & operator <<(QDataStream &out, InterfaceItem *b);
83 QDataStream & operator >>(QDataStream &in, InterfaceItem &b);