mapitem.h
author insilmaril
Mon, 08 Jun 2009 11:36:56 +0000
changeset 776 25e634a7e1dc
parent 775 6e4b586aa88a
child 777 8acac4fade1b
permissions -rw-r--r--
Images basically work (again)
     1 #ifndef MAPITEM_H
     2 #define MAPITEM_H
     3 
     4 #include <QPointF>
     5 
     6 #include "treeitem.h"
     7 #include "xmlobj.h"
     8 
     9 class LinkableMapObj;
    10 class TreeItem;
    11 
    12 /*! /brief MapItem is used to store information of MapObj and inherited
    13    classes.
    14  
    15 	This is done even while no QGraphicsView is availabe. This is useful
    16 	if e.g. on a small device like a cellphone te full map is not used,
    17 	but just a treeview instead.
    18 */
    19 
    20 class MapItem:public TreeItem, public XMLObj
    21 {
    22 public:
    23 	enum PositionMode {Unused,Absolute,Relative};
    24 protected:
    25 	QPointF pos;
    26 	PositionMode posMode;
    27 
    28 public:
    29 	MapItem();
    30 	MapItem (const QList<QVariant> &data, TreeItem *parent = 0);
    31 	void init();
    32 
    33 	/*! Used to save relative position while map is not in QGraphicsView */
    34 	virtual void setRelPos(const QPointF&);	
    35 
    36 	/*! Used to save absolute position while map is not in QGraphicsView */
    37 	virtual void setAbsPos(const QPointF&);	
    38 
    39 	/*! Tell object to use e.g. absolute positioning for mapcenter. 
    40 	    Defaulst is MapItem::Unused */
    41 	void setPositionMode (PositionMode mode);
    42 
    43 protected:
    44 	LinkableMapObj *lmo;
    45 public:
    46 	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
    47 	virtual LinkableMapObj* getLMO();
    48 
    49 	/*! Set pointer to related LinkableMapObj in QGraphicsView */
    50 	virtual void setLMO (LinkableMapObj*);
    51 
    52 	/*! Initialize LinkableMapObj with data in MapItem */
    53 	virtual void initLMO();
    54 
    55 	/*! Return data as attributes for saving in XML */
    56 	virtual QString getAttr();
    57 };
    58 
    59 
    60 #endif