mapobj.h
author insilmaril
Tue Jul 07 09:34:24 2009 +0000 (2009-07-07)
changeset 779 1fb50e79661c
parent 754 db0ec4bcf416
child 790 133e2ed6b9c5
permissions -rw-r--r--
Hiding of links works again
     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 /*! \brief Base class for all objects visible on a map
    20 */
    21 
    22 class MapObj:public XMLObj {
    23 public:
    24     MapObj ();
    25     MapObj (QGraphicsScene*);
    26     MapObj (MapObj*);
    27     virtual ~MapObj ();
    28     virtual void init ();
    29     virtual void copy (MapObj*);
    30 	virtual QGraphicsScene* getScene();
    31     virtual qreal x();
    32     virtual qreal y();
    33 	virtual qreal width();
    34 	virtual qreal height();
    35 	virtual QPointF getAbsPos();
    36 	virtual QString getPos();					// Return position as string (x,y)
    37     virtual void move (double x,double y);      // move to absolute Position
    38     virtual void move (QPointF p);
    39     virtual void moveBy (double x,double y);    // move to relative Position
    40     virtual QRectF getBBox();					// returns bounding box
    41     virtual QRectF getClickBox();				// returns box to click
    42 	virtual bool isInClickBox (const QPointF &p);	//! Checks if p is in clickBox
    43     virtual QSizeF getSize();					// returns size of bounding box
    44     virtual bool isVisibleObj();
    45     virtual void setVisibility(bool);
    46     virtual void positionBBox()=0;       
    47 	virtual void calcBBoxSize()=0;
    48 protected:  
    49     QGraphicsScene* scene;
    50     QRectF bbox;									// bounding box of MO itself
    51 	QRectF clickBox;								// area where mouseclicks are found
    52     QPointF absPos;							    // Position on canvas
    53     bool visible;
    54 };
    55 
    56 #endif