Skip to content
Snippets Groups Projects
Commit 723c977f authored by t.knopff's avatar t.knopff
Browse files

Make VectorItem::P_(X|Y|Z) private

parent 15ae6d56
No related branches found
No related tags found
1 merge request!138Refactor model: vector item
Pipeline #40115 passed
...@@ -42,6 +42,11 @@ void VectorItem::setX(double value) ...@@ -42,6 +42,11 @@ void VectorItem::setX(double value)
setItemValue(P_X, value); setItemValue(P_X, value);
} }
SessionItem* VectorItem::xItem() const
{
return getItem(P_X);
}
double VectorItem::y() const double VectorItem::y() const
{ {
return getItemValue(P_Y).toDouble(); return getItemValue(P_Y).toDouble();
...@@ -52,6 +57,11 @@ void VectorItem::setY(double value) ...@@ -52,6 +57,11 @@ void VectorItem::setY(double value)
setItemValue(P_Y, value); setItemValue(P_Y, value);
} }
SessionItem* VectorItem::yItem() const
{
return getItem(P_Y);
}
double VectorItem::z() const double VectorItem::z() const
{ {
return getItemValue(P_Z).toDouble(); return getItemValue(P_Z).toDouble();
...@@ -62,6 +72,11 @@ void VectorItem::setZ(double value) ...@@ -62,6 +72,11 @@ void VectorItem::setZ(double value)
setItemValue(P_Z, 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) void VectorItem::setXYZ(double x_value, double y_value, double z_value)
{ {
setX(x_value); setX(x_value);
......
...@@ -19,24 +19,27 @@ ...@@ -19,24 +19,27 @@
#include "GUI/Models/SessionItem.h" #include "GUI/Models/SessionItem.h"
class BA_CORE_API_ VectorItem : public SessionItem { class BA_CORE_API_ VectorItem : public SessionItem {
private:
public:
static const QString P_X; static const QString P_X;
static const QString P_Y; static const QString P_Y;
static const QString P_Z; static const QString P_Z;
public:
static const QString M_TYPE; static const QString M_TYPE;
VectorItem(); VectorItem();
double x() const; double x() const;
void setX(double value); void setX(double value);
SessionItem* xItem() const;
double y() const; double y() const;
void setY(double value); void setY(double value);
SessionItem* yItem() const;
double z() const; double z() const;
void setZ(double value); void setZ(double value);
SessionItem* zItem() const;
void setXYZ(double x_value, double y_value, double z_value); void setXYZ(double x_value, double y_value, double z_value);
......
...@@ -86,7 +86,7 @@ TEST_F(TestModelUtils, test_vectorItem) ...@@ -86,7 +86,7 @@ TEST_F(TestModelUtils, test_vectorItem)
// checking SessionItems visited during the iteration // checking SessionItems visited during the iteration
EXPECT_EQ(indices.size(), 4); // (VectorItem, P_X, P_Y, P_Z) x (row, col) EXPECT_EQ(indices.size(), 4); // (VectorItem, P_X, P_Y, P_Z) x (row, col)
EXPECT_EQ(model.itemForIndex(indices.front()), vectorItem); EXPECT_EQ(model.itemForIndex(indices.front()), vectorItem);
EXPECT_EQ(model.itemForIndex(indices.back()), vectorItem->getItem(VectorItem::P_Z)); EXPECT_EQ(model.itemForIndex(indices.back()), vectorItem->zItem());
} }
//! Tests iteration when some children is invisible. //! Tests iteration when some children is invisible.
......
...@@ -41,9 +41,9 @@ TEST_F(TestSessionItemUtils, test_ParentVisibleRow) ...@@ -41,9 +41,9 @@ TEST_F(TestSessionItemUtils, test_ParentVisibleRow)
// adding vector item // adding vector item
auto vector = model.insertItem<VectorItem>(); auto vector = model.insertItem<VectorItem>();
auto x = vector->getItem(VectorItem::P_X); auto x = vector->xItem();
auto y = vector->getItem(VectorItem::P_Y); auto y = vector->yItem();
auto z = vector->getItem(VectorItem::P_Z); auto z = vector->zItem();
x->setVisible(false); x->setVisible(false);
EXPECT_EQ(GUI::Session::ItemUtils::ParentVisibleRow(*x), -1); EXPECT_EQ(GUI::Session::ItemUtils::ParentVisibleRow(*x), -1);
EXPECT_EQ(GUI::Session::ItemUtils::ParentVisibleRow(*y), 0); EXPECT_EQ(GUI::Session::ItemUtils::ParentVisibleRow(*y), 0);
......
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