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

Description

Definition at line 23 of file MaskItemCatalog.h.

Public Types

using CatalogedType = MaskItem
 
enum class  Type : uint8_t {
  RegionOfInterest = 0 , Rectangle = 1 , Polygon = 2 , VerticalLine = 3 ,
  HorizontalLine = 4 , MaskAll = 5
}
 

Static Public Member Functions

static MaskItemcreate (Type type)
 Creates the item of the given type. More...
 
static Type type (const MaskItem *item)
 Returns the enum type of the given item. More...
 
static QVector< Typetypes ()
 Available types of items. More...
 

Member Typedef Documentation

◆ CatalogedType

Definition at line 25 of file MaskItemCatalog.h.

Member Enumeration Documentation

◆ Type

enum MaskItemCatalog::Type : uint8_t
strong
Enumerator
RegionOfInterest 
Rectangle 
Polygon 
VerticalLine 
HorizontalLine 
MaskAll 

Definition at line 28 of file MaskItemCatalog.h.

28  : uint8_t {
29  RegionOfInterest = 0,
30  Rectangle = 1,
31  Polygon = 2,
32  VerticalLine = 3,
33  HorizontalLine = 4,
34  MaskAll = 5
35  };

Member Function Documentation

◆ create()

MaskItem * MaskItemCatalog::create ( Type  type)
static

Creates the item of the given type.

Definition at line 19 of file MaskItemCatalog.cpp.

20 {
21  switch (type) {
23  return new RegionOfInterestItem();
24  case Type::Rectangle:
25  return new RectangleItem();
26  case Type::Polygon:
27  return new PolygonItem();
28  case Type::VerticalLine:
29  return new VerticalLineItem();
31  return new HorizontalLineItem();
32  case Type::MaskAll:
33  return new MaskAllItem();
34  }
35  ASSERT(false);
36 }
static Type type(const MaskItem *item)
Returns the enum type of the given item.

References HorizontalLine, MaskAll, Polygon, Rectangle, RegionOfInterest, type(), and VerticalLine.

Here is the call graph for this function:

◆ type()

MaskItemCatalog::Type MaskItemCatalog::type ( const MaskItem item)
static

Returns the enum type of the given item.

Definition at line 44 of file MaskItemCatalog.cpp.

45 {
46  if (dynamic_cast<const RegionOfInterestItem*>(item)) // has to be before test for Rectangle!
48  if (dynamic_cast<const RectangleItem*>(item))
49  return Type::Rectangle;
50  if (dynamic_cast<const PolygonItem*>(item))
51  return Type::Polygon;
52  if (dynamic_cast<const VerticalLineItem*>(item))
53  return Type::VerticalLine;
54  if (dynamic_cast<const HorizontalLineItem*>(item))
55  return Type::HorizontalLine;
56  if (dynamic_cast<const MaskAllItem*>(item))
57  return Type::MaskAll;
58 
59  ASSERT(false);
60 }

References HorizontalLine, MaskAll, Polygon, Rectangle, RegionOfInterest, and VerticalLine.

Referenced by create().

◆ types()

QVector< MaskItemCatalog::Type > MaskItemCatalog::types ( )
static

Available types of items.

Definition at line 38 of file MaskItemCatalog.cpp.

References HorizontalLine, MaskAll, Polygon, Rectangle, RegionOfInterest, and VerticalLine.


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