7 /////////////////////////////////////////////////////////////////
9 /////////////////////////////////////////////////////////////////
10 MapObj::MapObj (QGraphicsItem *parent, TreeItem *ti):QGraphicsItem (parent)
12 //qDebug() << "Const MapObj (this,ti)=("<<this<<","<<ti<<")";
19 //qDebug() << "Destr MapObj "<<this;
20 foreach (QGraphicsItem *i,childItems() )
21 // Avoid tha QGraphicsScene deletes children
22 i->setParentItem (NULL);
32 void MapObj::copy(MapObj* other)
35 bbox.setX (other->bbox.x() );
36 bbox.setY (other->bbox.y() );
37 bbox.setSize (QSizeF(other->bbox.width(), other->bbox.height() ) );
40 void MapObj::setTreeItem (TreeItem *ti)
45 TreeItem* MapObj::getTreeItem () const
52 return getAbsPos().x();
57 return getAbsPos().y();
65 qreal MapObj::height()
70 QPointF MapObj::getAbsPos()
75 QString MapObj::getPos()
77 return qpointFToString(absPos);
80 void MapObj::move (double x, double y)
82 MapObj::move (QPointF(x,y));
85 void MapObj::move (QPointF p)
89 clickPoly=QPolygonF (bbox);
92 void MapObj::moveBy (double x, double y)
95 MapObj::move (absPos + v );
96 bbox.moveTo (bbox.topLeft() + v);
97 clickPoly.translate (v);
100 QRectF MapObj::boundingRect () const
105 void MapObj::paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
109 QRectF MapObj::getBBox()
114 ConvexPolygon MapObj::getBoundingPolygon()
117 p<<bbox.topLeft()<<bbox.topRight()<<bbox.bottomRight()<<bbox.bottomLeft();
121 QPolygonF MapObj::getClickPoly()
126 QPainterPath MapObj::getClickPath()
129 QRectF br=clickPoly.boundingRect();
130 p.moveTo (br.topLeft() );
131 p.lineTo (br.topRight() );
132 p.lineTo (br.bottomRight() );
133 p.lineTo (br.bottomLeft() );
134 p.lineTo (br.topLeft() );
138 bool MapObj::isInClickBox (const QPointF &p)
140 return clickPoly.containsPoint (p,Qt::OddEvenFill);
143 QSizeF MapObj::getSize()
149 void MapObj::setRotation (const qreal &a)
154 qreal MapObj::getRotation ()
159 bool MapObj::isVisibleObj()
164 void MapObj::setVisibility(bool v)
169 void MapObj::positionBBox() {}
170 void MapObj::calcBBoxSize() {}