MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / paint

Method paint

ASAP/annotation/PointSetQtAnnotation.cpp:24–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void PointSetQtAnnotation::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
25 QWidget *widget) {
26 if (_annotation) {
27 _currentLoD = option->levelOfDetailFromTransform(painter->worldTransform());
28 //painter->drawRect(_bRect);
29 std::vector<Point> coords = _annotation->getCoordinates();
30 if (isSelected()) {
31 if (QtAnnotation::annotationColorForRects) {
32 painter->setPen(QPen(QBrush(getDrawingColor().lighter(150)), 4.5 * _rectSize / _currentLoD, Qt::PenStyle::SolidLine, Qt::PenCapStyle::SquareCap));
33 }
34 else {
35 painter->setPen(QPen(QBrush(_rectColor.lighter(150)), 4.5 * _rectSize / _currentLoD, Qt::PenStyle::SolidLine, Qt::PenCapStyle::SquareCap));
36 }
37 }
38 else {
39 painter->setPen(QPen(QBrush(_rectColor), 3 * _rectSize / _currentLoD, Qt::PenStyle::SolidLine, Qt::PenCapStyle::SquareCap));
40 }
41 for (unsigned int i = 0; i < coords.size(); ++i) {
42 if (i == _activeSeedPoint) {
43 painter->save();
44 painter->setPen(QPen(QBrush(_rectSelectedColor), 4.5 * _rectSize / _currentLoD, Qt::PenStyle::SolidLine, Qt::PenCapStyle::SquareCap));
45 painter->drawPoint(this->mapFromScene(coords[i].getX()*_scale, coords[i].getY()*_scale));
46 painter->restore();
47 }
48 else {
49 QPointF loc = this->mapFromScene(coords[i].getX()*_scale, coords[i].getY()*_scale);
50 painter->drawPoint(loc);
51 }
52 }
53 }
54}
55
56bool PointSetQtAnnotation::collidesWithPath(const QPainterPath & path, Qt::ItemSelectionMode mode) const {
57 return contains(path.currentPosition());

Callers

nothing calls this directly

Calls 3

getCoordinatesMethod · 0.80
sizeMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected