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

Description

Helper class for MaskGraphicsScene to hold drawing conditions.

Definition at line 22 of file MaskDrawingContext.h.

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. All shapes, except ROI, will be added on top of each other. ROI shape will be added at the bottom. More...
 
MaskEditorFlags::Activity getActivityType () const
 
bool getMaskValue () const
 
bool isActivityRequiresDrawingCancel (MaskEditorFlags::Activity proposed_new_activity) const
 Returns true, if proposed activity requires the cancel of drawing i.e. there is an ungoing polygon drawing, but user wants to start other drawing. 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
 

Constructor & Destructor Documentation

◆ MaskDrawingContext()

MaskDrawingContext::MaskDrawingContext ( )

Definition at line 18 of file MaskDrawingContext.cpp.

Member Function Documentation

◆ activityToModelType()

QString MaskDrawingContext::activityToModelType ( ) const

Returns model type corresponding to current activity.

Definition at line 123 of file MaskDrawingContext.cpp.

124 {
125  if (isRectangleMode())
126  return RectangleItem::M_TYPE;
127  if (isEllipseMode())
128  return EllipseItem::M_TYPE;
129  if (isROIMode())
131  return "";
132 }
static constexpr auto M_TYPE
Definition: MaskItems.h:167
bool isRectangleMode() const
static constexpr auto M_TYPE
Definition: MaskItems.h:61
static constexpr auto M_TYPE
Definition: MaskItems.h:83

References isEllipseMode(), isRectangleMode(), isROIMode(), RectangleItem::M_TYPE, RegionOfInterestItem::M_TYPE, and EllipseItem::M_TYPE.

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 137 of file MaskDrawingContext.cpp.

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

References isROIMode().

Referenced by MaskGraphicsScene::processRectangleShapeItem().

Here is the call graph for this function:

◆ getActivityType()

MaskEditorFlags::Activity MaskDrawingContext::getActivityType ( ) const

Definition at line 25 of file MaskDrawingContext.cpp.

26 {
27  return m_current_activity;
28 }

References m_current_activity.

◆ getMaskValue()

bool MaskDrawingContext::getMaskValue ( ) const

◆ isActivityRequiresDrawingCancel()

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

Returns 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 114 of file MaskDrawingContext.cpp.

116 {
117  return isDrawingInProgress() && isPolygonMode()
118  && proposed_new_activity >= MaskEditorFlags::PAN_ZOOM_MODE;
119 }
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

Definition at line 97 of file MaskDrawingContext.cpp.

98 {
99  return m_drawing_in_progress;
100 }

References m_drawing_in_progress.

Referenced by isActivityRequiresDrawingCancel(), and MaskGraphicsScene::isDrawingInProgress().

◆ isEllipseMode()

bool MaskDrawingContext::isEllipseMode ( ) const

◆ isHorizontalLineMode()

bool MaskDrawingContext::isHorizontalLineMode ( ) const

◆ isInZoomMode()

bool MaskDrawingContext::isInZoomMode ( ) const

◆ isLineMode()

bool MaskDrawingContext::isLineMode ( ) const

Definition at line 72 of file MaskDrawingContext.cpp.

73 {
75 }
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 30 of file MaskDrawingContext.cpp.

31 {
32  m_current_activity = value;
33 }

References m_current_activity.

Referenced by MaskGraphicsScene::onActivityModeChanged().

◆ setDrawingInProgress()

void MaskDrawingContext::setDrawingInProgress ( bool  value)

Definition at line 102 of file MaskDrawingContext.cpp.

103 {
104  m_drawing_in_progress = value;
105 }

References m_drawing_in_progress.

Referenced by MaskGraphicsScene::setDrawingInProgress().

◆ setMaskValue()

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

Definition at line 35 of file MaskDrawingContext.cpp.

36 {
37  m_mask_value = value;
38 }

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: