2 #include <QGraphicsScene>
4 #include "branchitem.h"
5 #include "linkablemapobj.h"
9 /////////////////////////////////////////////////////////////////
11 /////////////////////////////////////////////////////////////////
13 XLinkItem::XLinkItem(TreeItem *parent)
17 // qDebug() << "Const XLinkItem () "<<this;
21 XLinkItem::~XLinkItem()
23 // qDebug() << "Destr XLinkItem begin "<<this<<" pI="<<parentItem<<"
26 XLinkItem *xli = link->getOtherEnd(this);
28 model->deleteLater(xli->getID());
29 model->deleteLink(link);
31 // qDebug() << "Destr XLinkItem end";
34 void XLinkItem::init()
40 void XLinkItem::clear() {}
42 void XLinkItem::setLink(Link *l) { link = l; }
44 Link *XLinkItem::getLink() { return link; }
46 void XLinkItem::updateXLink()
52 MapObj *XLinkItem::getMO()
59 void XLinkItem::setSelection()
62 XLinkObj *xlo = (XLinkObj *)getMO();
64 if (parentItem == link->getBeginBranch())
65 xlo->setSelection(XLinkObj::C0);
66 else if (parentItem == link->getEndBranch())
67 xlo->setSelection(XLinkObj::C1);
72 BranchItem *XLinkItem::getPartnerBranch()
74 if (link && link->getBeginBranch() && link->getEndBranch()) {
75 if (parentItem == link->getBeginBranch())
76 return link->getEndBranch();
78 return link->getBeginBranch();