author | insilmaril |
Mon Jul 27 12:53:17 2009 +0000 (2009-07-27) | |
changeset 782 | ffb02a9bb508 |
parent 777 | 8acac4fade1b |
child 791 | f1006de05c54 |
permissions | -rw-r--r-- |
insilmaril@760 | 1 |
#ifndef MAPITEM_H |
insilmaril@760 | 2 |
#define MAPITEM_H |
insilmaril@760 | 3 |
|
insilmaril@760 | 4 |
#include <QPointF> |
insilmaril@760 | 5 |
|
insilmaril@779 | 6 |
//#include "xmlobj.h" |
insilmaril@779 | 7 |
#include "treeitem.h" |
insilmaril@762 | 8 |
|
insilmaril@760 | 9 |
class LinkableMapObj; |
insilmaril@760 | 10 |
|
insilmaril@760 | 11 |
/*! /brief MapItem is used to store information of MapObj and inherited |
insilmaril@760 | 12 |
classes. |
insilmaril@760 | 13 |
|
insilmaril@762 | 14 |
This is done even while no QGraphicsView is availabe. This is useful |
insilmaril@762 | 15 |
if e.g. on a small device like a cellphone te full map is not used, |
insilmaril@762 | 16 |
but just a treeview instead. |
insilmaril@760 | 17 |
*/ |
insilmaril@760 | 18 |
|
insilmaril@779 | 19 |
class MapItem:public TreeItem |
insilmaril@760 | 20 |
{ |
insilmaril@775 | 21 |
public: |
insilmaril@775 | 22 |
enum PositionMode {Unused,Absolute,Relative}; |
insilmaril@760 | 23 |
protected: |
insilmaril@760 | 24 |
QPointF pos; |
insilmaril@760 | 25 |
PositionMode posMode; |
insilmaril@760 | 26 |
|
insilmaril@760 | 27 |
public: |
insilmaril@760 | 28 |
MapItem(); |
insilmaril@779 | 29 |
MapItem(const QList<QVariant> &data, TreeItem *parent = 0); |
insilmaril@779 | 30 |
|
insilmaril@776 | 31 |
void init(); |
insilmaril@760 | 32 |
|
insilmaril@779 | 33 |
/*! Overloaded from TreeItem. Used to set parObj in LinkableMapObj */ |
insilmaril@779 | 34 |
virtual void appendChild (TreeItem *item); |
insilmaril@779 | 35 |
|
insilmaril@760 | 36 |
/*! Used to save relative position while map is not in QGraphicsView */ |
insilmaril@760 | 37 |
virtual void setRelPos(const QPointF&); |
insilmaril@760 | 38 |
|
insilmaril@760 | 39 |
/*! Used to save absolute position while map is not in QGraphicsView */ |
insilmaril@760 | 40 |
virtual void setAbsPos(const QPointF&); |
insilmaril@760 | 41 |
|
insilmaril@775 | 42 |
/*! Tell object to use e.g. absolute positioning for mapcenter. |
insilmaril@775 | 43 |
Defaulst is MapItem::Unused */ |
insilmaril@775 | 44 |
void setPositionMode (PositionMode mode); |
insilmaril@775 | 45 |
|
insilmaril@779 | 46 |
|
insilmaril@779 | 47 |
protected: |
insilmaril@779 | 48 |
bool hideLinkUnselected; |
insilmaril@779 | 49 |
public: |
insilmaril@779 | 50 |
/*! Hide link if item is not selected */ |
insilmaril@779 | 51 |
virtual void setHideLinkUnselected(bool); |
insilmaril@779 | 52 |
|
insilmaril@779 | 53 |
/*! Check if link is hidden for unselected items */ |
insilmaril@779 | 54 |
virtual bool getHideLinkUnselected(); |
insilmaril@779 | 55 |
|
insilmaril@779 | 56 |
virtual QString getMapAttr(); //! Get attributes for saving as XML |
insilmaril@779 | 57 |
|
insilmaril@779 | 58 |
|
insilmaril@779 | 59 |
|
insilmaril@760 | 60 |
protected: |
insilmaril@760 | 61 |
LinkableMapObj *lmo; |
insilmaril@760 | 62 |
public: |
insilmaril@760 | 63 |
/*! Returns pointer to related LinkableMapObj in QGraphicsView */ |
insilmaril@760 | 64 |
virtual LinkableMapObj* getLMO(); |
insilmaril@760 | 65 |
|
insilmaril@760 | 66 |
/*! Set pointer to related LinkableMapObj in QGraphicsView */ |
insilmaril@760 | 67 |
virtual void setLMO (LinkableMapObj*); |
insilmaril@760 | 68 |
|
insilmaril@760 | 69 |
/*! Initialize LinkableMapObj with data in MapItem */ |
insilmaril@760 | 70 |
virtual void initLMO(); |
insilmaril@762 | 71 |
|
insilmaril@760 | 72 |
}; |
insilmaril@760 | 73 |
|
insilmaril@760 | 74 |
|
insilmaril@760 | 75 |
#endif |