]> git.sven.stormbind.net Git - sven/vym.git/blob - src/mapitem.h
Replace Pierre as the maintainer
[sven/vym.git] / src / 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   public:
21     enum PositionMode { Unused, Absolute, Relative };
22
23   protected:
24     QPointF pos;
25     PositionMode posMode;
26
27   public:
28     MapItem(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   protected:
47     bool hideLinkUnselected;
48
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 void setRotation(const qreal &a);
60
61   protected:
62     MapObj *mo;
63     qreal angle;
64
65   public:
66     /*! Returns pointer to related LinkableMapObj in QGraphicsView */
67     virtual MapObj *getMO();
68     virtual LinkableMapObj *getLMO();
69
70     /*! Initialize LinkableMapObj with data in MapItem */
71     virtual void initLMO();
72 };
73
74 #endif