BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleLayoutView.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/SampleDesigner/ParticleLayoutView.cpp
6 //! @brief Implements class ParticleLayoutView
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 
20 
22 {
23  setName("ParticleLayout");
24  setColor(QColor(135, 206, 50));
27  ->setToolTip("Connect this port with the layer "
28  "to populate it with particles");
30  ->setToolTip("Connect one or several particles to this port");
32  ->setToolTip("Connect interference to this port "
33  "to have coherent scattering");
34 }
35 
36 void ParticleLayoutView::addView(IView* childView, int /* row */)
37 {
38  if (childView->type() == ViewTypes::PARTICLE) {
39  connectInputPort(dynamic_cast<ConnectableView*>(childView), 0);
40  } else if (childView->type() == ViewTypes::INTERFERENCE_FUNCTION_1D_LATTICE
46  connectInputPort(dynamic_cast<ConnectableView*>(childView), 1);
47  } else {
48  throw GUIHelpers::Error("ParticleLayoutView::addView() -> Error. Unknown view");
49  }
50 }
Defines class DesignerHelper.
Defines class GUIHelpers functions.
Defines class ParticleLayoutView.
Defines class ParticleView.
Defines class SessionItem.
view of ISampleNode's with rectangular shape and node functionality
void connectInputPort(ConnectableView *other, int port_number)
connects input port with given index with output port of other view
virtual void setColor(const QColor &color)
virtual void setRectangle(QRectF rect)
virtual NodeEditorPort * addPort(const QString &name, NodeEditorPort::EPortDirection direction, NodeEditorPort::EPortType port_type)
adds port to view
virtual void setName(const QString &name)
static QRectF getParticleLayoutBoundingRect()
parent class for graphic representation of all ISampleNode's
Definition: IView.h:25
int type() const
Definition: IView.h:54
ParticleLayoutView(QGraphicsItem *parent=0)
void addView(IView *childView, int row=0)
@ PARTICLE
Definition: ViewTypes.h:39
@ INTERFERENCE_FUNCTION_2D_LATTICE
Definition: ViewTypes.h:34
@ INTERFERENCE_FUNCTION_FINITE_2D_LATTICE
Definition: ViewTypes.h:36
@ INTERFERENCE_FUNCTION_RADIAL_PARA
Definition: ViewTypes.h:38
@ INTERFERENCE_FUNCTION_1D_LATTICE
Definition: ViewTypes.h:33
@ INTERFERENCE_FUNCTION_2D_PARA
Definition: ViewTypes.h:35
@ INTERFERENCE_FUNCTION_HARD_DISK
Definition: ViewTypes.h:37