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 /* FIXME testing QT4 only
108 cout << "MO::inBox "<<p<<" "<<
109 clickBox.left()<<","<<
110 clickBox.right()<<","<<
111 clickBox.top()<<","<<
112 clickBox.bottom()<<endl;
114 if (p.x() >= clickBox.left() && p.x() <= clickBox.right()
115 && p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
120 QRectF MapObj::getBBox()
125 QRectF MapObj::addBBox(QRectF r1, QRectF r2)
127 // Find smallest QRectF containing given rectangles
131 if (r1.left() <= r2.left() )
132 n.setLeft(r1.left() );
134 n.setLeft(r2.left() );
137 if (r1.top() <= r2.top() )
143 if (r1.right() <= r2.right() )
144 n.setRight(r2.right() );
146 n.setRight(r1.right() );
149 if (r1.bottom() <= r2.bottom() )
150 n.setBottom(r2.bottom() );
152 n.setBottom(r1.bottom() );
156 QSizeF MapObj::getSize()
162 bool MapObj::isVisibleObj()
167 void MapObj::setVisibility(bool v)