ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
VP12DViewRZFishEyeTransformation Class Reference

#include <VP12DViewRZFishEyeTransformation.h>

Inheritance diagram for VP12DViewRZFishEyeTransformation:
Collaboration diagram for VP12DViewRZFishEyeTransformation:

Public Member Functions

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

Private Attributes

double m_fisheyepar
 

Detailed Description

Definition at line 20 of file VP12DViewRZFishEyeTransformation.h.

Constructor & Destructor Documentation

◆ VP12DViewRZFishEyeTransformation()

VP12DViewRZFishEyeTransformation::VP12DViewRZFishEyeTransformation ( )

Definition at line 18 of file VP12DViewRZFishEyeTransformation.cxx.

20 {
21 }

◆ ~VP12DViewRZFishEyeTransformation()

virtual VP12DViewRZFishEyeTransformation::~VP12DViewRZFishEyeTransformation ( )
inlinevirtual

Definition at line 24 of file VP12DViewRZFishEyeTransformation.h.

24 {};

Member Function Documentation

◆ inverseTransform() [1/2]

QPointF VP12DViewRZFishEyeTransformation::inverseTransform ( const QPointF &  source) const
inlinevirtual

Implements IVP12DViewTransformation.

Definition at line 47 of file VP12DViewRZFishEyeTransformation.h.

48 {
49  return QPointF(source.x()/(1-fabs(source.x()*m_fisheyepar)),source.y()/(1-fabs(source.y()*m_fisheyepar)));
50 }

◆ inverseTransform() [2/2]

virtual QRectF VP12DViewRZFishEyeTransformation::inverseTransform ( const QRectF &  source) const
inlinevirtual

◆ inverseTransformPath()

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

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 }

◆ paintItem()

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

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]

QPointF VP12DViewRZFishEyeTransformation::transform ( const QPointF &  source) const
inlinevirtual

Implements IVP12DViewTransformation.

Definition at line 42 of file VP12DViewRZFishEyeTransformation.h.

43 {
44  return QPointF(source.x()/(1+fabs(source.x()*m_fisheyepar)),source.y()/(1+fabs(source.y()*m_fisheyepar)));
45 }

◆ transform() [2/2]

virtual QRectF VP12DViewRZFishEyeTransformation::transform ( const QRectF &  source) const
inlinevirtual

◆ transformPath()

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

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 }

Member Data Documentation

◆ m_fisheyepar

double VP12DViewRZFishEyeTransformation::m_fisheyepar
private

Definition at line 34 of file VP12DViewRZFishEyeTransformation.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
IVP12DViewTransformation::IVP12DViewTransformation
IVP12DViewTransformation()
Definition: IVP12DViewTransformation.h:30
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
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
VP12DViewRZFishEyeTransformation::m_fisheyepar
double m_fisheyepar
Definition: VP12DViewRZFishEyeTransformation.h:34