1 #include "ornamentedobj.h"
2 #include "linkablemapobj.h"
5 /////////////////////////////////////////////////////////////////
7 /////////////////////////////////////////////////////////////////
9 OrnamentedObj::OrnamentedObj():LinkableMapObj()
11 // cout << "Const OrnamentedObj ()\n";
15 OrnamentedObj::OrnamentedObj(QGraphicsScene* s) :LinkableMapObj(s)
17 // cout << "Const OrnamentedObj (s)\n";
21 OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->scene)
26 OrnamentedObj::~OrnamentedObj()
35 void OrnamentedObj::init ()
37 heading = new HeadingObj(scene);
38 heading->move (absPos.x(), absPos.y());
40 systemFlags=new FlagRowObj(scene);
41 standardFlags=new FlagRowObj(scene);
43 frame = new FrameObj (scene);
46 void OrnamentedObj::copy (OrnamentedObj* other)
48 LinkableMapObj::copy(other);
49 heading->copy(other->heading);
50 setColor (other->heading->getColor());
52 systemFlags->copy (other->systemFlags);
53 standardFlags->copy (other->standardFlags);
55 ornamentsBBox=other->ornamentsBBox;
58 void OrnamentedObj::setLinkColor()
60 VymModel *model=treeItem->getModel();
62 if (model->getMapLinkColorHint()==HeadingColor)
63 LinkableMapObj::setLinkColor (heading->getColor());
65 LinkableMapObj::setLinkColor (model->getMapDefLinkColor());
68 void OrnamentedObj::setColor (QColor col)
70 heading->setColor(col);
74 QColor OrnamentedObj::getColor ()
76 return heading->getColor();
79 FrameObj::FrameType OrnamentedObj::getFrameType()
81 return frame->getFrameType();
84 QString OrnamentedObj::getFrameTypeName()
86 return frame->getFrameTypeName();
89 void OrnamentedObj::setFrameType(const FrameObj::FrameType &t)
91 frame->setFrameType(t);
92 if (t == FrameObj::NoFrame)
93 linkpos=LinkableMapObj::Bottom;
95 linkpos=LinkableMapObj::Middle;
102 void OrnamentedObj::setFrameType(const QString &t)
104 frame->setFrameType(t);
105 if (frame->getFrameType() == FrameObj::NoFrame)
106 linkpos=LinkableMapObj::Bottom;
108 linkpos=LinkableMapObj::Middle;
115 void OrnamentedObj::setFramePadding (const int &i)
117 frame->setPadding (i);
123 int OrnamentedObj::getFramePadding ()
125 return frame->getPadding();
128 void OrnamentedObj::setFrameBorderWidth (const int &i)
130 frame->setBorderWidth(i);
136 int OrnamentedObj::getFrameBorderWidth()
138 return frame->getBorderWidth();
141 void OrnamentedObj::setFramePenColor(QColor col)
143 frame->setPenColor (col);
146 QColor OrnamentedObj::getFramePenColor()
148 return frame->getPenColor ();
151 void OrnamentedObj::setFrameBrushColor(QColor col)
153 frame->setBrushColor (col);
156 QColor OrnamentedObj::getFrameBrushColor()
158 return frame->getBrushColor ();
161 void OrnamentedObj::positionContents()
163 double d=frame->getPadding()/2;
167 double ox,oy; // Offset due to padding
172 systemFlags-> move (ox +x , oy + y );
174 // vertical align heading to bottom
175 heading->move (ox + x + systemFlags->getBBox().width(),
176 oy + y + ornamentsBBox.height() - heading->getHeight()
178 standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
180 ornamentsBBox.moveTopLeft ( QPointF ((int)(ox+x),(int)(oy+y)));
181 clickBox.moveTopLeft (QPointF ((int)(ox + x), (int)(oy + y)));
184 void OrnamentedObj::move (double x, double y)
192 void OrnamentedObj::move (QPointF p)
197 void OrnamentedObj::moveBy (double x, double y)
200 MapObj::moveBy (x,y);
202 systemFlags->moveBy (x,y);
203 standardFlags->moveBy (x,y);
204 heading->moveBy (x,y);
209 void OrnamentedObj::moveBy (QPointF p)
211 moveBy (p.x(), p.y());
214 void OrnamentedObj::move2RelPos(double x, double y)
216 setRelPos (QPointF(x,y));
219 QPointF p=parObj->getChildPos();
220 move (p.x()+x, p.y() +y);
224 void OrnamentedObj::move2RelPos(QPointF p)
226 move2RelPos (p.x(),p.y());
229 void OrnamentedObj::activateStandardFlag(Flag *flag)
231 standardFlags->activate(flag);
234 move (absPos.x(), absPos.y() );
238 void OrnamentedObj::deactivateStandardFlag(const QString &name)
240 standardFlags->deactivate(name);
243 move (absPos.x(), absPos.y() );
248 QString OrnamentedObj::getSystemFlagName(const QPointF &p) //FIXME-3
250 return systemFlags->getFlagName(p);