34 MapCircle::MapCircle(MapPointItem *center, MapPointItem *radius,
bool clockwise, MapGraphicItem *map, QColor color) :
35 QGraphicsEllipseItem(map), my_center(center), my_radius(radius),
36 my_map(map), myColor(color), myClockWise(clockwise)
40 connect(center, SIGNAL(
aboutToBeDeleted(MapPointItem*)),
this, SLOT(pointdeleted()));
41 connect(radius, SIGNAL(
aboutToBeDeleted(MapPointItem*)),
this, SLOT(pointdeleted()));
43 connect(map,SIGNAL(childSetOpacity(qreal)),
this,SLOT(
setOpacitySlot(qreal)));
46 MapCircle::MapCircle(HomeItem *center, MapPointItem *radius,
bool clockwise, MapGraphicItem *map, QColor color) :
47 QGraphicsEllipseItem(map), my_center(center), my_radius(radius),
48 my_map(map), myColor(color), myClockWise(clockwise)
52 connect(radius, SIGNAL(
aboutToBeDeleted(MapPointItem*)),
this, SLOT(pointdeleted()));
54 connect(map,SIGNAL(childSetOpacity(qreal)),
this,SLOT(
setOpacitySlot(qreal)));
57 int MapCircle::type()
const
63 void MapCircle::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget)
70 p1=QPointF(line.p1().x(),line.p1().y()+line.length());
71 p2=QPointF(line.p1().x(),line.p1().y()-line.length());
73 myPen.setColor(myColor);
75 painter->setPen(myPen);
76 QBrush brush=painter->brush();
77 painter->setBrush(myColor);
82 QPointF arrowP1 = p1 + QPointF(sin(angle + M_PI / 3) * arrowSize,
83 cos(angle + M_PI / 3) * arrowSize);
84 QPointF arrowP2 = p1 + QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize,
85 cos(angle + M_PI - M_PI / 3) * arrowSize);
87 QPointF arrowP21 = p2 + QPointF(sin(angle + M_PI + M_PI / 3) * arrowSize,
88 cos(angle + M_PI + M_PI / 3) * arrowSize);
89 QPointF arrowP22 = p2 + QPointF(sin(angle + M_PI + M_PI - M_PI / 3) * arrowSize,
90 cos(angle + M_PI + M_PI - M_PI / 3) * arrowSize);
93 arrowHead << p1 << arrowP1 << arrowP2;
94 painter->drawPolygon(arrowHead);
96 arrowHead << p2 << arrowP21 << arrowP22;
97 painter->drawPolygon(arrowHead);
98 painter->translate(-line.length(),-line.length());
99 painter->setBrush(brush);
100 painter->drawEllipse(this->rect());
106 line=QLineF(my_center->pos(),my_radius->pos());
107 this->setRect(my_center->pos().x(),my_center->pos().y(),2*line.length(),2*line.length());
A graphicsItem representing a MapPointItem.
A graphicsItem representing a Home Location.
A graphicsItem representing a circle connecting 2 map point.