diff --git a/GUI/Model/Job/ParameterTreeBuilder.cpp b/GUI/Model/Job/ParameterTreeBuilder.cpp index 95bbf7be1fb31bc8ae9d5b1a123b041ecaf26b50..3483dc69d887da85d87f6fbc743ce8b1bd7adc07 100644 --- a/GUI/Model/Job/ParameterTreeBuilder.cpp +++ b/GUI/Model/Job/ParameterTreeBuilder.cpp @@ -253,7 +253,7 @@ ParameterLabelItem* ParameterTreeBuilder::addItemWithParticles(ParameterLabelIte bool enableAbundance, bool enablePosition) { - auto* label = addLabel<ItemWithParticlesCatalog>(parentLabel, p); + auto* label = addLabel<ParticlesCatalog>(parentLabel, p); if (enableAbundance) addParameterItem(label, p->abundance()); diff --git a/GUI/Model/Sample/CompoundItem.cpp b/GUI/Model/Sample/CompoundItem.cpp index 8480a56e53c03ab056bc4f0d4c244b7396e6c0c8..cd11e8571b421b752a67be44f05bd6f33ea735c9 100644 --- a/GUI/Model/Sample/CompoundItem.cpp +++ b/GUI/Model/Sample/CompoundItem.cpp @@ -132,8 +132,7 @@ QVector<ItemWithParticles*> CompoundItem::itemsWithParticles() const return m_particles.toModifiableQVector(); } -PolyItem<ItemWithParticlesCatalog>& -CompoundItem::addItemWithParticleSelection(ItemWithParticles* particle) +PolyItem<ParticlesCatalog>& CompoundItem::addItemWithParticleSelection(ItemWithParticles* particle) { m_particles.emplace_item_back(particle); return m_particles.back(); diff --git a/GUI/Model/Sample/CompoundItem.h b/GUI/Model/Sample/CompoundItem.h index cb9c7de60134b128eb6379c58a8ab4b0529baa94..db54c61fe0c7d3e4c255af098a55dee151afe734 100644 --- a/GUI/Model/Sample/CompoundItem.h +++ b/GUI/Model/Sample/CompoundItem.h @@ -17,7 +17,7 @@ #include "GUI/Model/Descriptor/PolyVector.h" #include "GUI/Model/Sample/ItemWithParticles.h" -#include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include "GUI/Model/Sample/ParticlesCatalog.h" #include "Sample/Particle/Compound.h" #include <memory> @@ -33,7 +33,7 @@ public: std::unique_ptr<Compound> createCompound() const; QVector<ItemWithParticles*> itemsWithParticles() const; - PolyItem<ItemWithParticlesCatalog>& addItemWithParticleSelection(ItemWithParticles* particle); + PolyItem<ParticlesCatalog>& addItemWithParticleSelection(ItemWithParticles* particle); void removeItemWithParticle(ItemWithParticles* particle); QVector<ItemWithParticles*> containedItemsWithParticles() const override; @@ -41,7 +41,7 @@ public: bool expandCompound = true; private: - PolyVector<ItemWithParticlesCatalog> m_particles; + PolyVector<ParticlesCatalog> m_particles; const MaterialsSet* m_materials; }; diff --git a/GUI/Model/Sample/MesocrystalItem.cpp b/GUI/Model/Sample/MesocrystalItem.cpp index 0e00a707f1e3b43ebf01df5783471d17a0f557ac..5f32b101c3712479283bc3977aad2949fdf7a1f5 100644 --- a/GUI/Model/Sample/MesocrystalItem.cpp +++ b/GUI/Model/Sample/MesocrystalItem.cpp @@ -57,7 +57,7 @@ MesocrystalItem::MesocrystalItem(const MaterialsSet* materials) "vectorC"); m_outer_shape.initWithArgs("Outer Shape", "", FormFactorItemCatalog::Type::Box); - m_basis_particle.initWithArgs("Basis", "", ItemWithParticlesCatalog::Type::Particle, materials); + m_basis_particle.initWithArgs("Basis", "", ParticlesCatalog::Type::Particle, materials); } void MesocrystalItem::writeTo(QXmlStreamWriter* w) const diff --git a/GUI/Model/Sample/MesocrystalItem.h b/GUI/Model/Sample/MesocrystalItem.h index f1c91fb863cb4c330784a9c167e436509d5fcfef..ad6de6fe5faf8b3156ea7cf771b103888ff33ad5 100644 --- a/GUI/Model/Sample/MesocrystalItem.h +++ b/GUI/Model/Sample/MesocrystalItem.h @@ -20,7 +20,7 @@ #include "GUI/Model/Sample/FormFactorItemCatalog.h" #include "GUI/Model/Sample/FormFactorItems.h" #include "GUI/Model/Sample/ItemWithParticles.h" -#include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include "GUI/Model/Sample/ParticlesCatalog.h" #include "Sample/Lattice/Lattice3D.h" #include <memory> @@ -71,7 +71,7 @@ private: VectorProperty m_vectorB; VectorProperty m_vectorC; PolyItem<FormFactorItemCatalog> m_outer_shape; - PolyItem<ItemWithParticlesCatalog> m_basis_particle; + PolyItem<ParticlesCatalog> m_basis_particle; const MaterialsSet* m_materials; }; diff --git a/GUI/Model/Sample/ParticleLayoutItem.cpp b/GUI/Model/Sample/ParticleLayoutItem.cpp index ae2961053e433d25977e7ab06eb98df848b28069..9e1d6443715c9d49baadf6a7d8325f41122f3c31 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.cpp +++ b/GUI/Model/Sample/ParticleLayoutItem.cpp @@ -156,9 +156,9 @@ void ParticleLayoutItem::readFrom(QXmlStreamReader* r) // particle } else if (tag == Tag::Particle) { - PolyItem<ItemWithParticlesCatalog> p; - p.readFrom(r, m_materials); - m_particles.emplace_item_back(p.releaseItem()); + PolyItem<ParticlesCatalog> p; + p.readFrom(r, m_materials); + m_particles.emplace_item_back(p.releaseItem()); XML::gotoEndElementOfTag(r, tag); // layout groupbox: is expanded? diff --git a/GUI/Model/Sample/ParticleLayoutItem.h b/GUI/Model/Sample/ParticleLayoutItem.h index 3f9feeca95ad6a51e074679c78a3161a21043b38..553ff4c2d5472aa74975c22f29be0cf663e80c7e 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.h +++ b/GUI/Model/Sample/ParticleLayoutItem.h @@ -20,7 +20,7 @@ #include "GUI/Model/Sample/InterferenceItemCatalog.h" #include "GUI/Model/Sample/InterferenceItems.h" #include "GUI/Model/Sample/Item3D.h" -#include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include "GUI/Model/Sample/ParticlesCatalog.h" class ItemWithParticles; class MaterialsSet; @@ -76,7 +76,7 @@ public: private: DoubleProperty m_own_density; PolyItem<InterferenceItemCatalog> m_interference; - PolyVector<ItemWithParticlesCatalog> m_particles; + PolyVector<ParticlesCatalog> m_particles; const MaterialsSet* m_materials; }; diff --git a/GUI/Model/Sample/ItemWithParticlesCatalog.cpp b/GUI/Model/Sample/ParticlesCatalog.cpp similarity index 79% rename from GUI/Model/Sample/ItemWithParticlesCatalog.cpp rename to GUI/Model/Sample/ParticlesCatalog.cpp index 16594dd518447d080da2baf3fc7dd64a522c03f5..d3cd6153925c5e5441d17a776efdb8deec1160c2 100644 --- a/GUI/Model/Sample/ItemWithParticlesCatalog.cpp +++ b/GUI/Model/Sample/ParticlesCatalog.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Model/Sample/ItemWithParticlesCatalog.cpp -//! @brief Implements class ItemWithParticlesCatalog. +//! @file GUI/Model/Sample/ParticlesCatalog.cpp +//! @brief Implements class ParticlesCatalog. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,14 +12,14 @@ // // ************************************************************************************************ -#include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include "GUI/Model/Sample/ParticlesCatalog.h" #include "Base/Util/Assert.h" #include "GUI/Model/Sample/CompoundItem.h" #include "GUI/Model/Sample/CoreAndShellItem.h" #include "GUI/Model/Sample/MesocrystalItem.h" #include "GUI/Model/Sample/ParticleItem.h" -ItemWithParticles* ItemWithParticlesCatalog::create(Type type, const MaterialsSet* materials) +ItemWithParticles* ParticlesCatalog::create(Type type, const MaterialsSet* materials) { switch (type) { case Type::Particle: @@ -35,17 +35,17 @@ ItemWithParticles* ItemWithParticlesCatalog::create(Type type, const MaterialsSe } } -QVector<ItemWithParticlesCatalog::Type> ItemWithParticlesCatalog::types() +QVector<ParticlesCatalog::Type> ParticlesCatalog::types() { return {Type::Particle, Type::Composition, Type::CoreShell, Type::Mesocrystal}; } -QVector<ItemWithParticlesCatalog::Type> ItemWithParticlesCatalog::assemblyTypes() +QVector<ParticlesCatalog::Type> ParticlesCatalog::assemblyTypes() { return {Type::Composition, Type::CoreShell, Type::Mesocrystal}; } -UiInfo ItemWithParticlesCatalog::uiInfo(Type type) +UiInfo ParticlesCatalog::uiInfo(Type type) { switch (type) { case Type::Particle: @@ -64,7 +64,7 @@ UiInfo ItemWithParticlesCatalog::uiInfo(Type type) } } -ItemWithParticlesCatalog::Type ItemWithParticlesCatalog::type(const ItemWithParticles* item) +ParticlesCatalog::Type ParticlesCatalog::type(const ItemWithParticles* item) { ASSERT(item); diff --git a/GUI/Model/Sample/ItemWithParticlesCatalog.h b/GUI/Model/Sample/ParticlesCatalog.h similarity index 79% rename from GUI/Model/Sample/ItemWithParticlesCatalog.h rename to GUI/Model/Sample/ParticlesCatalog.h index f744195b4aea5573863524e0ebd92877f36ca290..11928856fe22d15aa43ffe440317cbac5cb2f344 100644 --- a/GUI/Model/Sample/ItemWithParticlesCatalog.h +++ b/GUI/Model/Sample/ParticlesCatalog.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Model/Sample/ItemWithParticlesCatalog.h -//! @brief Defines class ItemWithParticlesCatalog. +//! @file GUI/Model/Sample/ParticlesCatalog.h +//! @brief Defines class ParticlesCatalog. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_ITEMWITHPARTICLESCATALOG_H -#define BORNAGAIN_GUI_MODEL_SAMPLE_ITEMWITHPARTICLESCATALOG_H +#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLESCATALOG_H +#define BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLESCATALOG_H #include "GUI/Model/Type/UiInfo.h" #include <QVector> @@ -21,7 +21,7 @@ class ItemWithParticles; class MaterialsSet; -class ItemWithParticlesCatalog { +class ParticlesCatalog { public: // used in PolyItem<Catalog> using BaseType = ItemWithParticles; @@ -44,4 +44,4 @@ public: static Type type(const ItemWithParticles* item); }; -#endif // BORNAGAIN_GUI_MODEL_SAMPLE_ITEMWITHPARTICLESCATALOG_H +#endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLESCATALOG_H diff --git a/GUI/View/Sample/CompoundForm.cpp b/GUI/View/Sample/CompoundForm.cpp index d01a1208dd94ea6e27de5c98c1b6c980636f4a72..3ccefe1ed7118ca13586e00551c0cc78f01e4d42 100644 --- a/GUI/View/Sample/CompoundForm.cpp +++ b/GUI/View/Sample/CompoundForm.cpp @@ -39,7 +39,7 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd auto* btn = GUI::Util::Layer::createAddParticleButton( this, [=](FormFactorItemCatalog::Type type) { ec->addCompoundItem(compoundItem, type); }, - [=](ItemWithParticlesCatalog::Type type) { ec->addCompoundItem(compoundItem, type); }); + [=](ParticlesCatalog::Type type) { ec->addCompoundItem(compoundItem, type); }); m_structure_editing_widgets << btn; m_layout->addStructureEditingRow(btn); diff --git a/GUI/View/Sample/LayerEditorUtil.cpp b/GUI/View/Sample/LayerEditorUtil.cpp index 3e8d8435a472fc5fa4a9673a5b6df32c3bd0c142..d04dd64ae41954b7d53b43924e03e258ff40fd14 100644 --- a/GUI/View/Sample/LayerEditorUtil.cpp +++ b/GUI/View/Sample/LayerEditorUtil.cpp @@ -102,7 +102,7 @@ QWidget* GUI::Util::Layer::createWidgetForItemWithParticles(QWidget* parentWidge QPushButton* GUI::Util::Layer::createAddParticleButton( QWidget* parentWidget, std::function<void(FormFactorItemCatalog::Type t)> slotAddFormFactor, - std::function<void(ItemWithParticlesCatalog::Type t)> slotAddParticle) + std::function<void(ParticlesCatalog::Type t)> slotAddParticle) { auto* btn = new QPushButton("Add particle", parentWidget); @@ -128,10 +128,9 @@ QPushButton* GUI::Util::Layer::createAddParticleButton( } group("Particle assemblies"); - for (const auto type : - {ItemWithParticlesCatalog::Type::Composition, ItemWithParticlesCatalog::Type::CoreShell, - ItemWithParticlesCatalog::Type::Mesocrystal}) { - const auto ui = ItemWithParticlesCatalog::uiInfo(type); + for (const auto type : {ParticlesCatalog::Type::Composition, ParticlesCatalog::Type::CoreShell, + ParticlesCatalog::Type::Mesocrystal}) { + const auto ui = ParticlesCatalog::uiInfo(type); QAction* a = menuForEntries->addAction(QIcon(ui.iconPath), ui.menuEntry); a->setToolTip(ui.description); QObject::connect(a, &QAction::triggered, [=] { slotAddParticle(type); }); diff --git a/GUI/View/Sample/LayerEditorUtil.h b/GUI/View/Sample/LayerEditorUtil.h index 9194c40670804ced4daf0713f933fce0359d3edd..19aac79307ec807913cbdf84e25a50d892a540a5 100644 --- a/GUI/View/Sample/LayerEditorUtil.h +++ b/GUI/View/Sample/LayerEditorUtil.h @@ -17,7 +17,7 @@ #include "GUI/Model/Descriptor/DoubleProperty.h" #include "GUI/Model/Sample/FormFactorItemCatalog.h" -#include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include "GUI/Model/Sample/ParticlesCatalog.h" #include <QGridLayout> #include <QLabel> #include <QPushButton> @@ -59,7 +59,7 @@ QWidget* createWidgetForItemWithParticles(QWidget* parentWidget, QPushButton* createAddParticleButton(QWidget* parentWidget, std::function<void(FormFactorItemCatalog::Type t)> slotAddFormFactor, - std::function<void(ItemWithParticlesCatalog::Type t)> slotAddParticle); + std::function<void(ParticlesCatalog::Type t)> slotAddParticle); QVector<QColor> predefinedLayerColors(); diff --git a/GUI/View/Sample/MesocrystalForm.cpp b/GUI/View/Sample/MesocrystalForm.cpp index e286413122f9d76b17c271a4d3790c1dc2562da6..3ae25f5ed5615ee5814d14b1a6332f87e4136f7e 100644 --- a/GUI/View/Sample/MesocrystalForm.cpp +++ b/GUI/View/Sample/MesocrystalForm.cpp @@ -85,10 +85,10 @@ QComboBox* MesocrystalForm::createBasisCombo(QWidget* parent, ItemWithParticles* if (FormFactorItemCatalog::type(p->formFactorItem()) == type) currentData = static_cast<uint32_t>(type); } - for (auto type : ItemWithParticlesCatalog::assemblyTypes()) { - const auto ui = ItemWithParticlesCatalog::uiInfo(type); + for (auto type : ParticlesCatalog::assemblyTypes()) { + const auto ui = ParticlesCatalog::uiInfo(type); combo->addItem(QIcon(ui.iconPath), ui.menuEntry, 1000 + static_cast<uint32_t>(type)); - if (ItemWithParticlesCatalog::type(current) == type) + if (ParticlesCatalog::type(current) == type) currentData = 1000 + static_cast<uint32_t>(type); } @@ -110,8 +110,7 @@ void MesocrystalForm::onBasisComboChanged() if (currentData < 1000) m_ec->setMesocrystalBasis(this, static_cast<FormFactorItemCatalog::Type>(currentData)); else - m_ec->setMesocrystalBasis(this, - static_cast<ItemWithParticlesCatalog::Type>(currentData - 1000)); + m_ec->setMesocrystalBasis(this, static_cast<ParticlesCatalog::Type>(currentData - 1000)); } void MesocrystalForm::createBasisWidgets() diff --git a/GUI/View/Sample/ParticleLayoutForm.cpp b/GUI/View/Sample/ParticleLayoutForm.cpp index a61f331d36e3f1d6f2445cfe455ae9aaadcbce49..b76be42127f82ce03ca9893e80e779ea551b3703 100644 --- a/GUI/View/Sample/ParticleLayoutForm.cpp +++ b/GUI/View/Sample/ParticleLayoutForm.cpp @@ -52,7 +52,7 @@ ParticleLayoutForm::ParticleLayoutForm(LayerForm* form, ParticleLayoutItem* pLay auto* btn = GUI::Util::Layer::createAddParticleButton( this, [=](FormFactorItemCatalog::Type type) { ec->addParticleLayoutItem(pLayoutItem, type); }, - [=](ItemWithParticlesCatalog::Type type) { ec->addParticleLayoutItem(pLayoutItem, type); }); + [=](ParticlesCatalog::Type type) { ec->addParticleLayoutItem(pLayoutItem, type); }); m_structure_editing_widgets << btn; m_layout->addStructureEditingRow(btn); diff --git a/GUI/View/Sample/SampleEditorController.cpp b/GUI/View/Sample/SampleEditorController.cpp index cfd04a3ca48ecdff31a717009d845d38b2fe1c6c..e8c0ef1273ebaede7ebcdb1f42d8e00e75853568 100644 --- a/GUI/View/Sample/SampleEditorController.cpp +++ b/GUI/View/Sample/SampleEditorController.cpp @@ -183,7 +183,7 @@ void SampleEditorController::addParticleLayoutItem(ParticleLayoutItem* layout, } void SampleEditorController::addParticleLayoutItem(ParticleLayoutItem* layout, - ItemWithParticlesCatalog::Type type) + ParticlesCatalog::Type type) { auto* newItem = createAndInitItem(type); layout->addItemWithParticleSelection(newItem); @@ -192,7 +192,7 @@ void SampleEditorController::addParticleLayoutItem(ParticleLayoutItem* layout, void SampleEditorController::duplicateItemWithParticles(ItemWithParticles* item) { - auto type = ItemWithParticlesCatalog::type(item); + auto type = ParticlesCatalog::type(item); auto* newItem = createAndInitItem(type); GUI::Util::copyContents(item, newItem); @@ -219,7 +219,7 @@ void SampleEditorController::onParticleCompoundAdded(CompoundItem* composition, } void SampleEditorController::addCompoundItem(CompoundItem* compositionItem, - ItemWithParticlesCatalog::Type type) + ParticlesCatalog::Type type) { auto* newItem = createAndInitItem(type); compositionItem->addItemWithParticleSelection(newItem); @@ -243,10 +243,9 @@ SampleEditorController::createAndInitItem(FormFactorItemCatalog::Type formFactor return newParticle; } -ItemWithParticles* -SampleEditorController::createAndInitItem(ItemWithParticlesCatalog::Type type) const +ItemWithParticles* SampleEditorController::createAndInitItem(ParticlesCatalog::Type type) const { - auto* newItem = ItemWithParticlesCatalog::create(type, materialModel()); + auto* newItem = ParticlesCatalog::create(type, materialModel()); if (auto* p = dynamic_cast<ItemWithMaterial*>(newItem)) p->setMaterial(materialModel()->defaultMaterialItem()); @@ -416,7 +415,7 @@ void SampleEditorController::setSampleDescription(const QString& description) } void SampleEditorController::setMesocrystalBasis(MesocrystalForm* widget, - ItemWithParticlesCatalog::Type type) + ParticlesCatalog::Type type) { auto* meso = widget->mesocrystalItem(); meso->setBasisItem(createAndInitItem(type)); diff --git a/GUI/View/Sample/SampleEditorController.h b/GUI/View/Sample/SampleEditorController.h index d19e47c7f7a653d75d362a8de6db77b44d597fc3..d4374458638f1822d6b78b38722bdfcf7d1ee79f 100644 --- a/GUI/View/Sample/SampleEditorController.h +++ b/GUI/View/Sample/SampleEditorController.h @@ -16,7 +16,7 @@ #define BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLEEDITORCONTROLLER_H #include "GUI/Model/Sample/FormFactorItemCatalog.h" -#include "GUI/Model/Sample/ItemWithParticlesCatalog.h" +#include "GUI/Model/Sample/ParticlesCatalog.h" #include <QObject> class CompoundItem; @@ -74,12 +74,12 @@ public: void removeLayoutItem(LayerForm* layerForm, ParticleLayoutItem* layout); void onParticleLayoutAdded(ParticleLayoutItem* layout, ItemWithParticles* newItem); - void addParticleLayoutItem(ParticleLayoutItem* layout, ItemWithParticlesCatalog::Type type); + void addParticleLayoutItem(ParticleLayoutItem* layout, ParticlesCatalog::Type type); void addParticleLayoutItem(ParticleLayoutItem* layout, FormFactorItemCatalog::Type type); ParticleLayoutItem* parentLayoutItem(ItemWithParticles* item); void onParticleCompoundAdded(CompoundItem* composition, ItemWithParticles* newItem); - void addCompoundItem(CompoundItem* composition, ItemWithParticlesCatalog::Type type); + void addCompoundItem(CompoundItem* composition, ParticlesCatalog::Type type); void addCompoundItem(CompoundItem* composition, FormFactorItemCatalog::Type type); CompoundItem* parentCompoundItem(ItemWithParticles* item); @@ -89,7 +89,7 @@ public: void setCoreFormFactor(CoreAndShellForm* widget, FormFactorItemCatalog::Type type); void setShellFormFactor(CoreAndShellForm* widget, FormFactorItemCatalog::Type type); - void setMesocrystalBasis(MesocrystalForm* widget, ItemWithParticlesCatalog::Type type); + void setMesocrystalBasis(MesocrystalForm* widget, ParticlesCatalog::Type type); void setMesocrystalBasis(MesocrystalForm* widget, FormFactorItemCatalog::Type type); void selectInterference(InterferenceForm* widget, int newIndex); void setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool value); @@ -120,7 +120,7 @@ signals: private: ItemWithParticles* createAndInitItem(FormFactorItemCatalog::Type formFactorType) const; - ItemWithParticles* createAndInitItem(ItemWithParticlesCatalog::Type itemType) const; + ItemWithParticles* createAndInitItem(ParticlesCatalog::Type itemType) const; SampleItem* m_sample_item; SampleForm* m_sample_form;