diff --git a/GUI/Model/Item/BeamItems.cpp b/GUI/Model/Item/BeamItems.cpp index b022a69c6652a859fe0b2642af603b438d3dece8..a475ef0ca296cac578027353b08bbb5668e4d4af 100644 --- a/GUI/Model/Item/BeamItems.cpp +++ b/GUI/Model/Item/BeamItems.cpp @@ -21,7 +21,6 @@ #include "GUI/Model/Item/BeamWavelengthItem.h" #include "GUI/Model/Item/FootprintItems.h" #include "GUI/Model/Item/PointwiseAxisItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Types/DoubleDescriptor.h" #include <cmath> diff --git a/GUI/Model/Item/ParticleCoreShellItem.cpp b/GUI/Model/Item/ParticleCoreShellItem.cpp index c03cb4eaf1484e5aa4fcdc73ee374a94404e402d..7f55f80e8418f5bae07c7b65828788b579c62538 100644 --- a/GUI/Model/Item/ParticleCoreShellItem.cpp +++ b/GUI/Model/Item/ParticleCoreShellItem.cpp @@ -14,7 +14,6 @@ #include "GUI/Model/Item/ParticleCoreShellItem.h" #include "GUI/Model/Item/ParticleItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Model/MaterialModel.h" #include "GUI/Model/Types/DoubleDescriptor.h" #include "GUI/Support/Type/VariantUtil.h" diff --git a/GUI/Model/Item/ParticleCoreShellItem.h b/GUI/Model/Item/ParticleCoreShellItem.h index c2a6dacc8a582f19ec6c8825c03f3c40045fbce6..6b2bedd563a347be2f6c3b2945e21d7833c2cd47 100644 --- a/GUI/Model/Item/ParticleCoreShellItem.h +++ b/GUI/Model/Item/ParticleCoreShellItem.h @@ -20,7 +20,6 @@ class ParticleCoreShell; class ParticleItem; -class VectorItem; class MaterialModel; class ParticleCoreShellItem : public ItemWithParticles { diff --git a/GUI/Model/Item/ParticleItem.h b/GUI/Model/Item/ParticleItem.h index 9f1cb74b86bc83609b33f6eb88ff4b4f29c8cecb..954318bfcc27a1b3279f13c3654988416d00bce0 100644 --- a/GUI/Model/Item/ParticleItem.h +++ b/GUI/Model/Item/ParticleItem.h @@ -21,9 +21,7 @@ #include "GUI/Model/Item/ItemWithParticles.h" #include <memory> -class GroupItem; class Particle; -class VectorItem; class ParticleItem : public ItemWithMaterial, public ItemWithParticles { public: diff --git a/GUI/Model/Item/RectangularDetectorItem.cpp b/GUI/Model/Item/RectangularDetectorItem.cpp index 15b3d4840be04e9ca4b75379da6c1c834b1c7cf3..a897d82e931fb631122c35560824f8137acb445f 100644 --- a/GUI/Model/Item/RectangularDetectorItem.cpp +++ b/GUI/Model/Item/RectangularDetectorItem.cpp @@ -16,7 +16,6 @@ #include "Device/Detector/RectangularDetector.h" #include "GUI/Model/Item/AxesItems.h" #include "GUI/Model/Item/ResolutionFunctionItems.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/MakeItem/ResolutionFunctionItemCatalog.h" #include "GUI/Model/XML/Serializer.h" #include "GUI/Support/Data/XML.h" diff --git a/GUI/Model/Item/VectorItem.cpp b/GUI/Model/Item/VectorItem.cpp deleted file mode 100644 index 5eae9fed03deded026b6f7f2cdb3492512dab92d..0000000000000000000000000000000000000000 --- a/GUI/Model/Item/VectorItem.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/Model/Item/VectorItem.cpp -//! @brief Implements class VectorItem -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#include "GUI/Model/Item/VectorItem.h" - -VectorItem::VectorItem() - : SessionItem(M_TYPE) -{ - addProperty(P_X, 0.0)->setLimits(RealLimits::limitless()).setToolTip("x-coordinate"); - addProperty(P_Y, 0.0)->setLimits(RealLimits::limitless()).setToolTip("y-coordinate"); - addProperty(P_Z, 0.0)->setLimits(RealLimits::limitless()).setToolTip("z-coordinate"); - setEditable(false); -} - -double VectorItem::x() const -{ - return getItemValue(P_X).toDouble(); -} - -void VectorItem::setX(double value) -{ - setItemValue(P_X, value); -} - -SessionItem* VectorItem::xItem() const -{ - return getItem(P_X); -} - -double VectorItem::y() const -{ - return getItemValue(P_Y).toDouble(); -} - -void VectorItem::setY(double value) -{ - setItemValue(P_Y, value); -} - -SessionItem* VectorItem::yItem() const -{ - return getItem(P_Y); -} - -double VectorItem::z() const -{ - return getItemValue(P_Z).toDouble(); -} - -void VectorItem::setZ(double value) -{ - setItemValue(P_Z, value); -} - -SessionItem* VectorItem::zItem() const -{ - return getItem(P_Z); -} - -void VectorItem::setXYZ(double x_value, double y_value, double z_value) -{ - setX(x_value); - setY(y_value); - setZ(z_value); -} - -R3 VectorItem::getVector() const -{ - return R3(x(), y(), z()); -} - -void VectorItem::setVector(const R3& vec) -{ - setXYZ(vec.x(), vec.y(), vec.z()); -} diff --git a/GUI/Model/Item/VectorItem.h b/GUI/Model/Item/VectorItem.h deleted file mode 100644 index 989474bbe91dac6b46a97a5f29684dccdb7230e8..0000000000000000000000000000000000000000 --- a/GUI/Model/Item/VectorItem.h +++ /dev/null @@ -1,50 +0,0 @@ -// ************************************************************************************************ -// -// BornAgain: simulate and fit reflection and scattering -// -//! @file GUI/Model/Item/VectorItem.h -//! @brief Defines class VectorItem -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2018 -//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) -// -// ************************************************************************************************ - -#ifndef BORNAGAIN_GUI_MODEL_ITEM_VECTORITEM_H -#define BORNAGAIN_GUI_MODEL_ITEM_VECTORITEM_H - -#include "GUI/Model/BaseItem/SessionItem.h" -#include <heinz/Vectors3D.h> - -class BA_CORE_API_ VectorItem : public SessionItem { -private: - static constexpr auto P_X{"X"}; - static constexpr auto P_Y{"Y"}; - static constexpr auto P_Z{"Z"}; - -public: - static constexpr auto M_TYPE{"Vector"}; - - VectorItem(); - - double x() const; - void setX(double value); - SessionItem* xItem() const; - - double y() const; - void setY(double value); - SessionItem* yItem() const; - - double z() const; - void setZ(double value); - SessionItem* zItem() const; - - void setXYZ(double x_value, double y_value, double z_value); - - R3 getVector() const; - void setVector(const R3& vec); -}; - -#endif // BORNAGAIN_GUI_MODEL_ITEM_VECTORITEM_H diff --git a/GUI/Model/MakeItem/ItemCatalog.cpp b/GUI/Model/MakeItem/ItemCatalog.cpp index 5b649d8cdee0442a0fa96f4a03a57e5c4f615652..67836c6dec1a8f1ca05c6e8b5004b5de6e068aab 100644 --- a/GUI/Model/MakeItem/ItemCatalog.cpp +++ b/GUI/Model/MakeItem/ItemCatalog.cpp @@ -47,7 +47,6 @@ #include "GUI/Model/Item/SpecularBeamInclinationItem.h" #include "GUI/Model/Item/SpecularDataItem.h" #include "GUI/Model/Item/SphericalDetectorItem.h" -#include "GUI/Model/Item/VectorItem.h" ItemCatalog::ItemCatalog() { @@ -62,7 +61,6 @@ ItemCatalog::ItemCatalog() addItem<FootprintNoneItem>(); addItem<FootprintGaussianItem>(); addItem<FootprintSquareItem>(); - addItem<VectorItem>(); addItem<PropertyItem>(); diff --git a/GUI/Model/Types/VectorDescriptor.h b/GUI/Model/Types/VectorDescriptor.h index 021324fda4527620d03779b9212cdc5894c6abe9..6b16c8558dd99b366adff5de080dbe58acef1172 100644 --- a/GUI/Model/Types/VectorDescriptor.h +++ b/GUI/Model/Types/VectorDescriptor.h @@ -15,32 +15,19 @@ #ifndef BORNAGAIN_GUI_MODEL_TYPES_VECTORDESCRIPTOR_H #define BORNAGAIN_GUI_MODEL_TYPES_VECTORDESCRIPTOR_H -#include "GUI/Model/Item/VectorItem.h" + #include "GUI/Model/Types/DoubleDescriptor.h" #include <heinz/Vectors3D.h> //! Describes properties of a 3D vector, consisting of three double values. //! //! By using this class, the underlying data scheme is hidden from the user of the data. This e.g. -//! eases SessionItem migration. The underlying implementation can be a VectorItem, a member array +//! eases SessionItem migration. The underlying implementation can be a R3 vector, a member array //! of three doubles, three double members, or any other construction to hold the three values. class VectorDescriptor { public: VectorDescriptor() = default; - //! Operates on a VectorItem. - //! - //! The settings (like decimals, limits) are taken from the item. - //! Only for easier migration. Should be removed after SessionItem refactoring. - VectorDescriptor(VectorItem* item, const variant<QString, Unit>& unit) - : label(item->displayName()) - , tooltip(item->toolTip()) - , x(item->xItem(), unit) - , y(item->yItem(), unit) - , z(item->zItem(), unit) - { - } - VectorDescriptor(const QString& label, const QString& tooltip, double* xVar, double* yVar, double* zVar, const variant<QString, Unit>& unit) : label(label) diff --git a/GUI/View/Instrument/PolarizationAnalysisEditor.cpp b/GUI/View/Instrument/PolarizationAnalysisEditor.cpp index ec1443cb0d1540e128ecd86927daf4ee7dc9453f..85073696cb9c0d9cbece7c3341e54daab6e3a80f 100644 --- a/GUI/View/Instrument/PolarizationAnalysisEditor.cpp +++ b/GUI/View/Instrument/PolarizationAnalysisEditor.cpp @@ -15,7 +15,6 @@ #include "GUI/View/Instrument/PolarizationAnalysisEditor.h" #include "GUI/Model/Item/DetectorItems.h" #include "GUI/Model/Item/InstrumentItems.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/View/Instrument/VectorEditor.h" #include <QCheckBox> diff --git a/GUI/View/Instrument/VectorEditor.cpp b/GUI/View/Instrument/VectorEditor.cpp index 38727efffd65eabf3596cce410ea9fab884a6afc..72b0649e31e8b58cde4debf7f206efb39f1d90a8 100644 --- a/GUI/View/Instrument/VectorEditor.cpp +++ b/GUI/View/Instrument/VectorEditor.cpp @@ -13,12 +13,9 @@ // ************************************************************************************************ #include "GUI/View/Instrument/VectorEditor.h" -#include "GUI/Model/Item/VectorItem.h" - #include <QDoubleSpinBox> #include <QFormLayout> #include <QGroupBox> - #include <limits> VectorEditor::VectorEditor(const QString& title, const QString& tooltip, QWidget* parent) @@ -52,12 +49,6 @@ VectorEditor::VectorEditor(const QString& title, const QString& tooltip, QWidget &VectorEditor::onZValueChanged); } -void VectorEditor::setItem(VectorItem* item) -{ - ASSERT(item); - setVector(VectorDescriptor(item, Unit::unitless)); -} - void VectorEditor::setVector(const VectorDescriptor& d) { m_descriptor = d; diff --git a/GUI/View/Instrument/VectorEditor.h b/GUI/View/Instrument/VectorEditor.h index 31b271994c1d8d1e8b194e231a68d6f844ea5f4e..84aec906cc505d580e4f1a3c32c2ace2e44e206b 100644 --- a/GUI/View/Instrument/VectorEditor.h +++ b/GUI/View/Instrument/VectorEditor.h @@ -19,7 +19,6 @@ #include <QGroupBox> class QDoubleSpinBox; -class VectorItem; /// Widget for editing the three coordinates of a vector @@ -30,7 +29,6 @@ class VectorEditor : public QGroupBox { public: /// \param tooltip the tooltip for the spinboxes with wildcard ("%1") for coordinate VectorEditor(const QString& title, const QString& tooltip, QWidget* parent = nullptr); - void setItem(VectorItem* item); void setVector(const VectorDescriptor& d); signals: diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index 16c95abecff61c876b245cde70673e483acf7fec..7f9f326cc97032bc5b751d3b86bb6f5ac79bea3c 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -16,7 +16,6 @@ #include "GUI/Application/ApplicationSettings.h" #include "GUI/Model/Item/ItemWithMaterial.h" #include "GUI/Model/Item/MaterialItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Model/MaterialModel.h" #include "GUI/Model/Model/SampleModel.h" #include "GUI/Model/Project/ProjectDocument.h" diff --git a/GUI/View/MaterialEditor/MaterialEditorModel.cpp b/GUI/View/MaterialEditor/MaterialEditorModel.cpp index 780b6bf77e840186154f445de0ad05b3747f230b..048806e4f7abfc6af965a692020895885290e780 100644 --- a/GUI/View/MaterialEditor/MaterialEditorModel.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorModel.cpp @@ -14,7 +14,6 @@ #include "GUI/View/MaterialEditor/MaterialEditorModel.h" #include "GUI/Model/Item/MaterialItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Model/MaterialModel.h" #include "GUI/Model/Types/DoubleDescriptor.h" #include <QApplication> diff --git a/Tests/Unit/GUI/TestDetectorItems.cpp b/Tests/Unit/GUI/TestDetectorItems.cpp index 752307da0aaa26df3dcb26f2640f2464669f230f..ff58e1342dcfadcf3de406694a36cf470d41c10f 100644 --- a/Tests/Unit/GUI/TestDetectorItems.cpp +++ b/Tests/Unit/GUI/TestDetectorItems.cpp @@ -6,7 +6,6 @@ #include "GUI/Model/Item/RectangularDetectorItem.h" #include "GUI/Model/Item/ResolutionFunctionItems.h" #include "GUI/Model/Item/SphericalDetectorItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Model/InstrumentModel.h" #include "GUI/Model/Types/Unit.h" #include "GUI/Util/ComboProperty.h" diff --git a/Tests/Unit/GUI/TestSessionItemUtils.cpp b/Tests/Unit/GUI/TestSessionItemUtils.cpp index a44424e1411ad5d5895f35e8f1029babe268a9db..af7185afac24831c933a10970115c8f7757903e5 100644 --- a/Tests/Unit/GUI/TestSessionItemUtils.cpp +++ b/Tests/Unit/GUI/TestSessionItemUtils.cpp @@ -1,5 +1,4 @@ #include "GUI/Model/BaseItem/PropertyItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Model/SessionModel.h" #include "GUI/Support/Type/VariantUtil.h" #include "GUI/Util/ComboProperty.h" diff --git a/Tests/Unit/GUI/TestSessionModel.cpp b/Tests/Unit/GUI/TestSessionModel.cpp index 947a68942749621ab0da0a8c422008d23f25ac7c..7f9f7485ce2debb3a73e3b32202d0529c137ccc9 100644 --- a/Tests/Unit/GUI/TestSessionModel.cpp +++ b/Tests/Unit/GUI/TestSessionModel.cpp @@ -4,7 +4,6 @@ #include "GUI/Model/Item/LayerItem.h" #include "GUI/Model/Item/MaskItems.h" #include "GUI/Model/Item/MultiLayerItem.h" -#include "GUI/Model/Item/VectorItem.h" #include "GUI/Model/Model/InstrumentModel.h" #include "GUI/Model/Model/JobModel.h" #include "GUI/Model/Model/MaterialModel.h" @@ -135,10 +134,3 @@ TEST_F(TestSessionModel, moveWithinSameParent) EXPECT_EQ(poly->getItems().indexOf(pD), 3); EXPECT_EQ(poly->getItems().indexOf(pE), 4); } - -TEST_F(TestSessionModel, insertItem) -{ - SessionModel model("TestModel"); - auto* vectorItem = model.insertItem<VectorItem>(); - EXPECT_TRUE(dynamic_cast<VectorItem*>(vectorItem) != nullptr); -} diff --git a/Tests/Unit/GUI/TestVectorItem.cpp b/Tests/Unit/GUI/TestVectorItem.cpp deleted file mode 100644 index c5865250a59b09b38e74253a503bf3eacf4e708b..0000000000000000000000000000000000000000 --- a/Tests/Unit/GUI/TestVectorItem.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "GUI/Model/Item/VectorItem.h" -#include "Tests/GTestWrapper/google_test.h" - -//! Tests VectorItem class. - -class TestVectorItem : public ::testing::Test { -}; - -//! The initial state. - -TEST_F(TestVectorItem, initialState) -{ - VectorItem item; - - EXPECT_EQ(item.x(), 0.0); - EXPECT_EQ(item.y(), 0.0); - EXPECT_EQ(item.z(), 0.0); - - auto kvec = item.getVector(); - EXPECT_EQ(kvec.x(), 0.0); - EXPECT_EQ(kvec.y(), 0.0); - EXPECT_EQ(kvec.z(), 0.0); -} - -//! Setters. - -TEST_F(TestVectorItem, setXYZ) -{ - VectorItem item; - - item.setX(1.0); - item.setY(2.0); - item.setZ(3.0); - - EXPECT_EQ(item.x(), 1.0); - EXPECT_EQ(item.y(), 2.0); - EXPECT_EQ(item.z(), 3.0); - - auto kvec = item.getVector(); - EXPECT_EQ(kvec.x(), 1.0); - EXPECT_EQ(kvec.y(), 2.0); - EXPECT_EQ(kvec.z(), 3.0); -}