2 #include <QImageReader>
5 #include "floatimageobj.h"
7 /////////////////////////////////////////////////////////////////
9 /////////////////////////////////////////////////////////////////
11 FloatImageObj::FloatImageObj(QGraphicsItem *parent, TreeItem *ti)
12 : FloatObj(parent, ti)
14 // qDebug() << "Const FloatImageObj this=" << this << " ti=" << ti;
15 imageObj = new ImageObj(parent);
16 imageObj->setPos(absPos.x(), absPos.y());
17 imageObj->setVisibility(true);
21 // setLinkStyle (LinkableMapObj::Parabel);
24 FloatImageObj::~FloatImageObj()
26 // qDebug() << "Destr FloatImageObj "<<this<<"";
30 void FloatImageObj::copy(FloatImageObj *other)
32 FloatObj::copy(other);
33 imageObj->copy(other->imageObj);
37 void FloatImageObj::setZValue(const int &i)
40 // qDebug()<<"FIO::setZValue z="<<i;
41 // qDebug()<<" imageObj="<<imageObj;
42 // qDebug()<<" this="<<this;
43 imageObj->setZValue(i);
46 int FloatImageObj::z() { return qRound(imageObj->zValue()); }
48 bool FloatImageObj::load(const QString &fname)
50 if (!imageObj->load(fname))
53 bbox.setSize(QSizeF(imageObj->boundingRect().width(),
54 imageObj->boundingRect().height()));
61 bool FloatImageObj::save(const QString &fname) { return imageObj->save(fname); }
63 QString FloatImageObj::getExtension() { return imageObj->getExtension(); }
65 void FloatImageObj::setParObj(QGraphicsItem *p)
68 imageObj->setParentItem(p);
69 parObj = (LinkableMapObj *)p;
71 qDebug()<<"FIO::setParentItem";
72 qDebug()<<" this = "<<this;
73 qDebug()<<" imageObj=" << imageObj;
77 void FloatImageObj::setVisibility(bool v)
79 OrnamentedObj::setVisibility(v);
81 imageObj->setVisibility(true);
83 imageObj->setVisibility(false);
86 void FloatImageObj::setScaleFactor(qreal f)
88 imageObj->setScaleFactor(f);
89 bbox.setSize(QSizeF(imageObj->boundingRect().width(),
90 imageObj->boundingRect().height()));
94 qreal FloatImageObj::getScaleFactor() { return imageObj->getScaleFactor(); }
96 qreal FloatImageObj::width()
98 return imageObj->boundingRect().width();
101 qreal FloatImageObj::height()
103 return imageObj->boundingRect().height();
106 void FloatImageObj::moveCenter(double x, double y)
108 FloatObj::moveCenter(x, y);
109 imageObj->setPos(bbox.topLeft());
112 void FloatImageObj::move(double x, double y)
114 FloatObj::move(x, y);
115 imageObj->setPos(x, y);
119 void FloatImageObj::move(QPointF p) { FloatImageObj::move(p.x(), p.y()); }
121 void FloatImageObj::positionBBox() { clickPoly = QPolygonF(bbox); }
123 void FloatImageObj::calcBBoxSize()
128 QRectF FloatImageObj::getBBoxSizeWithChildren()
130 // TODO abstract in linkablemapobj.h, not calculated
134 void FloatImageObj::calcBBoxSizeWithChildren()
136 // TODO abstract in linkablemapobj.h