mapobj.h
author insilmaril
Thu, 03 Sep 2009 08:52:00 +0000
changeset 790 133e2ed6b9c5
parent 772 e3f722759c7e
child 792 7d67be709091
permissions -rw-r--r--
More work on xLinks
     1 #ifndef MAPOBJ_H
     2 #define MAPOBJ_H
     3 
     4 #include <QGraphicsScene>
     5 #include <QGraphicsItem>
     6 
     7 #include "xmlobj.h"
     8 
     9 #define Z_BBOX       0
    10 #define Z_XLINK     10
    11 #define Z_LINK      20
    12 #define Z_FRAME     50
    13 #define Z_SELBOX    60
    14 #define Z_FLOATIMG  65
    15 #define Z_ICON      80
    16 #define Z_TEXT     100
    17 #define Z_LINEEDIT 110
    18 
    19 
    20 class TreeItem;
    21 
    22 /*! \brief Base class for all objects visible on a map
    23 */
    24 
    25 class MapObj:public XMLObj {
    26 public:
    27     MapObj ();
    28     MapObj (QGraphicsScene *scene,TreeItem *ti=NULL);
    29     MapObj (MapObj*);
    30     virtual ~MapObj ();
    31     virtual void init ();
    32     virtual void copy (MapObj*);
    33 
    34 	virtual void setTreeItem(TreeItem *);
    35 	virtual TreeItem* getTreeItem() const;
    36 
    37 	virtual QGraphicsScene* getScene();
    38     virtual qreal x();
    39     virtual qreal y();
    40 	virtual qreal width();
    41 	virtual qreal height();
    42 	virtual QPointF getAbsPos();
    43 	virtual QString getPos();					// Return position as string (x,y)
    44     virtual void move (double x,double y);      // move to absolute Position
    45     virtual void move (QPointF p);
    46     virtual void moveBy (double x,double y);    // move to relative Position
    47     virtual QRectF getBBox();					// returns bounding box
    48     virtual QRectF getClickBox();				// returns box to click
    49 	virtual bool isInClickBox (const QPointF &p);	//! Checks if p is in clickBox
    50     virtual QSizeF getSize();					// returns size of bounding box
    51     virtual bool isVisibleObj();
    52     virtual void setVisibility(bool);
    53     virtual void positionBBox()=0;       
    54 	virtual void calcBBoxSize()=0;
    55 protected:  
    56     QGraphicsScene* scene;
    57     QRectF bbox;									// bounding box of MO itself
    58 	QRectF clickBox;								// area where mouseclicks are found
    59     QPointF absPos;							    // Position on canvas
    60     bool visible;
    61 
    62 	TreeItem *treeItem;				// Crossrefence to treemodel
    63 
    64 };
    65 
    66 #endif