1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/xlinkitem.h Thu Sep 17 09:41:09 2009 +0000
1.3 @@ -0,0 +1,48 @@
1.4 +#ifndef XLINKITEM_H
1.5 +#define XLINKITEM_H
1.6 +
1.7 +class BranchItem;
1.8 +class XLinkObj;
1.9 +class QGraphicsScene;
1.10 +
1.11 +#include "mapitem.h"
1.12 +
1.13 +/*! \brief xlinks are used to draw arbitrary connections between branches (BranchObj) in the map. */
1.14 +
1.15 +/////////////////////////////////////////////////////////////////////////////
1.16 +class XLinkItem:public MapItem {
1.17 +public:
1.18 + enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink};
1.19 +
1.20 + XLinkItem (const QList<QVariant> &data, TreeItem *parent=NULL);
1.21 + virtual ~XLinkItem ();
1.22 + virtual void init ();
1.23 + void setBegin (BranchItem*);
1.24 + BranchItem* getBegin();
1.25 + void setEnd (BranchItem*);
1.26 + void setEnd (QPointF);
1.27 + BranchItem* getEnd();
1.28 + void setColor(QColor);
1.29 + QColor getColor();
1.30 + void setWidth (int);
1.31 + int getWidth ();
1.32 + bool activate (); //! Creates a 2nd XLink (without a XLinkObj attached)
1.33 + bool isBegin(); //! true, if this is master xLink, which may have an XLinkObj attached
1.34 + void updateXLink();
1.35 + virtual void updateVisibility(); // FIXME-3 not really needed atm...
1.36 + BranchItem* getPartnerBranch ();
1.37 + XLinkItem *getPartnerXLink(); //! Partner XLink
1.38 + QString saveToDir ();
1.39 + virtual XLinkObj* createMapObj(QGraphicsScene *scene);
1.40 +
1.41 +private:
1.42 + XLinkState xLinkState; // init during drawing or active
1.43 + QColor color;
1.44 + int width;
1.45 + BranchItem *beginBranch;
1.46 + BranchItem *endBranch;
1.47 + XLinkItem *partnerXLink;
1.48 + bool isBeginXLink;
1.49 +};
1.50 +
1.51 +#endif