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