4 /////////////////////////////////////////////////////////////////
6 /////////////////////////////////////////////////////////////////
9 //qWarning ( "Const MapObj (): Please set scene somehow!!!");
14 MapObj::MapObj (QGraphicsScene *s)
16 // cout << "Const MapObj\n";
22 MapObj::MapObj (MapObj* mo)
24 // cout << "CopyConst MapObj\n";
30 // cout << "Destr MapObj\n";
39 void MapObj::copy(MapObj* other)
41 // scene=other->scene; // already set in constr. of child, use that one...
43 bbox.setX (other->bbox.x() );
44 bbox.setY (other->bbox.y() );
45 bbox.setSize (QSizeF(other->bbox.width(), other->bbox.height() ) );
48 QGraphicsScene* MapObj::getScene()
68 qreal MapObj::height()
73 QPointF MapObj::getAbsPos()
78 QString MapObj::getPos()
80 return qpointfToString(absPos);
83 void MapObj::move (double x, double y)
87 bbox.moveTo(QPointF(x,y));
88 clickBox.moveTo(QPointF(x,y));
91 void MapObj::move (QPointF p)
98 void MapObj::moveBy (double x, double y)
100 MapObj::move (x+absPos.x(),y+absPos.y() );
101 bbox.moveTo (bbox.x()+x,bbox.y()+y);
102 clickBox.moveTo (clickBox.x()+x,clickBox.y()+y);
105 bool MapObj::inBox(const QPointF &p)
107 if (p.x() >= clickBox.left() && p.x() <= clickBox.right()
108 && p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
113 QRectF MapObj::getBBox()
118 QRectF MapObj::addBBox(QRectF r1, QRectF r2)
120 // Find smallest QRectF containing given rectangles
124 if (r1.left() <= r2.left() )
125 n.setLeft(r1.left() );
127 n.setLeft(r2.left() );
130 if (r1.top() <= r2.top() )
136 if (r1.right() <= r2.right() )
137 n.setRight(r2.right() );
139 n.setRight(r1.right() );
142 if (r1.bottom() <= r2.bottom() )
143 n.setBottom(r2.bottom() );
145 n.setBottom(r1.bottom() );
149 QSizeF MapObj::getSize()
155 bool MapObj::isVisibleObj()
160 void MapObj::setVisibility(bool v)
165 void MapObj::animate()