Skip to content
Snippets Groups Projects
Commit 53cebe22 authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Added view class for ParticleDistribution

parent 717d4995
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,8 @@ class BA_CORE_API_ FormFactorItem : public ParameterizedItem ...@@ -23,7 +23,8 @@ class BA_CORE_API_ FormFactorItem : public ParameterizedItem
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit FormFactorItem(const QString name, ParameterizedItem *parent) : ParameterizedItem(name, parent){} explicit FormFactorItem(const QString name, ParameterizedItem *parent)
: ParameterizedItem(name, parent) {}
virtual IFormFactor *createFormFactor() const{ return 0;} virtual IFormFactor *createFormFactor() const{ return 0;}
virtual ~FormFactorItem(){} virtual ~FormFactorItem(){}
}; };
......
#include "ParticleDistributionView.h"
#include "ParameterizedItem.h"
#include <QDebug>
ParticleDistributionView::ParticleDistributionView(QGraphicsItem *parent)
: ConnectableView(parent)
{
setName(Constants::ParticleDistributionType);
setLabel("Distributed\nparticle");
setColor(DesignerHelper::getDefaultParticleColor());
setRectangle(DesignerHelper::getDefaultBoundingRect(Constants::ParticleDistributionType));
addPort("out", NodeEditorPort::Output, NodeEditorPort::FormFactor);
addPort("core", NodeEditorPort::Input, NodeEditorPort::FormFactor);
addPort("shell", NodeEditorPort::Input, NodeEditorPort::FormFactor);
m_roundpar = 5;
m_label_vspace = 45;
}
void ParticleDistributionView::addView(IView *childView, int /* row */)
{
int index = childView->getParameterizedItem()->getRegisteredProperty(ParameterizedItem::P_PORT).toInt();
qDebug() << "ParticleDistributionType::addView()" << index;
connectInputPort(dynamic_cast<ConnectableView *>(childView), index);
}
#ifndef PARTICLEDISTRIBUTIONVIEW_H
#define PARTICLEDISTRIBUTIONVIEW_H
#include "ConnectableView.h"
//! Class representing view of distributed particle item
class BA_CORE_API_ ParticleDistributionView : public ConnectableView
{
Q_OBJECT
public:
enum { Type = DesignerHelper::ParticleType };
ParticleDistributionView(QGraphicsItem *parent = 0);
int type() const { return Type; }
void addView(IView *childView, int row = 0);
};
#endif
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ParticleView.h" #include "ParticleView.h"
#include "TransformationView.h" #include "TransformationView.h"
#include "ParticleCoreShellView.h" #include "ParticleCoreShellView.h"
#include "ParticleDistributionView.h"
#include "InterferenceFunctionViews.h" #include "InterferenceFunctionViews.h"
#include "GUIHelpers.h" #include "GUIHelpers.h"
#include <QDebug> #include <QDebug>
...@@ -18,6 +19,7 @@ QStringList SampleViewFactory::m_valid_item_names = QStringList() ...@@ -18,6 +19,7 @@ QStringList SampleViewFactory::m_valid_item_names = QStringList()
<< Constants::ParticleType << Constants::ParticleType
<< Constants::TransformationType << Constants::TransformationType
<< Constants::ParticleCoreShellType << Constants::ParticleCoreShellType
<< Constants::ParticleDistributionType
<< Constants::InterferenceFunction1DParaCrystalType << Constants::InterferenceFunction1DParaCrystalType
<< Constants::InterferenceFunction2DParaCrystalType << Constants::InterferenceFunction2DParaCrystalType
<< Constants::InterferenceFunction2DLatticeType; << Constants::InterferenceFunction2DLatticeType;
...@@ -53,6 +55,9 @@ IView *SampleViewFactory::createSampleView(const QString &name) ...@@ -53,6 +55,9 @@ IView *SampleViewFactory::createSampleView(const QString &name)
else if (name==Constants::ParticleCoreShellType) { else if (name==Constants::ParticleCoreShellType) {
return new ParticleCoreShellView(); return new ParticleCoreShellView();
} }
else if (name==Constants::ParticleDistributionType) {
return new ParticleDistributionView();
}
else if (name==Constants::InterferenceFunction1DParaCrystalType) { else if (name==Constants::InterferenceFunction1DParaCrystalType) {
return new InterferenceFunction1DParaCrystalView(); return new InterferenceFunction1DParaCrystalView();
} }
......
...@@ -232,6 +232,14 @@ ...@@ -232,6 +232,14 @@
</widget> </widget>
</categoryentry> </categoryentry>
<categoryentry name="Distributed particle" icon="images/ParticleCoreShell.png">
<widget class="ParticleDistribution">
<property name="objectName">
<string notr="true">somestring</string>
</property>
</widget>
</categoryentry>
</category> </category>
<category name="Standard samples"> <category name="Standard samples">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment