ATLAS Offline Software
Public Member Functions | Private Member Functions | List of all members
IVP12DViewTransformation Class Referenceabstract

#include <IVP12DViewTransformation.h>

Inheritance diagram for IVP12DViewTransformation:
Collaboration diagram for IVP12DViewTransformation:

Public Member Functions

 IVP12DViewTransformation ()
 
virtual ~IVP12DViewTransformation ()
 
virtual QPointF transform (const QPointF &source) const =0
 
virtual QPointF inverseTransform (const QPointF &source) const =0
 
virtual void transformPath (const QPainterPath &source, QPainterPath &target) const
 
virtual void inverseTransformPath (const QPainterPath &source, QPainterPath &target) const
 
virtual QRectF inverseTransform (const QRectF &source) const
 
virtual QRectF transform (const QRectF &source) const
 
void paintItem (QPainter *, const QGraphicsItem *) const
 

Private Member Functions

 IVP12DViewTransformation (const IVP12DViewTransformation &)
 
IVP12DViewTransformationoperator= (const IVP12DViewTransformation &)
 

Detailed Description

Definition at line 27 of file IVP12DViewTransformation.h.

Constructor & Destructor Documentation

◆ IVP12DViewTransformation() [1/2]

IVP12DViewTransformation::IVP12DViewTransformation ( )
inline

Definition at line 30 of file IVP12DViewTransformation.h.

30 {};

◆ ~IVP12DViewTransformation()

virtual IVP12DViewTransformation::~IVP12DViewTransformation ( )
inlinevirtual

Definition at line 31 of file IVP12DViewTransformation.h.

31 {};

◆ IVP12DViewTransformation() [2/2]

IVP12DViewTransformation::IVP12DViewTransformation ( const IVP12DViewTransformation )
private

Member Function Documentation

◆ inverseTransform() [1/2]

virtual QPointF IVP12DViewTransformation::inverseTransform ( const QPointF &  source) const
pure virtual

◆ inverseTransform() [2/2]

QRectF IVP12DViewTransformation::inverseTransform ( const QRectF &  source) const
virtual

Reimplemented in VP12DViewRPhiFishEyeTransformation, and VP12DViewRZFishEyeTransformation.

Definition at line 50 of file IVP12DViewTransformation.cxx.

51 {
52  QPointF p1 = inverseTransform(source.bottomLeft());
53  QPointF p2 = inverseTransform(source.bottomRight());
54  QPointF p3 = inverseTransform(source.topLeft());
55  QPointF p4 = inverseTransform(source.topRight());
56 
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()));
62 }

◆ inverseTransformPath()

void IVP12DViewTransformation::inverseTransformPath ( const QPainterPath &  source,
QPainterPath &  target 
) const
virtual

Definition at line 38 of file IVP12DViewTransformation.cxx.

39 {
40  assert(target.elementCount()==0);
41  target.addPath(source);
42  for (int i=0; i<target.elementCount(); ++i) {//Fixme:iterator better and possible?
43  const QPainterPath::Element &e = target.elementAt(i);
44  QPointF newpos = inverseTransform(QPointF(e.x,e.y));
45  target.setElementPositionAt(i,newpos.x(),newpos.y());
46  }
47 }

◆ operator=()

IVP12DViewTransformation& IVP12DViewTransformation::operator= ( const IVP12DViewTransformation )
private

◆ paintItem()

void IVP12DViewTransformation::paintItem ( QPainter *  painter,
const QGraphicsItem *  item 
) const

Definition at line 80 of file IVP12DViewTransformation.cxx.

