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 LinkableMapObj *lmo=getLMO();
36 LinkableMapObj *itemLMO=((MapItem*)item)->getLMO();
38 itemLMO->setParObj (lmo);
42 void MapItem::setRelPos (const QPointF &p)
46 LinkableMapObj *lmo=getLMO();
49 ((OrnamentedObj*)lmo)->setUseRelPos (true);
50 ((OrnamentedObj*)lmo)->move2RelPos(p);
54 void MapItem::setAbsPos (const QPointF &p)
61 void MapItem::setPositionMode (PositionMode mode)
66 MapItem::PositionMode MapItem::getPositionMode ()
71 void MapItem::setHideLinkUnselected (bool b)
74 LinkableMapObj *lmo=getLMO();
77 //lmo->setHideLinkUnselected();
78 lmo->setVisibility (lmo->isVisibleObj());
79 lmo->updateLinkGeometry();
83 bool MapItem::getHideLinkUnselected()
85 return hideLinkUnselected;
88 QString MapItem::getMapAttr ()
91 LinkableMapObj *lmo=getLMO();
93 if (parentItem==rootItem)
97 if (type==TreeItem::Image ||depth()==1 || lmo->getUseRelPos() )
98 posMode=Relative; //FiXME-2 shouldn't this be replaced by relPos?
105 if (lmo) pos=lmo->getRelPos();
106 s= attribut("relPosX",QString().setNum(pos.x())) +
107 attribut("relPosY",QString().setNum(pos.y()));
110 if (mo) pos=mo->getAbsPos();
111 s=attribut("absPosX",QString().setNum(pos.x())) +
112 attribut("absPosY",QString().setNum(pos.y()));
116 if (hideLinkUnselected)
117 s+=attribut ("hideLink","true");
119 s+=attribut ("hideLink","false");
124 angle=mo->getRotation();
126 s+=attribut("rotation",QString().setNum(angle) );
131 QRectF MapItem::getBBoxURLFlag ()
133 QStringList list=systemFlags.activeFlagNames().filter ("system-url");
136 qWarning()<<"MapItem::getBBoxURLFlag found more than one system-url*";
139 return getBBoxFlag (list.first());
142 QRectF MapItem::getBBoxFlag (const QString &fname)
144 LinkableMapObj *lmo=getLMO();
146 return ((OrnamentedObj*)lmo)->getBBoxFlag (fname);
151 void MapItem::setRotation(const qreal &a)
155 if (mo) mo->setRotation (a);
158 MapObj* MapItem::getMO()
163 LinkableMapObj* MapItem::getLMO()
165 if (isBranchLikeType() || type==Image)
166 return (LinkableMapObj*)mo;
171 void MapItem::initLMO()
173 LinkableMapObj *lmo=getLMO();
178 lmo->setRelPos (pos);