mapitem.h
author insilmaril
Wed, 13 May 2009 08:26:27 +0000
changeset 767 6d2b32f305f9
parent 762 ffb95cd03156
child 775 6e4b586aa88a
permissions -rw-r--r--
Started to use QtKinetic for Animation
insilmaril@760
     1
#ifndef MAPITEM_H
insilmaril@760
     2
#define MAPITEM_H
insilmaril@760
     3
insilmaril@760
     4
#include <QPointF>
insilmaril@760
     5
insilmaril@762
     6
#include "xmlobj.h"
insilmaril@762
     7
insilmaril@760
     8
class LinkableMapObj;
insilmaril@760
     9
insilmaril@760
    10
/*! /brief MapItem is used to store information of MapObj and inherited
insilmaril@760
    11
   classes.
insilmaril@760
    12
 
insilmaril@762
    13
	This is done even while no QGraphicsView is availabe. This is useful
insilmaril@762
    14
	if e.g. on a small device like a cellphone te full map is not used,
insilmaril@762
    15
	but just a treeview instead.
insilmaril@760
    16
*/
insilmaril@760
    17
insilmaril@762
    18
class MapItem: public XMLObj
insilmaril@760
    19
{
insilmaril@760
    20
protected:
insilmaril@760
    21
	enum PositionMode {Unused,Absolute,Relative};
insilmaril@760
    22
	QPointF pos;
insilmaril@760
    23
	PositionMode posMode;
insilmaril@760
    24
insilmaril@760
    25
public:
insilmaril@760
    26
	MapItem();
insilmaril@760
    27
insilmaril@760
    28
	/*! Used to save relative position while map is not in QGraphicsView */
insilmaril@760
    29
	virtual void setRelPos(const QPointF&);	
insilmaril@760
    30
insilmaril@760
    31
	/*! Used to save absolute position while map is not in QGraphicsView */
insilmaril@760
    32
	virtual void setAbsPos(const QPointF&);	
insilmaril@760
    33
insilmaril@760
    34
protected:
insilmaril@760
    35
	LinkableMapObj *lmo;
insilmaril@760
    36
public:
insilmaril@760
    37
	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
insilmaril@760
    38
	virtual LinkableMapObj* getLMO();
insilmaril@760
    39
insilmaril@760
    40
	/*! Set pointer to related LinkableMapObj in QGraphicsView */
insilmaril@760
    41
	virtual void setLMO (LinkableMapObj*);
insilmaril@760
    42
insilmaril@760
    43
	/*! Initialize LinkableMapObj with data in MapItem */
insilmaril@760
    44
	virtual void initLMO();
insilmaril@762
    45
insilmaril@762
    46
	/*! Return data as attributes for saving in XML */
insilmaril@762
    47
	virtual QString getAttr();
insilmaril@760
    48
};
insilmaril@760
    49
insilmaril@760
    50
insilmaril@760
    51
#endif