5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
8 FrameObj::FrameObj() : MapObj()
10 // cout << "Const FrameObj ()\n";
14 FrameObj::FrameObj(QGraphicsScene *s) :MapObj(s)
16 // cout << "Const FrameObj\n";
29 penColor=QColor (Qt::black);
30 brushColor=QColor (Qt::white);
33 void FrameObj::clear()
50 void FrameObj::move(double x, double y)
57 rectFrame->setPos (x,y);
60 ellipseFrame->setPos (x,y);
65 void FrameObj::moveBy(double x, double y)
70 void FrameObj::positionBBox()
74 void FrameObj::calcBBoxSize()
78 void FrameObj::setRect(const QRectF &r)
86 // rectFrame->prepareGeometryChange();
87 rectFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
90 // ellipseFrame->prepareGeometryChange();
91 ellipseFrame->setRect (QRectF(bbox.x(),bbox.y(),bbox.width(),bbox.height() ));
96 int FrameObj::getBorder()
101 FrameType FrameObj::getFrameType()
106 QString FrameObj::getFrameTypeName()
121 void FrameObj::setFrameType(const FrameType &t)
134 rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(penColor), brushColor);
135 rectFrame->setZValue(Z_FRAME);
140 ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(penColor), brushColor);
141 ellipseFrame->setZValue(Z_FRAME);
142 ellipseFrame->show();
146 setVisibility (visible);
149 void FrameObj::setFrameType(const QString &t)
152 FrameObj::setFrameType (Rectangle);
153 else if (t=="Ellipse")
154 FrameObj::setFrameType (Ellipse);
156 FrameObj::setFrameType (NoFrame);
159 void FrameObj::setPenColor (QColor col)
165 QColor FrameObj::getPenColor ()
170 void FrameObj::setBrushColor (QColor col)
176 QColor FrameObj::getBrushColor ()
181 void FrameObj::repaint()
186 rectFrame->setPen (penColor);
187 rectFrame->setBrush (brushColor);
190 ellipseFrame->setPen (penColor);
191 ellipseFrame->setBrush (brushColor);
199 void FrameObj::setVisibility (bool v)
201 MapObj::setVisibility(v);
214 ellipseFrame->show();
216 ellipseFrame->hide();
221 QString FrameObj::saveToDir ()
223 QString frameTypeAttr=attribut ("frameType",getFrameTypeName());
224 QString penColAttr=attribut ("penColor",penColor.name() );
225 QString brushColAttr=attribut ("brushColor",brushColor.name() );
226 return singleElement ("frame",frameTypeAttr + penColAttr + brushColAttr);