5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
10 //qWarning ( "Const MapObj (): Please set scene somehow!!!");
15 MapObj::MapObj (QGraphicsScene *s, TreeItem *ti)
17 // cout << "Const MapObj\n";
24 MapObj::MapObj (MapObj* mo)
26 // cout << "CopyConst MapObj\n";
32 // cout << "Destr MapObj\n";
42 void MapObj::copy(MapObj* other)
44 // scene=other->scene; // already set in constr. of child, use that one...
46 bbox.setX (other->bbox.x() );
47 bbox.setY (other->bbox.y() );
48 bbox.setSize (QSizeF(other->bbox.width(), other->bbox.height() ) );
51 void MapObj::setTreeItem (TreeItem *ti)
56 TreeItem* MapObj::getTreeItem () const
62 QGraphicsScene* MapObj::getScene()
82 qreal MapObj::height()
87 QPointF MapObj::getAbsPos()
92 QString MapObj::getPos()
94 return qpointFToString(absPos);
97 void MapObj::move (double x, double y)
101 bbox.moveTo(QPointF(x,y));
102 clickBox.moveTo(QPointF(x,y));
105 void MapObj::move (QPointF p)
112 void MapObj::moveBy (double x, double y)
114 MapObj::move (x+absPos.x(),y+absPos.y() );
115 bbox.moveTo (bbox.x()+x,bbox.y()+y);
116 clickBox.moveTo (clickBox.x()+x,clickBox.y()+y);
119 QRectF MapObj::getBBox()
124 ConvexPolygon MapObj::getBoundingPolygon()
127 p<<bbox.topLeft()<<bbox.topRight()<<bbox.bottomRight()<<bbox.bottomLeft();
131 QRectF MapObj::getClickBox()
136 bool MapObj::isInClickBox (const QPointF &p)
138 return isInBox (p,clickBox);
141 QSizeF MapObj::getSize()
147 bool MapObj::isVisibleObj()
152 void MapObj::setVisibility(bool v)