BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskViewFactory.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/MaskWidgets/MaskViewFactory.cpp
6 //! @brief Implements class MaskViewFactory
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
26 
28 {
29  IShape2DView* result(0);
30  QString model_type = item->modelType();
31 
32  if (model_type == "MaskContainer") {
33  result = new MaskContainerView();
34  }
35 
36  else if (model_type == "ProjectionContainer") {
37  result = new MaskContainerView();
38  }
39 
40  else if (model_type == "RectangleMask") {
41  result = new RectangleView();
42  }
43 
44  else if (model_type == "PolygonMask") {
45  result = new PolygonView();
46  }
47 
48  else if (model_type == "PolygonPoint") {
49  result = new PolygonPointView();
50  }
51 
52  else if (model_type == "VerticalLineMask") {
53  result = new VerticalLineView();
54  }
55 
56  else if (model_type == "HorizontalLineMask") {
57  result = new HorizontalLineView();
58  }
59 
60  else if (model_type == "EllipseMask") {
61  result = new EllipseView();
62  }
63 
64  else if (model_type == "MaskAllMask") {
65  result = new MaskAllView();
66  }
67 
68  else if (model_type == "RegionOfInterest") {
69  result = new RegionOfInterestView();
70  }
71 
72  else {
73  throw GUIHelpers::Error("MaskViewFactory::createSampleView() -> Error! "
74  "Can't create a view for "
75  + model_type);
76  }
77 
78  result->setParameterizedItem(item);
79  result->setSceneAdaptor(adaptor);
80 
81  return result;
82 }
Defines EllipseView class.
Defines class GUIHelpers functions.
Defines IntensityDataView class.
Defines classes VerticalLineView and HorizontalLineView.
Defines MaskAllView class.
Defines MaskContainerView class.
Defines class MaskViewFactory.
Defines PolygonPointView class.
Defines PolygonView class.
Defines RegionOfInterestView class.
Defines class SessionItem.
This is a View of ellipse mask (represented by EllipseItem) on GraphicsScene.
Definition: EllipseView.h:23
This is a view of HorizontalLineItem mask.
Definition: LineViews.h:42
Interface to adapt MaskItems coordinates (expressed in units of IntensityDataItem) to/from scene coor...
Definition: ISceneAdaptor.h:24
Main interface class for views representing MaskItems, Projections on graphics scene.
Definition: IShape2DView.h:27
void setSceneAdaptor(const ISceneAdaptor *adaptor)
virtual void setParameterizedItem(SessionItem *item)
This is a view of MaskAllItem which covers whole detector plane with mask value=true.
Definition: MaskAllView.h:22
The MaskContainerView is nothing move than just transparent rectangle to cover axes area of ColorMapP...
static IShape2DView * createMaskView(SessionItem *item, ISceneAdaptor *adaptor=0)
This is a View of polygon point for PolygonMaskItem.
This is a View of polygon mask (represented by PolygonItem) on GraphicsScene.
Definition: PolygonView.h:23
This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene.
Definition: RectangleView.h:23
The RegionOfInterest class represent view of RegionOfInterestItem on graphics scene.
QString modelType() const
Get model type.
This is a view of VerticalLineItem mask.
Definition: LineViews.h:22
std::string model_type
Definition: types.h:23