hide export for floatimages.
1 #include "floatimageobj.h"
5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
9 uint FloatImageObj::saveCounter=0; // make instance
12 FloatImageObj::FloatImageObj ():FloatObj()
14 // cout << "Const FloatImageObj ()\n";
20 FloatImageObj::FloatImageObj (QCanvas* c):FloatObj(c)
22 // cout << "Const FloatImageObj (c) called from MapCenterObj (c)\n";
28 FloatImageObj::FloatImageObj (QCanvas* c, LinkableMapObj* p):FloatObj(c,p)
30 // cout << "Const FloatImageObj (c,p)\n";
34 FloatImageObj::~FloatImageObj ()
36 // cout << "Destr FloatImageObj "<<this<<"\n";
40 void FloatImageObj::init ()
42 icon=new ImageObj (canvas);
43 icon->move (absPos.x(), absPos.y() );
44 icon->setVisibility (true);
45 bbox.setSize (QSize(icon->size().width(), icon->size().height()));
46 clickBox.setSize (QSize(icon->size().width(), icon->size().height()));
48 originalFilename="no original name available";
54 void FloatImageObj::copy (FloatImageObj* other)
56 FloatObj::copy (other);
57 icon->copy (other->icon);
58 filetype=other->filetype;
59 filename=other->filename;
60 originalFilename=other->originalFilename;
61 saveInMap=other->saveInMap;
65 void FloatImageObj::setZ (const int &i)
71 int FloatImageObj::z ()
73 return qRound (icon->z());
76 void FloatImageObj::load (const QPixmap &pixmap)
79 bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
80 clickBox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
83 filename="noname.png";
86 bool FloatImageObj::load (const QString &fn)
90 bbox.setSize (QSize(icon->size().width()+8, icon->size().height()+8));
93 filetype=QPixmap::imageFormat (fn);
100 void FloatImageObj::save (const QString &fn, const char *format)
102 icon->save (fn,format);
105 void FloatImageObj::setOriginalFilename(const QString & fn)
110 QString FloatImageObj::getOriginalFilename()
112 return originalFilename;
115 void FloatImageObj::setVisibility(bool v)
117 LinkableMapObj::setVisibility(v);
119 icon->setVisibility(true);
121 icon->setVisibility(false);
124 void FloatImageObj::move (double x, double y)
127 icon->move (x+4,y+4);
131 void FloatImageObj::move (QPoint p)
136 void FloatImageObj::positionBBox()
141 void FloatImageObj::calcBBoxSize()
146 QString FloatImageObj::saveToDir (const QString &tmpdir,const QString &prefix, const QPoint &p)
150 QString useOrientAttr;
152 useOrientAttr=attribut ("useOrientation","true");
154 useOrientAttr=attribut ("useOrientation","false");
156 QString saveInMapAttr;
158 saveInMapAttr=attribut ("saveInMap","true");
161 saveInMapAttr=attribut ("saveInMap","false");
165 exportAttr=attribut ("floatExport","true");
167 exportAttr=attribut ("floatExport","false");
169 QString zAttr=attribut ("zPlane",QString().setNum(zPlane));
172 // prevent saving as GIF
176 url="images/"+prefix+"image-" + QString().number(saveCounter,10) + "." +filetype;
178 // And really save the image
179 icon->save (tmpdir + "/" + url, filetype);
181 return singleElement ("floatimage",
187 +attribut ("href",QString ("file:")+url)
191 void FloatImageObj::resetSaveCounter()
197 QRect FloatImageObj::getTotalBBox()
202 QRect FloatImageObj::getBBoxSizeWithChilds()
204 //FIXME abstract in linkablemapobj.h, not calculated
208 void FloatImageObj::calcBBoxSizeWithChilds()
210 //FIXME abstract in linkablemapobj.h
213 QString FloatImageObj::getSelectString()
218 if (parObj->getDepth()==0)
219 s= "fi:" + QString("%1").arg( ((BranchObj*)(parObj))->getFloatImageNum(this));
221 s= ((BranchObj*)(parObj))->getSelectString() + ",fi:" + QString("%1").arg( ((BranchObj*)(parObj))->getFloatImageNum(this));