Menu

[c54480]: / xlinkitem.cpp  Maximize  Restore  History

Download this file

93 lines (77 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <QGraphicsScene>
#include "xlinkitem.h"
#include "branchitem.h"
#include "linkablemapobj.h"
#include "vymmodel.h"
#include "xlinkobj.h"
/////////////////////////////////////////////////////////////////
// XLinkItem
/////////////////////////////////////////////////////////////////
XLinkItem::XLinkItem (const QList<QVariant> &data, TreeItem *parent):MapItem (data,parent)
{
//qDebug() << "Const XLinkItem () "<<this;
init();
}
XLinkItem::~XLinkItem ()
{
// qDebug() << "Destr XLinkItem begin "<<this<<" pI="<<parentItem<<" link="<<link;
if (link)
{
XLinkItem *xli=link->getOtherEnd (this);
if (xli) model->deleteLater (xli->getID());
model->deleteLink (link);
}
// qDebug() << "Destr XLinkItem end";
}
void XLinkItem::init ()
{
setType (XLink);
link=NULL;
}
void XLinkItem::clear()
{
}
void XLinkItem::setLink (Link *l)
{
link=l;
}
Link* XLinkItem::getLink ()
{
return link;
}
void XLinkItem::updateXLink()
{
if (link)
link->updateLink();
}
MapObj* XLinkItem::getMO()
{
if (link)
return link->getMO();
return NULL;
}
void XLinkItem::setSelection()
{
if (link)
{
XLinkObj* xlo=(XLinkObj*)getMO();
if (xlo)
{
if (parentItem==link->getBeginBranch() )
xlo->setSelection(XLinkObj::C0);
else if (parentItem==link->getEndBranch() )
xlo->setSelection(XLinkObj::C1);
}
}
}
BranchItem* XLinkItem::getPartnerBranch()
{
if (link && link->getBeginBranch() && link->getEndBranch())
{
if (parentItem==link->getBeginBranch())
return link->getEndBranch();
else
return link->getBeginBranch();
}
return NULL;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.