mapobj.h
author insilmaril
Fri Oct 02 13:24:55 2009 +0000 (2009-10-02)
changeset 802 f076fdec767d
parent 792 7d67be709091
permissions -rw-r--r--
More fixes for using proxy
     1 #ifndef MAPOBJ_H
     2 #define MAPOBJ_H
     3 
     4 #include <QGraphicsScene>
     5 #include <QGraphicsItem>
     6 
     7 #include "xmlobj.h"
     8 
     9 #define Z_BBOX       0
    10 #define Z_XLINK     10
    11 #define Z_LINK      20
    12 #define Z_FRAME     50
    13 #define Z_SELBOX    60
    14 #define Z_FLOATIMG  65
    15 #define Z_ICON      80
    16 #define Z_TEXT     100
    17 #define Z_LINEEDIT 110
    18 
    19 class ConvexPolygon;
    20 
    21 class TreeItem;
    22 
    23 /*! \brief Base class for all objects visible on a map
    24 */
    25 
    26 class MapObj:public XMLObj {
    27 public:
    28     MapObj ();
    29     MapObj (QGraphicsScene *scene,TreeItem *ti=NULL);
    30     MapObj (MapObj*);
    31     virtual ~MapObj ();
    32     virtual void init ();
    33     virtual void copy (MapObj*);
    34 
    35 	virtual void setTreeItem(TreeItem *);
    36 	virtual TreeItem* getTreeItem() const;
    37 
    38 	virtual QGraphicsScene* getScene();
    39     virtual qreal x();
    40     virtual qreal y();
    41 	virtual qreal width();
    42 	virtual qreal height();
    43 	virtual QPointF getAbsPos();
    44 	virtual QString getPos();					//! Return position as string (x,y)
    45     virtual void move (double x,double y);      //! move to absolute Position
    46     virtual void move (QPointF p);
    47     virtual void moveBy (double x,double y);    //! move to relative Position
    48     virtual QRectF getBBox();					//! returns bounding box
    49     virtual ConvexPolygon getBoundingPolygon();	//! return bounding convex polygon
    50     virtual QRectF getClickBox();				//! returns box to click
    51 	virtual bool isInClickBox (const QPointF &p);	//! Checks if p is in clickBox
    52     virtual QSizeF getSize();					//! returns size of bounding box
    53     virtual bool isVisibleObj();
    54     virtual void setVisibility(bool);
    55     virtual void positionBBox()=0;       
    56 	virtual void calcBBoxSize()=0;
    57 protected:  
    58     QGraphicsScene* scene;
    59     QRectF bbox;					// bounding box of MO itself
    60 	QRectF clickBox;				// area where mouseclicks are found
    61     QPointF absPos;				    // Position on canvas
    62     bool visible;
    63 
    64 	TreeItem *treeItem;				//! Crossrefence to treemodel
    65 
    66 	QGraphicsPolygonItem *pi;	//FIXME-3 testing only
    67 };
    68 
    69 #endif