1 #include "mapcenteritem.h"
2 #include "mapcenterobj.h"
7 MapCenterItem::MapCenterItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
9 //cout << "Constr. MapCenterItem\n";
13 MapCenterItem::~MapCenterItem()
15 cout << "Destr. MapCenterItem\n";
16 qDeleteAll(childItems);
19 QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-3 Check if everything is saved...
21 // Cloudy stuff can be hidden during exports
22 if (hidden) return QString();
25 BranchObj *bo=(BranchObj*)lmo;
29 scrolledAttr=attribut ("scrolled","yes");
34 // save area, if not scrolled
36 if (!((BranchObj*)(parObj))->isScrolled() )
39 attribut("x1",QString().setNum(absPos.x()-offset.x())) +
40 attribut("y1",QString().setNum(absPos.y()-offset.y())) +
41 attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
42 attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
47 // Providing an ID for a branch makes export to XHTML easier
50 idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
55 s=beginElement ("mapcenter"
61 // +getIncludeImageAttr()
66 s+=valueElement("heading", getHeading(),
67 attribut ("textColor",QColor( bo->getColor()).name()));
71 if (frame->getFrameType()!=FrameObj::NoFrame)
72 s+=frame->saveToDir ();
74 // save names of flags set
75 s+=standardFlags->saveToDir(tmpdir,prefix,0);
78 for (int i=0; i<floatimage.size(); ++i)
79 s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
88 TreeItem *ti=getBranchNum(i);
91 s+=getBranchNum(i)->saveToDir(tmpdir,prefix,offset);
99 QString ol; // old link
100 QString cl; // current link
101 for (int i=0; i<xlink.size(); ++i)
103 cl=xlink.at(i)->saveToDir();
110 qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
116 s+=endElement ("mapcenter");
120 BranchObj* MapCenterItem::createMapObj(QGraphicsScene *scene)
122 // Initialize MapCenterObj, order of things is important...
123 MapCenterObj* mco=new MapCenterObj(scene);
125 mco->setParObj(NULL);
126 mco->setModel (model);
127 mco->setTreeItem (this);
128 mco->setDefAttr(BranchObj::NewBranch);
132 if (!getHeading().isEmpty() )
134 mco->updateData(); //FIXME-3 better call model->emitDataHasChanged(treeItem);
135 mco->setColor (headingColor);
138 //mco->updateLink(); //FIXME-3