Skip to content
Snippets Groups Projects
Commit d9fe1c6c authored by Mikhail Svechnikov's avatar Mikhail Svechnikov Committed by Mikhail Svechnikov
Browse files

ParticleLayoutItem: use SelectionVector

parent ff7add69
Branches
Tags
1 merge request!1334GUI: introduce SelectionVector to reduce code duplication
......@@ -72,26 +72,19 @@ double ParticleLayoutItem::totalDensityValue() const
QVector<ItemWithParticles*> ParticleLayoutItem::itemsWithParticles() const
{
QVector<ItemWithParticles*> output;
for (const auto& sel : m_particles)
output.append(sel.currentItem());
return output;
return m_particles.toQVector();
}
SelectionProperty<ItemWithParticlesCatalog>&
ParticleLayoutItem::addItemWithParticleSelection(ItemWithParticles* particle)
{
SelectionProperty<ItemWithParticlesCatalog> newParticleSelection;
newParticleSelection.setCurrentItem(particle);
m_particles.push_back(std::move(newParticleSelection));
m_particles.push_back(particle);
return m_particles.back();
}
void ParticleLayoutItem::removeItemWithParticle(ItemWithParticles* particle)
{
for (size_t i = 0; i < m_particles.size(); i++)
if (m_particles[i].currentItem() == particle)
m_particles.erase(m_particles.begin() + i);
m_particles.delete_element(particle);
}
QVector<ItemWithParticles*> ParticleLayoutItem::containedItemsWithParticles() const
......
......@@ -83,7 +83,7 @@ public:
private:
DoubleProperty m_ownDensity;
SelectionProperty<InterferenceItemCatalog> m_interference;
std::vector<SelectionProperty<ItemWithParticlesCatalog>> m_particles;
SelectionVector<ItemWithParticlesCatalog> m_particles;
const MaterialModel* m_materialModel;
bool m_expandParticleLayout = true;
bool m_expandInterference = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment