mapitem.h
author insilmaril
Fri, 09 Apr 2010 14:24:04 +0000
changeset 846 f0fe7c36ec5c
parent 835 31841b366d5e
permissions -rw-r--r--
Version 1.13.3 and added treeeditor.png
     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 	PositionMode getPositionMode ();
    45 
    46 
    47 protected:
    48 	bool hideLinkUnselected;
    49 public:
    50 	/*! Hide link if item is not selected */
    51 	virtual void setHideLinkUnselected(bool);
    52 
    53 	/*! Check if link is hidden for unselected items */
    54 	virtual bool getHideLinkUnselected();
    55 
    56 	virtual QString getMapAttr();	//! Get attributes for saving as XML
    57 
    58 	virtual QRectF getBBoxURLFlag();//! get bbox of url flag
    59 	virtual QRectF getBBoxFlag   (const QString &fname);	//! get bbox of flag
    60 
    61 
    62 protected:
    63 	LinkableMapObj *lmo;
    64 public:
    65 	/*! Returns pointer to related LinkableMapObj in QGraphicsView */
    66 	virtual LinkableMapObj* getLMO();
    67 
    68 	/*! Set pointer to related LinkableMapObj in QGraphicsView */
    69 	virtual void setLMO (LinkableMapObj*);
    70 
    71 	/*! Initialize LinkableMapObj with data in MapItem */
    72 	virtual void initLMO();
    73 
    74 };
    75 
    76 
    77 #endif