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

Helper class for MaskGraphicsScene to hold drawing conditions. More...

Public Member Functions

 MaskDrawingContext ()
 
QString activityToModelType () const
 Returns model type corresponding to current activity. More...
 
int activityToRow () const
 Returns model row corresponding to given activity. More...
 
MaskEditorFlags::Activity getActivityType () const
 
bool getMaskValue () const
 
bool isActivityRequiresDrawingCancel (MaskEditorFlags::Activity proposed_new_activity)
 return true, if proposed activity requires the cancel of drawing i.e. More...
 
bool isDrawingInProgress () const
 
bool isEllipseMode () const
 
bool isHorizontalLineMode () const
 
bool isInZoomMode () const
 
bool isLineMode () const
 
bool isMaskAllMode () const
 
bool isPolygonMode () const
 
bool isRectangleMode () const
 
bool isRectangleShapeMode () const
 
bool isROIMode () const
 
bool isSelectionMode () const
 
bool isVerticalLineMode () const
 
void setActivityType (MaskEditorFlags::Activity value)
 
void setDrawingInProgress (bool value)
 
void setMaskValue (MaskEditorFlags::MaskValue value)
 

Private Attributes

MaskEditorFlags::Activity m_current_activity
 
bool m_drawing_in_progress
 
MaskEditorFlags::MaskValue m_mask_value
 

Detailed Description

Helper class for MaskGraphicsScene to hold drawing conditions.

Definition at line 22 of file MaskDrawingContext.h.

Constructor & Destructor Documentation

◆ MaskDrawingContext()

MaskDrawingContext::MaskDrawingContext ( )

Definition at line 17 of file MaskDrawingContext.cpp.

Member Function Documentation

◆ activityToModelType()

QString MaskDrawingContext::activityToModelType ( ) const

Returns model type corresponding to current activity.

Definition at line 124 of file MaskDrawingContext.cpp.

125 {
126  if (isRectangleMode())
127  return "RectangleMask";
128  if (isEllipseMode())
129  return "EllipseMask";
130  if (isROIMode())
131  return "RegionOfInterest";
132  return "";
133 }
bool isRectangleMode() const

References isEllipseMode(), isRectangleMode(), and isROIMode().

Referenced by MaskGraphicsScene::processRectangleShapeItem().

Here is the call graph for this function:

◆ activityToRow()

int MaskDrawingContext::activityToRow ( ) const

Returns model row corresponding to given activity.

All shapes, except ROI, will be added on top of each other. ROI shape will be added at the bottom.

Definition at line 138 of file MaskDrawingContext.cpp.

139 {
140  if (isROIMode())
141  return -1;
142  return 0;
143 }

References isROIMode().

Referenced by MaskGraphicsScene::processRectangleShapeItem().

Here is the call graph for this function:

◆ getActivityType()

MaskEditorFlags::Activity MaskDrawingContext::getActivityType ( ) const

Definition at line 24 of file MaskDrawingContext.cpp.

25 {
26  return m_current_activity;
27 }

References m_current_activity.

◆ getMaskValue()

bool MaskDrawingContext::getMaskValue ( ) const

◆ isActivityRequiresDrawingCancel()

bool MaskDrawingContext::isActivityRequiresDrawingCancel ( MaskEditorFlags::Activity  proposed_new_activity)

return true, if proposed activity requires the cancel of drawing i.e.

there is an ungoing polygon drawing, but user wants to start other drawing

Definition at line 113 of file MaskDrawingContext.cpp.

115 {
117  && proposed_new_activity >= MaskEditorFlags::PAN_ZOOM_MODE)
118  return true;
119  return false;
120 }
bool isDrawingInProgress() const

References isDrawingInProgress(), isPolygonMode(), and MaskEditorFlags::PAN_ZOOM_MODE.

Referenced by MaskGraphicsScene::onActivityModeChanged().

Here is the call graph for this function:

◆ isDrawingInProgress()

bool MaskDrawingContext::isDrawingInProgress ( ) const

◆ isEllipseMode()

bool MaskDrawingContext::isEllipseMode ( ) const

◆ isHorizontalLineMode()

bool MaskDrawingContext::isHorizontalLineMode ( ) const

◆ isInZoomMode()

bool MaskDrawingContext::isInZoomMode ( ) const

◆ isLineMode()

bool MaskDrawingContext::isLineMode ( ) const

Definition at line 71 of file MaskDrawingContext.cpp.

72 {
74 }
bool isVerticalLineMode() const
bool isHorizontalLineMode() const

References isHorizontalLineMode(), and isVerticalLineMode().

Referenced by MaskGraphicsScene::drawForeground(), MaskGraphicsScene::isValidForLineDrawing(), and MaskGraphicsScene::mouseMoveEvent().

Here is the call graph for this function:

◆ isMaskAllMode()

bool MaskDrawingContext::isMaskAllMode ( ) const

◆ isPolygonMode()

◆ isRectangleMode()

bool MaskDrawingContext::isRectangleMode ( ) const

◆ isRectangleShapeMode()

◆ isROIMode()

◆ isSelectionMode()

bool MaskDrawingContext::isSelectionMode ( ) const

◆ isVerticalLineMode()

bool MaskDrawingContext::isVerticalLineMode ( ) const

◆ setActivityType()

void MaskDrawingContext::setActivityType ( MaskEditorFlags::Activity  value)

Definition at line 29 of file MaskDrawingContext.cpp.

30 {
31  m_current_activity = value;
32 }

References m_current_activity.

Referenced by MaskGraphicsScene::onActivityModeChanged().

◆ setDrawingInProgress()

void MaskDrawingContext::setDrawingInProgress ( bool  value)

Definition at line 101 of file MaskDrawingContext.cpp.

102 {
103  m_drawing_in_progress = value;
104 }

References m_drawing_in_progress.

Referenced by MaskGraphicsScene::setDrawingInProgress().

◆ setMaskValue()

void MaskDrawingContext::setMaskValue ( MaskEditorFlags::MaskValue  value)

Definition at line 34 of file MaskDrawingContext.cpp.

35 {
36  m_mask_value = value;
37 }

References m_mask_value.

Referenced by MaskGraphicsScene::onMaskValueChanged().

Member Data Documentation

◆ m_current_activity

◆ m_drawing_in_progress

bool MaskDrawingContext::m_drawing_in_progress
private

Definition at line 55 of file MaskDrawingContext.h.

Referenced by isDrawingInProgress(), and setDrawingInProgress().

◆ m_mask_value

MaskEditorFlags::MaskValue MaskDrawingContext::m_mask_value
private

Definition at line 54 of file MaskDrawingContext.h.

Referenced by getMaskValue(), and setMaskValue().


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