author | insilmaril |
Wed Apr 25 16:02:54 2007 +0000 (2007-04-25) | |
changeset 466 | dd1d5832086b |
parent 366 | e95081c21da2 |
child 474 | d9add21ee9d3 |
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 |
#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@0 | 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 bool inBox(const QPointF&); // Check if Point is within clickbox |
insilmaril@408 | 40 |
virtual QRectF getBBox(); // returns bounding box |
insilmaril@408 | 41 |
virtual QRectF addBBox(QRectF,QRectF); // returns bbox which includes both boxes |
insilmaril@408 | 42 |
virtual QSizeF getSize(); // returns size of bounding box |
insilmaril@0 | 43 |
virtual bool isVisibleObj(); |
insilmaril@0 | 44 |
virtual void setVisibility(bool); |
insilmaril@175 | 45 |
virtual void positionBBox()=0; |
insilmaril@175 | 46 |
virtual void calcBBoxSize()=0; |
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 |