17 #include <QAbstractGraphicsShapeItem>
18 #include <QGraphicsLineItem>
19 #include <QGraphicsPixmapItem>
28 assert(
target.elementCount()==0);
30 for (
int i=0;
i<
target.elementCount(); ++
i) {
31 const QPainterPath::Element &
e =
target.elementAt(
i);
33 target.setElementPositionAt(
i,newpos.x(),newpos.y());
40 assert(
target.elementCount()==0);
42 for (
int i=0;
i<
target.elementCount(); ++
i) {
43 const QPainterPath::Element &
e =
target.elementAt(
i);
45 target.setElementPositionAt(
i,newpos.x(),newpos.y());
57 QPointF topleft(qMin(qMin(qMin(
p1.x(),
p2.x()),
p3.x()),p4.x()),
58 qMin(qMin(qMin(
p1.y(),
p2.y()),
p3.y()),p4.y()));
59 QPointF bottomright(qMax(qMax(qMax(
p1.x(),
p2.x()),
p3.x()),p4.x()),
60 qMax(qMax(qMax(
p1.y(),
p2.y()),
p3.y()),p4.y()));
61 return QRectF(topleft,QSizeF(bottomright.x()-topleft.x(),bottomright.y()-topleft.y()));
72 QPointF topleft(qMin(qMin(qMin(
p1.x(),
p2.x()),
p3.x()),p4.x()),
73 qMin(qMin(qMin(
p1.y(),
p2.y()),
p3.y()),p4.y()));
74 QPointF bottomright(qMax(qMax(qMax(
p1.x(),
p2.x()),
p3.x()),p4.x()),
75 qMax(qMax(qMax(
p1.y(),
p2.y()),
p3.y()),p4.y()));
76 return QRectF(topleft,QSizeF(bottomright.x()-topleft.x(),bottomright.y()-topleft.y()));
87 const QAbstractGraphicsShapeItem * shapeitem = qgraphicsitem_cast<const QAbstractGraphicsShapeItem*>(
item);
88 const QGraphicsLineItem * lineitem(0);
90 lineitem = qgraphicsitem_cast<const QGraphicsLineItem*>(
item);
92 if (shapeitem||lineitem) {
93 std::cout<<
"IVP12DViewTransformation::paintItem: INFO: Draws QAbstractGraphicsShapeItem/QGraphicsLineItem"<<std::endl;
95 const QGraphicsSimpleTextItem * simpletextitem = qgraphicsitem_cast<const QGraphicsSimpleTextItem*>(
item);
97 std::cout<<
"IVP12DViewTransformation::paintItem: WARNING - does not presently draw QGraphicsSimpleTextItems"<<std::endl;
103 painter->setPen(shapeitem->pen());
104 painter->setBrush(shapeitem->brush());
108 painter->setPen(lineitem->pen());
111 painter->drawPath(
path);
119 const QGraphicsItemGroup * groupitem = qgraphicsitem_cast<const QGraphicsItemGroup*>(
item);
121 std::cout<<
"IVP12DViewTransformation::paintItem: INFO: drawing QGraphicsGroupItem"<<std::endl;
124 const QGraphicsPixmapItem * pixmapitem = qgraphicsitem_cast<const QGraphicsPixmapItem*>(
item);
126 std::cout<<
"IVP12DViewTransformation::paintItem: WARNING - does not presently draw QGraphicsPixmapItems"<<std::endl;
132 std::cout<<
"IVP12DViewTransformation::paintItem: Can not paint graphics item in transformed view."
133 <<
" Please only use items derived from either QAbstractGraphicsShapeItem, QGraphicsLineItem, QGraphicsGroupItem or QGraphicsPixmapItem."<<std::endl;