4 /////////////////////////////////////////////////////////////////
6 /////////////////////////////////////////////////////////////////
9 //qWarning ( "Const MapObj (): Please set canvas somehow!!!");
14 MapObj::MapObj (QCanvas* c)
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 // canvas=other->canvas; // already set in constr. of child, use that one...
43 bbox.setX (other->bbox.x() );
44 bbox.setY (other->bbox.y() );
45 bbox.setSize (QSize(other->bbox.width(), other->bbox.height() ) );
48 QCanvas* MapObj::getCanvas()
73 QString MapObj::getPos()
75 return qpointToString(absPos);
78 void MapObj::move (double x, double y)
80 int xi=static_cast <int> (x);
81 int yi=static_cast <int> (y);
84 bbox.moveTopLeft(QPoint(xi,yi));
87 void MapObj::moveBy (double x, double y)
89 move (x+absPos.x(),y+absPos.y() );
92 bool MapObj::inBBox(QPoint p)
94 if (p.x() >= bbox.left() && p.x() <= bbox.right()
95 && p.y() <= bbox.bottom() && p.y() >= bbox.top() )
100 QRect MapObj::getBBox()
105 QRect MapObj::addBBox(QRect r1, QRect r2)
109 if (r1.left() <= r2.left() )
110 n.setLeft(r1.left() );
112 n.setLeft(r2.left() );
115 if (r1.top() <= r2.top() )
121 if (r1.right() <= r2.right() )
122 n.setRight(r2.right() );
124 n.setRight(r1.right() );
127 if (r1.bottom() <= r2.bottom() )
128 n.setBottom(r2.bottom() );
130 n.setBottom(r1.bottom() );
134 QSize MapObj::getSize()
140 bool MapObj::isVisibleObj()
145 void MapObj::setVisibility(bool v)