mapitem.cpp
changeset 776 25e634a7e1dc
parent 775 6e4b586aa88a
child 777 8acac4fade1b
     1.1 --- a/mapitem.cpp	Wed Jun 03 20:37:17 2009 +0000
     1.2 +++ b/mapitem.cpp	Mon Jun 08 11:36:56 2009 +0000
     1.3 @@ -5,9 +5,20 @@
     1.4  
     1.5  #include <iostream>
     1.6  using namespace std;
     1.7 +#include "misc.h"	//cout << QPointF
     1.8  
     1.9  MapItem::MapItem()
    1.10  {
    1.11 +	init();
    1.12 +}
    1.13 +
    1.14 +MapItem::MapItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
    1.15 +{
    1.16 +	init();
    1.17 +}
    1.18 +
    1.19 +void MapItem::init()
    1.20 +{
    1.21  	lmo=NULL;
    1.22  	posMode=Unused;
    1.23  }
    1.24 @@ -63,23 +74,33 @@
    1.25  
    1.26  QString MapItem::getAttr()
    1.27  {
    1.28 +	QString s;
    1.29 +	if (parentItem==rootItem)
    1.30 +		posMode=Absolute;
    1.31 +	else
    1.32 +	{
    1.33 +		if (type==TreeItem::Image ||depth()==1)
    1.34 +			posMode=Relative;
    1.35 +		else
    1.36 +			posMode=Unused;
    1.37 +	}
    1.38  	switch (posMode)
    1.39  	{
    1.40  		case Relative:	
    1.41  			if (lmo) pos=lmo->getRelPos();
    1.42 -			return
    1.43 -				attribut("relPosX",QString().setNum(pos.x())) +
    1.44 -				attribut("relPosY",QString().setNum(pos.y())); 
    1.45 +			s= attribut("relPosX",QString().setNum(pos.x())) +
    1.46 +			   attribut("relPosY",QString().setNum(pos.y())); 
    1.47  			break;
    1.48  		case Absolute:	
    1.49  			if (lmo) pos=lmo->getAbsPos();
    1.50 -			return
    1.51 -				attribut("absPosX",QString().setNum(pos.x())) +
    1.52 -				attribut("absPosY",QString().setNum(pos.y())); 
    1.53 +			s=attribut("absPosX",QString().setNum(pos.x())) +
    1.54 +			  attribut("absPosY",QString().setNum(pos.y())); 
    1.55  			break;
    1.56 -		default:
    1.57 -			return QString();
    1.58 -			break;
    1.59 +		default: break;
    1.60  	}
    1.61 +	if (hideExport)
    1.62 +		return s+attribut("hideInExport","true");
    1.63 +	else	
    1.64 +		return s;
    1.65  }
    1.66