author | insilmaril |
Wed Feb 27 16:09:06 2008 +0000 (2008-02-27) | |
changeset 675 | e524edc45aff |
parent 616 | 16d63fc9ae42 |
child 692 | c5e3cb54b9db |
permissions | -rw-r--r-- |
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@315 | 9 |
#define Z_BBOX 0 |
insilmaril@315 | 10 |
#define Z_XLINK 10 |
insilmaril@315 | 11 |
#define Z_LINK 20 |
insilmaril@315 | 12 |
#define Z_FRAME 50 |
insilmaril@315 | 13 |
#define Z_SELBOX 60 |
insilmaril@315 | 14 |
#define Z_FLOATIMG 65 |
insilmaril@315 | 15 |
#define Z_ICON 80 |
insilmaril@315 | 16 |
#define Z_TEXT 100 |
insilmaril@0 | 17 |
|
insilmaril@474 | 18 |
/*! \brief Base class for all objects visible on a map |
insilmaril@474 | 19 |
*/ |
insilmaril@474 | 20 |
|
insilmaril@616 | 21 |
class MapObj:public XMLObj { |
insilmaril@0 | 22 |
public: |
insilmaril@0 | 23 |
MapObj (); |
insilmaril@408 | 24 |
MapObj (QGraphicsScene*); |
insilmaril@0 | 25 |
MapObj (MapObj*); |
insilmaril@0 | 26 |
virtual ~MapObj (); |
insilmaril@0 | 27 |
virtual void init (); |
insilmaril@0 | 28 |
virtual void copy (MapObj*); |
insilmaril@408 | 29 |
virtual QGraphicsScene* getScene(); |
insilmaril@408 | 30 |
virtual qreal x(); |
insilmaril@408 | 31 |
virtual qreal y(); |
insilmaril@408 | 32 |
virtual qreal width(); |
insilmaril@408 | 33 |
virtual qreal height(); |
insilmaril@408 | 34 |
virtual QPointF getAbsPos(); |
insilmaril@129 | 35 |
virtual QString getPos(); // Return position as string (x,y) |
insilmaril@0 | 36 |
virtual void move (double x,double y); // move to absolute Position |
insilmaril@408 | 37 |
virtual void move (QPointF p); |
insilmaril@0 | 38 |
virtual void moveBy (double x,double y); // move to relative Position |
insilmaril@408 | 39 |
virtual QRectF getBBox(); // returns bounding box |
insilmaril@645 | 40 |
virtual QRectF getClickBox(); // returns box to click |
insilmaril@408 | 41 |
virtual QSizeF getSize(); // returns size of bounding box |
insilmaril@0 | 42 |
virtual bool isVisibleObj(); |
insilmaril@0 | 43 |
virtual void setVisibility(bool); |
insilmaril@175 | 44 |
virtual void positionBBox()=0; |
insilmaril@175 | 45 |
virtual void calcBBoxSize()=0; |
insilmaril@474 | 46 |
virtual void animate(); // called by timer for animated objects |
insilmaril@0 | 47 |
protected: |
insilmaril@408 | 48 |
QGraphicsScene* scene; |
insilmaril@408 | 49 |
QRectF bbox; // bounding box of MO itself |
insilmaril@408 | 50 |
QRectF clickBox; // area where mouseclicks are found |
insilmaril@408 | 51 |
QPointF absPos; // Position on canvas |
insilmaril@0 | 52 |
bool visible; |
insilmaril@0 | 53 |
}; |
insilmaril@0 | 54 |
|
insilmaril@0 | 55 |
#endif |