File: mapitem.h

package info (click to toggle)
vym 2.6.11-3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 12,628 kB
  • sloc: cpp: 34,052; ruby: 846; xml: 278; sh: 187; makefile: 28
file content (79 lines) | stat: -rw-r--r-- 1,991 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef MAPITEM_H
#define MAPITEM_H

#include <QPointF>

#include "treeitem.h"

class MapObj;
class LinkableMapObj;

/*! /brief MapItem is used to store information of MapObj and inherited
   classes.
 
    This is done even while no QGraphicsView is availabe. This is useful
    if e.g. on a small device like a cellphone the full map is not used,
    but just a treeview instead.
*/

class MapItem:public TreeItem
{
public:
    enum PositionMode {Unused,Absolute,Relative};
protected:
    QPointF pos;
    PositionMode posMode;

public:
    MapItem();
    MapItem(const QList<QVariant> &data, TreeItem *parent = 0);

    void init();

    /*! Overloaded from TreeItem. Used to set parObj in LinkableMapObj */
    virtual void appendChild (TreeItem *item);

    /*! Used to save relative position while map is not in QGraphicsView */
    virtual void setRelPos(const QPointF&); 

    /*! Used to save absolute position while map is not in QGraphicsView */
    virtual void setAbsPos(const QPointF&); 

    /*! Tell object to use e.g. absolute positioning for mapcenter. 
	Defaulst is MapItem::Unused */
    void setPositionMode (PositionMode mode);
    PositionMode getPositionMode ();


protected:
    bool hideLinkUnselected;
public:
    /*! Hide link if item is not selected */
    virtual void setHideLinkUnselected(bool);

    /*! Check if link is hidden for unselected items */
    virtual bool getHideLinkUnselected();

    virtual QString getMapAttr();   //! Get attributes for saving as XML

    virtual QRectF getBBoxURLFlag();//! get bbox of url flag
    virtual QRectF getBBoxFlag   (const QString &fname);    //! get bbox of flag
    virtual void setRotation (const qreal &a);


protected:
    MapObj *mo;
    qreal angle;

public:
    /*! Returns pointer to related LinkableMapObj in QGraphicsView */
    virtual         MapObj* getMO();
    virtual LinkableMapObj* getLMO();

    /*! Initialize LinkableMapObj with data in MapItem */
    virtual void initLMO();

};


#endif