mapitem.h
author insilmaril
Wed, 03 Jun 2009 20:37:17 +0000
changeset 775 6e4b586aa88a
parent 762 ffb95cd03156
child 776 25e634a7e1dc
permissions -rw-r--r--
Unscrolling temporary works again
     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 public:
    21 	enum PositionMode {Unused,Absolute,Relative};
    22 protected:
    23 	QPointF pos;
    24 	PositionMode posMode;
    25 
    26 public:
    27 	MapItem();
    28 
    29 	/*! Used to save relative position while map is not in QGraphicsView */
    30 	virtual void setRelPos(const QPointF&);	
    31 
    32 	/*! Used to save absolute position while map is not in QGraphicsView */
    33 	virtual void setAbsPos(const QPointF&);	
    34 
    35 	/*! Tell object to use e.g. absolute positioning for mapcenter. 
    36 	    Defaulst is MapItem::Unused */
    37 	void setPositionMode (PositionMode mode);
    38 
    39 protected:
    40 	LinkableMapObj *lmo;
    41 public:
    42 	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
    43 	virtual LinkableMapObj* getLMO();
    44 
    45 	/*! Set pointer to related LinkableMapObj in QGraphicsView */
    46 	virtual void setLMO (LinkableMapObj*);
    47 
    48 	/*! Initialize LinkableMapObj with data in MapItem */
    49 	virtual void initLMO();
    50 
    51 	/*! Return data as attributes for saving in XML */
    52 	virtual QString getAttr();
    53 };
    54 
    55 
    56 #endif