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

Description

Factory to construct views out of MaskItems for MaskGraphicsScene.

Definition at line 26 of file MaskViewFactory.h.

Static Public Member Functions

static IShape2DViewcreateMaskView (SessionItem *item, ISceneAdaptor *adaptor=nullptr)
 

Member Function Documentation

◆ createMaskView()

IShape2DView * MaskViewFactory::createMaskView ( SessionItem item,
ISceneAdaptor adaptor = nullptr 
)
static

Definition at line 32 of file MaskViewFactory.cpp.

33 {
34  IShape2DView* result(nullptr);
35 
36  if (item->hasModelType<MaskContainerItem>())
37  result = new MaskContainerView(polymorphic_downcast<MaskContainerItem*>(item));
38 
39  else if (item->hasModelType<ProjectionContainerItem>())
40  result = new MaskContainerView(polymorphic_downcast<ProjectionContainerItem*>(item));
41 
42 
43  else if (item->hasModelType<RectangleItem>())
44  result = new RectangleView(polymorphic_downcast<RectangleItem*>(item));
45 
46 
47  else if (item->hasModelType<PolygonItem>())
48  result = new PolygonView(polymorphic_downcast<PolygonItem*>(item));
49 
50 
51  else if (item->hasModelType<PolygonPointItem>())
52  result = new PolygonPointView(polymorphic_downcast<PolygonPointItem*>(item));
53 
54 
55  else if (item->hasModelType<VerticalLineItem>())
56  result = new VerticalLineView(polymorphic_downcast<VerticalLineItem*>(item));
57 
58 
59  else if (item->hasModelType<HorizontalLineItem>())
60  result = new HorizontalLineView(polymorphic_downcast<HorizontalLineItem*>(item));
61 
62 
63  else if (item->hasModelType<EllipseItem>())
64  result = new EllipseView(polymorphic_downcast<EllipseItem*>(item));
65 
66 
67  else if (item->hasModelType<MaskAllItem>())
68  result = new MaskAllView(polymorphic_downcast<MaskAllItem*>(item));
69 
70 
71  else if (item->hasModelType<RegionOfInterestItem>())
72  result = new RegionOfInterestView(polymorphic_downcast<RegionOfInterestItem*>(item));
73 
74 
75  else {
76  throw Error("MaskViewFactory::createSampleView() -> Error! "
77  "Can't create a view for "
78  + item->modelType());
79  }
80 
81  result->setSceneAdaptor(adaptor);
82 
83  return result;
84 }
This is a View of ellipse mask (represented by EllipseItem) on GraphicsScene. Given view follows stan...
Definition: EllipseView.h:25
This is a view of HorizontalLineItem mask.
Definition: LineViews.h:55
Main interface class for views representing MaskItems, Projections on graphics scene.
Definition: IShape2DView.h:27
This is a view of MaskAllItem which covers whole detector plane with mask value=true.
Definition: MaskAllView.h:24
Container holding various masks as children.
Definition: MaskItems.h:202
The MaskContainerView is nothing more than just transparent rectangle to cover axes area of ColorMapP...
This is a View of polygon point for PolygonMaskItem.
This is a View of polygon mask (represented by PolygonItem) on GraphicsScene.
Definition: PolygonView.h:26
A container to hold ProjectionItems, intended to store projections of color map on X,...
This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene....
Definition: RectangleView.h:25
The RegionOfInterest class represent view of RegionOfInterestItem on graphics scene.
bool hasModelType() const
Definition: SessionItem.h:421
QString modelType() const
Get model type.
This is a view of VerticalLineItem mask.
Definition: LineViews.h:25

References Error, SessionItem::hasModelType(), SessionItem::modelType(), and IShape2DView::setSceneAdaptor().

Referenced by MaskGraphicsScene::addViewForItem().

Here is the call graph for this function:

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