X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Fmapobj.h;fp=src%2Fmapobj.h;h=66dee77b735fb6fe0d58d453a10b2197700f3d8a;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=0000000000000000000000000000000000000000;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/src/mapobj.h b/src/mapobj.h new file mode 100644 index 0000000..66dee77 --- /dev/null +++ b/src/mapobj.h @@ -0,0 +1,77 @@ +#ifndef MAPOBJ_H +#define MAPOBJ_H + +#include + +#include "xmlobj.h" + +#define dZ_BBOX 0 // testing +#define dZ_SELBOX 5 +#define dZ_FRAME_LOW 10 +#define dZ_LINK 20 +#define dZ_XLINK 40 +#define dZ_FLOATIMG 70 +#define dZ_ICON 80 +#define dZ_TEXT 90 +#define dZ_DEPTH 100 +#define Z_SNOW 2000 +#define Z_INIT 9999 +#define Z_LINEEDIT 10000 + +class ConvexPolygon; + +#include "treeitem.h" + +/*! \brief Base class for all objects visible on a map + */ + +class MapObj : public XMLObj, public QGraphicsItem { + public: + MapObj(QGraphicsItem *parent = NULL, TreeItem *ti = NULL); + virtual ~MapObj(); + virtual void init(); + virtual void copy(MapObj *); + + virtual void setTreeItem(TreeItem *); + virtual TreeItem *getTreeItem() const; + + virtual qreal x(); + virtual qreal y(); + virtual qreal width(); + virtual qreal height(); + virtual QPointF getAbsPos(); + virtual QString getPos(); //! Return position as string (x,y) + virtual void move(double x, double y); //! move to absolute Position + virtual void move(QPointF p); + virtual void moveBy(double x, double y); //! move to relative Position + + virtual QRectF boundingRect() const; + virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + + virtual QRectF getBBox(); //! returns bounding box + virtual ConvexPolygon + getBoundingPolygon(); //! return bounding convex polygon + virtual QPolygonF getClickPoly(); //! returns polygon to click + virtual QPainterPath getSelectionPath(); //! returns path for selection + virtual bool isInClickBox(const QPointF &p); //! Checks if p is in clickBox + virtual QSizeF getSize(); //! returns size of bounding box + + virtual void setRotation(const qreal &a); + virtual qreal getRotation(); + virtual bool isVisibleObj(); + virtual void setVisibility(bool); + virtual void positionBBox(); + virtual void calcBBoxSize(); + + protected: + QRectF bbox; // bounding box of MO itself + QPolygonF clickPoly; // area where mouseclicks are found + QPointF absPos; // Position on canvas + bool visible; + + qreal angle; //! Rotation angle + + TreeItem *treeItem; //! Crossrefence to treemodel +}; + +#endif