3 #include "linkablemapobj.h"
4 #include "ornamentedobj.h"
13 MapItem::MapItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
22 hideLinkUnselected=false;
25 void MapItem::appendChild (TreeItem *item)
27 TreeItem::appendChild (item);
29 // FIXME-4 maybe access parent in MapObjs directly via treeItem
30 // and remove this here...
32 // If lmo exists, also set parObj there
33 if (lmo && (item->isBranchLikeType() || item->getType()==TreeItem::Image) )
35 LinkableMapObj *itemLMO=((MapItem*)item)->lmo;
37 itemLMO->setParObj (lmo);
41 void MapItem::setRelPos (const QPointF &p)
47 ((OrnamentedObj*)lmo)->setUseRelPos (true);
48 ((OrnamentedObj*)lmo)->move2RelPos(p);
52 void MapItem::setAbsPos (const QPointF &p)
56 if (lmo) lmo->move (p);
59 void MapItem::setPositionMode (PositionMode mode)
64 MapItem::PositionMode MapItem::getPositionMode ()
69 void MapItem::setHideLinkUnselected (bool b)
74 //lmo->setHideLinkUnselected();
75 lmo->setVisibility (lmo->isVisibleObj());
76 lmo->updateLinkGeometry();
80 bool MapItem::getHideLinkUnselected()
82 return hideLinkUnselected;
85 QString MapItem::getMapAttr ()
89 if (parentItem==rootItem)
93 if (type==TreeItem::Image ||depth()==1)
101 if (lmo) pos=lmo->getRelPos();
102 s= attribut("relPosX",QString().setNum(pos.x())) +
103 attribut("relPosY",QString().setNum(pos.y()));
106 if (lmo) pos=lmo->getAbsPos();
107 s=attribut("absPosX",QString().setNum(pos.x())) +
108 attribut("absPosY",QString().setNum(pos.y()));
112 if (hideLinkUnselected)
113 s+=attribut ("hideLink","true");
115 s+=attribut ("hideLink","false");
119 QRectF MapItem::getBBoxURLFlag ()
121 QStringList list=systemFlags.activeFlagNames().filter ("system-url");
124 qWarning()<<"MapItem::getBBoxURLFlag found more than one system-url*";
127 return getBBoxFlag (list.first());
130 QRectF MapItem::getBBoxFlag (const QString &fname)
133 return ((OrnamentedObj*)lmo)->getBBoxFlag (fname);
138 LinkableMapObj* MapItem::getLMO()
143 void MapItem::setLMO(LinkableMapObj *l)
148 void MapItem::initLMO()
154 lmo->setRelPos (pos);