1 #ifndef __INTERFACEITEM_H__
2 #define __INTERFACEITEM_H__
8 class ConnectedInterface;
22 InterfaceItem(double _position,
24 ConnectedInterface* _refInter,
25 AbstractBoxItem* _owner,
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 getEndPointInGroup();
45 void setOriginPoint();
46 inline void setId(int id){ this->id = id; }
47 inline void setPositionRatio(double ratio) { positionRatio = ratio; }
48 inline void setOrientation(int _orientation){ orientation = _orientation; }
51 void addConnectionItem(ConnectionItem* item);
52 void removeConnectionItem(ConnectionItem* item);
53 void updatePosition();
54 void updateName(QString name);
56 AbstractBoxItem* owner;
57 ConnectedInterface* refInter;
64 QList<ConnectionItem*> connections; // the connection items that are bounded to this interface item
70 int position; // position in pixels on the "orientation side" of the owner
71 int orientation; // north, south, east, west
72 QPointF originPoint; // the point where starts the drawing (along the box border) NB : in the owner coordinates
73 int nameWidth; // the graphical width of the name, computed from default font metrics
74 int nameHeight; // the graphical height of the name, computed from default font metrics
76 friend QDataStream &operator<<(QDataStream &out, InterfaceItem *b);
77 friend QDataStream &operator>>(QDataStream &in, InterfaceItem &b);
81 QDataStream & operator <<(QDataStream &out, InterfaceItem *b);
82 QDataStream & operator >>(QDataStream &in, InterfaceItem &b);