More documentation, fixed small bug where links of unselected objects where visible again
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 QPoint MapObj::getAbsPos()
78 QString MapObj::getPos()
80 return qpointToString(absPos);
83 void MapObj::move (double x, double y)
85 int xi=static_cast <int> (x);
86 int yi=static_cast <int> (y);
89 bbox.moveTopLeft(QPoint(xi,yi));
90 clickBox.moveTopLeft(QPoint(xi,yi));
93 void MapObj::moveBy (double x, double y)
97 move (x+absPos.x(),y+absPos.y() );
99 clickBox.moveBy (ix,iy);
102 bool MapObj::inBox(const QPoint &p)
104 if (p.x() >= clickBox.left() && p.x() <= clickBox.right()
105 && p.y() <= clickBox.bottom() && p.y() >= clickBox.top() )
110 QRect MapObj::getBBox()
115 QRect MapObj::addBBox(QRect r1, QRect r2)
117 // Find smallest QRect containing given rectangles
121 if (r1.left() <= r2.left() )
122 n.setLeft(r1.left() );
124 n.setLeft(r2.left() );
127 if (r1.top() <= r2.top() )
133 if (r1.right() <= r2.right() )
134 n.setRight(r2.right() );
136 n.setRight(r1.right() );
139 if (r1.bottom() <= r2.bottom() )
140 n.setBottom(r2.bottom() );
142 n.setBottom(r1.bottom() );
146 QSize MapObj::getSize()
152 bool MapObj::isVisibleObj()
157 void MapObj::setVisibility(bool v)