5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
10 // cout << "Const FlagObj ()\n";
14 FlagObj::FlagObj(Q3Canvas* c):MapObj(c)
16 // cout << "Const FlagObj canvas="<<c<<endl;
20 FlagObj::FlagObj (FlagObj* io)
27 // cout << "Destr FlagObj " << name << "\n";
28 if (icon) delete (icon);
37 icon=new ImageObj (canvas);
38 icon->move (absPos.x(), absPos.y() );
43 void FlagObj::copy (FlagObj* other)
48 tooltip=other->tooltip;
50 icon->copy(other->icon);
52 setVisibility (other->isVisibleObj() );
55 void FlagObj::move(double x, double y)
62 void FlagObj::moveBy(double x, double y)
64 move (x+absPos.x(),y+absPos.y() );
67 void FlagObj::setVisibility (bool v)
69 MapObj::setVisibility(v);
71 icon->setVisibility(true);
73 icon->setVisibility(false);
76 void FlagObj::load (const QString &fn)
83 void FlagObj::load (const QPixmap &pm)
90 void FlagObj::setName(const QString &n)
95 const QString FlagObj::getName()
100 void FlagObj::setGroup (const QString &n)
105 const QString FlagObj::getGroup()
110 void FlagObj::setToolTip(const QString &n)
115 const QString FlagObj::getToolTip()
120 QPixmap FlagObj::getPixmap()
122 return icon->getPixmap();
125 void FlagObj::setAction (QAction* a)
130 void FlagObj::updateAction ()
132 if (action) action->setChecked(state);
135 bool FlagObj::isActive()
140 void FlagObj::toggle()
148 void FlagObj::activate()
151 // only show icon, if flag itself is visible
154 icon->setVisibility (true);
159 void FlagObj::deactivate()
162 // if flag itself is invisible we don't need to call
165 icon->setVisibility (false);
170 void FlagObj::setUsed (bool b)
175 bool FlagObj::isUsed()
180 void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
182 QString fn=tmpdir + prefix + name + ".png";
183 icon->save (fn,"PNG");
186 void FlagObj::positionBBox()
188 bbox.moveTopLeft (absPos );
189 clickBox.moveTopLeft (absPos );
192 void FlagObj::calcBBoxSize()
194 if (visible && state)
196 bbox.setSize ( QSize(
197 icon->boundingRect().width(),
198 icon->boundingRect().height() ) );
201 bbox.setSize (QSize(0,0));
203 clickBox.setSize (bbox.size());