00001
00002
00003
00004
00005
00006
00007 #include "DataKey.h"
00008 #include "GraphicsPoint.h"
00009 #include "GraphicsPointPolygon.h"
00010 #include "Logger.h"
00011 #include <QGraphicsScene>
00012 #include "QtToString.h"
00013
00014 GraphicsPointPolygon::GraphicsPointPolygon(GraphicsPoint &graphicsPoint,
00015 const QPolygonF &polygon) :
00016 QGraphicsPolygonItem (polygon),
00017 m_graphicsPoint (graphicsPoint)
00018
00019 {
00020 LOG4CPP_INFO_S ((*mainCat)) << "GraphicsPointPolygon::GraphicsPointPolygon";
00021 }
00022
00023 QVariant GraphicsPointPolygon::itemChange(GraphicsItemChange change,
00024 const QVariant &value)
00025 {
00026 if (change == QGraphicsItem::ItemPositionHasChanged) {
00027
00028 LOG4CPP_DEBUG_S ((*mainCat)) << "GraphicsPointPolygon::itemChange"
00029 << " identifier=" << data (DATA_KEY_IDENTIFIER).toString().toLatin1().data()
00030 << " positionHasChanged";
00031
00032 setData (DATA_KEY_POSITION_HAS_CHANGED, QVariant (true));
00033 }
00034
00035 return QGraphicsPolygonItem::itemChange(change,
00036 value);
00037 }
00038
00039 void GraphicsPointPolygon::setRadius(int radius)
00040 {
00041
00042 double scale = (2 * radius) / boundingRect().width();
00043 setScale (scale);
00044 }