mapobj.h
author insilmaril
Tue Jul 17 11:20:20 2007 +0000 (2007-07-17)
changeset 554 34520279e086
parent 408 c2a05fa925a1
child 616 16d63fc9ae42
permissions -rw-r--r--
1.9.2 Bugfixes for exports
     1 #ifndef MAPOBJ_H
     2 #define MAPOBJ_H
     3 
     4 #include <QGraphicsScene>
     5 #include <QGraphicsItem>
     6 #include <iostream>
     7 
     8 #include "misc.h"
     9 
    10 using namespace std;
    11 
    12 #define Z_BBOX      0
    13 #define Z_XLINK    10
    14 #define Z_LINK     20
    15 #define Z_FRAME    50
    16 #define Z_SELBOX   60
    17 #define Z_FLOATIMG 65
    18 #define Z_ICON     80
    19 #define Z_TEXT    100
    20 
    21 /*! \brief Base class for all objects visible on a map
    22 */
    23 
    24 class MapObj:public xmlObj {
    25 public:
    26     MapObj ();
    27     MapObj (QGraphicsScene*);
    28     MapObj (MapObj*);
    29     virtual ~MapObj ();
    30     virtual void init ();
    31     virtual void copy (MapObj*);
    32 	virtual QGraphicsScene* getScene();
    33     virtual qreal x();
    34     virtual qreal y();
    35 	virtual qreal width();
    36 	virtual qreal height();
    37 	virtual QPointF getAbsPos();
    38 	virtual QString getPos();					// Return position as string (x,y)
    39     virtual void move (double x,double y);      // move to absolute Position
    40     virtual void move (QPointF p);
    41     virtual void moveBy (double x,double y);    // move to relative Position
    42     virtual bool inBox(const QPointF&);			// Check if Point is within clickbox
    43     virtual QRectF getBBox();					// returns bounding box
    44     virtual QRectF addBBox(QRectF,QRectF);			// returns bbox which includes both boxes
    45     virtual QSizeF getSize();					// returns size of bounding box
    46     virtual bool isVisibleObj();
    47     virtual void setVisibility(bool);
    48     virtual void positionBBox()=0;       
    49 	virtual void calcBBoxSize()=0;
    50 	virtual void animate();						// called by timer for animated objects
    51 protected:  
    52     QGraphicsScene* scene;
    53     QRectF bbox;									// bounding box of MO itself
    54 	QRectF clickBox;								// area where mouseclicks are found
    55     QPointF absPos;							    // Position on canvas
    56     bool visible;
    57 };
    58 
    59 #endif