mapitem.h
author insilmaril
Fri, 19 Feb 2010 13:47:03 +0000
changeset 823 0bba81dde1bc
parent 819 8f987e376035
child 835 31841b366d5e
permissions -rw-r--r--
More fixes
     1 #ifndef MAPITEM_H
     2 #define MAPITEM_H
     3 
     4 #include <QPointF>
     5 
     6 #include "treeitem.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 the full map is not used,
    15 	but just a treeview instead.
    16 */
    17 
    18 class MapItem:public TreeItem
    19 {
    20 public:
    21 	enum PositionMode {Unused,Absolute,Relative};
    22 protected:
    23 	QPointF pos;
    24 	PositionMode posMode;
    25 
    26 public:
    27 	MapItem();
    28 	MapItem(const QList<QVariant> &data, TreeItem *parent = 0);
    29 
    30 	void init();
    31 
    32 	/*! Overloaded from TreeItem. Used to set parObj in LinkableMapObj */
    33 	virtual void appendChild (TreeItem *item);
    34 
    35 	/*! Used to save relative position while map is not in QGraphicsView */
    36 	virtual void setRelPos(const QPointF&);	
    37 
    38 	/*! Used to save absolute position while map is not in QGraphicsView */
    39 	virtual void setAbsPos(const QPointF&);	
    40 
    41 	/*! Tell object to use e.g. absolute positioning for mapcenter. 
    42 	    Defaulst is MapItem::Unused */
    43 	void setPositionMode (PositionMode mode);
    44 
    45 
    46 protected:
    47 	bool hideLinkUnselected;
    48 public:
    49 	/*! Hide link if item is not selected */
    50 	virtual void setHideLinkUnselected(bool);
    51 
    52 	/*! Check if link is hidden for unselected items */
    53 	virtual bool getHideLinkUnselected();
    54 
    55 	virtual QString getMapAttr();	//! Get attributes for saving as XML
    56 
    57 	virtual QRectF getBBoxURLFlag();//! get bbox of url flag
    58 	virtual QRectF getBBoxFlag   (const QString &fname);	//! get bbox of flag
    59 
    60 
    61 protected:
    62 	LinkableMapObj *lmo;
    63 public:
    64 	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
    65 	virtual LinkableMapObj* getLMO();
    66 
    67 	/*! Set pointer to related LinkableMapObj in QGraphicsView */
    68 	virtual void setLMO (LinkableMapObj*);
    69 
    70 	/*! Initialize LinkableMapObj with data in MapItem */
    71 	virtual void initLMO();
    72 
    73 };
    74 
    75 
    76 #endif