5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
8 FlagObj::FlagObj(QGraphicsItem *parent):MapObj(parent)
10 // qDebug() << "Const FlagObj this="<<this<<" scene="<<s;
16 // qDebug() << "Destr FlagObj this="<<this <<" " <<name;
17 if (icon) delete (icon);
25 icon=new ImageObj (parentItem());
26 icon->setPos (absPos.x(), absPos.y() );
31 void FlagObj::copy (FlagObj* other)
37 icon->copy(other->icon);
38 setVisibility (other->isVisibleObj() );
41 void FlagObj::move(double x, double y)
48 void FlagObj::moveBy(double x, double y)
50 move (x+absPos.x(),y+absPos.y() );
53 void FlagObj::setZValue (double z)
58 void FlagObj::setVisibility (bool v)
60 MapObj::setVisibility(v);
62 icon->setVisibility(true);
64 icon->setVisibility(false);
67 void FlagObj::load (const QString &fn)
74 void FlagObj::load (const QPixmap &pm)
81 void FlagObj::setName(const QString &n)
86 const QString FlagObj::getName()
91 void FlagObj::setAlwaysVisible(bool b)
96 bool FlagObj::isAlwaysVisible()
101 bool FlagObj::isActive()
106 void FlagObj::toggle()
114 void FlagObj::activate()
117 // only show icon, if flag itself is visible
120 icon->setVisibility (true);
125 void FlagObj::deactivate()
128 // if flag itself is invisible we don't need to call
131 icon->setVisibility (false);
136 void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
138 QString fn=tmpdir + prefix + name + ".png";
139 icon->save (fn,"PNG");
142 void FlagObj::positionBBox()
144 bbox.moveTopLeft (absPos );
145 clickPoly=QPolygonF (bbox);
148 void FlagObj::calcBBoxSize()
150 if (visible && state)
151 bbox.setSize ( QSizeF(
152 icon->boundingRect().width(),
153 icon->boundingRect().height() ) );
155 bbox.setSize (QSizeF(0,0));
156 clickPoly= QPolygonF (bbox);