mapitem.h
author insilmaril
Mon, 29 Jun 2009 10:27:42 +0000
changeset 777 8acac4fade1b
parent 776 25e634a7e1dc
child 779 1fb50e79661c
permissions -rw-r--r--
more fixes
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@777
    18
class MapItem:public XMLObj
insilmaril@760
    19
{
insilmaril@775
    20
public:
insilmaril@775
    21
	enum PositionMode {Unused,Absolute,Relative};
insilmaril@760
    22
protected:
insilmaril@760
    23
	QPointF pos;
insilmaril@760
    24
	PositionMode posMode;
insilmaril@760
    25
insilmaril@760
    26
public:
insilmaril@760
    27
	MapItem();
insilmaril@776
    28
	void init();
insilmaril@760
    29
insilmaril@760
    30
	/*! Used to save relative position while map is not in QGraphicsView */
insilmaril@760
    31
	virtual void setRelPos(const QPointF&);	
insilmaril@760
    32
insilmaril@760
    33
	/*! Used to save absolute position while map is not in QGraphicsView */
insilmaril@760
    34
	virtual void setAbsPos(const QPointF&);	
insilmaril@760
    35
insilmaril@775
    36
	/*! Tell object to use e.g. absolute positioning for mapcenter. 
insilmaril@775
    37
	    Defaulst is MapItem::Unused */
insilmaril@775
    38
	void setPositionMode (PositionMode mode);
insilmaril@775
    39
insilmaril@760
    40
protected:
insilmaril@760
    41
	LinkableMapObj *lmo;
insilmaril@760
    42
public:
insilmaril@760
    43
	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
insilmaril@760
    44
	virtual LinkableMapObj* getLMO();
insilmaril@760
    45
insilmaril@760
    46
	/*! Set pointer to related LinkableMapObj in QGraphicsView */
insilmaril@760
    47
	virtual void setLMO (LinkableMapObj*);
insilmaril@760
    48
insilmaril@760
    49
	/*! Initialize LinkableMapObj with data in MapItem */
insilmaril@760
    50
	virtual void initLMO();
insilmaril@762
    51
insilmaril@760
    52
};
insilmaril@760
    53
insilmaril@760
    54
insilmaril@760
    55
#endif