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