5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
8 FrameObj::FrameObj() : MapObj()
10 // cout << "Const FrameObj ()\n";
14 FrameObj::FrameObj(QGraphicsScene *s) :MapObj(s)
16 // cout << "Const FrameObj\n";
30 penColor=QColor (Qt::black);
31 brushColor=QColor (Qt::white);
34 void FrameObj::clear()
51 void FrameObj::move(double x, double y)
58 rectFrame->setPos (x,y);
61 ellipseFrame->setPos (x,y);
66 void FrameObj::moveBy(double x, double y)
71 void FrameObj::positionBBox()
75 void FrameObj::calcBBoxSize()
79 void FrameObj::setRect(const QRectF &r)
87 // rectFrame->prepareGeometryChange();
88 rectFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
91 // ellipseFrame->prepareGeometryChange();
92 ellipseFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
97 void FrameObj::setPadding (const int &i)
103 int FrameObj::getPadding()
111 void FrameObj::setBorderWidth (const int &i)
117 int FrameObj::getBorderWidth()
122 FrameObj::FrameType FrameObj::getFrameType()
127 QString FrameObj::getFrameTypeName()
142 void FrameObj::setFrameType(const FrameType &t)
153 rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(penColor), brushColor);
154 rectFrame->setZValue(Z_FRAME);
158 ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(penColor), brushColor);
159 ellipseFrame->setZValue(Z_FRAME);
160 ellipseFrame->show();
164 setVisibility (visible);
167 void FrameObj::setFrameType(const QString &t)
170 FrameObj::setFrameType (Rectangle);
171 else if (t=="Ellipse")
172 FrameObj::setFrameType (Ellipse);
174 FrameObj::setFrameType (NoFrame);
177 void FrameObj::setPenColor (QColor col)
183 QColor FrameObj::getPenColor ()
188 void FrameObj::setBrushColor (QColor col)
194 QColor FrameObj::getBrushColor ()
199 void FrameObj::repaint()
202 pen.setColor (penColor);
203 pen.setWidth (borderWidth);
204 QBrush brush (brushColor);
208 rectFrame->setPen (pen);
209 rectFrame->setBrush (brush);
212 ellipseFrame->setPen (pen);
213 ellipseFrame->setBrush (brush);
221 void FrameObj::setVisibility (bool v)
223 MapObj::setVisibility(v);
236 ellipseFrame->show();
238 ellipseFrame->hide();
243 QString FrameObj::saveToDir ()
245 if (type==NoFrame) return QString();
246 QString frameTypeAttr=attribut ("frameType",getFrameTypeName());
247 QString penColAttr=attribut ("penColor",penColor.name() );
248 QString brushColAttr=attribut ("brushColor",brushColor.name() );
249 QString paddingAttr=attribut ("padding",QString::number (padding) );
250 QString borderWidthAttr=attribut ("borderWidth",QString::number (borderWidth) );
251 return singleElement (
252 "frame",frameTypeAttr +