81 {
82  //We are redoing most of the stuff as found in the various paint
83  //methods in qgraphicsitem.cpp. We dont care about
84  //QStyleOptionGraphicsItem's since they only seem to involve drawing
85  //rectangles around selected items (which we do another way anyway).
86 
87  const QAbstractGraphicsShapeItem * shapeitem = qgraphicsitem_cast<const QAbstractGraphicsShapeItem*>(item);
88  const QGraphicsLineItem * lineitem(0);
89  if (!shapeitem)
90  lineitem = qgraphicsitem_cast<const QGraphicsLineItem*>(item);
91 
92  if (shapeitem||lineitem) {
93  std::cout<<"IVP12DViewTransformation::paintItem: INFO: Draws QAbstractGraphicsShapeItem/QGraphicsLineItem"<<std::endl;
94  if (shapeitem) {
95  const QGraphicsSimpleTextItem * simpletextitem = qgraphicsitem_cast<const QGraphicsSimpleTextItem*>(/*shape*/item);
96  if (simpletextitem) {
97  std::cout<<"IVP12DViewTransformation::paintItem: WARNING - does not presently draw QGraphicsSimpleTextItems"<<std::endl;
98  return;
99  }
100  }
101  QPainterPath path;
102  if (shapeitem) {
103  painter->setPen(shapeitem->pen());
104  painter->setBrush(shapeitem->brush());
105  transformPath(shapeitem->shape(), path);
106  }
107  else if (lineitem) {
108  painter->setPen(lineitem->pen());
109  transformPath(lineitem->shape(), path);
110  }
111  painter->drawPath(path);//Fixme:transform
112  // QPainterPath QGraphicsPolygonItem::shape();
113  // QPainterPath QGraphicsPathItem::shape();
114  // QPainterPath QGraphicsRectItem::shape();
115  // QPainterPath QGraphicsEllipseItem::shape();//good enough
116  //Fixme: Most standard QT shape items have slightly more efficient methods that might be useful...
117  return;
118  }
119  const QGraphicsItemGroup * groupitem = qgraphicsitem_cast<const QGraphicsItemGroup*>(item);
120  if (groupitem) {
121  std::cout<<"IVP12DViewTransformation::paintItem: INFO: drawing QGraphicsGroupItem"<<std::endl;
122  return;
123  }
124  const QGraphicsPixmapItem * pixmapitem = qgraphicsitem_cast<const QGraphicsPixmapItem*>(item);
125  if (pixmapitem) {
126  std::cout<<"IVP12DViewTransformation::paintItem: WARNING - does not presently draw QGraphicsPixmapItems"<<std::endl;
127  //Pixmap: construct matrix transformation from the corners, and hope that the transformation is linear enough that it works.
128  //Perhaps test the assumption on a few other points within the pixmap.
129  return;
130  }
131 
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;
134  return;
135 
136 
137 }

◆ transform() [1/2]

virtual QPointF IVP12DViewTransformation::transform ( const QPointF &  source) const
pure virtual

◆ transform() [2/2]

QRectF IVP12DViewTransformation::transform ( const QRectF &  source) const
virtual

Reimplemented in VP12DViewRPhiFishEyeTransformation, and VP12DViewRZFishEyeTransformation.

Definition at line 65 of file IVP12DViewTransformation.cxx.

66 {
67  QPointF p1 = transform(source.bottomLeft());
68  QPointF p2 = transform(source.bottomRight());
69  QPointF p3 = transform(source.topLeft());
70  QPointF p4 = transform(source.topRight());
71 
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()));
77 }

◆ transformPath()

void IVP12DViewTransformation::transformPath ( const QPainterPath &  source,
QPainterPath &  target 
) const
virtual

Definition at line 26 of file IVP12DViewTransformation.cxx.

27 {
28  assert(target.elementCount()==0);
29  target.addPath(source);
30  for (int i=0; i<target.elementCount(); ++i) {//Fixme:iterator better and possible?
31  const QPainterPath::Element &e = target.elementAt(i);
32  QPointF newpos = transform(QPointF(e.x,e.y));
33  target.setElementPositionAt(i,newpos.x(),newpos.y());
34  }
35 }

The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
IVP12DViewTransformation::transformPath
virtual void transformPath(const QPainterPath &source, QPainterPath &target) const
Definition: IVP12DViewTransformation.cxx:26
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
IVP12DViewTransformation::transform
virtual QPointF transform(const QPointF &source) const =0
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
IVP12DViewTransformation::inverseTransform
virtual QPointF inverseTransform(const QPointF &source) const =0
lumiFormat.i
int i
Definition: lumiFormat.py:85
item
Definition: ItemListSvc.h:43
copySelective.target
string target
Definition: copySelective.py:37
copySelective.source
string source
Definition: copySelective.py:32
TRTCalib_cfilter.p3
p3
Definition: TRTCalib_cfilter.py:132