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

Description

Performs conversion of MaskItems coordinates between ColorMap and GraphicsScene.

Definition at line 24 of file ColorMapSceneAdaptor.h.

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

Signals

void update_request ()
 

Public Member Functions

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

Protected Attributes

QRectF m_viewport_rectangle
 

Private Attributes

ColorMapm_plot
 

Constructor & Destructor Documentation

◆ ColorMapSceneAdaptor()

ColorMapSceneAdaptor::ColorMapSceneAdaptor ( )

Definition at line 18 of file ColorMapSceneAdaptor.cpp.

19  : m_plot(nullptr)
20 {
21 }

Member Function Documentation

◆ eventFilter()

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

Definition at line 50 of file ColorMapSceneAdaptor.cpp.

51 {
52  Q_UNUSED(object);
53  if (event->type() == QEvent::Resize || event->type() == QEvent::UpdateRequest) {
55  emit update_request();
56  return false;
57  }
58  return true;
59 }
QRectF viewportRectangleInWidgetCoordinates()
Returns rectangle representing current axes zoom state in widget coordinates.
Definition: ColorMap.cpp:53
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
overridevirtual

convert scene x-coordinate to native mask coordinate

Implements ISceneAdaptor.

Definition at line 33 of file ColorMapSceneAdaptor.cpp.

34 {
35  return m_plot ? m_plot->pixelToXaxisCoord(scene_x) : scene_x;
36 }
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
overridevirtual

convert scene y-coordinate to native mask coordinate

Implements ISceneAdaptor.

Definition at line 38 of file ColorMapSceneAdaptor.cpp.

39 {
40  return m_plot ? m_plot->pixelToYaxisCoord(scene_y) : scene_y;
41 }
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 43 of file ColorMapSceneAdaptor.cpp.

44 {
45  m_plot = plot;
46  if (m_plot)
47  m_plot->installEventFilter(this);
48 }

References m_plot.

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

◆ toSceneX()

qreal ColorMapSceneAdaptor::toSceneX ( qreal  ) const
overridevirtual

convert native mask x-coordinate to scene coordinate

Implements ISceneAdaptor.

Definition at line 23 of file ColorMapSceneAdaptor.cpp.

24 {
25  return m_plot ? m_plot->xAxisCoordToPixel(mask_x) : mask_x;
26 }
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
overridevirtual

convert native mask y-coordinate to scene coordinate

Implements ISceneAdaptor.

Definition at line 28 of file ColorMapSceneAdaptor.cpp.

29 {
30  return m_plot ? m_plot->yAxisCoordToPixel(mask_y) : mask_y;
31 }
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
overridevirtual

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

Reimplemented from ISceneAdaptor.

Definition at line 61 of file ColorMapSceneAdaptor.cpp.

62 {
63  return m_viewport_rectangle;
64 }

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: