mapcenteritem.cpp
author insilmaril
Thu, 23 Apr 2009 12:15:31 +0000
changeset 755 ed5b407975b3
parent 749 9ff332964015
child 760 59614eaf5fbb
permissions -rw-r--r--
more data in Tree, less in Map
     1 #include "mapcenteritem.h"
     2 #include "mapcenterobj.h"
     3 
     4 #include <iostream>
     5 using namespace std;
     6 
     7 MapCenterItem::MapCenterItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
     8 {
     9 	scrolled=false;
    10 	tmpUnscrolled=false;
    11 }
    12 
    13 MapCenterItem::~MapCenterItem()
    14 {
    15 	cout << "Destr. MapCenterItem\n";
    16     qDeleteAll(childItems);
    17 }
    18 
    19 QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
    20 {
    21 	// Cloudy stuff can be hidden during exports
    22 	if (hidden) return QString();
    23 
    24     QString s,a;
    25 	BranchObj *bo=(BranchObj*)lmo;
    26 
    27 	/* FIXME-1
    28 	// Update of note is usually done while unselecting a branch
    29 	if (isNoteInEditor) getNoteFromTextEditor();
    30 	
    31 	QString scrolledAttr;
    32 	if (scrolled) 
    33 		scrolledAttr=attribut ("scrolled","yes");
    34 	else
    35 		scrolledAttr="";
    36 
    37 	// save area, if not scrolled
    38 	QString areaAttr;
    39 	if (!((BranchObj*)(parObj))->isScrolled() )
    40 	{
    41 		areaAttr=
    42 			attribut("x1",QString().setNum(absPos.x()-offset.x())) +
    43 			attribut("y1",QString().setNum(absPos.y()-offset.y())) +
    44 			attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
    45 			attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
    46 
    47 	} else
    48 		areaAttr="";
    49 	
    50 	// Providing an ID for a branch makes export to XHTML easier
    51 	QString idAttr;
    52 	if (countXLinks()>0)
    53 		idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
    54 	else
    55 		idAttr="";
    56 
    57 	*/
    58     s=beginElement ("branch" 
    59 	//	+getOrnXMLAttr() 
    60 	//	+scrolledAttr 
    61 	//	+areaAttr 
    62 	//	+idAttr 
    63 	//	+getIncludeImageAttr() 
    64 		);
    65     incIndent();
    66 
    67 	// save heading
    68     s+=valueElement("heading", getHeading(),
    69 		attribut ("textColor",QColor( bo->getColor()).name()));
    70 
    71 /*
    72 	// Save frame
    73 	if (frame->getFrameType()!=FrameObj::NoFrame) 
    74 		s+=frame->saveToDir ();
    75 
    76 	// save names of flags set
    77 	s+=standardFlags->saveToDir(tmpdir,prefix,0);
    78 	
    79 	// Save FloatImages
    80 	for (int i=0; i<floatimage.size(); ++i)
    81 		s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
    82 */
    83 
    84 	// save note
    85 	if (!note.isEmpty() )
    86 		s+=note.saveToDir();
    87 	
    88 	// Save branches
    89 	TreeItem *ti=getFirstBranch();
    90 	TreeItem *last=getLastBranch();
    91 	while (ti && ti!=last) 
    92 		s+=ti->saveToDir(tmpdir,prefix,offset);
    93 
    94 	/*
    95 	// Save XLinks
    96 	QString ol;	// old link
    97 	QString cl;	// current link
    98 	for (int i=0; i<xlink.size(); ++i)
    99 	{
   100 		cl=xlink.at(i)->saveToDir();
   101 		if (cl!=ol)
   102 		{
   103 			s+=cl;
   104 			ol=cl;
   105 		} else
   106 		{
   107 			qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
   108 		}
   109 	}	
   110 	*/
   111 
   112     decIndent();
   113     s+=endElement   ("branch");
   114     return s;
   115 }
   116 
   117 
   118