Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • c.trageser/bornagain
  • mlz/bornagain
2 results
Show changes
Commits on Source (16)
Showing
with 98 additions and 86 deletions
......@@ -69,6 +69,7 @@ Checks: '*,
-performance-noexcept-move-constructor,
-performance-no-automatic-move,
-performance-unnecessary-value-param,
-readability-misleading-indentation,
-readability-use-anyofallof,
......
......@@ -356,7 +356,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
BUILTIN_STL_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
......
......@@ -356,7 +356,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
BUILTIN_STL_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
......
......@@ -356,7 +356,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
BUILTIN_STL_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
......
......@@ -777,16 +777,16 @@ void GUI::Transform::FromDomain::setRotation(ItemWithParticles* item, const IRot
auto* transformationItem = item->createTransformationItem();
if (auto* r = dynamic_cast<const RotationX*>(rotation)) {
if (const auto* r = dynamic_cast<const RotationX*>(rotation)) {
auto* rotationItem = transformationItem->setRotationType<XRotationItem>();
rotationItem->angle().set(Units::rad2deg(r->getAngle()));
} else if (auto* r = dynamic_cast<const RotationY*>(rotation)) {
} else if (const auto* r = dynamic_cast<const RotationY*>(rotation)) {
auto* rotationItem = transformationItem->setRotationType<YRotationItem>();
rotationItem->angle().set(Units::rad2deg(r->getAngle()));
} else if (auto* r = dynamic_cast<const RotationZ*>(rotation)) {
} else if (const auto* r = dynamic_cast<const RotationZ*>(rotation)) {
auto* rotationItem = transformationItem->setRotationType<ZRotationItem>();
rotationItem->angle().set(Units::rad2deg(r->getAngle()));
} else if (auto* r = dynamic_cast<const RotationEuler*>(rotation)) {
} else if (const auto* r = dynamic_cast<const RotationEuler*>(rotation)) {
auto* rotationItem = transformationItem->setRotationType<EulerRotationItem>();
rotationItem->alpha().set(Units::rad2deg(r->getAlpha()));
rotationItem->beta().set(Units::rad2deg(r->getBeta()));
......@@ -799,22 +799,22 @@ void GUI::Transform::FromDomain::setInterference(ParticleLayoutItem* layoutItem,
{
if (!interference)
layoutItem->removeInterference();
else if (auto* itf = dynamic_cast<const Interference1DLattice*>(interference)) {
else if (const auto* itf = dynamic_cast<const Interference1DLattice*>(interference)) {
auto* itfItem = layoutItem->createInterference<Interference1DLatticeItem>();
set1DLatticeItem(itfItem, *itf);
} else if (auto* itf = dynamic_cast<const Interference2DLattice*>(interference)) {
} else if (const auto* itf = dynamic_cast<const Interference2DLattice*>(interference)) {
auto* itfItem = layoutItem->createInterference<Interference2DLatticeItem>();
set2DLatticeItem(itfItem, *itf);
} else if (auto* itf = dynamic_cast<const Interference2DParaCrystal*>(interference)) {
} else if (const auto* itf = dynamic_cast<const Interference2DParaCrystal*>(interference)) {
auto* itfItem = layoutItem->createInterference<Interference2DParaCrystalItem>();
set2DParaCrystalItem(itfItem, *itf);
} else if (auto* itf = dynamic_cast<const InterferenceFinite2DLattice*>(interference)) {
} else if (const auto* itf = dynamic_cast<const InterferenceFinite2DLattice*>(interference)) {
auto* itfItem = layoutItem->createInterference<InterferenceFinite2DLatticeItem>();
setFinite2DLatticeItem(itfItem, *itf);
} else if (auto* itf = dynamic_cast<const InterferenceHardDisk*>(interference)) {
} else if (const auto* itf = dynamic_cast<const InterferenceHardDisk*>(interference)) {
auto* itfItem = layoutItem->createInterference<InterferenceHardDiskItem>();
setHardDiskItem(itfItem, *itf);
} else if (auto* itf = dynamic_cast<const InterferenceRadialParaCrystal*>(interference)) {
} else if (const auto* itf = dynamic_cast<const InterferenceRadialParaCrystal*>(interference)) {
auto* itfItem = layoutItem->createInterference<InterferenceRadialParaCrystalItem>();
setRadialParaCrystalItem(itfItem, *itf);
} else
......@@ -824,132 +824,140 @@ void GUI::Transform::FromDomain::setInterference(ParticleLayoutItem* layoutItem,
void GUI::Transform::FromDomain::setFormFactor(std::variant<ParticleItem*, MesoCrystalItem*> parent,
const IFormFactor* iFormFactor)
{
if (auto* formFactor = dynamic_cast<const FormFactorAnisoPyramid*>(iFormFactor)) {
if (const auto* formFactor = dynamic_cast<const FormFactorAnisoPyramid*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<AnisoPyramidItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAlpha(Units::rad2deg(formFactor->getAlpha()));
} else if (auto* formFactor = dynamic_cast<const FormFactorBarGauss*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorBarGauss*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<BarGaussItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorBarLorentz*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorBarLorentz*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<BarLorentzItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorBox*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorBox*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<BoxItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorCone*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorCone*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<ConeItem>(parent);
formFactorItem->setRadius(formFactor->getRadius());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAlpha(Units::rad2deg(formFactor->getAlpha()));
} else if (auto* formFactor = dynamic_cast<const FormFactorCone6*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorCone6*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<Cone6Item>(parent);
formFactorItem->setBaseEdge(formFactor->getBaseEdge());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAlpha(Units::rad2deg(formFactor->getAlpha()));
} else if (auto* formFactor = dynamic_cast<const FormFactorCuboctahedron*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorCuboctahedron*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<CuboctahedronItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setHeightRatio(formFactor->getHeightRatio());
formFactorItem->setAlpha(Units::rad2deg(formFactor->getAlpha()));
} else if (auto* formFactor = dynamic_cast<const FormFactorCylinder*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorCylinder*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<CylinderItem>(parent);
formFactorItem->setRadius(formFactor->getRadius());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorDodecahedron*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorDodecahedron*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<DodecahedronItem>(parent);
formFactorItem->setEdge(formFactor->getEdge());
} else if (auto* formFactor = dynamic_cast<const FormFactorEllipsoidalCylinder*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorEllipsoidalCylinder*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<EllipsoidalCylinderItem>(parent);
formFactorItem->setRadiusX(formFactor->getRadiusX());
formFactorItem->setRadiusY(formFactor->getRadiusY());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorFullSphere*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorFullSphere*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<FullSphereItem>(parent);
formFactorItem->setRadius(formFactor->getRadius());
} else if (auto* formFactor = dynamic_cast<const FormFactorFullSpheroid*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorFullSpheroid*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<FullSpheroidItem>(parent);
formFactorItem->setRadius(formFactor->getRadius());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorIcosahedron*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorIcosahedron*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<IcosahedronItem>(parent);
formFactorItem->setEdge(formFactor->getEdge());
} else if (auto* formFactor = dynamic_cast<const FormFactorHemiEllipsoid*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorHemiEllipsoid*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<HemiEllipsoidItem>(parent);
formFactorItem->setRadiusX(formFactor->getRadiusX());
formFactorItem->setRadiusY(formFactor->getRadiusY());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorPrism3*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorPrism3*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<Prism3Item>(parent);
formFactorItem->setBaseEdge(formFactor->getBaseEdge());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorPrism6*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorPrism6*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<Prism6Item>(parent);
formFactorItem->setBaseEdge(formFactor->getBaseEdge());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorPyramid*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorPyramid*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<PyramidItem>(parent);
formFactorItem->setBaseEdge(formFactor->getBaseEdge());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAlpha(Units::rad2deg(formFactor->getAlpha()));
} else if (auto* formFactor = dynamic_cast<const FormFactorCosineRippleBox*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorCosineRippleBox*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<CosineRippleBoxItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorCosineRippleGauss*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorCosineRippleGauss*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<CosineRippleGaussItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorCosineRippleLorentz*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorCosineRippleLorentz*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<CosineRippleLorentzItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
} else if (auto* formFactor = dynamic_cast<const FormFactorSawtoothRippleBox*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorSawtoothRippleBox*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<SawtoothRippleBoxItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAsymmetry(formFactor->getAsymmetry());
} else if (auto* formFactor = dynamic_cast<const FormFactorSawtoothRippleGauss*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorSawtoothRippleGauss*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<SawtoothRippleGaussItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAsymmetry(formFactor->getAsymmetry());
} else if (auto* formFactor =
} else if (const auto* formFactor =
dynamic_cast<const FormFactorSawtoothRippleLorentz*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<SawtoothRippleLorentzItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setWidth(formFactor->getWidth());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAsymmetry(formFactor->getAsymmetry());
} else if (auto* formFactor = dynamic_cast<const FormFactorTetrahedron*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorTetrahedron*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<TetrahedronItem>(parent);
formFactorItem->setBaseEdge(formFactor->getBaseEdge());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setAlpha(Units::rad2deg(formFactor->getAlpha()));
} else if (auto* formFactor = dynamic_cast<const FormFactorTruncatedCube*>(iFormFactor)) {
} else if (const auto* formFactor = dynamic_cast<const FormFactorTruncatedCube*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<TruncatedCubeItem>(parent);
formFactorItem->setLength(formFactor->getLength());
formFactorItem->setRemovedLength(formFactor->getRemovedLength());
} else if (auto* formFactor = dynamic_cast<const FormFactorTruncatedSphere*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorTruncatedSphere*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<TruncatedSphereItem>(parent);
formFactorItem->setRadius(formFactor->getRadius());
formFactorItem->setHeight(formFactor->getHeight());
formFactorItem->setRemovedTop(formFactor->getRemovedTop());
} else if (auto* formFactor = dynamic_cast<const FormFactorTruncatedSpheroid*>(iFormFactor)) {
} else if (const auto* formFactor =
dynamic_cast<const FormFactorTruncatedSpheroid*>(iFormFactor)) {
auto* formFactorItem = addFormFactorItem<TruncatedSpheroidItem>(parent);
formFactorItem->setRadius(formFactor->getRadius());
formFactorItem->setHeight(formFactor->getHeight());
......@@ -957,4 +965,4 @@ void GUI::Transform::FromDomain::setFormFactor(std::variant<ParticleItem*, MesoC
formFactorItem->setRemovedTop(formFactor->getRemovedTop());
} else
ASSERT(false);
}
\ No newline at end of file
}
......@@ -38,12 +38,12 @@ namespace GUI::Transform::FromDomain {
MultiLayerItem* GUISampleBuilder::populateSampleModel(SampleModel* sampleModel,
MaterialModel* materialModel,
const MultiLayer& multiLayer,
const QString& node_name)
const QString& nodeName)
{
m_sampleModel = sampleModel;
m_materialModel = materialModel;
m_topSampleName = node_name;
m_topSampleName = nodeName;
if (m_topSampleName.isEmpty())
m_topSampleName = multiLayer.sampleName().c_str();
......@@ -55,7 +55,7 @@ MultiLayerItem* GUISampleBuilder::populateSampleModel(SampleModel* sampleModel,
// iterate over layers
for (size_t layerIndex = 0; layerIndex < multiLayer.numberOfLayers(); layerIndex++) {
auto* layer = multiLayer.layer(layerIndex);
const auto* layer = multiLayer.layer(layerIndex);
const LayerInterface* top_interface =
layerIndex == 0 ? nullptr : multiLayer.layerInterface(layerIndex - 1);
......@@ -66,7 +66,7 @@ MultiLayerItem* GUISampleBuilder::populateSampleModel(SampleModel* sampleModel,
FromDomain::setLayerItem(layerItem, layer, top_interface);
// iterate over particle layouts
for (auto layout : layer->layouts()) {
for (const auto* layout : layer->layouts()) {
auto* layoutItem = layerItem->addLayout();
layoutItem->totalDensity().set(layout->totalParticleSurfaceDensity());
layoutItem->weight().set(layout->weight());
......@@ -79,8 +79,8 @@ MultiLayerItem* GUISampleBuilder::populateSampleModel(SampleModel* sampleModel,
}
// initialize all items with materials to find the materials
for (auto multiLayerItem : sampleModel->multiLayerItems())
for (auto itemWithMaterial : multiLayerItem->itemsWithMaterial())
for (auto* multiLayerItem : sampleModel->multiLayerItems())
for (auto* itemWithMaterial : multiLayerItem->itemsWithMaterial())
itemWithMaterial->setMaterialModel(materialModel);
return multilayerItem;
......@@ -172,4 +172,4 @@ void GUISampleBuilder::copyParticle(const IParticle* iparticle,
}
}
} // namespace GUI::Transform::FromDomain
\ No newline at end of file
} // namespace GUI::Transform::FromDomain
......@@ -38,7 +38,7 @@ namespace GUI::Transform::FromDomain {
class GUISampleBuilder {
public:
MultiLayerItem* populateSampleModel(SampleModel* sampleModel, MaterialModel* materialModel,
const MultiLayer& node, const QString& node_name = "");
const MultiLayer& multiLayer, const QString& nodeName = "");
private:
MaterialItem* createMaterialFromDomain(const Material*);
......
......@@ -117,7 +117,7 @@ void GUI::Model::ParameterTreeUtils::createParameterTree(JobItem* jobItem,
descriptors << material->magnetizationVector().x << material->magnetizationVector().y
<< material->magnetizationVector().z;
for (auto d : descriptors) {
for (const auto& d : descriptors) {
auto* materialValue = materialLabel->model()->insertItem<ParameterItem>(materialLabel);
materialValue->setDisplayName(d.label);
materialValue->setValue(QVariant(d.get()));
......
......@@ -54,7 +54,8 @@ MaterialItem::MaterialItem() : m_data(Refractive(0.0, 0.0))
}
MaterialItem::MaterialItem(const MaterialItem& other)
: m_name(other.m_name)
: QObject()
, m_name(other.m_name)
, m_id(other.m_id)
, m_color(other.m_color)
, m_data(other.m_data)
......
......@@ -35,6 +35,11 @@ public:
MaterialItem();
//! Creates a complete copy, also the identifier is the same.
//!
//! Note that the base QObject is freshly initialized, not copied from \a other. Therefore
//! object hierarchy, connections, properties, object name or similar things are not copied.
//! This is of no harm since this class is only derived from QObject to provide data change
//! signaling.
MaterialItem(const MaterialItem& other);
//! Turns material into refractive index material.
......
......@@ -173,7 +173,7 @@ void MaterialModel::removeMaterial(MaterialItem* materialItem)
void MaterialModel::writeContentTo(QXmlStreamWriter* writer) const
{
writeAttribute(writer, GUI::Session::XML::Version, int(1));
for (auto m : m_materialItems) {
for (auto* m : m_materialItems) {
writer->writeStartElement("Material");
m->writeContentTo(writer);
writer->writeEndElement();
......@@ -192,7 +192,7 @@ void MaterialModel::readContentFrom(QXmlStreamReader* reader)
while (reader->readNextStartElement()) {
if (reader->name() == "Material") {
MaterialItem* m = new MaterialItem;
auto* m = new MaterialItem;
m->readContentFrom(reader);
addMaterial(m, false);
reader->skipCurrentElement();
......@@ -210,7 +210,7 @@ void MaterialModel::initFrom(const MaterialModel& from)
bool anyAddedOrRemoved = false;
// remove non-existing
auto iter = m_materialItems.begin();
auto* iter = m_materialItems.begin();
while (iter != m_materialItems.end())
if (!from.findMaterialItem((*iter)->identifier())) {
delete *iter;
......
......@@ -349,13 +349,13 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
}
// initialize all items with materials to find the materials
for (auto multiLayerItem : m_applicationModels.sampleModel()->multiLayerItems())
for (auto itemWithMaterial : multiLayerItem->itemsWithMaterial())
for (auto* multiLayerItem : m_applicationModels.sampleModel()->multiLayerItems())
for (auto* itemWithMaterial : multiLayerItem->itemsWithMaterial())
itemWithMaterial->setMaterialModel(materialModel());
// make a sanity check whether all materials are present
for (auto multiLayerItem : m_applicationModels.sampleModel()->multiLayerItems())
for (auto itemWithMaterial : multiLayerItem->itemsWithMaterial())
for (const auto* multiLayerItem : m_applicationModels.sampleModel()->multiLayerItems())
for (const auto* itemWithMaterial : multiLayerItem->itemsWithMaterial())
if (itemWithMaterial->materialItem() == nullptr) {
QString message = QString("Material link is broken (id: '%1')")
.arg(itemWithMaterial->materialIdentifier());
......
......@@ -25,9 +25,6 @@
#include "GUI/Model/Types/UIntDescriptor.h"
#include "GUI/Util/Error.h"
#include <QColor>
#include <boost/polymorphic_cast.hpp>
using boost::polymorphic_cast;
namespace {
......
......@@ -29,12 +29,12 @@ void SampleValidator::iterateItems(const SessionItem* parentItem)
void SampleValidator::validateItem(const SessionItem* item)
{
if (auto* p = dynamic_cast<const ParticleCoreShellItem*>(item)) {
if (const auto* p = dynamic_cast<const ParticleCoreShellItem*>(item)) {
if (!p->core())
addMessage("Core/shell particle doesn't have core defined.");
if (!p->shell())
addMessage("Core/shell particle doesn't have shell defined.");
} else if (auto* p = dynamic_cast<const ParticleCompositionItem*>(item))
} else if (const auto* p = dynamic_cast<const ParticleCompositionItem*>(item))
if (p->particles().isEmpty())
addMessage("Particle composition doesn't have any particles.");
}
......
......@@ -22,10 +22,10 @@
#include "GUI/Util/Error.h"
std::unique_ptr<MultiLayer>
GUI::Model::DomainObjectBuilder::buildMultiLayer(const MultiLayerItem& multiLayerItem)
GUI::Model::DomainObjectBuilder::buildMultiLayer(const MultiLayerItem& item)
{
auto P_multilayer = GUI::Transform::ToDomain::createMultiLayer(multiLayerItem);
for (auto* layerItem : multiLayerItem.layers()) {
auto P_multilayer = GUI::Transform::ToDomain::createMultiLayer(item);
for (auto* layerItem : item.layers()) {
auto P_layer = buildLayer(*layerItem);
const auto roughness = layerItem->roughness().currentItem();
auto P_roughness = GUI::Transform::ToDomain::createLayerRoughness(roughness);
......
......@@ -31,7 +31,7 @@ class ICoordSystem;
namespace GUI::Model::DomainObjectBuilder {
std::unique_ptr<MultiLayer> buildMultiLayer(const MultiLayerItem& multilayer_item);
std::unique_ptr<MultiLayer> buildMultiLayer(const MultiLayerItem& item);
std::unique_ptr<Layer> buildLayer(const LayerItem& item);
std::unique_ptr<ParticleLayout> buildParticleLayout(const ParticleLayoutItem& item);
......
......@@ -39,16 +39,16 @@ DoubleDescriptor::DoubleDescriptor(const QString& label, const QString& tooltip,
{
}
DoubleDescriptor::DoubleDescriptor(QString label, QString tooltip, int decimals,
const RealLimits& limits, function<void(double)> setter,
function<double()> getter, const variant<QString, Unit>& unit)
: label(std::move(label))
, tooltip(std::move(tooltip))
, decimals(decimals)
, limits(limits)
DoubleDescriptor::DoubleDescriptor(QString label_, QString tooltip_, int decimals_,
const RealLimits& limits_, function<void(double)> setter,
function<double()> getter, const variant<QString, Unit>& unit_)
: label(std::move(label_))
, tooltip(std::move(tooltip_))
, decimals(decimals_)
, limits(limits_)
, set(std::move(setter))
, get(std::move(getter))
, unit(unit)
, unit(unit_)
{
// #baLayerEditor the following path creation has to be implemented when SessionItem migration
// has finished
......@@ -72,10 +72,10 @@ DoubleDescriptor::DoubleDescriptor(const QString& label, const QString& tooltip,
DoubleDescriptor::DoubleDescriptor(const QString& label, double* var,
const variant<QString, Unit>& unit)
: label(label), decimals(3), limits(RealLimits::nonnegative()), unit(unit)
: DoubleDescriptor(
label, "", 3, RealLimits::nonnegative(), [=](double v) { *var = v; }, [=] { return *var; },
unit)
{
set = [=](double v) { *var = v; };
get = [=]() { return *var; };
}
DoubleDescriptor::operator double() const
......
......@@ -41,6 +41,11 @@ public:
//! Only for easier migration. Should be removed after SessionItem refactoring.
DoubleDescriptor(SessionItem* item, const variant<QString, Unit>& unit);
//! Operates on any kind of storage (e.g. session items), by using setter/getter methods
//! decimals is set to 3, limits is set to nonnegative
DoubleDescriptor(const QString& label, const QString& tooltip, function<void(double)> setter,
function<double()> getter, const variant<QString, Unit>& unit);
//! Operates on a session item. The settings (like decimals, limits) are taken from the session
//! item.
//! Only for easier migration. Should be removed after SessionItem refactoring.
......@@ -66,11 +71,6 @@ private: // private as long as path initialization is not included in params (to
DoubleDescriptor(const QString& label, const QString& tooltip, double* var,
const variant<QString, Unit>& unit);
//! Operates on any kind of storage (e.g. session items), by using setter/getter methods
//! decimals is set to 3, limits is set to nonnegative
DoubleDescriptor(const QString& label, const QString& tooltip, function<void(double)> setter,
function<double()> getter, const variant<QString, Unit>& unit);
public:
//! Return the current value of the handled parameter.
operator double() const;
......
......@@ -158,6 +158,6 @@ void MinimizerSettingsWidget::createMimimizerEdits()
void MinimizerSettingsWidget::updateUIValues()
{
for (auto updater : m_updaters)
for (const auto& updater : m_updaters)
updater();
}
......@@ -75,9 +75,9 @@ void SliderSettingsWidget::rangeChanged()
m_currentSliderRange = 10.0;
else if (m_radio2->isChecked())
m_currentSliderRange = 100.0;
else if (m_radio3->isChecked()) {
else if (m_radio3->isChecked())
m_currentSliderRange = 1000.0;
}
emit sliderRangeFactorChanged(m_currentSliderRange);
}
......