mapobj.h
author insilmaril
Thu Dec 14 17:01:44 2006 +0000 (2006-12-14)
changeset 411 910ba9fab728
parent 366 e95081c21da2
child 474 d9add21ee9d3
permissions -rw-r--r--
1.8.61 various fixes, see changelog
     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 class MapObj:public xmlObj {
    22 public:
    23     MapObj ();
    24     MapObj (QGraphicsScene*);
    25     MapObj (MapObj*);
    26     virtual ~MapObj ();
    27     virtual void init ();
    28     virtual void copy (MapObj*);
    29 	virtual QGraphicsScene* getScene();
    30     virtual qreal x();
    31     virtual qreal y();
    32 	virtual qreal width();
    33 	virtual qreal height();
    34 	virtual QPointF getAbsPos();
    35 	virtual QString getPos();					// Return position as string (x,y)
    36     virtual void move (double x,double y);      // move to absolute Position
    37     virtual void move (QPointF p);
    38     virtual void moveBy (double x,double y);    // move to relative Position
    39     virtual bool inBox(const QPointF&);			// Check if Point is within clickbox
    40     virtual QRectF getBBox();					// returns bounding box
    41     virtual QRectF addBBox(QRectF,QRectF);			// returns bbox which includes both boxes
    42     virtual QSizeF getSize();					// returns size of bounding box
    43     virtual bool isVisibleObj();
    44     virtual void setVisibility(bool);
    45     virtual void positionBBox()=0;       
    46 	virtual void calcBBoxSize()=0;
    47 protected:  
    48     QGraphicsScene* scene;
    49     QRectF bbox;									// bounding box of MO itself
    50 	QRectF clickBox;								// area where mouseclicks are found
    51     QPointF absPos;							    // Position on canvas
    52     bool visible;
    53 };
    54 
    55 #endif