mapobj.h
author insilmaril
Mon Jul 27 12:53:17 2009 +0000 (2009-07-27)
changeset 783 85dec6a8c12c
parent 754 db0ec4bcf416
child 790 133e2ed6b9c5
permissions -rw-r--r--
Playing with dbus, fixed name of TW translation file
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
insilmaril@616
     7
#include "xmlobj.h"
insilmaril@0
     8
insilmaril@772
     9
#define Z_BBOX       0
insilmaril@772
    10
#define Z_XLINK     10
insilmaril@772
    11
#define Z_LINK      20
insilmaril@772
    12
#define Z_FRAME     50
insilmaril@772
    13
#define Z_SELBOX    60
insilmaril@772
    14
#define Z_FLOATIMG  65
insilmaril@772
    15
#define Z_ICON      80
insilmaril@772
    16
#define Z_TEXT     100
insilmaril@772
    17
#define Z_LINEEDIT 110
insilmaril@0
    18
insilmaril@474
    19
/*! \brief Base class for all objects visible on a map
insilmaril@474
    20
*/
insilmaril@474
    21
insilmaril@616
    22
class MapObj:public XMLObj {
insilmaril@0
    23
public:
insilmaril@0
    24
    MapObj ();
insilmaril@408
    25
    MapObj (QGraphicsScene*);
insilmaril@0
    26
    MapObj (MapObj*);
insilmaril@0
    27
    virtual ~MapObj ();
insilmaril@0
    28
    virtual void init ();
insilmaril@0
    29
    virtual void copy (MapObj*);
insilmaril@408
    30
	virtual QGraphicsScene* getScene();
insilmaril@408
    31
    virtual qreal x();
insilmaril@408
    32
    virtual qreal y();
insilmaril@408
    33
	virtual qreal width();
insilmaril@408
    34
	virtual qreal height();
insilmaril@408
    35
	virtual QPointF getAbsPos();
insilmaril@129
    36
	virtual QString getPos();					// Return position as string (x,y)
insilmaril@0
    37
    virtual void move (double x,double y);      // move to absolute Position
insilmaril@408
    38
    virtual void move (QPointF p);
insilmaril@0
    39
    virtual void moveBy (double x,double y);    // move to relative Position
insilmaril@408
    40
    virtual QRectF getBBox();					// returns bounding box
insilmaril@645
    41
    virtual QRectF getClickBox();				// returns box to click
insilmaril@754
    42
	virtual bool isInClickBox (const QPointF &p);	//! Checks if p is in clickBox
insilmaril@408
    43
    virtual QSizeF getSize();					// returns size of bounding box
insilmaril@0
    44
    virtual bool isVisibleObj();
insilmaril@0
    45
    virtual void setVisibility(bool);
insilmaril@175
    46
    virtual void positionBBox()=0;       
insilmaril@175
    47
	virtual void calcBBoxSize()=0;
insilmaril@0
    48
protected:  
insilmaril@408
    49
    QGraphicsScene* scene;
insilmaril@408
    50
    QRectF bbox;									// bounding box of MO itself
insilmaril@408
    51
	QRectF clickBox;								// area where mouseclicks are found
insilmaril@408
    52
    QPointF absPos;							    // Position on canvas
insilmaril@0
    53
    bool visible;
insilmaril@0
    54
};
insilmaril@0
    55
insilmaril@0
    56
#endif