diff --git a/GUI/Model/Job/ParameterTreeBuilder.cpp b/GUI/Model/Job/ParameterTreeBuilder.cpp index 3308f130c39d4206f8d6d7cfcf6f6d239b475fb0..0b2db692f947a50ea198c839bdabe43bbb091715 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<ParticlesCatalog>(parentLabel, p); + auto* label = addLabel<ParticleCatalog>(parentLabel, p); if (enableAbundance) addParameterItem(label, p->abundance()); diff --git a/GUI/Model/Sample/CompoundItem.cpp b/GUI/Model/Sample/CompoundItem.cpp index 064e50ee10e036cc966195df91e3ced7079a90c0..20e07185a9fd8bc7a1b876e5b03348945e7fff28 100644 --- a/GUI/Model/Sample/CompoundItem.cpp +++ b/GUI/Model/Sample/CompoundItem.cpp @@ -18,8 +18,8 @@ #include "GUI/Model/Descriptor/PolyItem.h" #include "GUI/Model/Sample/CoreAndShellItem.h" #include "GUI/Model/Sample/MesocrystalItem.h" +#include "GUI/Model/Sample/ParticleCatalog.h" #include "GUI/Model/Sample/ParticleItem.h" -#include "GUI/Model/Sample/ParticlesCatalog.h" #include "Sample/Particle/Compound.h" #include "Sample/Particle/CoreAndShell.h" #include "Sample/Particle/Mesocrystal.h" @@ -67,7 +67,7 @@ void CompoundItem::writeTo(QXmlStreamWriter* w) const // particles for (auto* t : m_particles) { w->writeStartElement(Tag::Particle); - PolyItem<ParticlesCatalog>::writeItemTo(t, w); + PolyItem<ParticleCatalog>::writeItemTo(t, w); w->writeEndElement(); } XML::writeTaggedValue(w, Tag::ExpandCompoundGroupbox, expandCompound); @@ -86,7 +86,7 @@ void CompoundItem::readFrom(QXmlStreamReader* r) XML::readBaseElement<ItemWithParticles>(r, tag, this); else if (tag == Tag::Particle) { MaterialsSet* dummy = nullptr; - m_particles.push_back(PolyItem<ParticlesCatalog>().readItemFrom(r, dummy)); // TODO + m_particles.push_back(PolyItem<ParticleCatalog>().readItemFrom(r, dummy)); // TODO XML::gotoEndElementOfTag(r, tag); } else if (tag == Tag::ExpandCompoundGroupbox) expandCompound = XML::readTaggedBool(r, tag); diff --git a/GUI/Model/Sample/MesocrystalItem.cpp b/GUI/Model/Sample/MesocrystalItem.cpp index ae6d9fb7e985e8aaf9867f9943678cfd239a712c..eb9455bed371cb4f18268ad60155f35b9bb29834 100644 --- a/GUI/Model/Sample/MesocrystalItem.cpp +++ b/GUI/Model/Sample/MesocrystalItem.cpp @@ -58,7 +58,7 @@ MesocrystalItem::MesocrystalItem(const MaterialsSet*) "vectorC"); m_outer_shape.initWithArgs("Outer Shape", "", FormfactorCatalog::Type::Box); - m_basis_particle.initWithArgs("Basis", "", ParticlesCatalog::Type::Particle, nullptr); + m_basis_particle.initWithArgs("Basis", "", ParticleCatalog::Type::Particle, nullptr); } void MesocrystalItem::writeTo(QXmlStreamWriter* w) const diff --git a/GUI/Model/Sample/MesocrystalItem.h b/GUI/Model/Sample/MesocrystalItem.h index aa40f05e956e874210e125417caa104fdd2384cf..2469b05f588d43361e5efb5a93b2bc95e50c7506 100644 --- a/GUI/Model/Sample/MesocrystalItem.h +++ b/GUI/Model/Sample/MesocrystalItem.h @@ -20,7 +20,7 @@ #include "GUI/Model/Sample/FormfactorCatalog.h" #include "GUI/Model/Sample/FormfactorItems.h" #include "GUI/Model/Sample/ItemWithParticles.h" -#include "GUI/Model/Sample/ParticlesCatalog.h" +#include "GUI/Model/Sample/ParticleCatalog.h" #include "Sample/Lattice/Lattice3D.h" #include <memory> @@ -71,7 +71,7 @@ private: VectorProperty m_vectorB; VectorProperty m_vectorC; PolyItem<FormfactorCatalog> m_outer_shape; - PolyItem<ParticlesCatalog> m_basis_particle; + PolyItem<ParticleCatalog> m_basis_particle; }; template <typename T> T* MesocrystalItem::setOuterShapeType() diff --git a/GUI/Model/Sample/ParticlesCatalog.cpp b/GUI/Model/Sample/ParticleCatalog.cpp similarity index 82% rename from GUI/Model/Sample/ParticlesCatalog.cpp rename to GUI/Model/Sample/ParticleCatalog.cpp index b542b12361c8b32cdd48fb0e4364f0d0876c41e9..25afa2b3348d17a139e7822b4c5b046e2d00b893 100644 --- a/GUI/Model/Sample/ParticlesCatalog.cpp +++ b/GUI/Model/Sample/ParticleCatalog.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Model/Sample/ParticlesCatalog.cpp -//! @brief Implements class ParticlesCatalog. +//! @file GUI/Model/Sample/ParticleCatalog.cpp +//! @brief Implements class ParticleCatalog. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,14 +12,14 @@ // // ************************************************************************************************ -#include "GUI/Model/Sample/ParticlesCatalog.h" +#include "GUI/Model/Sample/ParticleCatalog.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* ParticlesCatalog::create(Type type, const MaterialsSet* materials) +ItemWithParticles* ParticleCatalog::create(Type type, const MaterialsSet* materials) { switch (type) { case Type::Particle: @@ -35,17 +35,17 @@ ItemWithParticles* ParticlesCatalog::create(Type type, const MaterialsSet* mater } } -QVector<ParticlesCatalog::Type> ParticlesCatalog::types() +QVector<ParticleCatalog::Type> ParticleCatalog::types() { return {Type::Particle, Type::Composition, Type::CoreShell, Type::Mesocrystal}; } -QVector<ParticlesCatalog::Type> ParticlesCatalog::assemblyTypes() +QVector<ParticleCatalog::Type> ParticleCatalog::assemblyTypes() { return {Type::Composition, Type::CoreShell, Type::Mesocrystal}; } -UiInfo ParticlesCatalog::uiInfo(Type type) +UiInfo ParticleCatalog::uiInfo(Type type) { switch (type) { case Type::Particle: @@ -64,7 +64,7 @@ UiInfo ParticlesCatalog::uiInfo(Type type) } } -ParticlesCatalog::Type ParticlesCatalog::type(const ItemWithParticles* item) +ParticleCatalog::Type ParticleCatalog::type(const ItemWithParticles* item) { ASSERT(item); diff --git a/GUI/Model/Sample/ParticlesCatalog.h b/GUI/Model/Sample/ParticleCatalog.h similarity index 81% rename from GUI/Model/Sample/ParticlesCatalog.h rename to GUI/Model/Sample/ParticleCatalog.h index 11928856fe22d15aa43ffe440317cbac5cb2f344..52fa65408d7647e8d0e5dba365f28fc9182f1d5b 100644 --- a/GUI/Model/Sample/ParticlesCatalog.h +++ b/GUI/Model/Sample/ParticleCatalog.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Model/Sample/ParticlesCatalog.h -//! @brief Defines class ParticlesCatalog. +//! @file GUI/Model/Sample/ParticleCatalog.h +//! @brief Defines class ParticleCatalog. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLESCATALOG_H -#define BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLESCATALOG_H +#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLECATALOG_H +#define BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLECATALOG_H #include "GUI/Model/Type/UiInfo.h" #include <QVector> @@ -21,7 +21,7 @@ class ItemWithParticles; class MaterialsSet; -class ParticlesCatalog { +class ParticleCatalog { public: // used in PolyItem<Catalog> using BaseType = ItemWithParticles; @@ -44,4 +44,4 @@ public: static Type type(const ItemWithParticles* item); }; -#endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLESCATALOG_H +#endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLECATALOG_H diff --git a/GUI/Model/Sample/ParticleLayoutItem.cpp b/GUI/Model/Sample/ParticleLayoutItem.cpp index 263f761728b79e87b9d624ac5fc433a806291691..5f48cffc71ac25aa4e847449a630447fe297db3e 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.cpp +++ b/GUI/Model/Sample/ParticleLayoutItem.cpp @@ -18,8 +18,8 @@ #include "GUI/Model/Sample/CompoundItem.h" #include "GUI/Model/Sample/Lattice2DItems.h" #include "GUI/Model/Sample/MesocrystalItem.h" +#include "GUI/Model/Sample/ParticleCatalog.h" #include "GUI/Model/Sample/ParticleItem.h" -#include "GUI/Model/Sample/ParticlesCatalog.h" namespace { namespace Tag { @@ -112,7 +112,7 @@ void ParticleLayoutItem::writeTo(QXmlStreamWriter* w) const // particles for (auto* t : m_particles) { w->writeStartElement(Tag::Particle); - PolyItem<ParticlesCatalog>::writeItemTo(t, w); + PolyItem<ParticleCatalog>::writeItemTo(t, w); w->writeEndElement(); } XML::writeTaggedValue(w, Tag::ExpandLayoutGroupbox, expandParticleLayout); @@ -133,7 +133,7 @@ void ParticleLayoutItem::readFrom(QXmlStreamReader* r) } else if (tag == Tag::InterferenceFunction) XML::readTaggedElement(r, tag, m_interference); else if (tag == Tag::Particle) { - m_particles.push_back(PolyItem<ParticlesCatalog>().readItemFrom(r, m_materials)); + m_particles.push_back(PolyItem<ParticleCatalog>().readItemFrom(r, m_materials)); XML::gotoEndElementOfTag(r, tag); } else if (tag == Tag::ExpandLayoutGroupbox) expandParticleLayout = XML::readTaggedBool(r, tag); diff --git a/GUI/View/Sample/CompoundForm.cpp b/GUI/View/Sample/CompoundForm.cpp index 8ba46a95a4d74abed64dcbfd7e653813437ad541..dc4c290b45b3a9f678776f058746dcafce9bd7ab 100644 --- a/GUI/View/Sample/CompoundForm.cpp +++ b/GUI/View/Sample/CompoundForm.cpp @@ -40,7 +40,7 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compoundItem, SampleEd auto* btn = GUI::Util::Layer::createAddParticleButton( this, [=](FormfactorCatalog::Type type) { ec->addCompoundItem(compoundItem, type); }, - [=](ParticlesCatalog::Type type) { ec->addCompoundItem(compoundItem, type); }); + [=](ParticleCatalog::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 aa61107de6b86ab0f71df844c5a824aa094553da..630d0b69bc97b760182bc87178a7899ffeb58a82 100644 --- a/GUI/View/Sample/LayerEditorUtil.cpp +++ b/GUI/View/Sample/LayerEditorUtil.cpp @@ -103,7 +103,7 @@ QWidget* GUI::Util::Layer::createWidgetForItemWithParticles(QWidget* parentWidge QPushButton* GUI::Util::Layer::createAddParticleButton( QWidget* parentWidget, std::function<void(FormfactorCatalog::Type t)> slotAddFormfactor, - std::function<void(ParticlesCatalog::Type t)> slotAddParticle) + std::function<void(ParticleCatalog::Type t)> slotAddParticle) { auto* btn = new QPushButton("Add particle", parentWidget); @@ -129,9 +129,9 @@ QPushButton* GUI::Util::Layer::createAddParticleButton( } group("Particle assemblies"); - for (const auto type : {ParticlesCatalog::Type::Composition, ParticlesCatalog::Type::CoreShell, - ParticlesCatalog::Type::Mesocrystal}) { - const auto ui = ParticlesCatalog::uiInfo(type); + for (const auto type : {ParticleCatalog::Type::Composition, ParticleCatalog::Type::CoreShell, + ParticleCatalog::Type::Mesocrystal}) { + const auto ui = ParticleCatalog::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 410d34881cb62ce7a90aad908424d2a321c4597a..3ea37a56fa2e10fa43abf98dd8c3b7ccbf6d38c4 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/FormfactorCatalog.h" -#include "GUI/Model/Sample/ParticlesCatalog.h" +#include "GUI/Model/Sample/ParticleCatalog.h" #include <QGridLayout> #include <QPushButton> #include <functional> @@ -51,7 +51,7 @@ QWidget* createWidgetForItemWithParticles(QWidget* parentWidget, QPushButton* createAddParticleButton(QWidget* parentWidget, std::function<void(FormfactorCatalog::Type t)> slotAddFormfactor, - std::function<void(ParticlesCatalog::Type t)> slotAddParticle); + std::function<void(ParticleCatalog::Type t)> slotAddParticle); QVector<QColor> predefinedLayerColors(); diff --git a/GUI/View/Sample/MesocrystalForm.cpp b/GUI/View/Sample/MesocrystalForm.cpp index 13d4f4c529412fc01e74b5a138312ee4d6f1bf73..3ea9bc44e6c35c03fa688dfdce296cab9d23144e 100644 --- a/GUI/View/Sample/MesocrystalForm.cpp +++ b/GUI/View/Sample/MesocrystalForm.cpp @@ -85,10 +85,10 @@ QComboBox* MesocrystalForm::createBasisCombo(QWidget* parent, ItemWithParticles* if (FormfactorCatalog::type(p->formFactorItem()) == type) currentData = static_cast<uint32_t>(type); } - for (auto type : ParticlesCatalog::assemblyTypes()) { - const auto ui = ParticlesCatalog::uiInfo(type); + for (auto type : ParticleCatalog::assemblyTypes()) { + const auto ui = ParticleCatalog::uiInfo(type); combo->addItem(QIcon(ui.iconPath), ui.menuEntry, 1000 + static_cast<uint32_t>(type)); - if (ParticlesCatalog::type(current) == type) + if (ParticleCatalog::type(current) == type) currentData = 1000 + static_cast<uint32_t>(type); } @@ -110,7 +110,7 @@ void MesocrystalForm::onBasisComboChanged() if (currentData < 1000) m_ec->setMesocrystalBasis(this, static_cast<FormfactorCatalog::Type>(currentData)); else - m_ec->setMesocrystalBasis(this, static_cast<ParticlesCatalog::Type>(currentData - 1000)); + m_ec->setMesocrystalBasis(this, static_cast<ParticleCatalog::Type>(currentData - 1000)); } void MesocrystalForm::createBasisWidgets() diff --git a/GUI/View/Sample/ParticleLayoutForm.cpp b/GUI/View/Sample/ParticleLayoutForm.cpp index 064344f60d42d2803238d4ee21d03d82db896759..7c80926427f2084b723f91e072dac30c1b6dcaa1 100644 --- a/GUI/View/Sample/ParticleLayoutForm.cpp +++ b/GUI/View/Sample/ParticleLayoutForm.cpp @@ -52,7 +52,7 @@ ParticleLayoutForm::ParticleLayoutForm(LayerForm* form, ParticleLayoutItem* t, auto* btn = GUI::Util::Layer::createAddParticleButton( this, [=](FormfactorCatalog::Type type) { ec->addParticleLayoutItem(t, type); }, - [=](ParticlesCatalog::Type type) { ec->addParticleLayoutItem(t, type); }); + [=](ParticleCatalog::Type type) { ec->addParticleLayoutItem(t, 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 dd001a377b8d4dc839fe564e246677b0684404d4..dcd9bba671fa2e387b8c2b763e2b4dcb9bf91cd3 100644 --- a/GUI/View/Sample/SampleEditorController.cpp +++ b/GUI/View/Sample/SampleEditorController.cpp @@ -185,7 +185,7 @@ void SampleEditorController::addParticleLayoutItem(ParticleLayoutItem* layout, } void SampleEditorController::addParticleLayoutItem(ParticleLayoutItem* layout, - ParticlesCatalog::Type type) + ParticleCatalog::Type type) { auto* newItem = createAndInitItem(type); layout->addItemWithParticleSelection(newItem); @@ -194,7 +194,7 @@ void SampleEditorController::addParticleLayoutItem(ParticleLayoutItem* layout, void SampleEditorController::duplicateItemWithParticles(ItemWithParticles* item) { - auto type = ParticlesCatalog::type(item); + auto type = ParticleCatalog::type(item); auto* newItem = createAndInitItem(type); GUI::Util::copyContents(item, newItem); @@ -221,7 +221,7 @@ void SampleEditorController::onParticleCompoundAdded(CompoundItem* composition, } void SampleEditorController::addCompoundItem(CompoundItem* compositionItem, - ParticlesCatalog::Type type) + ParticleCatalog::Type type) { auto* newItem = createAndInitItem(type); compositionItem->addItemWithParticleSelection(newItem); @@ -245,9 +245,9 @@ SampleEditorController::createAndInitItem(FormfactorCatalog::Type formFactorType return newParticle; } -ItemWithParticles* SampleEditorController::createAndInitItem(ParticlesCatalog::Type type) const +ItemWithParticles* SampleEditorController::createAndInitItem(ParticleCatalog::Type type) const { - auto* newItem = ParticlesCatalog::create(type, materialModel()); + auto* newItem = ParticleCatalog::create(type, materialModel()); if (auto* p = dynamic_cast<ItemWithMaterial*>(newItem)) p->setMaterial(materialModel()->defaultMaterialItem()); @@ -405,7 +405,7 @@ void SampleEditorController::onStoppedToMoveLayer(QWidget* widgetToMove, } void SampleEditorController::setMesocrystalBasis(MesocrystalForm* widget, - ParticlesCatalog::Type type) + ParticleCatalog::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 a956d8671d4cb311855bdf5a95bd3f2f41172761..9cd2574d89720b1c284e258019ffa72d01e9fe0e 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/FormfactorCatalog.h" -#include "GUI/Model/Sample/ParticlesCatalog.h" +#include "GUI/Model/Sample/ParticleCatalog.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, ParticlesCatalog::Type type); + void addParticleLayoutItem(ParticleLayoutItem* layout, ParticleCatalog::Type type); void addParticleLayoutItem(ParticleLayoutItem* layout, FormfactorCatalog::Type type); ParticleLayoutItem* parentLayoutItem(ItemWithParticles* item); void onParticleCompoundAdded(CompoundItem* composition, ItemWithParticles* newItem); - void addCompoundItem(CompoundItem* composition, ParticlesCatalog::Type type); + void addCompoundItem(CompoundItem* composition, ParticleCatalog::Type type); void addCompoundItem(CompoundItem* composition, FormfactorCatalog::Type type); CompoundItem* parentCompoundItem(ItemWithParticles* item); @@ -89,7 +89,7 @@ public: void setCoreFormfactor(CoreAndShellForm* widget, FormfactorCatalog::Type type); void setShellFormfactor(CoreAndShellForm* widget, FormfactorCatalog::Type type); - void setMesocrystalBasis(MesocrystalForm* widget, ParticlesCatalog::Type type); + void setMesocrystalBasis(MesocrystalForm* widget, ParticleCatalog::Type type); void setMesocrystalBasis(MesocrystalForm* widget, FormfactorCatalog::Type type); void selectInterference(InterferenceForm* widget, int newIndex); void setIntegrateOverXi(LatticeTypeSelectionForm* widget, bool value); @@ -117,7 +117,7 @@ signals: private: ItemWithParticles* createAndInitItem(FormfactorCatalog::Type formFactorType) const; - ItemWithParticles* createAndInitItem(ParticlesCatalog::Type itemType) const; + ItemWithParticles* createAndInitItem(ParticleCatalog::Type itemType) const; SampleItem* m_sample_item; SampleForm* m_sample_form;