X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Fmapitem.h;fp=src%2Fmapitem.h;h=be20fbc2c7dbdbcaa4c6c5257910392d08d2f9cc;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=0000000000000000000000000000000000000000;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/src/mapitem.h b/src/mapitem.h new file mode 100644 index 0000000..be20fbc --- /dev/null +++ b/src/mapitem.h @@ -0,0 +1,74 @@ +#ifndef MAPITEM_H +#define MAPITEM_H + +#include + +#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(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 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