BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ColorMapSceneAdaptor Class Reference

Performs conversion of MaskItems coordinates between ColorMap and GraphicsScene. More...

Inheritance diagram for ColorMapSceneAdaptor:
[legend]
Collaboration diagram for ColorMapSceneAdaptor:
[legend]

Signals

void update_request ()
 

Public Member Functions

 ColorMapSceneAdaptor ()
 
bool eventFilter (QObject *object, QEvent *event)
 
qreal fromSceneX (qreal scene_x) const
 convert scene x-coordinate to native mask coordinate More...
 
qreal fromSceneY (qreal scene_y) const
 convert scene y-coordinate to native mask coordinate More...
 
void setColorMapPlot (ColorMap *plot)
 
qreal toSceneX (qreal mask_x) const
 convert native mask x-coordinate to scene coordinate More...
 
qreal toSceneY (qreal mask_y) const
 convert native mask y-coordinate to scene coordinate More...
 
const QRectF & viewportRectangle () const
 returns ColorMapPlot axes rectangle (at current zoom level) in scene coordinates More...
 

Protected Attributes

QRectF m_viewport_rectangle
 

Private Attributes

ColorMapm_plot
 

Detailed Description

Performs conversion of MaskItems coordinates between ColorMap and GraphicsScene.

Definition at line 23 of file ColorMapSceneAdaptor.h.

Constructor & Destructor Documentation

◆ ColorMapSceneAdaptor()

ColorMapSceneAdaptor::ColorMapSceneAdaptor ( )

Definition at line 18 of file ColorMapSceneAdaptor.cpp.

18 : m_plot(0) {}

Member Function Documentation

◆ eventFilter()

bool ColorMapSceneAdaptor::eventFilter ( QObject *  object,
QEvent *  event 
)

Definition at line 47 of file ColorMapSceneAdaptor.cpp.

48 {
49  Q_UNUSED(object);
50  if (event->type() == QEvent::Resize || event->type() == QEvent::UpdateRequest) {
52  emit update_request();
53  return false;
54  }
55  return true;
56 }
QRectF viewportRectangleInWidgetCoordinates()
returns rectangle representing current axes zoom state in widget coordinates
Definition: ColorMap.cpp:51
QRectF m_viewport_rectangle
Definition: ISceneAdaptor.h:45
void update_request()

References m_plot, ISceneAdaptor::m_viewport_rectangle, ISceneAdaptor::update_request(), and ColorMap::viewportRectangleInWidgetCoordinates().

Here is the call graph for this function:

◆ fromSceneX()

qreal ColorMapSceneAdaptor::fromSceneX ( qreal  ) const
virtual

convert scene x-coordinate to native mask coordinate

Implements ISceneAdaptor.

Definition at line 30 of file ColorMapSceneAdaptor.cpp.

31 {
32  return m_plot ? m_plot->pixelToXaxisCoord(scene_x) : scene_x;
33 }
double pixelToXaxisCoord(double pixel) const
transform widget coordinates to axes coordinates

References m_plot, and ScientificPlot::pixelToXaxisCoord().

Here is the call graph for this function:

◆ fromSceneY()

qreal ColorMapSceneAdaptor::fromSceneY ( qreal  ) const
virtual

convert scene y-coordinate to native mask coordinate

Implements ISceneAdaptor.

Definition at line 35 of file ColorMapSceneAdaptor.cpp.

36 {
37  return m_plot ? m_plot->pixelToYaxisCoord(scene_y) : scene_y;
38 }
double pixelToYaxisCoord(double pixel) const

References m_plot, and ScientificPlot::pixelToYaxisCoord().

Here is the call graph for this function:

◆ setColorMapPlot()

void ColorMapSceneAdaptor::setColorMapPlot ( ColorMap plot)

Definition at line 40 of file ColorMapSceneAdaptor.cpp.

41 {
42  m_plot = plot;
43  if (m_plot)
44  m_plot->installEventFilter(this);
45 }

References m_plot.

Referenced by MaskGraphicsProxy::~MaskGraphicsProxy(), and MaskGraphicsProxy::setSceneAdaptor().

◆ toSceneX()

qreal ColorMapSceneAdaptor::toSceneX ( qreal  ) const
virtual

convert native mask x-coordinate to scene coordinate

Implements ISceneAdaptor.

Definition at line 20 of file ColorMapSceneAdaptor.cpp.

21 {
22  return m_plot ? m_plot->xAxisCoordToPixel(mask_x) : mask_x;
23 }
double xAxisCoordToPixel(double axis_coordinate) const
transform axes coordinates to CustomPlot widget coordinates

References m_plot, and ScientificPlot::xAxisCoordToPixel().

Here is the call graph for this function:

◆ toSceneY()

qreal ColorMapSceneAdaptor::toSceneY ( qreal  ) const
virtual

convert native mask y-coordinate to scene coordinate

Implements ISceneAdaptor.

Definition at line 25 of file ColorMapSceneAdaptor.cpp.

26 {
27  return m_plot ? m_plot->yAxisCoordToPixel(mask_y) : mask_y;
28 }
double yAxisCoordToPixel(double axis_coordinate) const

References m_plot, and ScientificPlot::yAxisCoordToPixel().

Here is the call graph for this function:

◆ update_request

void ISceneAdaptor::update_request ( )
signalinherited

◆ viewportRectangle()

const QRectF & ColorMapSceneAdaptor::viewportRectangle ( ) const
virtual

returns ColorMapPlot axes rectangle (at current zoom level) in scene coordinates

Reimplemented from ISceneAdaptor.

Definition at line 58 of file ColorMapSceneAdaptor.cpp.

59 {
60  return m_viewport_rectangle;
61 }

References ISceneAdaptor::m_viewport_rectangle.

Member Data Documentation

◆ m_plot

ColorMap* ColorMapSceneAdaptor::m_plot
private

◆ m_viewport_rectangle

QRectF ISceneAdaptor::m_viewport_rectangle
protectedinherited

The documentation for this class was generated from the following files: