diff -r d922fb6ea482 -r 6b0a5f4923d3 xlinkitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xlinkitem.cpp Thu Sep 17 09:41:09 2009 +0000 @@ -0,0 +1,210 @@ +#include +#include "xlinkitem.h" + +#include "branchitem.h" +#include "linkablemapobj.h" +#include "vymmodel.h" +#include "xlinkobj.h" + +#include +using namespace std; + +///////////////////////////////////////////////////////////////// +// XLinkItem +///////////////////////////////////////////////////////////////// + +XLinkItem::XLinkItem (const QList &data, TreeItem *parent):MapItem (data,parent) + +{ + //cout << "Const XLinkItem () "<getHeading()); + setHeading ("xLink to: "+endBranch->getHeading()); + + model->updateActions(); + return true; + } else + return false; +} + +bool XLinkItem::isBegin() +{ + return isBeginXLink; +} + +void XLinkItem::updateXLink() +{ + if(lmo && isBeginXLink) + ((XLinkObj*)lmo)->updateXLink(); + else + if (partnerXLink) partnerXLink->updateXLink(); +} + +void XLinkItem::updateVisibility() +{ + if (lmo) lmo->updateVisibility(); +} + +BranchItem* XLinkItem::getPartnerBranch() +{ + if (!beginBranch && !endBranch) + return NULL; + if (isBeginXLink) + return endBranch; + else + return beginBranch; +} + + +XLinkItem* XLinkItem::getPartnerXLink() +{ + return partnerXLink; +} + + +QString XLinkItem::saveToDir () +{ + QString s=""; + if (beginBranch && endBranch && xLinkState==activeXLink) + { + if (beginBranch==endBranch ) + qWarning ("XLI::saveToDir beginBranch==endBranch"); //FIXME-3 s="" + else + { + QString colAttr=attribut ("color",color.name()); + QString widAttr=attribut ("width",QString().setNum(width,10)); + QString begSelAttr=attribut ("beginID",model->getSelectString(beginBranch)); + QString endSelAttr=attribut ("endID", model->getSelectString(endBranch)); + s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr); + + s+=endElement ("xlink"); + } + } + return s; +} + +XLinkObj* XLinkItem::createMapObj(QGraphicsScene *scene) +{ + XLinkObj* xlo=new XLinkObj (scene,this); + lmo=(LinkableMapObj*)xlo; + return xlo; +} +