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
15
#include "
GUI/coregui/Views/SampleDesigner/ParticleLayoutView.h
"
16
#include "
GUI/coregui/Models/SessionItem.h
"
17
#include "
GUI/coregui/Views/SampleDesigner/DesignerHelper.h
"
18
#include "
GUI/coregui/Views/SampleDesigner/ParticleView.h
"
19
#include "
GUI/coregui/utils/GUIHelpers.h
"
20
21
ParticleLayoutView::ParticleLayoutView
(QGraphicsItem* parent) :
ConnectableView
(parent)
22
{
23
setName
(
"ParticleLayout"
);
24
setColor
(QColor(135, 206, 50));
25
setRectangle
(
DesignerHelper::getParticleLayoutBoundingRect
());
26
addPort
(
"out"
,
NodeEditorPort::OUTPUT
,
NodeEditorPort::PARTICLE_LAYOUT
)
27
->setToolTip(
"Connect this port with the layer "
28
"to populate it with particles"
);
29
addPort
(
"particle"
,
NodeEditorPort::INPUT
,
NodeEditorPort::FORM_FACTOR
)
30
->setToolTip(
"Connect one or several particles to this port"
);
31
addPort
(
"interference"
,
NodeEditorPort::INPUT
,
NodeEditorPort::INTERFERENCE
)
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
41
|| childView->
type
() ==
ViewTypes::INTERFERENCE_FUNCTION_2D_LATTICE
42
|| childView->
type
() ==
ViewTypes::INTERFERENCE_FUNCTION_2D_PARA
43
|| childView->
type
() ==
ViewTypes::INTERFERENCE_FUNCTION_FINITE_2D_LATTICE
44
|| childView->
type
() ==
ViewTypes::INTERFERENCE_FUNCTION_HARD_DISK
45
|| childView->
type
() ==
ViewTypes::INTERFERENCE_FUNCTION_RADIAL_PARA
) {
46
connectInputPort
(
dynamic_cast<
ConnectableView
*
>
(childView), 1);
47
}
else
{
48
throw
GUIHelpers::Error
(
"ParticleLayoutView::addView() -> Error. Unknown view"
);
49
}
50
}
DesignerHelper.h
Defines class DesignerHelper.
GUIHelpers.h
Defines class GUIHelpers functions.
ParticleLayoutView.h
Defines class ParticleLayoutView.
ParticleView.h
Defines class ParticleView.
SessionItem.h
Defines class SessionItem.
ConnectableView
view of ISampleNode's with rectangular shape and node functionality
Definition:
ConnectableView.h:27
ConnectableView::connectInputPort
void connectInputPort(ConnectableView *other, int port_number)
connects input port with given index with output port of other view
Definition:
ConnectableView.cpp:90
ConnectableView::setColor
virtual void setColor(const QColor &color)
Definition:
ConnectableView.h:57
ConnectableView::setRectangle
virtual void setRectangle(QRectF rect)
Definition:
ConnectableView.h:40
ConnectableView::addPort
virtual NodeEditorPort * addPort(const QString &name, NodeEditorPort::EPortDirection direction, NodeEditorPort::EPortType port_type)
adds port to view
Definition:
ConnectableView.cpp:68
ConnectableView::setName
virtual void setName(const QString &name)
Definition:
ConnectableView.h:56
DesignerHelper::getParticleLayoutBoundingRect
static QRectF getParticleLayoutBoundingRect()
Definition:
DesignerHelper.cpp:240
GUIHelpers::Error
Definition:
GUIHelpers.h:27
IView
parent class for graphic representation of all ISampleNode's
Definition:
IView.h:25
IView::type
int type() const
Definition:
IView.h:54
NodeEditorPort::PARTICLE_LAYOUT
@ PARTICLE_LAYOUT
Definition:
NodeEditorPort.h:34
NodeEditorPort::INTERFERENCE
@ INTERFERENCE
Definition:
NodeEditorPort.h:34
NodeEditorPort::FORM_FACTOR
@ FORM_FACTOR
Definition:
NodeEditorPort.h:34
NodeEditorPort::OUTPUT
@ OUTPUT
Definition:
NodeEditorPort.h:37
NodeEditorPort::INPUT
@ INPUT
Definition:
NodeEditorPort.h:37
ParticleLayoutView::ParticleLayoutView
ParticleLayoutView(QGraphicsItem *parent=0)
Definition:
ParticleLayoutView.cpp:21
ParticleLayoutView::addView
void addView(IView *childView, int row=0)
Definition:
ParticleLayoutView.cpp:36
ViewTypes::PARTICLE
@ PARTICLE
Definition:
ViewTypes.h:39
ViewTypes::INTERFERENCE_FUNCTION_2D_LATTICE
@ INTERFERENCE_FUNCTION_2D_LATTICE
Definition:
ViewTypes.h:34
ViewTypes::INTERFERENCE_FUNCTION_FINITE_2D_LATTICE
@ INTERFERENCE_FUNCTION_FINITE_2D_LATTICE
Definition:
ViewTypes.h:36
ViewTypes::INTERFERENCE_FUNCTION_RADIAL_PARA
@ INTERFERENCE_FUNCTION_RADIAL_PARA
Definition:
ViewTypes.h:38
ViewTypes::INTERFERENCE_FUNCTION_1D_LATTICE
@ INTERFERENCE_FUNCTION_1D_LATTICE
Definition:
ViewTypes.h:33
ViewTypes::INTERFERENCE_FUNCTION_2D_PARA
@ INTERFERENCE_FUNCTION_2D_PARA
Definition:
ViewTypes.h:35
ViewTypes::INTERFERENCE_FUNCTION_HARD_DISK
@ INTERFERENCE_FUNCTION_HARD_DISK
Definition:
ViewTypes.h:37
GUI
coregui
Views
SampleDesigner
ParticleLayoutView.cpp
Generated by
1.9.1