]> git.sven.stormbind.net Git - sven/vym.git/blob - mapitem.h
3559a363a95ec267d2a44a2d60b4c87881e55ad4
[sven/vym.git] / mapitem.h
1 #ifndef MAPITEM_H
2 #define MAPITEM_H
3
4 #include <QPointF>
5
6 #include "treeitem.h"
7
8 class MapObj;
9 class LinkableMapObj;
10
11 /*! /brief MapItem is used to store information of MapObj and inherited
12    classes.
13  
14     This is done even while no QGraphicsView is availabe. This is useful
15     if e.g. on a small device like a cellphone the full map is not used,
16     but just a treeview instead.
17 */
18
19 class MapItem:public TreeItem
20 {
21 public:
22     enum PositionMode {Unused,Absolute,Relative};
23 protected:
24     QPointF pos;
25     PositionMode posMode;
26
27 public:
28     MapItem();
29     MapItem(const QList<QVariant> &data, TreeItem *parent = 0);
30
31     void init();
32
33     /*! Overloaded from TreeItem. Used to set parObj in LinkableMapObj */
34     virtual void appendChild (TreeItem *item);
35
36     /*! Used to save relative position while map is not in QGraphicsView */
37     virtual void setRelPos(const QPointF&); 
38
39     /*! Used to save absolute position while map is not in QGraphicsView */
40     virtual void setAbsPos(const QPointF&); 
41
42     /*! Tell object to use e.g. absolute positioning for mapcenter. 
43         Defaulst is MapItem::Unused */
44     void setPositionMode (PositionMode mode);
45     PositionMode getPositionMode ();
46
47
48 protected:
49     bool hideLinkUnselected;
50 public:
51     /*! Hide link if item is not selected */
52     virtual void setHideLinkUnselected(bool);
53
54     /*! Check if link is hidden for unselected items */
55     virtual bool getHideLinkUnselected();
56
57     virtual QString getMapAttr();   //! Get attributes for saving as XML
58
59     virtual QRectF getBBoxURLFlag();//! get bbox of url flag
60     virtual QRectF getBBoxFlag   (const QString &fname);    //! get bbox of flag
61     virtual void setRotation (const qreal &a);
62
63
64 protected:
65     MapObj *mo;
66     qreal angle;
67
68 public:
69     /*! Returns pointer to related LinkableMapObj in QGraphicsView */
70     virtual         MapObj* getMO();
71     virtual LinkableMapObj* getLMO();
72
73     /*! Initialize LinkableMapObj with data in MapItem */
74     virtual void initLMO();
75
76 };
77
78
79 #endif