From 61e74916b72945e03295f2b8dbe07eefb9fe4966 Mon Sep 17 00:00:00 2001 From: David Li <dawei.li@gmx.net> Date: Wed, 9 Mar 2016 10:10:37 +0100 Subject: [PATCH] renaming functions: getRegisteredProperty->getChildValue setRegisteredProperty->setChildValue --- GUI/coregui/Models/AxesItems.cpp | 14 +- GUI/coregui/Models/BeamAngleItems.cpp | 24 +- GUI/coregui/Models/BeamDistributionItem.cpp | 10 +- GUI/coregui/Models/BeamItem.cpp | 26 +- GUI/coregui/Models/BeamWavelengthItem.cpp | 2 +- GUI/coregui/Models/DetectorItems.cpp | 2 +- GUI/coregui/Models/DistributionItem.cpp | 68 ++--- GUI/coregui/Models/DomainObjectBuilder.cpp | 2 +- GUI/coregui/Models/FTDecayFunctionItems.cpp | 54 ++-- GUI/coregui/Models/FTDecayFunctionItems.h | 2 +- GUI/coregui/Models/FTDistributionItems.cpp | 82 +++--- GUI/coregui/Models/FTDistributionItems.h | 2 +- GUI/coregui/Models/FitModel.cpp | 14 +- GUI/coregui/Models/FitParameterItems.cpp | 18 +- GUI/coregui/Models/FitParameterModel.cpp | 12 +- GUI/coregui/Models/FormFactorItems.cpp | 208 +++++++------- GUI/coregui/Models/GUIObjectBuilder.cpp | 138 +++++----- GUI/coregui/Models/IntensityDataItem.cpp | 68 ++--- .../Models/InterferenceFunctionItems.cpp | 42 +-- GUI/coregui/Models/ItemLink.cpp | 4 +- GUI/coregui/Models/JobItem.cpp | 64 ++--- GUI/coregui/Models/JobModel.cpp | 4 +- GUI/coregui/Models/JobResultsPresenter.cpp | 6 +- GUI/coregui/Models/LatticeTypeItems.cpp | 10 +- GUI/coregui/Models/LayerItem.cpp | 6 +- GUI/coregui/Models/LayerRoughnessItems.cpp | 6 +- GUI/coregui/Models/MagneticFieldItem.cpp | 12 +- GUI/coregui/Models/MaskItems.cpp | 56 ++-- GUI/coregui/Models/MaterialItem.cpp | 10 +- GUI/coregui/Models/MaterialModel.cpp | 2 +- GUI/coregui/Models/ModelMapper.cpp | 4 +- GUI/coregui/Models/ModelPath.cpp | 6 +- GUI/coregui/Models/MultiLayerItem.cpp | 4 +- GUI/coregui/Models/ParameterModelBuilder.cpp | 6 +- .../Models/ParticleCompositionItem.cpp | 8 +- GUI/coregui/Models/ParticleCoreShellItem.cpp | 8 +- .../Models/ParticleDistributionItem.cpp | 22 +- GUI/coregui/Models/ParticleItem.cpp | 10 +- GUI/coregui/Models/ParticleLayoutItem.cpp | 4 +- .../Models/RectangularDetectorItem.cpp | 56 ++-- GUI/coregui/Models/RefractiveIndexItem.cpp | 16 +- .../Models/ResolutionFunctionItems.cpp | 8 +- GUI/coregui/Models/RotationItems.cpp | 24 +- GUI/coregui/Models/SampleModel.cpp | 2 +- GUI/coregui/Models/SessionGraphicsItem.cpp | 4 +- GUI/coregui/Models/SessionItem.cpp | 98 +++---- GUI/coregui/Models/SessionItem.h | 26 +- GUI/coregui/Models/SessionModel.cpp | 84 +++--- GUI/coregui/Models/SessionModel.h | 6 +- GUI/coregui/Models/SphericalDetectorItem.cpp | 26 +- GUI/coregui/Models/TestItem.cpp | 8 +- GUI/coregui/Models/TransformFromDomain.cpp | 254 +++++++++--------- GUI/coregui/Models/TransformToDomain.cpp | 70 ++--- GUI/coregui/Models/TransformationItem.cpp | 2 +- GUI/coregui/Models/VectorItem.cpp | 18 +- .../Views/FitWidgets/FitParameterWidget.cpp | 2 +- GUI/coregui/Views/FitWidgets/RunFitWidget.cpp | 8 +- .../Views/InfoWidgets/DistributionWidget.cpp | 6 +- .../DetectorMaskDelegate.cpp | 38 +-- .../RectangularDetectorWidget.cpp | 2 +- .../IntensityDataWidgets/ColorMapPlot.cpp | 6 +- .../IntensityDataPlotWidget.cpp | 14 +- .../IntensityDataWidget.cpp | 12 +- GUI/coregui/Views/MaskWidgets/EllipseView.cpp | 22 +- GUI/coregui/Views/MaskWidgets/IMaskView.cpp | 6 +- GUI/coregui/Views/MaskWidgets/LineViews.cpp | 8 +- .../Views/MaskWidgets/MaskEditorActions.cpp | 4 +- .../Views/MaskWidgets/MaskGraphicsScene.cpp | 32 +-- .../MaskWidgets/MaskResultsPresenter.cpp | 8 +- .../Views/MaskWidgets/PolygonPointView.cpp | 4 +- GUI/coregui/Views/MaskWidgets/PolygonView.cpp | 10 +- .../Views/MaskWidgets/RectangleView.cpp | 26 +- .../MaterialEditor/MaterialEditorToolBar.cpp | 2 +- .../UniversalPropertyEditor.cpp | 7 +- .../Views/SampleDesigner/DesignerScene.cpp | 46 ++-- .../Views/SampleDesigner/ILayerView.cpp | 6 +- GUI/coregui/Views/SampleDesigner/IView.cpp | 12 +- .../Views/SampleDesigner/MultiLayerView.cpp | 2 +- GUI/coregui/Views/SampleView.cpp | 4 +- .../TestGUI/GUICoreObjectCorrespondence.h | 2 +- .../TestGUI/TestFTDistributionItems.h | 6 +- Tests/UnitTests/TestGUI/TestFormFactorItems.h | 8 +- .../TestGUI/TestLayerRoughnessItems.h | 18 +- Tests/UnitTests/TestGUI/TestMapper.h | 14 +- .../UnitTests/TestGUI/TestParaCrystalItems.h | 10 +- .../UnitTests/TestGUI/TestParameterizedItem.h | 16 +- 86 files changed, 1034 insertions(+), 1069 deletions(-) diff --git a/GUI/coregui/Models/AxesItems.cpp b/GUI/coregui/Models/AxesItems.cpp index bfb16dde5f0..60dd2d02f1e 100644 --- a/GUI/coregui/Models/AxesItems.cpp +++ b/GUI/coregui/Models/AxesItems.cpp @@ -29,13 +29,13 @@ BasicAxisItem::BasicAxisItem(const QString &type) void BasicAxisItem::register_basic_properties() { - registerProperty(P_IS_VISIBLE, true)->setVisible(false); - registerProperty(P_NBINS, 100)->setLimits(AttLimits::limited(1, 1024)); - registerProperty(P_MIN, 0.0)->setDecimals(3); + addProperty(P_IS_VISIBLE, true)->setVisible(false); + addProperty(P_NBINS, 100)->setLimits(AttLimits::limited(1, 1024)); + addProperty(P_MIN, 0.0)->setDecimals(3); getItem(P_MIN)->setLimits(AttLimits::limitless()); - registerProperty(P_MAX, -1.0)->setDecimals(3); + addProperty(P_MAX, -1.0)->setDecimals(3); getItem(P_MAX)->setLimits(AttLimits::limitless()); - registerProperty(P_TITLE, QString()); + addProperty(P_TITLE, QString()); } // ---------------------------------------------------------------------------------------------- // @@ -46,8 +46,8 @@ const QString AmplitudeAxisItem::P_LOCK_MIN_MAX = "Lock (min, max)"; AmplitudeAxisItem::AmplitudeAxisItem() : BasicAxisItem(Constants::AmplitudeAxisType) { - registerProperty(P_LOCK_MIN_MAX, false)->setVisible(false); - registerProperty(P_IS_LOGSCALE, true); + addProperty(P_LOCK_MIN_MAX, false)->setVisible(false); + addProperty(P_IS_LOGSCALE, true); getItem(BasicAxisItem::P_TITLE)->setVisible(false); getItem(BasicAxisItem::P_IS_VISIBLE)->setVisible(true); } diff --git a/GUI/coregui/Models/BeamAngleItems.cpp b/GUI/coregui/Models/BeamAngleItems.cpp index d6c7c489a10..f3cee16c931 100644 --- a/GUI/coregui/Models/BeamAngleItems.cpp +++ b/GUI/coregui/Models/BeamAngleItems.cpp @@ -27,7 +27,7 @@ BeamInclinationAngleItem::BeamInclinationAngleItem() cache->setVisible(false); cache->setLimits(AttLimits::limited(0.0, 90.0)); cache->setDecimals(3); - setRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE, 0.2); + setChildValue(BeamDistributionItem::P_CACHED_VALUE, 0.2); SessionItem *distribution = dynamic_cast<DistributionNoneItem *>(getGroupItem(P_DISTRIBUTION)); Q_ASSERT(distribution); @@ -50,7 +50,7 @@ std::unique_ptr<IDistribution1D> BeamInclinationAngleItem::createDistribution1D( BeamAzimuthalAngleItem::BeamAzimuthalAngleItem() : BeamDistributionItem(Constants::BeamAzimuthalAngleType) { - setRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE, 0.0); + setChildValue(BeamDistributionItem::P_CACHED_VALUE, 0.0); auto cache = getItem(BeamDistributionItem::P_CACHED_VALUE); cache->setVisible(false); cache->setLimits(AttLimits::limited(-90.0, 90.0)); @@ -80,37 +80,37 @@ BeamAngleHelper::creatAngleDistribution(DistributionItem *distributionItem) std::unique_ptr<IDistribution1D> P_distribution {}; if (distributionItem->modelType() == Constants::DistributionGateType) { double min - = distributionItem->getRegisteredProperty(DistributionGateItem::P_MIN).toDouble(); + = distributionItem->getChildValue(DistributionGateItem::P_MIN).toDouble(); double max - = distributionItem->getRegisteredProperty(DistributionGateItem::P_MAX).toDouble(); + = distributionItem->getChildValue(DistributionGateItem::P_MAX).toDouble(); P_distribution = std::move( GUIHelpers::make_unique<DistributionGate>(Units::deg2rad(min), Units::deg2rad(max))); } else if (distributionItem->modelType() == Constants::DistributionLorentzType) { double mean - = distributionItem->getRegisteredProperty(DistributionLorentzItem::P_MEAN).toDouble(); + = distributionItem->getChildValue(DistributionLorentzItem::P_MEAN).toDouble(); double hwhm - = distributionItem->getRegisteredProperty(DistributionLorentzItem::P_HWHM).toDouble(); + = distributionItem->getChildValue(DistributionLorentzItem::P_HWHM).toDouble(); P_distribution = std::move(GUIHelpers::make_unique<DistributionLorentz>( Units::deg2rad(mean), Units::deg2rad(hwhm))); } else if (distributionItem->modelType() == Constants::DistributionGaussianType) { double mean - = distributionItem->getRegisteredProperty(DistributionGaussianItem::P_MEAN).toDouble(); - double std_dev = distributionItem->getRegisteredProperty( + = distributionItem->getChildValue(DistributionGaussianItem::P_MEAN).toDouble(); + double std_dev = distributionItem->getChildValue( DistributionGaussianItem::P_STD_DEV).toDouble(); P_distribution = std::move(GUIHelpers::make_unique<DistributionGaussian>( Units::deg2rad(mean), Units::deg2rad(std_dev))); } else if (distributionItem->modelType() == Constants::DistributionLogNormalType) { - double median = distributionItem->getRegisteredProperty(DistributionLogNormalItem::P_MEDIAN) + double median = distributionItem->getChildValue(DistributionLogNormalItem::P_MEDIAN) .toDouble(); - double scale_par = distributionItem->getRegisteredProperty( + double scale_par = distributionItem->getChildValue( DistributionLogNormalItem::P_SCALE_PAR).toDouble(); P_distribution = std::move( GUIHelpers::make_unique<DistributionLogNormal>(Units::deg2rad(median), scale_par)); } else if (distributionItem->modelType() == Constants::DistributionCosineType) { double mean - = distributionItem->getRegisteredProperty(DistributionCosineItem::P_MEAN).toDouble(); + = distributionItem->getChildValue(DistributionCosineItem::P_MEAN).toDouble(); double sigma - = distributionItem->getRegisteredProperty(DistributionCosineItem::P_SIGMA).toDouble(); + = distributionItem->getChildValue(DistributionCosineItem::P_SIGMA).toDouble(); P_distribution = std::move(GUIHelpers::make_unique<DistributionCosine>( Units::deg2rad(mean), Units::deg2rad(sigma))); } diff --git a/GUI/coregui/Models/BeamDistributionItem.cpp b/GUI/coregui/Models/BeamDistributionItem.cpp index 287ec705533..01447319585 100644 --- a/GUI/coregui/Models/BeamDistributionItem.cpp +++ b/GUI/coregui/Models/BeamDistributionItem.cpp @@ -28,9 +28,9 @@ const QString BeamDistributionItem::P_CACHED_VALUE = "Cached value"; BeamDistributionItem::BeamDistributionItem(const QString name) : SessionItem(name) { - registerProperty(P_CACHED_VALUE, 0.0); + addProperty(P_CACHED_VALUE, 0.0); getItem(P_CACHED_VALUE)->setVisible(false); - registerGroupProperty(P_DISTRIBUTION, Constants::DistributionExtendedGroup); + addGroupProperty(P_DISTRIBUTION, Constants::DistributionExtendedGroup); setGroupProperty(P_DISTRIBUTION, Constants::DistributionNoneType); } @@ -64,11 +64,11 @@ BeamDistributionItem::getParameterDistributionForName(const std::string ¶met auto P_distribution = createDistribution1D(); if (P_distribution) { - int nbr_samples = distributionItem->getRegisteredProperty( + int nbr_samples = distributionItem->getChildValue( DistributionItem::P_NUMBER_OF_SAMPLES).toInt(); double sigma_factor(0); - if (distributionItem->isRegisteredTag(DistributionItem::P_SIGMA_FACTOR)) { - sigma_factor = distributionItem->getRegisteredProperty( + if (distributionItem->isTag(DistributionItem::P_SIGMA_FACTOR)) { + sigma_factor = distributionItem->getChildValue( DistributionItem::P_SIGMA_FACTOR).toInt(); } diff --git a/GUI/coregui/Models/BeamItem.cpp b/GUI/coregui/Models/BeamItem.cpp index 407b3043041..0866825f1a6 100644 --- a/GUI/coregui/Models/BeamItem.cpp +++ b/GUI/coregui/Models/BeamItem.cpp @@ -34,32 +34,32 @@ const QString BeamItem::P_AZIMUTHAL_ANGLE = "Azimuthal Angle"; BeamItem::BeamItem() : SessionItem(Constants::BeamType) { ScientificDoubleProperty intensity(1e+08); - registerProperty(P_INTENSITY, intensity.getVariant())->setLimits(AttLimits::limited(0.0, 1e+32)); - registerGroupProperty(P_WAVELENGTH, Constants::BeamWavelengthType); - registerGroupProperty(P_INCLINATION_ANGLE, Constants::BeamInclinationAngleType); - registerGroupProperty(P_AZIMUTHAL_ANGLE, Constants::BeamAzimuthalAngleType); + addProperty(P_INTENSITY, intensity.getVariant())->setLimits(AttLimits::limited(0.0, 1e+32)); + addGroupProperty(P_WAVELENGTH, Constants::BeamWavelengthType); + addGroupProperty(P_INCLINATION_ANGLE, Constants::BeamInclinationAngleType); + addGroupProperty(P_AZIMUTHAL_ANGLE, Constants::BeamAzimuthalAngleType); } double BeamItem::getIntensity() const { ScientificDoubleProperty intensity - = getRegisteredProperty(P_INTENSITY).value<ScientificDoubleProperty>(); + = getChildValue(P_INTENSITY).value<ScientificDoubleProperty>(); return intensity.getValue(); } void BeamItem::setIntensity(double value) { ScientificDoubleProperty intensity - = getRegisteredProperty(P_INTENSITY).value<ScientificDoubleProperty>(); + = getChildValue(P_INTENSITY).value<ScientificDoubleProperty>(); intensity.setValue(value); - setRegisteredProperty(P_INTENSITY, intensity.getVariant()); + setChildValue(P_INTENSITY, intensity.getVariant()); } double BeamItem::getWavelength() const { SessionItem *beamWavelength = getGroupItem(P_WAVELENGTH); Q_ASSERT(beamWavelength); - return beamWavelength->getRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE).toDouble(); + return beamWavelength->getChildValue(BeamDistributionItem::P_CACHED_VALUE).toDouble(); } void BeamItem::setWavelength(double value, const QString &distribution_name) @@ -70,14 +70,14 @@ void BeamItem::setWavelength(double value, const QString &distribution_name) SessionItem *distributionItem = beamWavelength->setGroupProperty( BeamDistributionItem::P_DISTRIBUTION, Constants::DistributionNoneType); Q_ASSERT(distributionItem); - distributionItem->setRegisteredProperty(DistributionNoneItem::P_VALUE, value); + distributionItem->setChildValue(DistributionNoneItem::P_VALUE, value); } double BeamItem::getInclinationAngle() const { SessionItem *angleItem = getGroupItem(P_INCLINATION_ANGLE); Q_ASSERT(angleItem); - return angleItem->getRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE).toDouble(); + return angleItem->getChildValue(BeamDistributionItem::P_CACHED_VALUE).toDouble(); } void BeamItem::setInclinationAngle(double value, const QString &distribution_name) @@ -88,14 +88,14 @@ void BeamItem::setInclinationAngle(double value, const QString &distribution_nam SessionItem *distributionItem = angleItem->setGroupProperty( BeamDistributionItem::P_DISTRIBUTION, Constants::DistributionNoneType); Q_ASSERT(distributionItem); - distributionItem->setRegisteredProperty(DistributionNoneItem::P_VALUE, value); + distributionItem->setChildValue(DistributionNoneItem::P_VALUE, value); } double BeamItem::getAzimuthalAngle() const { SessionItem *angleItem = getGroupItem(P_AZIMUTHAL_ANGLE); Q_ASSERT(angleItem); - return angleItem->getRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE).toDouble(); + return angleItem->getChildValue(BeamDistributionItem::P_CACHED_VALUE).toDouble(); } void BeamItem::setAzimuthalAngle(double value, const QString &distribution_name) @@ -106,5 +106,5 @@ void BeamItem::setAzimuthalAngle(double value, const QString &distribution_name) SessionItem *distributionItem = angleItem->setGroupProperty( BeamDistributionItem::P_DISTRIBUTION, Constants::DistributionNoneType); Q_ASSERT(distributionItem); - distributionItem->setRegisteredProperty(DistributionNoneItem::P_VALUE, value); + distributionItem->setChildValue(DistributionNoneItem::P_VALUE, value); } diff --git a/GUI/coregui/Models/BeamWavelengthItem.cpp b/GUI/coregui/Models/BeamWavelengthItem.cpp index bb4f1a2f4a6..34b4f588a5a 100644 --- a/GUI/coregui/Models/BeamWavelengthItem.cpp +++ b/GUI/coregui/Models/BeamWavelengthItem.cpp @@ -22,5 +22,5 @@ BeamWavelengthItem::BeamWavelengthItem() cache->setVisible(false); cache->setLimits(AttLimits::lowerLimited(1e-4)); cache->setDecimals(4); - setRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE, 0.1); + setChildValue(BeamDistributionItem::P_CACHED_VALUE, 0.1); } diff --git a/GUI/coregui/Models/DetectorItems.cpp b/GUI/coregui/Models/DetectorItems.cpp index f2e2a867600..05de82aa2d3 100644 --- a/GUI/coregui/Models/DetectorItems.cpp +++ b/GUI/coregui/Models/DetectorItems.cpp @@ -25,7 +25,7 @@ const QString DetectorItem::T_MASKS = "Mask tag"; DetectorItem::DetectorItem() : SessionItem(Constants::DetectorType) { - registerGroupProperty(P_DETECTOR, Constants::DetectorGroup); + addGroupProperty(P_DETECTOR, Constants::DetectorGroup); registerTag(T_MASKS, 0, -1, QStringList() << Constants::MaskContainerType); setDefaultTag(T_MASKS); setGroupProperty(P_DETECTOR, Constants::SphericalDetectorType); diff --git a/GUI/coregui/Models/DistributionItem.cpp b/GUI/coregui/Models/DistributionItem.cpp index 676eaf8db68..5a35211d2b5 100644 --- a/GUI/coregui/Models/DistributionItem.cpp +++ b/GUI/coregui/Models/DistributionItem.cpp @@ -30,12 +30,12 @@ DistributionItem::DistributionItem(const QString name) void DistributionItem::register_number_of_samples() { - registerProperty(P_NUMBER_OF_SAMPLES, 5); + addProperty(P_NUMBER_OF_SAMPLES, 5); } void DistributionItem::register_sigma_factor() { - registerProperty(P_SIGMA_FACTOR, 2.0); + addProperty(P_SIGMA_FACTOR, 2.0); } /* ------------------------------------------------ */ @@ -45,7 +45,7 @@ const QString DistributionNoneItem::P_VALUE = "Value"; DistributionNoneItem::DistributionNoneItem() : DistributionItem(Constants::DistributionNoneType) { - registerProperty(P_VALUE, 0.1)->setLimits(AttLimits::limitless()); + addProperty(P_VALUE, 0.1)->setLimits(AttLimits::limitless()); } std::unique_ptr<IDistribution1D> DistributionNoneItem::createDistribution() const @@ -55,7 +55,7 @@ std::unique_ptr<IDistribution1D> DistributionNoneItem::createDistribution() cons void DistributionNoneItem::init_parameters(double value, PropertyAttribute attribute) { - setRegisteredProperty(DistributionNoneItem::P_VALUE, value); + setChildValue(DistributionNoneItem::P_VALUE, value); // setPropertyAttribute(DistributionNoneItem::P_VALUE, attribute); } @@ -67,16 +67,16 @@ const QString DistributionGateItem::P_MAX = "Maximum"; DistributionGateItem::DistributionGateItem() : DistributionItem(Constants::DistributionGateType) { - registerProperty(P_MIN, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_MAX, 1.0)->setLimits(AttLimits::limitless()); + addProperty(P_MIN, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_MAX, 1.0)->setLimits(AttLimits::limitless()); register_number_of_samples(); register_sigma_factor(); } std::unique_ptr<IDistribution1D> DistributionGateItem::createDistribution() const { - double min = getRegisteredProperty(P_MIN).toDouble(); - double max = getRegisteredProperty(P_MAX).toDouble(); + double min = getChildValue(P_MIN).toDouble(); + double max = getChildValue(P_MAX).toDouble(); return GUIHelpers::make_unique<DistributionGate>(min, max); } @@ -84,9 +84,9 @@ void DistributionGateItem::init_parameters(double value, PropertyAttribute attri { double sigma(0.1*std::abs(value)); if(sigma == 0.0) sigma = 0.1; - setRegisteredProperty(P_MIN, value - sigma); + setChildValue(P_MIN, value - sigma); // setPropertyAttribute(P_MIN, attribute); - setRegisteredProperty(P_MAX, value + sigma); + setChildValue(P_MAX, value + sigma); // setPropertyAttribute(P_MAX, attribute); } @@ -98,16 +98,16 @@ const QString DistributionLorentzItem::P_HWHM = "HWHM"; DistributionLorentzItem::DistributionLorentzItem() : DistributionItem(Constants::DistributionLorentzType) { - registerProperty(P_MEAN, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_HWHM, 1.0); + addProperty(P_MEAN, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_HWHM, 1.0); register_number_of_samples(); register_sigma_factor(); } std::unique_ptr<IDistribution1D> DistributionLorentzItem::createDistribution() const { - double mean = getRegisteredProperty(P_MEAN).toDouble(); - double hwhm = getRegisteredProperty(P_HWHM).toDouble(); + double mean = getChildValue(P_MEAN).toDouble(); + double hwhm = getChildValue(P_HWHM).toDouble(); return GUIHelpers::make_unique<DistributionLorentz>(mean, hwhm); } @@ -116,9 +116,9 @@ void DistributionLorentzItem::init_parameters(double value, PropertyAttribute at double sigma(0.1*std::abs(value)); if(sigma == 0.0) sigma = 0.1; - setRegisteredProperty(P_MEAN, value); + setChildValue(P_MEAN, value); // setPropertyAttribute(P_MEAN, attribute); - setRegisteredProperty(P_HWHM, sigma); + setChildValue(P_HWHM, sigma); getItem(P_HWHM)->setLimits(AttLimits::lowerLimited(0.0)); } @@ -130,16 +130,16 @@ const QString DistributionGaussianItem::P_STD_DEV = "Standard deviation"; DistributionGaussianItem::DistributionGaussianItem() : DistributionItem(Constants::DistributionGaussianType) { - registerProperty(P_MEAN, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_STD_DEV, 1.0); + addProperty(P_MEAN, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_STD_DEV, 1.0); register_number_of_samples(); register_sigma_factor(); } std::unique_ptr<IDistribution1D> DistributionGaussianItem::createDistribution() const { - double mean = getRegisteredProperty(P_MEAN).toDouble(); - double std_dev = getRegisteredProperty(P_STD_DEV).toDouble(); + double mean = getChildValue(P_MEAN).toDouble(); + double std_dev = getChildValue(P_STD_DEV).toDouble(); return GUIHelpers::make_unique<DistributionGaussian>(mean, std_dev); } @@ -148,9 +148,9 @@ void DistributionGaussianItem::init_parameters(double value, PropertyAttribute a double sigma(0.1*std::abs(value)); if(sigma == 0.0) sigma = 0.1; - setRegisteredProperty(P_MEAN, value); + setChildValue(P_MEAN, value); // setPropertyAttribute(P_MEAN, attribute); - setRegisteredProperty(P_STD_DEV, sigma); + setChildValue(P_STD_DEV, sigma); getItem(P_STD_DEV)->setLimits(AttLimits::lowerLimited(0.0)); } @@ -162,16 +162,16 @@ const QString DistributionLogNormalItem::P_SCALE_PAR = "Scale parameter"; DistributionLogNormalItem::DistributionLogNormalItem() : DistributionItem(Constants::DistributionLogNormalType) { - registerProperty(P_MEDIAN, 1.0); - registerProperty(P_SCALE_PAR, 1.0); + addProperty(P_MEDIAN, 1.0); + addProperty(P_SCALE_PAR, 1.0); register_number_of_samples(); register_sigma_factor(); } std::unique_ptr<IDistribution1D> DistributionLogNormalItem::createDistribution() const { - double median = getRegisteredProperty(P_MEDIAN).toDouble(); - double scale_par = getRegisteredProperty(P_SCALE_PAR).toDouble(); + double median = getChildValue(P_MEDIAN).toDouble(); + double scale_par = getChildValue(P_SCALE_PAR).toDouble(); return GUIHelpers::make_unique<DistributionLogNormal>(median, scale_par); } @@ -180,9 +180,9 @@ void DistributionLogNormalItem::init_parameters(double value, PropertyAttribute double sigma(0.1*std::abs(value)); if(sigma == 0.0) sigma = 0.1; - setRegisteredProperty(P_MEDIAN, value); + setChildValue(P_MEDIAN, value); // setPropertyAttribute(P_MEDIAN, attribute); - setRegisteredProperty(P_SCALE_PAR, sigma); + setChildValue(P_SCALE_PAR, sigma); getItem(P_SCALE_PAR)->setLimits(AttLimits::lowerLimited(0.0)); } @@ -194,16 +194,16 @@ const QString DistributionCosineItem::P_SIGMA = "Sigma"; DistributionCosineItem::DistributionCosineItem() : DistributionItem(Constants::DistributionCosineType) { - registerProperty(P_MEAN, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_SIGMA, 1.0); + addProperty(P_MEAN, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_SIGMA, 1.0); register_number_of_samples(); register_sigma_factor(); } std::unique_ptr<IDistribution1D> DistributionCosineItem::createDistribution() const { - double mean = getRegisteredProperty(P_MEAN).toDouble(); - double sigma = getRegisteredProperty(P_SIGMA).toDouble(); + double mean = getChildValue(P_MEAN).toDouble(); + double sigma = getChildValue(P_SIGMA).toDouble(); return GUIHelpers::make_unique<DistributionCosine>(mean, sigma); } @@ -212,8 +212,8 @@ void DistributionCosineItem::init_parameters(double value, PropertyAttribute att double sigma(0.1*std::abs(value)); if(sigma == 0.0) sigma = 0.1; - setRegisteredProperty(P_MEAN, value); + setChildValue(P_MEAN, value); // setPropertyAttribute(P_MEAN, attribute); - setRegisteredProperty(P_SIGMA, sigma); + setChildValue(P_SIGMA, sigma); getItem(P_SIGMA)->setLimits(AttLimits::lowerLimited(0.0)); } diff --git a/GUI/coregui/Models/DomainObjectBuilder.cpp b/GUI/coregui/Models/DomainObjectBuilder.cpp index 805b4d0ea98..7266dc33d1a 100644 --- a/GUI/coregui/Models/DomainObjectBuilder.cpp +++ b/GUI/coregui/Models/DomainObjectBuilder.cpp @@ -89,7 +89,7 @@ std::unique_ptr<ParticleLayout> DomainObjectBuilder::buildParticleLayout( if (children[i]->modelType() == Constants::ParticleDistributionType) { auto prop = children[i] - ->getRegisteredProperty(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER) + ->getChildValue(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER) .value<ComboProperty>(); QString par_name = prop.getValue(); if (par_name == ParticleDistributionItem::NO_SELECTION) { diff --git a/GUI/coregui/Models/FTDecayFunctionItems.cpp b/GUI/coregui/Models/FTDecayFunctionItems.cpp index 91218935aad..58caa27a2d5 100644 --- a/GUI/coregui/Models/FTDecayFunctionItems.cpp +++ b/GUI/coregui/Models/FTDecayFunctionItems.cpp @@ -33,69 +33,69 @@ using namespace Constants; FTDecayFunction1DCauchyItem::FTDecayFunction1DCauchyItem() : FTDecayFunction1DItem(FTDecayFunction1DCauchyType) { - registerProperty(P_DECAY_LENGTH, 1000.0); + addProperty(P_DECAY_LENGTH, 1000.0); } IFTDecayFunction1D *FTDecayFunction1DCauchyItem::createFTDecayFunction() const { return new FTDecayFunction1DCauchy( - getRegisteredProperty(P_DECAY_LENGTH).toDouble() ); + getChildValue(P_DECAY_LENGTH).toDouble() ); } // Gauss FTDecayFunction1DGaussItem::FTDecayFunction1DGaussItem() : FTDecayFunction1DItem(FTDecayFunction1DGaussType) { - registerProperty(P_DECAY_LENGTH, 1000.0); + addProperty(P_DECAY_LENGTH, 1000.0); } IFTDecayFunction1D *FTDecayFunction1DGaussItem::createFTDecayFunction() const { return new FTDecayFunction1DGauss( - getRegisteredProperty(P_DECAY_LENGTH).toDouble() ); + getChildValue(P_DECAY_LENGTH).toDouble() ); } // Triangle FTDecayFunction1DTriangleItem::FTDecayFunction1DTriangleItem() : FTDecayFunction1DItem(FTDecayFunction1DTriangleType) { - registerProperty(P_DECAY_LENGTH, 1000.0); + addProperty(P_DECAY_LENGTH, 1000.0); } IFTDecayFunction1D *FTDecayFunction1DTriangleItem::createFTDecayFunction() const { return new FTDecayFunction1DTriangle( - getRegisteredProperty(P_DECAY_LENGTH).toDouble() ); + getChildValue(P_DECAY_LENGTH).toDouble() ); } // Voigt FTDecayFunction1DVoigtItem::FTDecayFunction1DVoigtItem() : FTDecayFunction1DItem(FTDecayFunction1DVoigtType) { - registerProperty(P_DECAY_LENGTH, 1000.0); - registerProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); + addProperty(P_DECAY_LENGTH, 1000.0); + addProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); } IFTDecayFunction1D *FTDecayFunction1DVoigtItem::createFTDecayFunction() const { return new FTDecayFunction1DVoigt( - getRegisteredProperty(P_DECAY_LENGTH).toDouble(), - getRegisteredProperty(P_ETA).toDouble() ); + getChildValue(P_DECAY_LENGTH).toDouble(), + getChildValue(P_ETA).toDouble() ); } FTDecayFunction2DCauchyItem::FTDecayFunction2DCauchyItem() : FTDecayFunction2DItem(FTDecayFunction2DCauchyType) { - registerProperty(P_DECAY_LENGTH_X, 1000.0); - registerProperty(P_DECAY_LENGTH_Y, 1000.0); + addProperty(P_DECAY_LENGTH_X, 1000.0); + addProperty(P_DECAY_LENGTH_Y, 1000.0); } IFTDecayFunction2D *FTDecayFunction2DCauchyItem::createFTDecayFunction() const { auto *p_result - = new FTDecayFunction2DCauchy(getRegisteredProperty(P_DECAY_LENGTH_X).toDouble(), - getRegisteredProperty(P_DECAY_LENGTH_Y).toDouble()); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble()); + = new FTDecayFunction2DCauchy(getChildValue(P_DECAY_LENGTH_X).toDouble(), + getChildValue(P_DECAY_LENGTH_Y).toDouble()); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble()); p_result->setGamma(gamma); return p_result; } @@ -103,16 +103,16 @@ IFTDecayFunction2D *FTDecayFunction2DCauchyItem::createFTDecayFunction() const FTDecayFunction2DGaussItem::FTDecayFunction2DGaussItem() : FTDecayFunction2DItem(FTDecayFunction2DGaussType) { - registerProperty(P_DECAY_LENGTH_X, 1000.0); - registerProperty(P_DECAY_LENGTH_Y, 1000.0); + addProperty(P_DECAY_LENGTH_X, 1000.0); + addProperty(P_DECAY_LENGTH_Y, 1000.0); } IFTDecayFunction2D *FTDecayFunction2DGaussItem::createFTDecayFunction() const { auto *p_result - = new FTDecayFunction2DGauss(getRegisteredProperty(P_DECAY_LENGTH_X).toDouble(), - getRegisteredProperty(P_DECAY_LENGTH_Y).toDouble()); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble()); + = new FTDecayFunction2DGauss(getChildValue(P_DECAY_LENGTH_X).toDouble(), + getChildValue(P_DECAY_LENGTH_Y).toDouble()); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble()); p_result->setGamma(gamma); return p_result; } @@ -120,18 +120,18 @@ IFTDecayFunction2D *FTDecayFunction2DGaussItem::createFTDecayFunction() const FTDecayFunction2DVoigtItem::FTDecayFunction2DVoigtItem() : FTDecayFunction2DItem(FTDecayFunction2DVoigtType) { - registerProperty(P_DECAY_LENGTH_X, 1000.0); - registerProperty(P_DECAY_LENGTH_Y, 1000.0); - registerProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); + addProperty(P_DECAY_LENGTH_X, 1000.0); + addProperty(P_DECAY_LENGTH_Y, 1000.0); + addProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); } IFTDecayFunction2D *FTDecayFunction2DVoigtItem::createFTDecayFunction() const { auto *p_result - = new FTDecayFunction2DVoigt(getRegisteredProperty(P_DECAY_LENGTH_X).toDouble(), - getRegisteredProperty(P_DECAY_LENGTH_Y).toDouble(), - getRegisteredProperty(P_ETA).toDouble()); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble()); + = new FTDecayFunction2DVoigt(getChildValue(P_DECAY_LENGTH_X).toDouble(), + getChildValue(P_DECAY_LENGTH_Y).toDouble(), + getChildValue(P_ETA).toDouble()); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble()); p_result->setGamma(gamma); return p_result; } diff --git a/GUI/coregui/Models/FTDecayFunctionItems.h b/GUI/coregui/Models/FTDecayFunctionItems.h index 230a3ac3cb8..2f7332a3005 100644 --- a/GUI/coregui/Models/FTDecayFunctionItems.h +++ b/GUI/coregui/Models/FTDecayFunctionItems.h @@ -74,7 +74,7 @@ public: static const QString P_GAMMA; explicit FTDecayFunction2DItem(const QString name) : SessionItem(name) { - registerProperty(P_GAMMA, 0.0); + addProperty(P_GAMMA, 0.0); } virtual IFTDecayFunction2D *createFTDecayFunction() const { return 0;} virtual ~FTDecayFunction2DItem(){} diff --git a/GUI/coregui/Models/FTDistributionItems.cpp b/GUI/coregui/Models/FTDistributionItems.cpp index 74fa3ecea01..d20a6f390b4 100644 --- a/GUI/coregui/Models/FTDistributionItems.cpp +++ b/GUI/coregui/Models/FTDistributionItems.cpp @@ -34,80 +34,80 @@ const QString FTDistribution2DVoigtItem::P_ETA = "Eta"; FTDistribution1DCauchyItem::FTDistribution1DCauchyItem() : FTDistribution1DItem(FTDistribution1DCauchyType) { - registerProperty(P_CORR_LENGTH, 1.0); + addProperty(P_CORR_LENGTH, 1.0); } IFTDistribution1D *FTDistribution1DCauchyItem::createFTDistribution() const { return new FTDistribution1DCauchy( - getRegisteredProperty(P_CORR_LENGTH).toDouble() ); + getChildValue(P_CORR_LENGTH).toDouble() ); } // Gauss FTDistribution1DGaussItem::FTDistribution1DGaussItem() : FTDistribution1DItem(FTDistribution1DGaussType) { - registerProperty(P_CORR_LENGTH, 1.0); + addProperty(P_CORR_LENGTH, 1.0); } IFTDistribution1D *FTDistribution1DGaussItem::createFTDistribution() const { return new FTDistribution1DGauss( - getRegisteredProperty(P_CORR_LENGTH).toDouble() ); + getChildValue(P_CORR_LENGTH).toDouble() ); } // Gate FTDistribution1DGateItem::FTDistribution1DGateItem() : FTDistribution1DItem(FTDistribution1DGateType) { - registerProperty(P_CORR_LENGTH, 1.0); + addProperty(P_CORR_LENGTH, 1.0); } IFTDistribution1D *FTDistribution1DGateItem::createFTDistribution() const { return new FTDistribution1DGate( - getRegisteredProperty(P_CORR_LENGTH).toDouble() ); + getChildValue(P_CORR_LENGTH).toDouble() ); } // Triangle FTDistribution1DTriangleItem::FTDistribution1DTriangleItem() : FTDistribution1DItem(FTDistribution1DTriangleType) { - registerProperty(P_CORR_LENGTH, 1.0); + addProperty(P_CORR_LENGTH, 1.0); } IFTDistribution1D *FTDistribution1DTriangleItem::createFTDistribution() const { return new FTDistribution1DTriangle( - getRegisteredProperty(P_CORR_LENGTH).toDouble() ); + getChildValue(P_CORR_LENGTH).toDouble() ); } // Cosine FTDistribution1DCosineItem::FTDistribution1DCosineItem() : FTDistribution1DItem(FTDistribution1DCosineType) { - registerProperty(P_CORR_LENGTH, 1.0); + addProperty(P_CORR_LENGTH, 1.0); } IFTDistribution1D *FTDistribution1DCosineItem::createFTDistribution() const { return new FTDistribution1DCosine( - getRegisteredProperty(P_CORR_LENGTH).toDouble() ); + getChildValue(P_CORR_LENGTH).toDouble() ); } // Voigt FTDistribution1DVoigtItem::FTDistribution1DVoigtItem() : FTDistribution1DItem(FTDistribution1DVoigtType) { - registerProperty(P_CORR_LENGTH, 1.0); - registerProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); + addProperty(P_CORR_LENGTH, 1.0); + addProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); } IFTDistribution1D *FTDistribution1DVoigtItem::createFTDistribution() const { return new FTDistribution1DVoigt( - getRegisteredProperty(P_CORR_LENGTH).toDouble(), - getRegisteredProperty(P_ETA).toDouble() ); + getChildValue(P_CORR_LENGTH).toDouble(), + getChildValue(P_ETA).toDouble() ); } @@ -117,17 +117,17 @@ IFTDistribution1D *FTDistribution1DVoigtItem::createFTDistribution() const FTDistribution2DCauchyItem::FTDistribution2DCauchyItem() : FTDistribution2DItem(FTDistribution2DCauchyType) { - registerProperty(P_CORR_LENGTH_X, 1.0); - registerProperty(P_CORR_LENGTH_Y, 1.0); + addProperty(P_CORR_LENGTH_X, 1.0); + addProperty(P_CORR_LENGTH_Y, 1.0); } IFTDistribution2D *FTDistribution2DCauchyItem::createFTDistribution() const { auto *p_result = new FTDistribution2DCauchy( - getRegisteredProperty(P_CORR_LENGTH_X).toDouble(), - getRegisteredProperty(P_CORR_LENGTH_Y).toDouble() + getChildValue(P_CORR_LENGTH_X).toDouble(), + getChildValue(P_CORR_LENGTH_Y).toDouble() ); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble() ); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble() ); p_result->setGamma(gamma); return p_result; } @@ -136,17 +136,17 @@ IFTDistribution2D *FTDistribution2DCauchyItem::createFTDistribution() const FTDistribution2DGaussItem::FTDistribution2DGaussItem() : FTDistribution2DItem(FTDistribution2DGaussType) { - registerProperty(P_CORR_LENGTH_X, 1.0); - registerProperty(P_CORR_LENGTH_Y, 1.0); + addProperty(P_CORR_LENGTH_X, 1.0); + addProperty(P_CORR_LENGTH_Y, 1.0); } IFTDistribution2D *FTDistribution2DGaussItem::createFTDistribution() const { auto *p_result = new FTDistribution2DGauss( - getRegisteredProperty(P_CORR_LENGTH_X).toDouble(), - getRegisteredProperty(P_CORR_LENGTH_Y).toDouble() + getChildValue(P_CORR_LENGTH_X).toDouble(), + getChildValue(P_CORR_LENGTH_Y).toDouble() ); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble() ); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble() ); p_result->setGamma(gamma); return p_result; } @@ -155,17 +155,17 @@ IFTDistribution2D *FTDistribution2DGaussItem::createFTDistribution() const FTDistribution2DGateItem::FTDistribution2DGateItem() : FTDistribution2DItem(FTDistribution2DGateType) { - registerProperty(P_CORR_LENGTH_X, 1.0); - registerProperty(P_CORR_LENGTH_Y, 1.0); + addProperty(P_CORR_LENGTH_X, 1.0); + addProperty(P_CORR_LENGTH_Y, 1.0); } IFTDistribution2D *FTDistribution2DGateItem::createFTDistribution() const { auto *p_result = new FTDistribution2DGate( - getRegisteredProperty(P_CORR_LENGTH_X).toDouble(), - getRegisteredProperty(P_CORR_LENGTH_Y).toDouble() + getChildValue(P_CORR_LENGTH_X).toDouble(), + getChildValue(P_CORR_LENGTH_Y).toDouble() ); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble() ); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble() ); p_result->setGamma(gamma); return p_result; } @@ -174,17 +174,17 @@ IFTDistribution2D *FTDistribution2DGateItem::createFTDistribution() const FTDistribution2DConeItem::FTDistribution2DConeItem() : FTDistribution2DItem(FTDistribution2DConeType) { - registerProperty(P_CORR_LENGTH_X, 1.0); - registerProperty(P_CORR_LENGTH_Y, 1.0); + addProperty(P_CORR_LENGTH_X, 1.0); + addProperty(P_CORR_LENGTH_Y, 1.0); } IFTDistribution2D *FTDistribution2DConeItem::createFTDistribution() const { auto *p_result = new FTDistribution2DCone( - getRegisteredProperty(P_CORR_LENGTH_X).toDouble(), - getRegisteredProperty(P_CORR_LENGTH_Y).toDouble() + getChildValue(P_CORR_LENGTH_X).toDouble(), + getChildValue(P_CORR_LENGTH_Y).toDouble() ); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble() ); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble() ); p_result->setGamma(gamma); return p_result; } @@ -193,19 +193,19 @@ IFTDistribution2D *FTDistribution2DConeItem::createFTDistribution() const FTDistribution2DVoigtItem::FTDistribution2DVoigtItem() : FTDistribution2DItem(FTDistribution2DVoigtType) { - registerProperty(P_CORR_LENGTH_X, 1.0); - registerProperty(P_CORR_LENGTH_Y, 1.0); - registerProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); + addProperty(P_CORR_LENGTH_X, 1.0); + addProperty(P_CORR_LENGTH_Y, 1.0); + addProperty(P_ETA, 0.5)->setLimits(AttLimits::limited(0.0, 1.0)); } IFTDistribution2D *FTDistribution2DVoigtItem::createFTDistribution() const { auto *p_result = new FTDistribution2DVoigt( - getRegisteredProperty(P_CORR_LENGTH_X).toDouble(), - getRegisteredProperty(P_CORR_LENGTH_Y).toDouble(), - getRegisteredProperty(P_ETA).toDouble() + getChildValue(P_CORR_LENGTH_X).toDouble(), + getChildValue(P_CORR_LENGTH_Y).toDouble(), + getChildValue(P_ETA).toDouble() ); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble() ); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble() ); p_result->setGamma(gamma); return p_result; } diff --git a/GUI/coregui/Models/FTDistributionItems.h b/GUI/coregui/Models/FTDistributionItems.h index 00dfa32c3a3..c9d3c101d42 100644 --- a/GUI/coregui/Models/FTDistributionItems.h +++ b/GUI/coregui/Models/FTDistributionItems.h @@ -90,7 +90,7 @@ public: static const QString P_GAMMA; explicit FTDistribution2DItem(const QString name) : SessionItem(name) { - registerProperty(P_GAMMA, 0.0); + addProperty(P_GAMMA, 0.0); } virtual IFTDistribution2D *createFTDistribution() const { return 0;} virtual ~FTDistribution2DItem(){} diff --git a/GUI/coregui/Models/FitModel.cpp b/GUI/coregui/Models/FitModel.cpp index ee7c23b9551..6114a2340ac 100644 --- a/GUI/coregui/Models/FitModel.cpp +++ b/GUI/coregui/Models/FitModel.cpp @@ -47,11 +47,11 @@ InputDataItem *FitModel::getInputData() { } QString FitModel::getSelectedSampleName () { - return getFitSelection()->getRegisteredProperty(FitSelectionItem::P_SAMPLE).toString(); + return getFitSelection()->getChildValue(FitSelectionItem::P_SAMPLE).toString(); } QString FitModel::getSelectedInstrumentName(){ - return getFitSelection()->getRegisteredProperty(FitSelectionItem::P_INSTRUMENT).toString(); + return getFitSelection()->getChildValue(FitSelectionItem::P_INSTRUMENT).toString(); } QStringList FitModel::getSampleNames() { @@ -101,12 +101,12 @@ SessionItem *FitModel::getSelectedInstrumentItem() { void FitModel::setSelectedSample(const QString &displayName) { SessionItem *selection = getFitSelection(); - selection->setRegisteredProperty(FitSelectionItem::P_SAMPLE, displayName); + selection->setChildValue(FitSelectionItem::P_SAMPLE, displayName); } void FitModel::setSelectedInstrument(const QString &displayName) { SessionItem *selection = getFitSelection(); - selection->setRegisteredProperty(FitSelectionItem::P_INSTRUMENT, displayName); + selection->setChildValue(FitSelectionItem::P_INSTRUMENT, displayName); } MinimizerSettingsItem *FitModel::getMinimizerSettings() { @@ -116,7 +116,7 @@ MinimizerSettingsItem *FitModel::getMinimizerSettings() { QString FitModel::getMinimizerAlgorithm() { if (auto *item = getMinimizerSettings()) { - return item->getRegisteredProperty(MinimizerSettingsItem::P_ALGO).value<ComboProperty>() + return item->getChildValue(MinimizerSettingsItem::P_ALGO).value<ComboProperty>() .getValue(); } return QString(); @@ -124,14 +124,14 @@ QString FitModel::getMinimizerAlgorithm() { QString FitModel::getInputDataPath() { if (auto *item = getInputData()) { - return item->getRegisteredProperty(InputDataItem::P_PATH).toString(); + return item->getChildValue(InputDataItem::P_PATH).toString(); } return ""; } void FitModel::setInputDataPath(const QString &path) { if (auto *item = getInputData()) { - item->setRegisteredProperty(InputDataItem::P_PATH, path); + item->setChildValue(InputDataItem::P_PATH, path); } } diff --git a/GUI/coregui/Models/FitParameterItems.cpp b/GUI/coregui/Models/FitParameterItems.cpp index e3e8530aa37..0cce33bcccf 100644 --- a/GUI/coregui/Models/FitParameterItems.cpp +++ b/GUI/coregui/Models/FitParameterItems.cpp @@ -33,10 +33,10 @@ const QString FitParameterItem::P_MAX = "Max"; FitParameterItem::FitParameterItem() : SessionItem(Constants::FitParameterType) { - registerProperty(P_USE, true); - registerProperty(P_INIT, 0.0); - registerProperty(P_MIN, 0.0); - registerProperty(P_MAX, 0.0); + addProperty(P_USE, true); + addProperty(P_INIT, 0.0); + addProperty(P_MIN, 0.0); + addProperty(P_MAX, 0.0); const QString T_LINK = "Link tag"; registerTag(T_LINK, 0, -1, QStringList() << Constants::FitParameterLinkType); setDefaultTag(T_LINK); @@ -49,7 +49,7 @@ const QString FitParameterLinkItem::P_LINK = "Link"; FitParameterLinkItem::FitParameterLinkItem() : SessionItem(Constants::FitParameterLinkType) { - registerProperty(P_LINK, ""); + addProperty(P_LINK, ""); } @@ -59,8 +59,8 @@ const QString FitSelectionItem::P_INSTRUMENT = "Instrument"; FitSelectionItem::FitSelectionItem() : SessionItem(Constants::FitSelectionType) { - registerProperty(P_SAMPLE, ""); - registerProperty(P_INSTRUMENT, ""); + addProperty(P_SAMPLE, ""); + addProperty(P_INSTRUMENT, ""); } const QString MinimizerSettingsItem::P_ALGO = "Algorithm"; @@ -70,7 +70,7 @@ MinimizerSettingsItem::MinimizerSettingsItem() { ComboProperty algo; algo << "Migrad" << "Simplex" << "Combined" << "Scan" << "Fumili"; - registerProperty(P_ALGO, algo.getVariant()); + addProperty(P_ALGO, algo.getVariant()); } const QString InputDataItem::P_PATH = "Path"; @@ -78,7 +78,7 @@ const QString InputDataItem::P_PATH = "Path"; InputDataItem::InputDataItem() : SessionItem(Constants::InputDataType) { - registerProperty(P_PATH, ""); + addProperty(P_PATH, ""); } diff --git a/GUI/coregui/Models/FitParameterModel.cpp b/GUI/coregui/Models/FitParameterModel.cpp index 002219b5f25..d7bb932da77 100644 --- a/GUI/coregui/Models/FitParameterModel.cpp +++ b/GUI/coregui/Models/FitParameterModel.cpp @@ -54,7 +54,7 @@ QModelIndex FitParameterModel::itemForLink(const QString &link) const for (int j = 0; j < rowcount; j++) { QModelIndex curIndex = index(j,0,index(i,0,QModelIndex())); QString value = itemForIndex(curIndex) - ->getRegisteredProperty(FitParameterLinkItem::P_LINK).toString(); + ->getChildValue(FitParameterLinkItem::P_LINK).toString(); if (value == link) return curIndex; } @@ -113,11 +113,11 @@ bool FitParameterModel::dropMimeData(const QMimeData *data, Qt::DropAction actio if (!parent.isValid()) { auto newlink = addParameter(); double value = parts[1].toDouble(); - newlink->setRegisteredProperty(FitParameterItem::P_INIT, value); + newlink->setChildValue(FitParameterItem::P_INIT, value); cur = indexOfItem(newlink); } auto link = insertNewItem(Constants::FitParameterLinkType, cur, row); - if (link) link->setRegisteredProperty(FitParameterLinkItem::P_LINK, parts[0]); + if (link) link->setChildValue(FitParameterLinkItem::P_LINK, parts[0]); emit dataChanged(cur, cur); return true; } @@ -132,14 +132,14 @@ QVariant FitParameterModel::data(const QModelIndex & index, int role) const if (item->parent() != itemForIndex(QModelIndex())) { if (index.column() == 0) - return item->getRegisteredProperty(FitParameterLinkItem::P_LINK); + return item->getChildValue(FitParameterLinkItem::P_LINK); else return QVariant(); } if (index.column() == 0) return item->itemName(); else - return item->getRegisteredProperty(m_columnNames->value(index.column())); + return item->getChildValue(m_columnNames->value(index.column())); } } return QVariant(); @@ -151,7 +151,7 @@ bool FitParameterModel::setData(const QModelIndex &index, const QVariant &value, return false; if (SessionItem *item = itemForIndex(index)) { if (role == Qt::EditRole && index.column() > 0 && index.column() < 5) { - item->setRegisteredProperty(m_columnNames->value(index.column()), value); + item->setChildValue(m_columnNames->value(index.column()), value); emit dataChanged(index, index); return true; } diff --git a/GUI/coregui/Models/FormFactorItems.cpp b/GUI/coregui/Models/FormFactorItems.cpp index 35b61cb86c0..45ac03cfec8 100644 --- a/GUI/coregui/Models/FormFactorItems.cpp +++ b/GUI/coregui/Models/FormFactorItems.cpp @@ -29,19 +29,19 @@ const QString AnisoPyramidItem::P_ALPHA = QString::fromStdString(BornAgain::Alph AnisoPyramidItem::AnisoPyramidItem() : FormFactorItem(Constants::AnisoPyramidType) { - registerProperty(P_LENGTH, 20.0); - registerProperty(P_WIDTH, 16.0); - registerProperty(P_HEIGHT, 13.0); - registerProperty(P_ALPHA, 60.0); + addProperty(P_LENGTH, 20.0); + addProperty(P_WIDTH, 16.0); + addProperty(P_HEIGHT, 13.0); + addProperty(P_ALPHA, 60.0); } std::unique_ptr<IFormFactor> AnisoPyramidItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorAnisoPyramid>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_WIDTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_ALPHA).toDouble()*Units::degree + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_WIDTH).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_ALPHA).toDouble()*Units::degree ); } @@ -54,17 +54,17 @@ const QString BoxItem::P_HEIGHT = QString::fromStdString(BornAgain::Height); BoxItem::BoxItem() : FormFactorItem(Constants::BoxType) { - registerProperty(P_LENGTH, 20.0); - registerProperty(P_WIDTH, 16.0); - registerProperty(P_HEIGHT, 13.0); + addProperty(P_LENGTH, 20.0); + addProperty(P_WIDTH, 16.0); + addProperty(P_HEIGHT, 13.0); } std::unique_ptr<IFormFactor> BoxItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorBox>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_WIDTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_WIDTH).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -77,17 +77,17 @@ const QString ConeItem::P_ALPHA = QString::fromStdString(BornAgain::Alpha); ConeItem::ConeItem() : FormFactorItem(Constants::ConeType) { - registerProperty(P_RADIUS, 10.0); - registerProperty(P_HEIGHT, 13.0); - registerProperty(P_ALPHA, 60.0); + addProperty(P_RADIUS, 10.0); + addProperty(P_HEIGHT, 13.0); + addProperty(P_ALPHA, 60.0); } std::unique_ptr<IFormFactor> ConeItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorCone>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_ALPHA).toDouble()*Units::degree + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_ALPHA).toDouble()*Units::degree ); } @@ -100,17 +100,17 @@ const QString Cone6Item::P_ALPHA = QString::fromStdString(BornAgain::Alpha); Cone6Item::Cone6Item() : FormFactorItem(Constants::Cone6Type) { - registerProperty(P_RADIUS, 10.0); - registerProperty(P_HEIGHT, 13.0); - registerProperty(P_ALPHA, 60.0); + addProperty(P_RADIUS, 10.0); + addProperty(P_HEIGHT, 13.0); + addProperty(P_ALPHA, 60.0); } std::unique_ptr<IFormFactor> Cone6Item::createFormFactor() const { return GUIHelpers::make_unique<FormFactorCone6>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_ALPHA).toDouble()*Units::degree + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_ALPHA).toDouble()*Units::degree ); } @@ -124,19 +124,19 @@ const QString CuboctahedronItem::P_ALPHA = QString::fromStdString(BornAgain::Alp CuboctahedronItem::CuboctahedronItem() : FormFactorItem(Constants::CuboctahedronType) { - registerProperty(P_LENGTH, 20.0); - registerProperty(P_HEIGHT, 13.0); - registerProperty(P_HEIGHT_RATIO, 0.7)->setLimits(AttLimits::lowerLimited(0.0)); - registerProperty(P_ALPHA, 60.0); + addProperty(P_LENGTH, 20.0); + addProperty(P_HEIGHT, 13.0); + addProperty(P_HEIGHT_RATIO, 0.7)->setLimits(AttLimits::lowerLimited(0.0)); + addProperty(P_ALPHA, 60.0); } std::unique_ptr<IFormFactor> CuboctahedronItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorCuboctahedron>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_HEIGHT_RATIO).toDouble(), - getRegisteredProperty(P_ALPHA).toDouble()*Units::degree + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_HEIGHT_RATIO).toDouble(), + getChildValue(P_ALPHA).toDouble()*Units::degree ); } @@ -148,15 +148,15 @@ const QString CylinderItem::P_HEIGHT = QString::fromStdString(BornAgain::Height) CylinderItem::CylinderItem() : FormFactorItem(Constants::CylinderType) { - registerProperty(P_RADIUS, 8.0); - registerProperty(P_HEIGHT, 16.0); + addProperty(P_RADIUS, 8.0); + addProperty(P_HEIGHT, 16.0); } std::unique_ptr<IFormFactor> CylinderItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorCylinder>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -169,17 +169,17 @@ const QString EllipsoidalCylinderItem::P_HEIGHT = QString::fromStdString(BornAga EllipsoidalCylinderItem::EllipsoidalCylinderItem() : FormFactorItem(Constants::EllipsoidalCylinderType) { - registerProperty(P_RADIUS_X, 8.0); - registerProperty(P_RADIUS_Y, 13.0); - registerProperty(P_HEIGHT, 16.0); + addProperty(P_RADIUS_X, 8.0); + addProperty(P_RADIUS_Y, 13.0); + addProperty(P_HEIGHT, 16.0); } std::unique_ptr<IFormFactor> EllipsoidalCylinderItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorEllipsoidalCylinder>( - getRegisteredProperty(P_RADIUS_X).toDouble(), - getRegisteredProperty(P_RADIUS_Y).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_RADIUS_X).toDouble(), + getChildValue(P_RADIUS_Y).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -190,13 +190,13 @@ const QString FullSphereItem::P_RADIUS = QString::fromStdString(BornAgain::Radiu FullSphereItem::FullSphereItem() : FormFactorItem(Constants::FullSphereType) { - registerProperty(P_RADIUS, 8.0); + addProperty(P_RADIUS, 8.0); } std::unique_ptr<IFormFactor> FullSphereItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorFullSphere>( - getRegisteredProperty(P_RADIUS).toDouble() + getChildValue(P_RADIUS).toDouble() ); } @@ -208,15 +208,15 @@ const QString FullSpheroidItem::P_HEIGHT = QString::fromStdString(BornAgain::Hei FullSpheroidItem::FullSpheroidItem() : FormFactorItem(Constants::FullSpheroidType) { - registerProperty(P_RADIUS, 10.0); - registerProperty(P_HEIGHT, 13.0); + addProperty(P_RADIUS, 10.0); + addProperty(P_HEIGHT, 13.0); } std::unique_ptr<IFormFactor> FullSpheroidItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorFullSpheroid>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -229,17 +229,17 @@ const QString HemiEllipsoidItem::P_HEIGHT = QString::fromStdString(BornAgain::He HemiEllipsoidItem::HemiEllipsoidItem() : FormFactorItem(Constants::HemiEllipsoidType) { - registerProperty(P_RADIUS_X, 10.0); - registerProperty(P_RADIUS_Y, 6.0); - registerProperty(P_HEIGHT, 8.0); + addProperty(P_RADIUS_X, 10.0); + addProperty(P_RADIUS_Y, 6.0); + addProperty(P_HEIGHT, 8.0); } std::unique_ptr<IFormFactor> HemiEllipsoidItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorHemiEllipsoid>( - getRegisteredProperty(P_RADIUS_X).toDouble(), - getRegisteredProperty(P_RADIUS_Y).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_RADIUS_X).toDouble(), + getChildValue(P_RADIUS_Y).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -251,15 +251,15 @@ const QString Prism3Item::P_HEIGHT = QString::fromStdString(BornAgain::Height); Prism3Item::Prism3Item() : FormFactorItem(Constants::Prism3Type) { - registerProperty(P_LENGTH, 10.0); - registerProperty(P_HEIGHT, 13.0); + addProperty(P_LENGTH, 10.0); + addProperty(P_HEIGHT, 13.0); } std::unique_ptr<IFormFactor> Prism3Item::createFormFactor() const { return GUIHelpers::make_unique<FormFactorPrism3>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -271,15 +271,15 @@ const QString Prism6Item::P_HEIGHT = QString::fromStdString(BornAgain::Height); Prism6Item::Prism6Item() : FormFactorItem(Constants::Prism6Type) { - registerProperty(P_RADIUS, 5.0); - registerProperty(P_HEIGHT, 11.0); + addProperty(P_RADIUS, 5.0); + addProperty(P_HEIGHT, 11.0); } std::unique_ptr<IFormFactor> Prism6Item::createFormFactor() const { return GUIHelpers::make_unique<FormFactorPrism6>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -292,17 +292,17 @@ const QString PyramidItem::P_ALPHA = QString::fromStdString(BornAgain::Alpha); PyramidItem::PyramidItem() : FormFactorItem(Constants::PyramidType) { - registerProperty(P_LENGTH, 18.0); - registerProperty(P_HEIGHT, 13.0); - registerProperty(P_ALPHA, 60.0); + addProperty(P_LENGTH, 18.0); + addProperty(P_HEIGHT, 13.0); + addProperty(P_ALPHA, 60.0); } std::unique_ptr<IFormFactor> PyramidItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorPyramid>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_ALPHA).toDouble()*Units::degree + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_ALPHA).toDouble()*Units::degree ); } @@ -315,17 +315,17 @@ const QString Ripple1Item::P_HEIGHT = QString::fromStdString(BornAgain::Height); Ripple1Item::Ripple1Item() : FormFactorItem(Constants::Ripple1Type) { - registerProperty(P_LENGTH, 27.0); - registerProperty(P_WIDTH, 20.0); - registerProperty(P_HEIGHT, 14.0); + addProperty(P_LENGTH, 27.0); + addProperty(P_WIDTH, 20.0); + addProperty(P_HEIGHT, 14.0); } std::unique_ptr<IFormFactor> Ripple1Item::createFormFactor() const { return GUIHelpers::make_unique<FormFactorRipple1>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_WIDTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_WIDTH).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -339,19 +339,19 @@ const QString Ripple2Item::P_ASYMMETRY = QString::fromStdString(BornAgain::Asymm Ripple2Item::Ripple2Item() : FormFactorItem(Constants::Ripple2Type) { - registerProperty(P_LENGTH, 36.0); - registerProperty(P_WIDTH, 25.0); - registerProperty(P_HEIGHT, 14.0); - registerProperty(P_ASYMMETRY, 3.0); + addProperty(P_LENGTH, 36.0); + addProperty(P_WIDTH, 25.0); + addProperty(P_HEIGHT, 14.0); + addProperty(P_ASYMMETRY, 3.0); } std::unique_ptr<IFormFactor> Ripple2Item::createFormFactor() const { return GUIHelpers::make_unique<FormFactorRipple2>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_WIDTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_ASYMMETRY).toDouble() + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_WIDTH).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_ASYMMETRY).toDouble() ); } @@ -364,17 +364,17 @@ const QString TetrahedronItem::P_ALPHA = QString::fromStdString(BornAgain::Alpha TetrahedronItem::TetrahedronItem() : FormFactorItem(Constants::TetrahedronType) { - registerProperty(P_LENGTH, 15.0); - registerProperty(P_HEIGHT, 6.0); - registerProperty(P_ALPHA, 60.0); + addProperty(P_LENGTH, 15.0); + addProperty(P_HEIGHT, 6.0); + addProperty(P_ALPHA, 60.0); } std::unique_ptr<IFormFactor> TetrahedronItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorTetrahedron>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_ALPHA).toDouble()*Units::degree + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_ALPHA).toDouble()*Units::degree ); } @@ -387,15 +387,15 @@ const QString TruncatedCubeItem::P_REMOVED_LENGTH = QString::fromStdString(BornA TruncatedCubeItem::TruncatedCubeItem() : FormFactorItem(Constants::TruncatedCubeType) { - registerProperty(P_LENGTH, 15.0); - registerProperty(P_REMOVED_LENGTH, 6.0); + addProperty(P_LENGTH, 15.0); + addProperty(P_REMOVED_LENGTH, 6.0); } std::unique_ptr<IFormFactor> TruncatedCubeItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorTruncatedCube>( - getRegisteredProperty(P_LENGTH).toDouble(), - getRegisteredProperty(P_REMOVED_LENGTH).toDouble() + getChildValue(P_LENGTH).toDouble(), + getChildValue(P_REMOVED_LENGTH).toDouble() ); } @@ -407,15 +407,15 @@ const QString TruncatedSphereItem::P_HEIGHT = QString::fromStdString(BornAgain:: TruncatedSphereItem::TruncatedSphereItem() : FormFactorItem(Constants::TruncatedSphereType) { - registerProperty(P_RADIUS, 5.0); - registerProperty(P_HEIGHT, 7.0); + addProperty(P_RADIUS, 5.0); + addProperty(P_HEIGHT, 7.0); } std::unique_ptr<IFormFactor> TruncatedSphereItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorTruncatedSphere>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble() + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble() ); } @@ -428,17 +428,17 @@ const QString TruncatedSpheroidItem::P_HFC = QString::fromStdString(BornAgain::H TruncatedSpheroidItem::TruncatedSpheroidItem() : FormFactorItem(Constants::TruncatedSpheroidType) { - registerProperty(P_RADIUS, 7.5); - registerProperty(P_HEIGHT, 9.0); - registerProperty(P_HFC, 1.2); + addProperty(P_RADIUS, 7.5); + addProperty(P_HEIGHT, 9.0); + addProperty(P_HFC, 1.2); } std::unique_ptr<IFormFactor> TruncatedSpheroidItem::createFormFactor() const { return GUIHelpers::make_unique<FormFactorTruncatedSpheroid>( - getRegisteredProperty(P_RADIUS).toDouble(), - getRegisteredProperty(P_HEIGHT).toDouble(), - getRegisteredProperty(P_HFC).toDouble() + getChildValue(P_RADIUS).toDouble(), + getChildValue(P_HEIGHT).toDouble(), + getChildValue(P_HFC).toDouble() ); } diff --git a/GUI/coregui/Models/GUIObjectBuilder.cpp b/GUI/coregui/Models/GUIObjectBuilder.cpp index 164c3a02d65..74890c93043 100644 --- a/GUI/coregui/Models/GUIObjectBuilder.cpp +++ b/GUI/coregui/Models/GUIObjectBuilder.cpp @@ -149,9 +149,9 @@ void GUIObjectBuilder::visit(const ParticleLayout *sample) approx_prop.setValue("Decoupling Approximation"); break; } - item->setRegisteredProperty(ParticleLayoutItem::P_APPROX, + item->setChildValue(ParticleLayoutItem::P_APPROX, approx_prop.getVariant()); - item->setRegisteredProperty(ParticleLayoutItem::P_TOTAL_DENSITY, + item->setChildValue(ParticleLayoutItem::P_TOTAL_DENSITY, sample->getTotalParticleSurfaceDensity()); m_levelToParentItem[getLevel()] = item; } @@ -172,7 +172,7 @@ void GUIObjectBuilder::visit(const Layer *sample) SessionItem *layerItem = m_sampleModel->insertNewItem( Constants::LayerType, m_sampleModel->indexOfItem(parent)); - layerItem->setRegisteredProperty(LayerItem::P_MATERIAL, + layerItem->setChildValue(LayerItem::P_MATERIAL, createMaterialFromDomain(sample->getMaterial()).getVariant()); TransformFromDomain::setItemFromSample(layerItem, sample, interface); @@ -193,7 +193,7 @@ void GUIObjectBuilder::visit(const MultiLayer *sample) SessionItem *item = m_sampleModel->insertNewItem(Constants::MultiLayerType); item->setItemName(sample->getName().c_str()); - item->setRegisteredProperty(MultiLayerItem::P_CROSS_CORR_LENGTH, + item->setChildValue(MultiLayerItem::P_CROSS_CORR_LENGTH, sample->getCrossCorrLength()); m_levelToParentItem[getLevel()] = item; m_itemToSample[item] = sample; @@ -234,8 +234,8 @@ void GUIObjectBuilder::visit(const Particle *sample) buildPositionInfo(particleItem, sample); - particleItem->setRegisteredProperty(ParticleItem::P_ABUNDANCE, sample->getAbundance()); - particleItem->setRegisteredProperty(ParticleItem::P_MATERIAL, + particleItem->setChildValue(ParticleItem::P_ABUNDANCE, sample->getAbundance()); + particleItem->setChildValue(ParticleItem::P_MATERIAL, createMaterialFromDomain(sample->getMaterial()).getVariant()); m_levelToParentItem[getLevel()] = particleItem; } @@ -265,7 +265,7 @@ void GUIObjectBuilder::visit(const ParticleCoreShell *sample) SessionItem *coreshellItem = m_sampleModel->insertNewItem( Constants::ParticleCoreShellType, m_sampleModel->indexOfItem(parent)); - coreshellItem->setRegisteredProperty(ParticleItem::P_ABUNDANCE, sample->getAbundance()); + coreshellItem->setChildValue(ParticleItem::P_ABUNDANCE, sample->getAbundance()); buildPositionInfo(coreshellItem, sample); @@ -281,7 +281,7 @@ void GUIObjectBuilder::visit(const ParticleComposition *sample) Q_ASSERT(parent); SessionItem *particle_composition_item = m_sampleModel->insertNewItem( Constants::ParticleCompositionType, m_sampleModel->indexOfItem(parent)); - particle_composition_item->setRegisteredProperty(ParticleItem::P_ABUNDANCE, + particle_composition_item->setChildValue(ParticleItem::P_ABUNDANCE, sample->getAbundance()); buildPositionInfo(particle_composition_item, sample); @@ -295,13 +295,13 @@ void GUIObjectBuilder::visit(const FormFactorAnisoPyramid *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::AnisoPyramidType); - ffItem->setRegisteredProperty(AnisoPyramidItem::P_LENGTH, + ffItem->setChildValue(AnisoPyramidItem::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(AnisoPyramidItem::P_WIDTH, + ffItem->setChildValue(AnisoPyramidItem::P_WIDTH, sample->getWidth()); - ffItem->setRegisteredProperty(AnisoPyramidItem::P_HEIGHT, + ffItem->setChildValue(AnisoPyramidItem::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(AnisoPyramidItem::P_ALPHA, + ffItem->setChildValue(AnisoPyramidItem::P_ALPHA, Units::rad2deg(sample->getAlpha())); m_levelToParentItem[getLevel()] = particleItem; } @@ -311,9 +311,9 @@ void GUIObjectBuilder::visit(const FormFactorBox *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::BoxType); - ffItem->setRegisteredProperty(BoxItem::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(BoxItem::P_WIDTH, sample->getWidth()); - ffItem->setRegisteredProperty(BoxItem::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(BoxItem::P_LENGTH, sample->getLength()); + ffItem->setChildValue(BoxItem::P_WIDTH, sample->getWidth()); + ffItem->setChildValue(BoxItem::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -322,9 +322,9 @@ void GUIObjectBuilder::visit(const FormFactorCone *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::ConeType); - ffItem->setRegisteredProperty(ConeItem::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(ConeItem::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(ConeItem::P_ALPHA, + ffItem->setChildValue(ConeItem::P_RADIUS, sample->getRadius()); + ffItem->setChildValue(ConeItem::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(ConeItem::P_ALPHA, Units::rad2deg(sample->getAlpha())); m_levelToParentItem[getLevel()] = particleItem; } @@ -334,9 +334,9 @@ void GUIObjectBuilder::visit(const FormFactorCone6 *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::Cone6Type); - ffItem->setRegisteredProperty(Cone6Item::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(Cone6Item::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(Cone6Item::P_ALPHA, + ffItem->setChildValue(Cone6Item::P_RADIUS, sample->getRadius()); + ffItem->setChildValue(Cone6Item::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(Cone6Item::P_ALPHA, Units::rad2deg(sample->getAlpha())); m_levelToParentItem[getLevel()] = particleItem; } @@ -346,13 +346,13 @@ void GUIObjectBuilder::visit(const FormFactorCuboctahedron *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::CuboctahedronType); - ffItem->setRegisteredProperty(CuboctahedronItem::P_LENGTH, + ffItem->setChildValue(CuboctahedronItem::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(CuboctahedronItem::P_HEIGHT, + ffItem->setChildValue(CuboctahedronItem::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(CuboctahedronItem::P_HEIGHT_RATIO, + ffItem->setChildValue(CuboctahedronItem::P_HEIGHT_RATIO, sample->getHeightRatio()); - ffItem->setRegisteredProperty(CuboctahedronItem::P_ALPHA, + ffItem->setChildValue(CuboctahedronItem::P_ALPHA, Units::rad2deg(sample->getAlpha())); m_levelToParentItem[getLevel()] = particleItem; } @@ -362,8 +362,8 @@ void GUIObjectBuilder::visit(const FormFactorCylinder *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::CylinderType); - ffItem->setRegisteredProperty(CylinderItem::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(CylinderItem::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(CylinderItem::P_RADIUS, sample->getRadius()); + ffItem->setChildValue(CylinderItem::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -372,11 +372,11 @@ void GUIObjectBuilder::visit(const FormFactorEllipsoidalCylinder *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::EllipsoidalCylinderType); - ffItem->setRegisteredProperty(EllipsoidalCylinderItem::P_RADIUS_X, + ffItem->setChildValue(EllipsoidalCylinderItem::P_RADIUS_X, sample->getRadiusX()); - ffItem->setRegisteredProperty(EllipsoidalCylinderItem::P_RADIUS_Y, + ffItem->setChildValue(EllipsoidalCylinderItem::P_RADIUS_Y, sample->getRadiusY()); - ffItem->setRegisteredProperty(EllipsoidalCylinderItem::P_HEIGHT, + ffItem->setChildValue(EllipsoidalCylinderItem::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -386,7 +386,7 @@ void GUIObjectBuilder::visit(const FormFactorFullSphere *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::FullSphereType); - ffItem->setRegisteredProperty(FullSphereItem::P_RADIUS, + ffItem->setChildValue(FullSphereItem::P_RADIUS, sample->getRadius()); m_levelToParentItem[getLevel()] = particleItem; } @@ -396,9 +396,9 @@ void GUIObjectBuilder::visit(const FormFactorFullSpheroid *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::FullSpheroidType); - ffItem->setRegisteredProperty(FullSpheroidItem::P_RADIUS, + ffItem->setChildValue(FullSpheroidItem::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(FullSpheroidItem::P_HEIGHT, + ffItem->setChildValue(FullSpheroidItem::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -408,11 +408,11 @@ void GUIObjectBuilder::visit(const FormFactorHemiEllipsoid *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::HemiEllipsoidType); - ffItem->setRegisteredProperty(HemiEllipsoidItem::P_RADIUS_X, + ffItem->setChildValue(HemiEllipsoidItem::P_RADIUS_X, sample->getRadiusX()); - ffItem->setRegisteredProperty(HemiEllipsoidItem::P_RADIUS_Y, + ffItem->setChildValue(HemiEllipsoidItem::P_RADIUS_Y, sample->getRadiusY()); - ffItem->setRegisteredProperty(HemiEllipsoidItem::P_HEIGHT, + ffItem->setChildValue(HemiEllipsoidItem::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -422,8 +422,8 @@ void GUIObjectBuilder::visit(const FormFactorPrism3 *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::Prism3Type); - ffItem->setRegisteredProperty(Prism3Item::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(Prism3Item::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(Prism3Item::P_LENGTH, sample->getLength()); + ffItem->setChildValue(Prism3Item::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -432,8 +432,8 @@ void GUIObjectBuilder::visit(const FormFactorPrism6 *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::Prism6Type); - ffItem->setRegisteredProperty(Prism6Item::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(Prism6Item::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(Prism6Item::P_RADIUS, sample->getRadius()); + ffItem->setChildValue(Prism6Item::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -442,9 +442,9 @@ void GUIObjectBuilder::visit(const FormFactorPyramid *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::PyramidType); - ffItem->setRegisteredProperty(PyramidItem::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(PyramidItem::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(PyramidItem::P_ALPHA, + ffItem->setChildValue(PyramidItem::P_LENGTH, sample->getLength()); + ffItem->setChildValue(PyramidItem::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(PyramidItem::P_ALPHA, Units::rad2deg(sample->getAlpha())); m_levelToParentItem[getLevel()] = particleItem; } @@ -454,9 +454,9 @@ void GUIObjectBuilder::visit(const FormFactorRipple1 *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::Ripple1Type); - ffItem->setRegisteredProperty(Ripple1Item::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(Ripple1Item::P_WIDTH, sample->getWidth()); - ffItem->setRegisteredProperty(Ripple1Item::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(Ripple1Item::P_LENGTH, sample->getLength()); + ffItem->setChildValue(Ripple1Item::P_WIDTH, sample->getWidth()); + ffItem->setChildValue(Ripple1Item::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -465,10 +465,10 @@ void GUIObjectBuilder::visit(const FormFactorRipple2 *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::Ripple2Type); - ffItem->setRegisteredProperty(Ripple2Item::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(Ripple2Item::P_WIDTH, sample->getWidth()); - ffItem->setRegisteredProperty(Ripple2Item::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(Ripple2Item::P_ASYMMETRY, + ffItem->setChildValue(Ripple2Item::P_LENGTH, sample->getLength()); + ffItem->setChildValue(Ripple2Item::P_WIDTH, sample->getWidth()); + ffItem->setChildValue(Ripple2Item::P_HEIGHT, sample->getHeight()); + ffItem->setChildValue(Ripple2Item::P_ASYMMETRY, sample->getAsymmetry()); m_levelToParentItem[getLevel()] = particleItem; } @@ -478,11 +478,11 @@ void GUIObjectBuilder::visit(const FormFactorTetrahedron *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::TetrahedronType); - ffItem->setRegisteredProperty(TetrahedronItem::P_LENGTH, + ffItem->setChildValue(TetrahedronItem::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(TetrahedronItem::P_HEIGHT, + ffItem->setChildValue(TetrahedronItem::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(TetrahedronItem::P_ALPHA, + ffItem->setChildValue(TetrahedronItem::P_ALPHA, Units::rad2deg(sample->getAlpha())); m_levelToParentItem[getLevel()] = particleItem; } @@ -492,9 +492,9 @@ void GUIObjectBuilder::visit(const FormFactorTruncatedCube *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::TruncatedCubeType); - ffItem->setRegisteredProperty(TruncatedCubeItem::P_LENGTH, + ffItem->setChildValue(TruncatedCubeItem::P_LENGTH, sample->getLength()); - ffItem->setRegisteredProperty(TruncatedCubeItem::P_REMOVED_LENGTH, + ffItem->setChildValue(TruncatedCubeItem::P_REMOVED_LENGTH, sample->getRemovedLength()); m_levelToParentItem[getLevel()] = particleItem; } @@ -504,9 +504,9 @@ void GUIObjectBuilder::visit(const FormFactorTruncatedSphere *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::TruncatedSphereType); - ffItem->setRegisteredProperty(TruncatedSphereItem::P_RADIUS, + ffItem->setChildValue(TruncatedSphereItem::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(TruncatedSphereItem::P_HEIGHT, + ffItem->setChildValue(TruncatedSphereItem::P_HEIGHT, sample->getHeight()); m_levelToParentItem[getLevel()] = particleItem; } @@ -516,11 +516,11 @@ void GUIObjectBuilder::visit(const FormFactorTruncatedSpheroid *sample) SessionItem *particleItem = m_levelToParentItem[getLevel()-1]; SessionItem *ffItem = particleItem->setGroupProperty( ParticleItem::P_FORM_FACTOR, Constants::TruncatedSpheroidType); - ffItem->setRegisteredProperty(TruncatedSpheroidItem::P_RADIUS, + ffItem->setChildValue(TruncatedSpheroidItem::P_RADIUS, sample->getRadius()); - ffItem->setRegisteredProperty(TruncatedSpheroidItem::P_HEIGHT, + ffItem->setChildValue(TruncatedSpheroidItem::P_HEIGHT, sample->getHeight()); - ffItem->setRegisteredProperty(TruncatedSpheroidItem::P_HFC, + ffItem->setChildValue(TruncatedSpheroidItem::P_HFC, sample->getHeightFlattening()); m_levelToParentItem[getLevel()] = particleItem; } @@ -591,7 +591,7 @@ void GUIObjectBuilder::visit(const RotationX *sample) Constants::TransformationType, m_sampleModel->indexOfItem(parent)); SessionItem *p_rotationItem = transformation_item->setGroupProperty( TransformationItem::P_ROT, Constants::XRotationType); - p_rotationItem->setRegisteredProperty(XRotationItem::P_ANGLE, + p_rotationItem->setChildValue(XRotationItem::P_ANGLE, Units::rad2deg(sample->getAngle()) ); m_levelToParentItem[getLevel()] = transformation_item; } @@ -607,7 +607,7 @@ void GUIObjectBuilder::visit(const RotationY *sample) Constants::TransformationType, m_sampleModel->indexOfItem(parent)); SessionItem *p_rotationItem = transformation_item->setGroupProperty( TransformationItem::P_ROT, Constants::YRotationType); - p_rotationItem->setRegisteredProperty(YRotationItem::P_ANGLE, + p_rotationItem->setChildValue(YRotationItem::P_ANGLE, Units::rad2deg(sample->getAngle())); m_levelToParentItem[getLevel()] = transformation_item; } @@ -623,7 +623,7 @@ void GUIObjectBuilder::visit(const RotationZ *sample) Constants::TransformationType, m_sampleModel->indexOfItem(parent)); SessionItem *p_rotationItem = transformation_item->setGroupProperty( TransformationItem::P_ROT, Constants::ZRotationType); - p_rotationItem->setRegisteredProperty(ZRotationItem::P_ANGLE, + p_rotationItem->setChildValue(ZRotationItem::P_ANGLE, Units::rad2deg(sample->getAngle()) ); m_levelToParentItem[getLevel()] = transformation_item; } @@ -639,11 +639,11 @@ void GUIObjectBuilder::visit(const RotationEuler *sample) Constants::TransformationType, m_sampleModel->indexOfItem(parent)); SessionItem *p_rotationItem = transformation_item->setGroupProperty( TransformationItem::P_ROT, Constants::EulerRotationType); - p_rotationItem->setRegisteredProperty(EulerRotationItem::P_ALPHA, + p_rotationItem->setChildValue(EulerRotationItem::P_ALPHA, Units::rad2deg(sample->getAlpha()) ); - p_rotationItem->setRegisteredProperty(EulerRotationItem::P_BETA, + p_rotationItem->setChildValue(EulerRotationItem::P_BETA, Units::rad2deg(sample->getBeta()) ); - p_rotationItem->setRegisteredProperty(EulerRotationItem::P_GAMMA, + p_rotationItem->setChildValue(EulerRotationItem::P_GAMMA, Units::rad2deg(sample->getGamma()) ); m_levelToParentItem[getLevel()] = transformation_item; } @@ -652,9 +652,9 @@ void GUIObjectBuilder::buildPositionInfo(SessionItem *particleItem, const IParti { kvector_t position = sample->getPosition(); SessionItem *p_position_item = particleItem->getGroupItem(ParticleItem::P_POSITION); - p_position_item->setRegisteredProperty(VectorItem::P_X, position.x()); - p_position_item->setRegisteredProperty(VectorItem::P_Y, position.y()); - p_position_item->setRegisteredProperty(VectorItem::P_Z, position.z()); + p_position_item->setChildValue(VectorItem::P_X, position.x()); + p_position_item->setChildValue(VectorItem::P_Y, position.y()); + p_position_item->setChildValue(VectorItem::P_Z, position.z()); } MaterialProperty GUIObjectBuilder::createMaterialFromDomain( diff --git a/GUI/coregui/Models/IntensityDataItem.cpp b/GUI/coregui/Models/IntensityDataItem.cpp index d34ed5778e8..787536a400e 100644 --- a/GUI/coregui/Models/IntensityDataItem.cpp +++ b/GUI/coregui/Models/IntensityDataItem.cpp @@ -44,10 +44,10 @@ IntensityDataItem::IntensityDataItem() setItemName(Constants::IntensityDataType); ComboProperty units; - registerProperty(P_AXES_UNITS, units.getVariant())->setVisible(false); + addProperty(P_AXES_UNITS, units.getVariant())->setVisible(false); - registerProperty(P_PROJECTIONS_FLAG, false)->setVisible(false); - registerProperty(P_IS_INTERPOLATED, true); + addProperty(P_PROJECTIONS_FLAG, false)->setVisible(false); + addProperty(P_IS_INTERPOLATED, true); ComboProperty gradient; @@ -58,17 +58,17 @@ IntensityDataItem::IntensityDataItem() << Constants::GRADIENT_POLAR << Constants::GRADIENT_SPECTRUM << Constants::GRADIENT_JET << Constants::GRADIENT_HUES; gradient.setValue(Constants::GRADIENT_JET); - registerProperty(P_GRADIENT, gradient.getVariant()); + addProperty(P_GRADIENT, gradient.getVariant()); - registerProperty(P_PROPERTY_PANEL_FLAG, false)->setVisible(false); + addProperty(P_PROPERTY_PANEL_FLAG, false)->setVisible(false); - registerGroupProperty(P_XAXIS, Constants::BasicAxisType); + addGroupProperty(P_XAXIS, Constants::BasicAxisType); getGroupItem(P_XAXIS)->getItem(BasicAxisItem::P_NBINS)->setVisible(false); - registerGroupProperty(P_YAXIS, Constants::BasicAxisType); + addGroupProperty(P_YAXIS, Constants::BasicAxisType); getGroupItem(P_YAXIS)->getItem(BasicAxisItem::P_NBINS)->setVisible(false); - registerGroupProperty(P_ZAXIS, Constants::AmplitudeAxisType); + addGroupProperty(P_ZAXIS, Constants::AmplitudeAxisType); getGroupItem(P_ZAXIS)->getItem(BasicAxisItem::P_NBINS)->setVisible(false); registerTag(T_MASKS, 0, -1, QStringList() << Constants::MaskContainerType); @@ -112,12 +112,12 @@ void IntensityDataItem::setOutputData(OutputData<double> *data) double IntensityDataItem::getLowerX() const { - return getGroupItem(P_XAXIS)->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + return getGroupItem(P_XAXIS)->getChildValue(BasicAxisItem::P_MIN).toDouble(); } double IntensityDataItem::getUpperX() const { - return getGroupItem(P_XAXIS)->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + return getGroupItem(P_XAXIS)->getChildValue(BasicAxisItem::P_MAX).toDouble(); } double IntensityDataItem::getXmin() const @@ -134,12 +134,12 @@ double IntensityDataItem::getXmax() const double IntensityDataItem::getLowerY() const { - return getGroupItem(P_YAXIS)->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + return getGroupItem(P_YAXIS)->getChildValue(BasicAxisItem::P_MIN).toDouble(); } double IntensityDataItem::getUpperY() const { - return getGroupItem(P_YAXIS)->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + return getGroupItem(P_YAXIS)->getChildValue(BasicAxisItem::P_MAX).toDouble(); } double IntensityDataItem::getYmin() const @@ -156,48 +156,48 @@ double IntensityDataItem::getYmax() const double IntensityDataItem::getLowerZ() const { - return getGroupItem(P_ZAXIS)->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + return getGroupItem(P_ZAXIS)->getChildValue(BasicAxisItem::P_MIN).toDouble(); } double IntensityDataItem::getUpperZ() const { - return getGroupItem(P_ZAXIS)->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + return getGroupItem(P_ZAXIS)->getChildValue(BasicAxisItem::P_MAX).toDouble(); } QString IntensityDataItem::getGradient() const { - ComboProperty combo_property = getRegisteredProperty(P_GRADIENT).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_GRADIENT).value<ComboProperty>(); return combo_property.getValue(); } bool IntensityDataItem::isLogz() const { - return getGroupItem(P_ZAXIS)->getRegisteredProperty(AmplitudeAxisItem::P_IS_LOGSCALE).toBool(); + return getGroupItem(P_ZAXIS)->getChildValue(AmplitudeAxisItem::P_IS_LOGSCALE).toBool(); } bool IntensityDataItem::isInterpolated() const { - return getRegisteredProperty(P_IS_INTERPOLATED).toBool(); + return getChildValue(P_IS_INTERPOLATED).toBool(); } QString IntensityDataItem::getXaxisTitle() const { - return getGroupItem(P_XAXIS)->getRegisteredProperty(BasicAxisItem::P_TITLE).toString(); + return getGroupItem(P_XAXIS)->getChildValue(BasicAxisItem::P_TITLE).toString(); } QString IntensityDataItem::getYaxisTitle() const { - return getGroupItem(P_YAXIS)->getRegisteredProperty(BasicAxisItem::P_TITLE).toString(); + return getGroupItem(P_YAXIS)->getChildValue(BasicAxisItem::P_TITLE).toString(); } bool IntensityDataItem::isZAxisLocked() const { - return getGroupItem(P_ZAXIS)->getRegisteredProperty(AmplitudeAxisItem::P_LOCK_MIN_MAX).toBool(); + return getGroupItem(P_ZAXIS)->getChildValue(AmplitudeAxisItem::P_LOCK_MIN_MAX).toBool(); } void IntensityDataItem::setZAxisLocked(bool state) { - return getGroupItem(P_ZAXIS)->setRegisteredProperty(AmplitudeAxisItem::P_LOCK_MIN_MAX, state); + return getGroupItem(P_ZAXIS)->setChildValue(AmplitudeAxisItem::P_LOCK_MIN_MAX, state); } //! Sets the name of intensity data item from proposed name. This name will be used to save file @@ -210,69 +210,69 @@ void IntensityDataItem::setNameFromProposed(const QString &proposed_name) QString IntensityDataItem::getSelectedAxesUnits() const { - ComboProperty combo= getRegisteredProperty(IntensityDataItem::P_AXES_UNITS) + ComboProperty combo= getChildValue(IntensityDataItem::P_AXES_UNITS) .value<ComboProperty>(); return combo.getValue(); } void IntensityDataItem::setLowerX(double xmin) { - getGroupItem(P_XAXIS)->setRegisteredProperty(BasicAxisItem::P_MIN, xmin); + getGroupItem(P_XAXIS)->setChildValue(BasicAxisItem::P_MIN, xmin); } void IntensityDataItem::setUpperX(double xmax) { - getGroupItem(P_XAXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, xmax); + getGroupItem(P_XAXIS)->setChildValue(BasicAxisItem::P_MAX, xmax); } void IntensityDataItem::setLowerY(double ymin) { - getGroupItem(P_YAXIS)->setRegisteredProperty(BasicAxisItem::P_MIN, ymin); + getGroupItem(P_YAXIS)->setChildValue(BasicAxisItem::P_MIN, ymin); } void IntensityDataItem::setUpperY(double ymax) { - getGroupItem(P_YAXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, ymax); + getGroupItem(P_YAXIS)->setChildValue(BasicAxisItem::P_MAX, ymax); } void IntensityDataItem::setLowerAndUpperZ(double zmin, double zmax) { if(getLowerZ() != zmin) { - getGroupItem(P_ZAXIS)->setRegisteredProperty(BasicAxisItem::P_MIN, zmin); + getGroupItem(P_ZAXIS)->setChildValue(BasicAxisItem::P_MIN, zmin); } if(getUpperZ() != zmax) { - getGroupItem(P_ZAXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, zmax); + getGroupItem(P_ZAXIS)->setChildValue(BasicAxisItem::P_MAX, zmax); } } void IntensityDataItem::setLowerZ(double zmin) { - getGroupItem(P_ZAXIS)->setRegisteredProperty(BasicAxisItem::P_MIN, zmin); + getGroupItem(P_ZAXIS)->setChildValue(BasicAxisItem::P_MIN, zmin); } void IntensityDataItem::setUpperZ(double zmax) { - getGroupItem(P_ZAXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, zmax); + getGroupItem(P_ZAXIS)->setChildValue(BasicAxisItem::P_MAX, zmax); } void IntensityDataItem::setLogz(bool logz) { - getGroupItem(P_ZAXIS)->setRegisteredProperty(AmplitudeAxisItem::P_IS_LOGSCALE, logz); + getGroupItem(P_ZAXIS)->setChildValue(AmplitudeAxisItem::P_IS_LOGSCALE, logz); } void IntensityDataItem::setInterpolated(bool interp) { - setRegisteredProperty(P_IS_INTERPOLATED, interp); + setChildValue(P_IS_INTERPOLATED, interp); } void IntensityDataItem::setXaxisTitle(QString xtitle) { - getGroupItem(P_XAXIS)->setRegisteredProperty(BasicAxisItem::P_TITLE, xtitle); + getGroupItem(P_XAXIS)->setChildValue(BasicAxisItem::P_TITLE, xtitle); } void IntensityDataItem::setYaxisTitle(QString ytitle) { - getGroupItem(P_YAXIS)->setRegisteredProperty(BasicAxisItem::P_TITLE, ytitle); + getGroupItem(P_YAXIS)->setChildValue(BasicAxisItem::P_TITLE, ytitle); } //! set zoom range of x,y axes to axes of input data diff --git a/GUI/coregui/Models/InterferenceFunctionItems.cpp b/GUI/coregui/Models/InterferenceFunctionItems.cpp index 4fbeecc2c25..3fc218e6cb7 100644 --- a/GUI/coregui/Models/InterferenceFunctionItems.cpp +++ b/GUI/coregui/Models/InterferenceFunctionItems.cpp @@ -57,32 +57,32 @@ InterferenceFunctionRadialParaCrystalItem::InterferenceFunctionRadialParaCrystal ) : SessionGraphicsItem(Constants::InterferenceFunctionRadialParaCrystalType) { - registerProperty(P_PEAK_DISTANCE, 20.0*Units::nanometer); - registerProperty(P_DAMPING_LENGTH, 1000.0*Units::micrometer); - registerProperty(P_DOMAIN_SIZE, 20.0*Units::micrometer); - registerProperty(P_KAPPA, 0.0); - registerGroupProperty(P_PDF, Constants::FTDistribution1DGroup); + addProperty(P_PEAK_DISTANCE, 20.0*Units::nanometer); + addProperty(P_DAMPING_LENGTH, 1000.0*Units::micrometer); + addProperty(P_DOMAIN_SIZE, 20.0*Units::micrometer); + addProperty(P_KAPPA, 0.0); + addGroupProperty(P_PDF, Constants::FTDistribution1DGroup); } InterferenceFunction2DParaCrystalItem::InterferenceFunction2DParaCrystalItem( ) : SessionGraphicsItem(Constants::InterferenceFunction2DParaCrystalType) { - registerGroupProperty(InterferenceFunction2DLatticeItem::P_LATTICE_TYPE, + addGroupProperty(InterferenceFunction2DLatticeItem::P_LATTICE_TYPE, Constants::LatticeGroup); - registerProperty(P_DAMPING_LENGTH, 0.0); - registerProperty(P_DOMAIN_SIZE1, 20.0*Units::micrometer); - registerProperty(P_DOMAIN_SIZE2, 20.0*Units::micrometer); - registerProperty(P_XI_INTEGRATION, true); - registerProperty(P_ROTATION_ANGLE, 0.0); + addProperty(P_DAMPING_LENGTH, 0.0); + addProperty(P_DOMAIN_SIZE1, 20.0*Units::micrometer); + addProperty(P_DOMAIN_SIZE2, 20.0*Units::micrometer); + addProperty(P_XI_INTEGRATION, true); + addProperty(P_ROTATION_ANGLE, 0.0); getItem(P_ROTATION_ANGLE)->setEnabled(false); - registerGroupProperty(P_PDF1, Constants::FTDistribution2DGroup); - registerGroupProperty(P_PDF2, Constants::FTDistribution2DGroup); + addGroupProperty(P_PDF1, Constants::FTDistribution2DGroup); + addGroupProperty(P_PDF2, Constants::FTDistribution2DGroup); mapper()->setOnPropertyChange( [this](const QString &name) { - if(name == P_XI_INTEGRATION && isRegisteredTag(P_ROTATION_ANGLE)) { - if(getRegisteredProperty(P_XI_INTEGRATION).toBool()) { + if(name == P_XI_INTEGRATION && isTag(P_ROTATION_ANGLE)) { + if(getChildValue(P_XI_INTEGRATION).toBool()) { getItem(P_ROTATION_ANGLE)->setEnabled(false); } else { getItem(P_ROTATION_ANGLE)->setEnabled(true); @@ -94,16 +94,16 @@ InterferenceFunction2DParaCrystalItem::InterferenceFunction2DParaCrystalItem( InterferenceFunction1DLatticeItem::InterferenceFunction1DLatticeItem() : SessionGraphicsItem(Constants::InterferenceFunction1DLatticeType) { - registerProperty(P_LENGTH, 20.0*Units::nanometer); - registerProperty(P_ROTATION_ANGLE, 0.0); - registerGroupProperty(P_DECAY_FUNCTION, Constants::FTDecayFunction1DGroup); + addProperty(P_LENGTH, 20.0*Units::nanometer); + addProperty(P_ROTATION_ANGLE, 0.0); + addGroupProperty(P_DECAY_FUNCTION, Constants::FTDecayFunction1DGroup); } InterferenceFunction2DLatticeItem::InterferenceFunction2DLatticeItem( ) : SessionGraphicsItem(Constants::InterferenceFunction2DLatticeType) { - registerGroupProperty(P_LATTICE_TYPE, Constants::LatticeGroup); - registerProperty(P_ROTATION_ANGLE, 0.0); - registerGroupProperty(P_DECAY_FUNCTION, Constants::FTDecayFunction2DGroup); + addGroupProperty(P_LATTICE_TYPE, Constants::LatticeGroup); + addProperty(P_ROTATION_ANGLE, 0.0); + addGroupProperty(P_DECAY_FUNCTION, Constants::FTDecayFunction2DGroup); } diff --git a/GUI/coregui/Models/ItemLink.cpp b/GUI/coregui/Models/ItemLink.cpp index 7af310df852..27079bdf28d 100644 --- a/GUI/coregui/Models/ItemLink.cpp +++ b/GUI/coregui/Models/ItemLink.cpp @@ -43,7 +43,7 @@ void ItemLink::setValue(double value) QVariant ItemLink::getVariant() { - QVariant variant = m_item->getRegisteredProperty(m_property_name); + QVariant variant = m_item->getChildValue(m_property_name); if(variant.typeName() == QString("double")) { variant.setValue(m_value); return variant; @@ -64,6 +64,6 @@ QVariant ItemLink::getVariant() void ItemLink::updateItem() { - getItem()->setRegisteredProperty(getPropertyName(), getVariant()); + getItem()->setChildValue(getPropertyName(), getVariant()); } diff --git a/GUI/coregui/Models/JobItem.cpp b/GUI/coregui/Models/JobItem.cpp index 1148febad23..bad1e94207d 100644 --- a/GUI/coregui/Models/JobItem.cpp +++ b/GUI/coregui/Models/JobItem.cpp @@ -62,27 +62,27 @@ JobItem::JobItem() { // registerProperty(OBSOLETE_P_NAME, Constants::JobItemType); setItemName(Constants::JobItemType); - registerProperty(P_IDENTIFIER, QString())->setVisible(false); - registerProperty(P_SAMPLE_NAME, QString())->setEditable(false); - registerProperty(P_INSTRUMENT_NAME, QString())->setEditable(false); + addProperty(P_IDENTIFIER, QString())->setVisible(false); + addProperty(P_SAMPLE_NAME, QString())->setEditable(false); + addProperty(P_INSTRUMENT_NAME, QString())->setEditable(false); ComboProperty status; status << Constants::STATUS_IDLE << Constants::STATUS_RUNNING << Constants::STATUS_COMPLETED << Constants::STATUS_CANCELED << Constants::STATUS_FAILED; - registerProperty(P_STATUS, status.getVariant())->setEditable(false); + addProperty(P_STATUS, status.getVariant())->setEditable(false); - registerProperty(P_BEGIN_TIME, QString())->setEditable(false); - registerProperty(P_END_TIME, QString())->setEditable(false); - registerProperty(P_COMMENTS, QString())->setVisible(false); + addProperty(P_BEGIN_TIME, QString())->setEditable(false); + addProperty(P_END_TIME, QString())->setEditable(false); + addProperty(P_COMMENTS, QString())->setVisible(false); - registerProperty(P_PROGRESS, 0)->setVisible(false); - registerProperty(P_NTHREADS, -1)->setVisible(false); + addProperty(P_PROGRESS, 0)->setVisible(false); + addProperty(P_NTHREADS, -1)->setVisible(false); ComboProperty policy; policy << Constants::JOB_RUN_IMMEDIATELY << Constants::JOB_RUN_IN_BACKGROUND << Constants::JOB_RUN_SUBMIT_ONLY; - registerProperty(P_RUN_POLICY, policy.getVariant())->setVisible(false); + addProperty(P_RUN_POLICY, policy.getVariant())->setVisible(false); const QString T_DATA = "Data Tag"; registerTag("Data Tag", 0, -1, QStringList() << Constants::IntensityDataType @@ -107,12 +107,12 @@ JobItem::~JobItem() QString JobItem::getIdentifier() const { - return getRegisteredProperty(P_IDENTIFIER).toString(); + return getChildValue(P_IDENTIFIER).toString(); } void JobItem::setIdentifier(const QString &identifier) { - setRegisteredProperty(JobItem::P_IDENTIFIER, identifier); + setChildValue(JobItem::P_IDENTIFIER, identifier); } IntensityDataItem *JobItem::getIntensityDataItem() @@ -126,15 +126,15 @@ IntensityDataItem *JobItem::getIntensityDataItem() QString JobItem::getStatus() const { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); return combo_property.getValue(); } void JobItem::setStatus(const QString &status) { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); combo_property.setValue(status); - setRegisteredProperty(P_STATUS, combo_property.getVariant()); + setChildValue(P_STATUS, combo_property.getVariant()); if(status == Constants::STATUS_FAILED) { if(IntensityDataItem *intensityItem = getIntensityDataItem()) { if(intensityItem->getOutputData()) @@ -146,90 +146,90 @@ void JobItem::setStatus(const QString &status) bool JobItem::isIdle() const { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); return combo_property.getValue() == Constants::STATUS_IDLE; } bool JobItem::isRunning() const { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); return combo_property.getValue() == Constants::STATUS_RUNNING; } bool JobItem::isCompleted() const { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); return combo_property.getValue() == Constants::STATUS_COMPLETED; } bool JobItem::isCanceled() const { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); return combo_property.getValue() == Constants::STATUS_CANCELED; } bool JobItem::isFailed() const { - ComboProperty combo_property = getRegisteredProperty(P_STATUS).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_STATUS).value<ComboProperty>(); return combo_property.getValue() == Constants::STATUS_FAILED; } void JobItem::setBeginTime(const QString &begin_time) { - setRegisteredProperty(P_BEGIN_TIME, begin_time); + setChildValue(P_BEGIN_TIME, begin_time); } void JobItem::setEndTime(const QString &end_time) { - setRegisteredProperty(P_END_TIME, end_time); + setChildValue(P_END_TIME, end_time); } QString JobItem::getComments() const { - return getRegisteredProperty(P_COMMENTS).toString(); + return getChildValue(P_COMMENTS).toString(); } void JobItem::setComments(const QString &comments) { - setRegisteredProperty(P_COMMENTS, comments); + setChildValue(P_COMMENTS, comments); } int JobItem::getProgress() const { - return getRegisteredProperty(P_PROGRESS).toInt(); + return getChildValue(P_PROGRESS).toInt(); } void JobItem::setProgress(int progress) { - setRegisteredProperty(P_PROGRESS, progress); + setChildValue(P_PROGRESS, progress); } int JobItem::getNumberOfThreads() const { - return getRegisteredProperty(P_NTHREADS).toInt(); + return getChildValue(P_NTHREADS).toInt(); } void JobItem::setNumberOfThreads(int number_of_threads) { - setRegisteredProperty(P_NTHREADS, number_of_threads); + setChildValue(P_NTHREADS, number_of_threads); } void JobItem::setRunPolicy(const QString &run_policy) { - ComboProperty combo_property = getRegisteredProperty(JobItem::P_RUN_POLICY).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(JobItem::P_RUN_POLICY).value<ComboProperty>(); combo_property.setValue(run_policy); - setRegisteredProperty(JobItem::P_RUN_POLICY, combo_property.getVariant()); + setChildValue(JobItem::P_RUN_POLICY, combo_property.getVariant()); } bool JobItem::runImmediately() const { - ComboProperty combo_property = getRegisteredProperty(P_RUN_POLICY).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_RUN_POLICY).value<ComboProperty>(); return combo_property.getValue() == Constants::JOB_RUN_IMMEDIATELY; } bool JobItem::runInBackground() const { - ComboProperty combo_property = getRegisteredProperty(P_RUN_POLICY).value<ComboProperty>(); + ComboProperty combo_property = getChildValue(P_RUN_POLICY).value<ComboProperty>(); return combo_property.getValue() == Constants::JOB_RUN_IN_BACKGROUND; } diff --git a/GUI/coregui/Models/JobModel.cpp b/GUI/coregui/Models/JobModel.cpp index 0cbd27d8cbd..0b469cf847a 100644 --- a/GUI/coregui/Models/JobModel.cpp +++ b/GUI/coregui/Models/JobModel.cpp @@ -107,7 +107,7 @@ void JobModel::setSampleForJobItem(JobItem *jobItem, const MultiLayerItem *multi // our original multiLayerItem might come from backup itself, lets clean up its specific name QString name = new_item->itemName(); name.remove(Constants::JOB_BACKUP); - jobItem->setRegisteredProperty(JobItem::P_SAMPLE_NAME, name); + jobItem->setChildValue(JobItem::P_SAMPLE_NAME, name); // if new_item is supposed to be the backup, then it's name should end up with '_backup' if(backup) { @@ -135,7 +135,7 @@ void JobModel::setInstrumentForJobItem(JobItem *jobItem, const InstrumentItem *i // our original instrumentItem might itself come from backup, lets clean up its specific name QString name = new_item->itemName(); name.remove(Constants::JOB_BACKUP); - jobItem->setRegisteredProperty(JobItem::P_INSTRUMENT_NAME, name); + jobItem->setChildValue(JobItem::P_INSTRUMENT_NAME, name); // if new_item is supposed to be the backup, then it's name should end up with '_backup' if(backup) { diff --git a/GUI/coregui/Models/JobResultsPresenter.cpp b/GUI/coregui/Models/JobResultsPresenter.cpp index 097a4c1167e..fdd4c27589a 100644 --- a/GUI/coregui/Models/JobResultsPresenter.cpp +++ b/GUI/coregui/Models/JobResultsPresenter.cpp @@ -179,14 +179,14 @@ JobResultsPresenter::preferableGUIAxesUnits(IDetector2D::EAxesUnits default_unit void JobResultsPresenter::initIntensityItemProperties(IntensityDataItem *intensityItem, const IDetector2D *detector) { - ComboProperty combo = intensityItem->getRegisteredProperty(IntensityDataItem::P_AXES_UNITS) + ComboProperty combo = intensityItem->getChildValue(IntensityDataItem::P_AXES_UNITS) .value<ComboProperty>(); if(!combo.getValues().isEmpty()) return; QString cachedUnits = combo.getCachedValue(); - intensityItem->getItem(IntensityDataItem::P_AXES_UNITS)->setVisible(true); + intensityItem->getItem(IntensityDataItem::P_AXES_UNITS)->setVisible(true); foreach (auto units, detector->getValidAxesUnits()) { combo << getNameFromAxesUnits(units); @@ -200,7 +200,7 @@ void JobResultsPresenter::initIntensityItemProperties(IntensityDataItem *intensi combo.setValue(cachedUnits); } - intensityItem->setRegisteredProperty(IntensityDataItem::P_AXES_UNITS, combo.getVariant()); + intensityItem->setChildValue(IntensityDataItem::P_AXES_UNITS, combo.getVariant()); diff --git a/GUI/coregui/Models/LatticeTypeItems.cpp b/GUI/coregui/Models/LatticeTypeItems.cpp index 72303b9e7a4..f1968b82491 100644 --- a/GUI/coregui/Models/LatticeTypeItems.cpp +++ b/GUI/coregui/Models/LatticeTypeItems.cpp @@ -26,19 +26,19 @@ const QString HexagonalLatticeTypeItem::P_LATTICE_LENGTH = "Lattice_length"; BasicLatticeTypeItem::BasicLatticeTypeItem() : SessionItem(QString("BasicLatticeType")) { - registerProperty(P_LATTICE_LENGTH1, 20.0); - registerProperty(P_LATTICE_LENGTH2, 20.0); - registerProperty(P_LATTICE_ANGLE, 90.0); + addProperty(P_LATTICE_LENGTH1, 20.0); + addProperty(P_LATTICE_LENGTH2, 20.0); + addProperty(P_LATTICE_ANGLE, 90.0); } SquareLatticeTypeItem::SquareLatticeTypeItem() : SessionItem(QString("SquareLatticeType")) { - registerProperty(P_LATTICE_LENGTH, 20.0); + addProperty(P_LATTICE_LENGTH, 20.0); } HexagonalLatticeTypeItem::HexagonalLatticeTypeItem() : SessionItem(QString("HexagonalLatticeType")) { - registerProperty(P_LATTICE_LENGTH, 20.0); + addProperty(P_LATTICE_LENGTH, 20.0); } diff --git a/GUI/coregui/Models/LayerItem.cpp b/GUI/coregui/Models/LayerItem.cpp index 5b0b5080169..a09f37f9dd7 100644 --- a/GUI/coregui/Models/LayerItem.cpp +++ b/GUI/coregui/Models/LayerItem.cpp @@ -25,10 +25,10 @@ const QString LayerItem::T_LAYOUTS = "Layout tag"; LayerItem::LayerItem() : SessionGraphicsItem(Constants::LayerType) { - registerProperty(P_THICKNESS, 0.0); - registerProperty(P_MATERIAL, MaterialUtils::getDefaultMaterialProperty().getVariant()); + addProperty(P_THICKNESS, 0.0); + addProperty(P_MATERIAL, MaterialUtils::getDefaultMaterialProperty().getVariant()); - registerGroupProperty(P_ROUGHNESS, Constants::LayerRoughnessGroup); + addGroupProperty(P_ROUGHNESS, Constants::LayerRoughnessGroup); setGroupProperty(P_ROUGHNESS, Constants::LayerZeroRoughnessType); registerTag(T_LAYOUTS, 0, -1, QStringList() << Constants::ParticleLayoutType); setDefaultTag(T_LAYOUTS); diff --git a/GUI/coregui/Models/LayerRoughnessItems.cpp b/GUI/coregui/Models/LayerRoughnessItems.cpp index f874586edd0..63b7846ff38 100644 --- a/GUI/coregui/Models/LayerRoughnessItems.cpp +++ b/GUI/coregui/Models/LayerRoughnessItems.cpp @@ -29,8 +29,8 @@ const QString LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH = "Lateral corr len LayerBasicRoughnessItem::LayerBasicRoughnessItem() : SessionItem(Constants::LayerBasicRoughnessType) { - registerProperty(P_SIGMA, 1.0); - registerProperty(P_HURST, 0.3)->setLimits(AttLimits::limited(0.0, 1.0)); + addProperty(P_SIGMA, 1.0); + addProperty(P_HURST, 0.3)->setLimits(AttLimits::limited(0.0, 1.0)); getItem(P_HURST)->setDecimals(3); - registerProperty(P_LATERAL_CORR_LENGTH, 5.0); + addProperty(P_LATERAL_CORR_LENGTH, 5.0); } diff --git a/GUI/coregui/Models/MagneticFieldItem.cpp b/GUI/coregui/Models/MagneticFieldItem.cpp index d252e605c4c..2897b8d2b59 100644 --- a/GUI/coregui/Models/MagneticFieldItem.cpp +++ b/GUI/coregui/Models/MagneticFieldItem.cpp @@ -22,14 +22,14 @@ const QString MagneticFieldItem::P_BZ = "Bz"; MagneticFieldItem::MagneticFieldItem() : SessionItem(Constants::MagneticFieldType) { - registerProperty(P_BX, 0.0); - registerProperty(P_BY, 0.0); - registerProperty(P_BZ, 0.0); + addProperty(P_BX, 0.0); + addProperty(P_BY, 0.0); + addProperty(P_BZ, 0.0); } QString MagneticFieldItem::itemLabel() const { - return QString("(%1, %2, %3)").arg(getRegisteredProperty(P_BX).toDouble()) - .arg(getRegisteredProperty(P_BY).toDouble()) - .arg(getRegisteredProperty(P_BZ).toDouble()); + return QString("(%1, %2, %3)").arg(getChildValue(P_BX).toDouble()) + .arg(getChildValue(P_BY).toDouble()) + .arg(getChildValue(P_BZ).toDouble()); } diff --git a/GUI/coregui/Models/MaskItems.cpp b/GUI/coregui/Models/MaskItems.cpp index 396ebb29f28..f1719092535 100644 --- a/GUI/coregui/Models/MaskItems.cpp +++ b/GUI/coregui/Models/MaskItems.cpp @@ -40,7 +40,7 @@ const QString MaskItem::P_MASK_VALUE = "Mask value"; MaskItem::MaskItem(const QString &name) : SessionItem(name) { - registerProperty(P_MASK_VALUE, true); + addProperty(P_MASK_VALUE, true); } std::unique_ptr<Geometry::IShape2D> MaskItem::createShape(double scale) const @@ -60,18 +60,18 @@ RectangleItem::RectangleItem() : MaskItem(Constants::RectangleMaskType) { setItemName(Constants::RectangleMaskType); - registerProperty(P_XLOW, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_YLOW, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_XUP, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_YUP, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_XLOW, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_YLOW, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_XUP, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_YUP, 0.0)->setLimits(AttLimits::limitless()); } std::unique_ptr<Geometry::IShape2D> RectangleItem::createShape(double scale) const { - double xlow = scale*getRegisteredProperty(P_XLOW).toDouble(); - double ylow = scale*getRegisteredProperty(P_YLOW).toDouble(); - double xup = scale*getRegisteredProperty(P_XUP).toDouble(); - double yup = scale*getRegisteredProperty(P_YUP).toDouble(); + double xlow = scale*getChildValue(P_XLOW).toDouble(); + double ylow = scale*getChildValue(P_YLOW).toDouble(); + double xup = scale*getChildValue(P_XUP).toDouble(); + double yup = scale*getChildValue(P_YUP).toDouble(); return GUIHelpers::make_unique<Geometry::Rectangle>(xlow, ylow, xup, yup); } @@ -83,8 +83,8 @@ PolygonPointItem::PolygonPointItem() : SessionItem(Constants::PolygonPointType) { setItemName(Constants::PolygonPointType); - registerProperty(P_POSX, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_POSY, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_POSX, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_POSY, 0.0)->setLimits(AttLimits::limitless()); } /* ------------------------------------------------------------------------- */ @@ -98,15 +98,15 @@ PolygonItem::PolygonItem() const QString T_POINTS = "Point tag"; registerTag(T_POINTS, 0, -1, QStringList() << Constants::PolygonPointType); setDefaultTag(T_POINTS); - registerProperty(P_ISCLOSED, false)->setVisible(false); + addProperty(P_ISCLOSED, false)->setVisible(false); } std::unique_ptr<Geometry::IShape2D> PolygonItem::createShape(double scale) const { std::vector<double> x,y; foreach(SessionItem *item, this->getChildrenOfType(Constants::PolygonPointType)) { - x.push_back(scale*item->getRegisteredProperty(PolygonPointItem::P_POSX).toDouble()); - y.push_back(scale*item->getRegisteredProperty(PolygonPointItem::P_POSY).toDouble()); + x.push_back(scale*item->getChildValue(PolygonPointItem::P_POSX).toDouble()); + y.push_back(scale*item->getChildValue(PolygonPointItem::P_POSY).toDouble()); } return GUIHelpers::make_unique<Geometry::Polygon>(x, y); } @@ -118,13 +118,13 @@ VerticalLineItem::VerticalLineItem() : MaskItem(Constants::VerticalLineMaskType) { setItemName(Constants::VerticalLineMaskType); - registerProperty(P_POSX, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_POSX, 0.0)->setLimits(AttLimits::limitless()); } std::unique_ptr<Geometry::IShape2D> VerticalLineItem::createShape(double scale) const { return GUIHelpers::make_unique<Geometry::VerticalLine>( - scale*getRegisteredProperty(VerticalLineItem::P_POSX).toDouble()); + scale*getChildValue(VerticalLineItem::P_POSX).toDouble()); } /* ------------------------------------------------------------------------- */ @@ -134,13 +134,13 @@ HorizontalLineItem::HorizontalLineItem() : MaskItem(Constants::HorizontalLineMaskType) { setItemName(Constants::HorizontalLineMaskType); - registerProperty(P_POSY, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_POSY, 0.0)->setLimits(AttLimits::limitless()); } std::unique_ptr<Geometry::IShape2D> HorizontalLineItem::createShape(double scale) const { return GUIHelpers::make_unique<Geometry::HorizontalLine>( - scale*getRegisteredProperty(HorizontalLineItem::P_POSY).toDouble()); + scale*getChildValue(HorizontalLineItem::P_POSY).toDouble()); } /* ------------------------------------------------------------------------- */ @@ -155,20 +155,20 @@ EllipseItem::EllipseItem() : MaskItem(Constants::EllipseMaskType) { setItemName(Constants::EllipseMaskType); - registerProperty(P_XCENTER, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_YCENTER, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_XRADIUS, 0.0); - registerProperty(P_YRADIUS, 0.0); - registerProperty(P_ANGLE, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_XCENTER, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_YCENTER, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_XRADIUS, 0.0); + addProperty(P_YRADIUS, 0.0); + addProperty(P_ANGLE, 0.0)->setLimits(AttLimits::limitless()); } std::unique_ptr<Geometry::IShape2D> EllipseItem::createShape(double scale) const { - double xcenter = scale*getRegisteredProperty(EllipseItem::P_XCENTER).toDouble(); - double ycenter = scale*getRegisteredProperty(EllipseItem::P_YCENTER).toDouble(); - double xradius = scale*getRegisteredProperty(EllipseItem::P_XRADIUS).toDouble(); - double yradius = scale*getRegisteredProperty(EllipseItem::P_YRADIUS).toDouble(); - double angle = scale*getRegisteredProperty(EllipseItem::P_ANGLE).toDouble(); + double xcenter = scale*getChildValue(EllipseItem::P_XCENTER).toDouble(); + double ycenter = scale*getChildValue(EllipseItem::P_YCENTER).toDouble(); + double xradius = scale*getChildValue(EllipseItem::P_XRADIUS).toDouble(); + double yradius = scale*getChildValue(EllipseItem::P_YRADIUS).toDouble(); + double angle = scale*getChildValue(EllipseItem::P_ANGLE).toDouble(); return GUIHelpers::make_unique<Geometry::Ellipse>(xcenter, ycenter, xradius, yradius, angle); } diff --git a/GUI/coregui/Models/MaterialItem.cpp b/GUI/coregui/Models/MaterialItem.cpp index 4e903b86214..8ce631de40f 100644 --- a/GUI/coregui/Models/MaterialItem.cpp +++ b/GUI/coregui/Models/MaterialItem.cpp @@ -35,20 +35,20 @@ MaterialItem::MaterialItem() setItemName(Constants::MaterialType); ColorProperty color; - registerProperty(P_COLOR, color.getVariant()); - registerGroupProperty(P_REFRACTIVE_INDEX, Constants::RefractiveIndexType); - registerProperty(P_IDENTIFIER, QUuid::createUuid().toString()); + addProperty(P_COLOR, color.getVariant()); + addGroupProperty(P_REFRACTIVE_INDEX, Constants::RefractiveIndexType); + addProperty(P_IDENTIFIER, QUuid::createUuid().toString()); // getItem(P_IDENTIFIER)->setVisible(false); } QString MaterialItem::getIdentifier() const { - return getRegisteredProperty(P_IDENTIFIER).toString(); + return getChildValue(P_IDENTIFIER).toString(); } QColor MaterialItem::getColor() const { - ColorProperty color_property = getRegisteredProperty(P_COLOR).value<ColorProperty>(); + ColorProperty color_property = getChildValue(P_COLOR).value<ColorProperty>(); return color_property.getColor(); } diff --git a/GUI/coregui/Models/MaterialModel.cpp b/GUI/coregui/Models/MaterialModel.cpp index d6a63bfa028..1956392e437 100644 --- a/GUI/coregui/Models/MaterialModel.cpp +++ b/GUI/coregui/Models/MaterialModel.cpp @@ -47,7 +47,7 @@ MaterialItem *MaterialModel::addMaterial(const QString &name, double delta, doub refractiveIndexItem->setDelta(delta); refractiveIndexItem->setBeta(beta); - materialItem->setRegisteredProperty(MaterialItem::P_COLOR, MaterialUtils::suggestMaterialColorProperty(name).getVariant()); + materialItem->setChildValue(MaterialItem::P_COLOR, MaterialUtils::suggestMaterialColorProperty(name).getVariant()); return materialItem; } diff --git a/GUI/coregui/Models/ModelMapper.cpp b/GUI/coregui/Models/ModelMapper.cpp index 635402c1e06..8f1c1f667cb 100644 --- a/GUI/coregui/Models/ModelMapper.cpp +++ b/GUI/coregui/Models/ModelMapper.cpp @@ -96,7 +96,7 @@ void ModelMapper::onDataChanged(const QModelIndex &topLeft, const QModelIndex &b if (nestling > 0 && nestling < 2) { // something happened with our property or group item if (SessionItem *item = m_model->itemForIndex(topLeft)) { - if (m_item->isRegisteredTag(item->itemName())) { + if (m_item->isTag(item->itemName())) { // some property changed if (m_active && m_onPropertyChange.size() > 0) { for (auto f : m_onPropertyChange) { @@ -108,7 +108,7 @@ void ModelMapper::onDataChanged(const QModelIndex &topLeft, const QModelIndex &b } if (nestling > 1) { if (SessionItem *parent = item->parent()) { - if (parent->isRegisteredTag(item->itemName())) { + if (parent->isTag(item->itemName())) { if (m_active && m_onChildPropertyChange.size() > 0) { for (auto f : m_onChildPropertyChange) { f(parent, item->itemName()); diff --git a/GUI/coregui/Models/ModelPath.cpp b/GUI/coregui/Models/ModelPath.cpp index 2a6b6950bb4..964bcbdd468 100644 --- a/GUI/coregui/Models/ModelPath.cpp +++ b/GUI/coregui/Models/ModelPath.cpp @@ -28,7 +28,7 @@ QStringList ModelPath::getParameterTreeList(const SessionItem *item, QString pre && item->value().type() == QVariant::Double) { result << prefix + item->itemName(); } else { - if (item->hasChildItems()) { + if (item->hasChildren()) { for (auto p_child : item->childItems()) { QString child_name = p_child->itemName(); QString child_prefix = prefix + child_name + QString("/"); @@ -46,8 +46,8 @@ double ModelPath::getParameterValue(const SessionItem *item, const QString &name if (p_child) { return getParameterValue(p_child, stripFirstField(name)); } - if (item->isRegisteredTag(head)) { - return item->getRegisteredProperty(head).toDouble(); + if (item->isTag(head)) { + return item->getChildValue(head).toDouble(); } else { return 0.0; } diff --git a/GUI/coregui/Models/MultiLayerItem.cpp b/GUI/coregui/Models/MultiLayerItem.cpp index 69eb7dfdd59..a2628f698f7 100644 --- a/GUI/coregui/Models/MultiLayerItem.cpp +++ b/GUI/coregui/Models/MultiLayerItem.cpp @@ -25,7 +25,7 @@ const QString MultiLayerItem::T_LAYERS = "Layer tag"; MultiLayerItem::MultiLayerItem() : SessionGraphicsItem(Constants::MultiLayerType) { - registerProperty(P_CROSS_CORR_LENGTH, 0.0); + addProperty(P_CROSS_CORR_LENGTH, 0.0); registerTag(T_LAYERS, 0, -1, QStringList() << Constants::LayerType); setDefaultTag(T_LAYERS); setItemName(Constants::MultiLayerType); @@ -38,7 +38,7 @@ MultiLayerItem::MultiLayerItem() void MultiLayerItem::updateLayers() { - QList<SessionItem*> list = getChildrenOfType(Constants::LayerType); + QVector<SessionItem*> list = getChildrenOfType(Constants::LayerType); for(auto it = list.begin(); it != list.end(); ++it) { if(it == list.begin()) { (*it)->getItem(LayerItem::P_ROUGHNESS)->setEnabled(false); diff --git a/GUI/coregui/Models/ParameterModelBuilder.cpp b/GUI/coregui/Models/ParameterModelBuilder.cpp index ea229f20edc..4c8ec312e10 100644 --- a/GUI/coregui/Models/ParameterModelBuilder.cpp +++ b/GUI/coregui/Models/ParameterModelBuilder.cpp @@ -187,7 +187,7 @@ QStandardItem *ParameterModelBuilder::iterateInstrumentItem(InstrumentItem *inst if (wavelengthDistribution->modelType() == Constants::DistributionNoneType) { addPropertyToParameterModel( standardItem, BeamItem::P_WAVELENGTH, BeamDistributionItem::P_CACHED_VALUE, - beamWavelength->getRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE), + beamWavelength->getChildValue(BeamDistributionItem::P_CACHED_VALUE), beamWavelength); } else { addDisabledProperty(standardItem, BeamItem::P_WAVELENGTH); @@ -202,7 +202,7 @@ QStandardItem *ParameterModelBuilder::iterateInstrumentItem(InstrumentItem *inst if (inclinationDistribution->modelType() == Constants::DistributionNoneType) { addPropertyToParameterModel( standardItem, BeamItem::P_INCLINATION_ANGLE, BeamDistributionItem::P_CACHED_VALUE, - inclinationAngle->getRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE), + inclinationAngle->getChildValue(BeamDistributionItem::P_CACHED_VALUE), inclinationAngle); } else { addDisabledProperty(standardItem, BeamItem::P_INCLINATION_ANGLE); @@ -216,7 +216,7 @@ QStandardItem *ParameterModelBuilder::iterateInstrumentItem(InstrumentItem *inst if (azimuthalDistribution->modelType() == Constants::DistributionNoneType) { addPropertyToParameterModel( standardItem, BeamItem::P_AZIMUTHAL_ANGLE, BeamDistributionItem::P_CACHED_VALUE, - azimuthalAngle->getRegisteredProperty(BeamDistributionItem::P_CACHED_VALUE), + azimuthalAngle->getChildValue(BeamDistributionItem::P_CACHED_VALUE), azimuthalAngle); } else { addDisabledProperty(standardItem, BeamItem::P_AZIMUTHAL_ANGLE); diff --git a/GUI/coregui/Models/ParticleCompositionItem.cpp b/GUI/coregui/Models/ParticleCompositionItem.cpp index 75c4a3b3404..8dc833209d7 100644 --- a/GUI/coregui/Models/ParticleCompositionItem.cpp +++ b/GUI/coregui/Models/ParticleCompositionItem.cpp @@ -26,10 +26,10 @@ const QString ParticleCompositionItem::T_TRANSFORMATION = "Transformation Tag"; ParticleCompositionItem::ParticleCompositionItem() : SessionGraphicsItem(Constants::ParticleCompositionType) { - registerProperty(ParticleItem::P_ABUNDANCE, 1.0); + addProperty(ParticleItem::P_ABUNDANCE, 1.0); getItem(ParticleItem::P_ABUNDANCE)->setLimits(AttLimits::limited(0.0, 1.0)); getItem(ParticleItem::P_ABUNDANCE)->setDecimals(3); - registerGroupProperty(ParticleItem::P_POSITION, Constants::VectorType); + addGroupProperty(ParticleItem::P_POSITION, Constants::VectorType); PositionTranslator position_translator; ModelPath::addParameterTranslator(position_translator); @@ -44,7 +44,7 @@ ParticleCompositionItem::ParticleCompositionItem() [this](SessionItem *parent) { if (parent && (parent->modelType() == Constants::ParticleCompositionType || parent->modelType() == Constants::ParticleDistributionType)) { - setRegisteredProperty(ParticleItem::P_ABUNDANCE, 1.0); + setChildValue(ParticleItem::P_ABUNDANCE, 1.0); getItem(ParticleItem::P_ABUNDANCE)->setEnabled(false); } else { getItem(ParticleItem::P_ABUNDANCE)->setEnabled(true); @@ -54,7 +54,7 @@ ParticleCompositionItem::ParticleCompositionItem() std::unique_ptr<ParticleComposition> ParticleCompositionItem::createParticleComposition() const { - double abundance = getRegisteredProperty(ParticleItem::P_ABUNDANCE).toDouble(); + double abundance = getChildValue(ParticleItem::P_ABUNDANCE).toDouble(); auto P_composition = GUIHelpers::make_unique<ParticleComposition>(); P_composition->setAbundance(abundance); QVector<SessionItem *> children = childItems(); diff --git a/GUI/coregui/Models/ParticleCoreShellItem.cpp b/GUI/coregui/Models/ParticleCoreShellItem.cpp index 61fa811bbb5..4f7fd9fcafb 100644 --- a/GUI/coregui/Models/ParticleCoreShellItem.cpp +++ b/GUI/coregui/Models/ParticleCoreShellItem.cpp @@ -28,10 +28,10 @@ const QString ParticleCoreShellItem::T_TRANSFORMATION = "Transformation Tag"; ParticleCoreShellItem::ParticleCoreShellItem() : SessionGraphicsItem(Constants::ParticleCoreShellType) { - registerProperty(ParticleItem::P_ABUNDANCE, 1.0); + addProperty(ParticleItem::P_ABUNDANCE, 1.0); getItem(ParticleItem::P_ABUNDANCE)->setLimits(AttLimits::limited(0.0, 1.0)); getItem(ParticleItem::P_ABUNDANCE)->setDecimals(3); - registerGroupProperty(ParticleItem::P_POSITION, Constants::VectorType); + addGroupProperty(ParticleItem::P_POSITION, Constants::VectorType); PositionTranslator position_translator; ModelPath::addParameterTranslator(position_translator); @@ -47,7 +47,7 @@ ParticleCoreShellItem::ParticleCoreShellItem() if (name == "OBSOLETE_P_PORT" && parent()) { if (parent()->modelType() == Constants::ParticleCompositionType || parent()->modelType() == Constants::ParticleDistributionType) { - setRegisteredProperty(ParticleItem::P_ABUNDANCE, 1.0); + setChildValue(ParticleItem::P_ABUNDANCE, 1.0); getItem(ParticleItem::P_ABUNDANCE)->setEnabled(false); } } @@ -56,7 +56,7 @@ ParticleCoreShellItem::ParticleCoreShellItem() std::unique_ptr<ParticleCoreShell> ParticleCoreShellItem::createParticleCoreShell() const { - double abundance = getRegisteredProperty(ParticleItem::P_ABUNDANCE).toDouble(); + double abundance = getChildValue(ParticleItem::P_ABUNDANCE).toDouble(); auto children = childItems(); std::unique_ptr<Particle> P_core {}; std::unique_ptr<Particle> P_shell {}; diff --git a/GUI/coregui/Models/ParticleDistributionItem.cpp b/GUI/coregui/Models/ParticleDistributionItem.cpp index 402966de04b..f95d12b8751 100644 --- a/GUI/coregui/Models/ParticleDistributionItem.cpp +++ b/GUI/coregui/Models/ParticleDistributionItem.cpp @@ -37,18 +37,18 @@ const QString ParticleDistributionItem::T_PARTICLES = "Particle Tag"; ParticleDistributionItem::ParticleDistributionItem() : SessionGraphicsItem(Constants::ParticleDistributionType) { - registerProperty(ParticleItem::P_ABUNDANCE, 1.0); + addProperty(ParticleItem::P_ABUNDANCE, 1.0); getItem(ParticleItem::P_ABUNDANCE)->setLimits(AttLimits::limited(0.0, 1.0)); getItem(ParticleItem::P_ABUNDANCE)->setDecimals(3); - registerGroupProperty(P_DISTRIBUTION, Constants::DistributionGroup); + addGroupProperty(P_DISTRIBUTION, Constants::DistributionGroup); registerTag(T_PARTICLES, 0, 1, QStringList() << Constants::ParticleType << Constants::ParticleCoreShellType << Constants::ParticleCompositionType); setDefaultTag(T_PARTICLES); ComboProperty par_prop; - registerProperty(P_DISTRIBUTED_PARAMETER, par_prop.getVariant()); + addProperty(P_DISTRIBUTED_PARAMETER, par_prop.getVariant()); updateParameterList(); mapper()->setOnChildPropertyChange( [this](SessionItem*,QString) @@ -77,26 +77,26 @@ std::unique_ptr<ParticleDistribution> ParticleDistributionItem::createParticleDi auto P_distribution = TransformToDomain::createDistribution(*distr_item); - auto prop = getRegisteredProperty(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER) + auto prop = getChildValue(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER) .value<ComboProperty>(); QString par_name = prop.getValue(); std::string domain_par = ModelPath::translateParameterName(this, par_name); int nbr_samples - = distr_item->getRegisteredProperty(DistributionItem::P_NUMBER_OF_SAMPLES).toInt(); + = distr_item->getChildValue(DistributionItem::P_NUMBER_OF_SAMPLES).toInt(); double sigma_factor - = distr_item->getRegisteredProperty(DistributionItem::P_SIGMA_FACTOR).toDouble(); + = distr_item->getChildValue(DistributionItem::P_SIGMA_FACTOR).toDouble(); ParameterDistribution par_distr(domain_par, *P_distribution, nbr_samples, sigma_factor); auto result = GUIHelpers::make_unique<ParticleDistribution>(*P_particle, par_distr); - double abundance = getRegisteredProperty(ParticleItem::P_ABUNDANCE).toDouble(); + double abundance = getChildValue(ParticleItem::P_ABUNDANCE).toDouble(); result->setAbundance(abundance); return result; } void ParticleDistributionItem::updateParameterList() { - if (!isRegisteredTag(P_DISTRIBUTED_PARAMETER)) + if (!isTag(P_DISTRIBUTED_PARAMETER)) return; - QVariant par_prop = getRegisteredProperty(P_DISTRIBUTED_PARAMETER); + QVariant par_prop = getChildValue(P_DISTRIBUTED_PARAMETER); auto combo_prop = par_prop.value<ComboProperty>(); QString cached_par = combo_prop.getCachedValue(); if (!combo_prop.cacheContainsGUIValue()) { @@ -120,13 +120,13 @@ void ParticleDistributionItem::updateParameterList() } else { updated_prop.setValue(NO_SELECTION); } - setRegisteredProperty(P_DISTRIBUTED_PARAMETER, updated_prop.getVariant()); + setChildValue(P_DISTRIBUTED_PARAMETER, updated_prop.getVariant()); } QStringList ParticleDistributionItem::getChildParameterNames() const { QStringList result; - QList<SessionItem *> children = getUnregisteredChildren(); + QVector<SessionItem *> children = getItems(); if (children.size() > 1) { qDebug() << "ParticleDistributionItem::getChildParameterNames(): " << "More than one child item"; diff --git a/GUI/coregui/Models/ParticleItem.cpp b/GUI/coregui/Models/ParticleItem.cpp index 623cabbdf38..87602fb11b5 100644 --- a/GUI/coregui/Models/ParticleItem.cpp +++ b/GUI/coregui/Models/ParticleItem.cpp @@ -33,12 +33,12 @@ const QString ParticleItem::T_TRANSFORMATION = "Transformation tag"; ParticleItem::ParticleItem() : SessionGraphicsItem(Constants::ParticleType) { - registerGroupProperty(P_FORM_FACTOR, Constants::FormFactorGroup); - registerProperty(P_MATERIAL, + addGroupProperty(P_FORM_FACTOR, Constants::FormFactorGroup); + addProperty(P_MATERIAL, MaterialUtils::getDefaultMaterialProperty().getVariant()); - registerProperty(P_ABUNDANCE, 1.0)->setLimits(AttLimits::limited(0.0, 1.0)); + addProperty(P_ABUNDANCE, 1.0)->setLimits(AttLimits::limited(0.0, 1.0)); getItem(P_ABUNDANCE)->setDecimals(3); - registerGroupProperty(P_POSITION, Constants::VectorType); + addGroupProperty(P_POSITION, Constants::VectorType); PositionTranslator position_translator; ModelPath::addParameterTranslator(position_translator); @@ -54,7 +54,7 @@ std::unique_ptr<Particle> ParticleItem::createParticle() const auto P_material = TransformToDomain::createDomainMaterial(*this); auto P_particle = GUIHelpers::make_unique<Particle>(*P_material); - double abundance = getRegisteredProperty(ParticleItem::P_ABUNDANCE).toDouble(); + double abundance = getChildValue(ParticleItem::P_ABUNDANCE).toDouble(); P_particle->setAbundance(abundance); auto ffItem = static_cast<FormFactorItem*>(getGroupItem(ParticleItem::P_FORM_FACTOR)); diff --git a/GUI/coregui/Models/ParticleLayoutItem.cpp b/GUI/coregui/Models/ParticleLayoutItem.cpp index 1158439d37f..62a3ae4d5c1 100644 --- a/GUI/coregui/Models/ParticleLayoutItem.cpp +++ b/GUI/coregui/Models/ParticleLayoutItem.cpp @@ -28,8 +28,8 @@ ParticleLayoutItem::ParticleLayoutItem() { ComboProperty approx; approx << "Decoupling Approximation" << "Size Space Coupling Approximation"; - registerProperty(P_APPROX, approx.getVariant()); - registerProperty(P_TOTAL_DENSITY, 1.0); + addProperty(P_APPROX, approx.getVariant()); + addProperty(P_TOTAL_DENSITY, 1.0); registerTag(T_PARTICLES, 0, -1, QStringList() << Constants::ParticleType << Constants::ParticleCoreShellType << Constants::ParticleCompositionType << Constants::ParticleDistributionType); diff --git a/GUI/coregui/Models/RectangularDetectorItem.cpp b/GUI/coregui/Models/RectangularDetectorItem.cpp index 74886d8a9ad..e5b64f8cef5 100644 --- a/GUI/coregui/Models/RectangularDetectorItem.cpp +++ b/GUI/coregui/Models/RectangularDetectorItem.cpp @@ -65,25 +65,25 @@ RectangularDetectorItem::RectangularDetectorItem() , m_is_constructed(false) { // axes parameters - registerGroupProperty(P_X_AXIS, Constants::BasicAxisType); + addGroupProperty(P_X_AXIS, Constants::BasicAxisType); getGroupItem(P_X_AXIS)->getItem(BasicAxisItem::P_TITLE)->setVisible(false); getGroupItem(P_X_AXIS)->getItem(BasicAxisItem::P_MIN)->setVisible(false); - getGroupItem(P_X_AXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, default_detector_width); + getGroupItem(P_X_AXIS)->setChildValue(BasicAxisItem::P_MAX, default_detector_width); getGroupItem(P_X_AXIS)->getItem(BasicAxisItem::P_MAX)->setDisplayName(QStringLiteral("Width")); getGroupItem(P_X_AXIS)->getItem(BasicAxisItem::P_MAX) ->setToolTip(QStringLiteral("Width of the detector in mm")); - registerGroupProperty(P_Y_AXIS, Constants::BasicAxisType); + addGroupProperty(P_Y_AXIS, Constants::BasicAxisType); getGroupItem(P_Y_AXIS)->getItem(BasicAxisItem::P_TITLE)->setVisible(false); getGroupItem(P_Y_AXIS)->getItem(BasicAxisItem::P_MIN)->setVisible(false); - getGroupItem(P_Y_AXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, default_detector_height); + getGroupItem(P_Y_AXIS)->setChildValue(BasicAxisItem::P_MAX, default_detector_height); getGroupItem(P_Y_AXIS)->getItem(BasicAxisItem::P_MAX)->setDisplayName(QStringLiteral("Height")); getGroupItem(P_Y_AXIS)->getItem(BasicAxisItem::P_MAX) ->setToolTip(QStringLiteral("Height of the detector in mm")); // resolution function - registerGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionGroup); + addGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionGroup); setGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionNoneType); // alignment selector @@ -93,21 +93,21 @@ RectangularDetectorItem::RectangularDetectorItem() << Constants::ALIGNMENT_TO_SAMPLE << Constants::ALIGNMENT_TO_REFLECTED_BEAM << Constants::ALIGNMENT_TO_REFLECTED_BEAM_DPOS; alignment.setValue(Constants::ALIGNMENT_TO_DIRECT_BEAM); - registerProperty(P_ALIGNMENT, alignment.getVariant()); + addProperty(P_ALIGNMENT, alignment.getVariant()); // alignment parameters - registerGroupProperty(P_NORMAL, Constants::VectorType); - getGroupItem(P_NORMAL)->setRegisteredProperty(VectorItem::P_X, default_detector_distance); + addGroupProperty(P_NORMAL, Constants::VectorType); + getGroupItem(P_NORMAL)->setChildValue(VectorItem::P_X, default_detector_distance); - registerGroupProperty(P_DIRECTION, Constants::VectorType); - getGroupItem(P_DIRECTION)->setRegisteredProperty(VectorItem::P_Y, -1.0); + addGroupProperty(P_DIRECTION, Constants::VectorType); + getGroupItem(P_DIRECTION)->setChildValue(VectorItem::P_Y, -1.0); - registerProperty(P_U0, default_detector_width/2.)->setToolTip(tooltip_u0); - registerProperty(P_V0, 0.0)->setToolTip(tooltip_v0); - registerProperty(P_DBEAM_U0, default_detector_width/2.)->setToolTip(tooltip_dbeam_u0); - registerProperty(P_DBEAM_V0, 0.0)->setToolTip(tooltip_dbeam_v0); + addProperty(P_U0, default_detector_width/2.)->setToolTip(tooltip_u0); + addProperty(P_V0, 0.0)->setToolTip(tooltip_v0); + addProperty(P_DBEAM_U0, default_detector_width/2.)->setToolTip(tooltip_dbeam_u0); + addProperty(P_DBEAM_V0, 0.0)->setToolTip(tooltip_dbeam_v0); - registerProperty(P_DISTANCE, default_detector_distance) + addProperty(P_DISTANCE, default_detector_distance) ->setToolTip(QStringLiteral("Distance in [mm] from the sample origin to the detector plane")); update_properties_appearance(); @@ -125,14 +125,14 @@ std::unique_ptr<IDetector2D> RectangularDetectorItem::createDetector() const auto x_axis = dynamic_cast<BasicAxisItem *>( getGroupItem(RectangularDetectorItem::P_X_AXIS)); Q_ASSERT(x_axis); - int n_x = x_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); - double width = x_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + int n_x = x_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); + double width = x_axis->getChildValue(BasicAxisItem::P_MAX).toDouble(); auto y_axis = dynamic_cast<BasicAxisItem *>( getGroupItem(RectangularDetectorItem::P_Y_AXIS)); Q_ASSERT(y_axis); - int n_y = y_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); - double height = y_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + int n_y = y_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); + double height = y_axis->getChildValue(BasicAxisItem::P_MAX).toDouble(); // std::unique_ptr<RectangularDetector> result(new RectangularDetector(100, 20.0, 100, 20.0)); // result->setPerpendicularToSampleX(1000.0, 10.0, 0.0); @@ -141,16 +141,16 @@ std::unique_ptr<IDetector2D> RectangularDetectorItem::createDetector() const // distance and alighnment - double u0 = getRegisteredProperty(P_U0).toDouble(); - double v0 = getRegisteredProperty(P_V0).toDouble(); - double dbeam_u0 = getRegisteredProperty(P_DBEAM_U0).toDouble(); - double dbeam_v0 = getRegisteredProperty(P_DBEAM_V0).toDouble(); - double distance = getRegisteredProperty(P_DISTANCE).toDouble(); + double u0 = getChildValue(P_U0).toDouble(); + double v0 = getChildValue(P_V0).toDouble(); + double dbeam_u0 = getChildValue(P_DBEAM_U0).toDouble(); + double dbeam_v0 = getChildValue(P_DBEAM_V0).toDouble(); + double distance = getChildValue(P_DISTANCE).toDouble(); kvector_t normal = getNormalVector(); kvector_t direction = getDirectionVector(); - ComboProperty alignment = getRegisteredProperty(P_ALIGNMENT).value<ComboProperty>(); + ComboProperty alignment = getChildValue(P_ALIGNMENT).value<ComboProperty>(); if (alignment.getValue() == Constants::ALIGNMENT_GENERIC) { result->setPosition(normal, u0, v0, direction); @@ -187,13 +187,13 @@ std::unique_ptr<IResolutionFunction2D> RectangularDetectorItem::createResolution void RectangularDetectorItem::setDetectorAlignment(const QString &alignment) { ComboProperty combo_property - = getRegisteredProperty(RectangularDetectorItem::P_ALIGNMENT).value<ComboProperty>(); + = getChildValue(RectangularDetectorItem::P_ALIGNMENT).value<ComboProperty>(); if(!combo_property.getValues().contains(alignment)) { throw GUIHelpers::Error("RectangularDetectorItem::setDetectorAlignment -> Unexpected alignment"); } combo_property.setValue(alignment); - setRegisteredProperty(RectangularDetectorItem::P_ALIGNMENT, combo_property.getVariant()); + setChildValue(RectangularDetectorItem::P_ALIGNMENT, combo_property.getVariant()); } @@ -201,7 +201,7 @@ void RectangularDetectorItem::setDetectorAlignment(const QString &alignment) void RectangularDetectorItem::update_properties_appearance() { // hiding all alignment properties - ComboProperty alignment = getRegisteredProperty(P_ALIGNMENT).value<ComboProperty>(); + ComboProperty alignment = getChildValue(P_ALIGNMENT).value<ComboProperty>(); QStringList prop_list; prop_list << P_NORMAL << P_DIRECTION << P_U0 << P_V0 << P_DBEAM_U0 << P_DBEAM_V0 << P_DISTANCE; foreach(auto prop, prop_list) { diff --git a/GUI/coregui/Models/RefractiveIndexItem.cpp b/GUI/coregui/Models/RefractiveIndexItem.cpp index 9a7e99dd9bb..32d33583ea3 100644 --- a/GUI/coregui/Models/RefractiveIndexItem.cpp +++ b/GUI/coregui/Models/RefractiveIndexItem.cpp @@ -25,10 +25,10 @@ RefractiveIndexItem::RefractiveIndexItem() : SessionItem(Constants::RefractiveIndexType) { ScientificDoubleProperty delta(0.0); - registerProperty(P_DELTA, delta.getVariant()); + addProperty(P_DELTA, delta.getVariant()); ScientificDoubleProperty beta(0.0); - registerProperty(P_BETA, beta.getVariant()); + addProperty(P_BETA, beta.getVariant()); } QString RefractiveIndexItem::itemLabel() const @@ -38,24 +38,24 @@ QString RefractiveIndexItem::itemLabel() const double RefractiveIndexItem::getDelta() const { - return getRegisteredProperty(P_DELTA).value<ScientificDoubleProperty>().getValue(); + return getChildValue(P_DELTA).value<ScientificDoubleProperty>().getValue(); } void RefractiveIndexItem::setDelta(double delta) { - ScientificDoubleProperty scd_property = getRegisteredProperty(P_DELTA).value<ScientificDoubleProperty>(); + ScientificDoubleProperty scd_property = getChildValue(P_DELTA).value<ScientificDoubleProperty>(); scd_property.setValue(delta); - setRegisteredProperty(P_DELTA, scd_property.getVariant()); + setChildValue(P_DELTA, scd_property.getVariant()); } double RefractiveIndexItem::getBeta() const { - return getRegisteredProperty(P_BETA).value<ScientificDoubleProperty>().getValue(); + return getChildValue(P_BETA).value<ScientificDoubleProperty>().getValue(); } void RefractiveIndexItem::setBeta(double beta) { - ScientificDoubleProperty scd_property = getRegisteredProperty(P_BETA).value<ScientificDoubleProperty>(); + ScientificDoubleProperty scd_property = getChildValue(P_BETA).value<ScientificDoubleProperty>(); scd_property.setValue(beta); - setRegisteredProperty(P_BETA, scd_property.getVariant()); + setChildValue(P_BETA, scd_property.getVariant()); } diff --git a/GUI/coregui/Models/ResolutionFunctionItems.cpp b/GUI/coregui/Models/ResolutionFunctionItems.cpp index a83565dba35..2de5fb342c5 100644 --- a/GUI/coregui/Models/ResolutionFunctionItems.cpp +++ b/GUI/coregui/Models/ResolutionFunctionItems.cpp @@ -44,17 +44,17 @@ const QString ResolutionFunction2DGaussianItem::P_SIGMA_Y = "Sigma Y"; ResolutionFunction2DGaussianItem::ResolutionFunction2DGaussianItem() : ResolutionFunctionItem(Constants::ResolutionFunction2DGaussianType) { - registerProperty(P_SIGMA_X, 0.02); + addProperty(P_SIGMA_X, 0.02); getItem(P_SIGMA_X)->setLimits(AttLimits::lowerLimited(0.0)); getItem(P_SIGMA_X)->setDecimals(3); - registerProperty(P_SIGMA_Y, 0.02); + addProperty(P_SIGMA_Y, 0.02); getItem(P_SIGMA_Y)->setLimits(AttLimits::lowerLimited(0.0)); getItem(P_SIGMA_Y)->setDecimals(3); } IResolutionFunction2D *ResolutionFunction2DGaussianItem::createResolutionFunction(double scale) const { - double sigma_x = getRegisteredProperty(P_SIGMA_X).toDouble(); - double sigma_y = getRegisteredProperty(P_SIGMA_Y).toDouble(); + double sigma_x = getChildValue(P_SIGMA_X).toDouble(); + double sigma_y = getChildValue(P_SIGMA_Y).toDouble(); return new ResolutionFunction2DGaussian(sigma_x*scale, sigma_y*scale); } diff --git a/GUI/coregui/Models/RotationItems.cpp b/GUI/coregui/Models/RotationItems.cpp index 94980cbc640..c399720979d 100644 --- a/GUI/coregui/Models/RotationItems.cpp +++ b/GUI/coregui/Models/RotationItems.cpp @@ -24,12 +24,12 @@ const QString XRotationItem::P_ANGLE = "Angle"; XRotationItem::XRotationItem() : RotationItem(Constants::XRotationType) { - registerProperty(P_ANGLE, 0.0); + addProperty(P_ANGLE, 0.0); } IRotation *XRotationItem::createRotation() const { - double alpha = Units::deg2rad(getRegisteredProperty(P_ANGLE).toDouble() ); + double alpha = Units::deg2rad(getChildValue(P_ANGLE).toDouble() ); return new RotationX(alpha); } @@ -40,12 +40,12 @@ const QString YRotationItem::P_ANGLE = "Angle"; YRotationItem::YRotationItem() : RotationItem(Constants::YRotationType) { - registerProperty(P_ANGLE, 0.0); + addProperty(P_ANGLE, 0.0); } IRotation *YRotationItem::createRotation() const { - double alpha = Units::deg2rad(getRegisteredProperty(P_ANGLE).toDouble() ); + double alpha = Units::deg2rad(getChildValue(P_ANGLE).toDouble() ); return new RotationY(alpha); } @@ -56,12 +56,12 @@ const QString ZRotationItem::P_ANGLE = "Angle"; ZRotationItem::ZRotationItem() : RotationItem(Constants::ZRotationType) { - registerProperty(P_ANGLE, 0.0); + addProperty(P_ANGLE, 0.0); } IRotation *ZRotationItem::createRotation() const { - double alpha = Units::deg2rad(getRegisteredProperty(P_ANGLE).toDouble() ); + double alpha = Units::deg2rad(getChildValue(P_ANGLE).toDouble() ); return new RotationZ(alpha); } @@ -74,15 +74,15 @@ const QString EulerRotationItem::P_GAMMA = "Gamma"; EulerRotationItem::EulerRotationItem() : RotationItem(Constants::EulerRotationType) { - registerProperty(P_ALPHA, 0.0); - registerProperty(P_BETA, 0.0); - registerProperty(P_GAMMA, 0.0); + addProperty(P_ALPHA, 0.0); + addProperty(P_BETA, 0.0); + addProperty(P_GAMMA, 0.0); } IRotation *EulerRotationItem::createRotation() const { - double alpha = Units::deg2rad(getRegisteredProperty(P_ALPHA).toDouble() ); - double beta = Units::deg2rad(getRegisteredProperty(P_BETA).toDouble() ); - double gamma = Units::deg2rad(getRegisteredProperty(P_GAMMA).toDouble() ); + double alpha = Units::deg2rad(getChildValue(P_ALPHA).toDouble() ); + double beta = Units::deg2rad(getChildValue(P_BETA).toDouble() ); + double gamma = Units::deg2rad(getChildValue(P_GAMMA).toDouble() ); return new RotationEuler(alpha, beta, gamma); } diff --git a/GUI/coregui/Models/SampleModel.cpp b/GUI/coregui/Models/SampleModel.cpp index a3969f14b6c..ad5e430d933 100644 --- a/GUI/coregui/Models/SampleModel.cpp +++ b/GUI/coregui/Models/SampleModel.cpp @@ -71,7 +71,7 @@ void SampleModel::exploreForMaterials(const QModelIndex &parentIndex) || item->modelType() == Constants::ParticleType) { qDebug() << " found item" << item->modelType(); MaterialProperty material_property - = item->getRegisteredProperty(LayerItem::P_MATERIAL).value<MaterialProperty>(); + = item->getChildValue(LayerItem::P_MATERIAL).value<MaterialProperty>(); if (material_property.getIdentifier() == m_material_identifier) { // item->setRegisteredProperty(LayerItem::P_MATERIAL, // material_property.getVariant()); diff --git a/GUI/coregui/Models/SessionGraphicsItem.cpp b/GUI/coregui/Models/SessionGraphicsItem.cpp index 921e9af758e..3a37096d756 100644 --- a/GUI/coregui/Models/SessionGraphicsItem.cpp +++ b/GUI/coregui/Models/SessionGraphicsItem.cpp @@ -23,7 +23,7 @@ const QString SessionGraphicsItem::P_YPOS = "ypos"; SessionGraphicsItem::SessionGraphicsItem(const QString &model_type) : SessionItem(model_type) { - registerProperty(P_XPOS, qreal(0.0))->setVisible(false); - registerProperty(P_YPOS, qreal(0.0))->setVisible(false); + addProperty(P_XPOS, qreal(0.0))->setVisible(false); + addProperty(P_YPOS, qreal(0.0))->setVisible(false); } diff --git a/GUI/coregui/Models/SessionItem.cpp b/GUI/coregui/Models/SessionItem.cpp index d13cab66555..0a6c9a1500e 100644 --- a/GUI/coregui/Models/SessionItem.cpp +++ b/GUI/coregui/Models/SessionItem.cpp @@ -256,7 +256,7 @@ QVector<SessionItem *> SessionItem::getItems(const QString &tag) const if (!tagInfo.isValid()) return QVector<SessionItem*>(); int index = tagStartIndex(tagName); - Q_ASSERT(index >= 0 && index < m_children.size()); + Q_ASSERT(index >= 0 && index <= m_children.size()); return m_children.mid(index, tagInfo.childCount); } void SessionItem::changeFlags(bool enabled, int flag) @@ -335,13 +335,21 @@ QVariant SessionItem::value() const bool SessionItem::setValue(QVariant value) { + QVariant previous_variant = this->value(); + if (previous_variant.isValid() && GUIHelpers::getVariantType(previous_variant) != GUIHelpers::getVariantType(value)) { + qDebug() << "ParameterizedItem::setRegisteredProperty() -> Error. Type of previous and new " + "variant does not coincide."; + qDebug() << "New variant" << value << ", previous " << previous_variant; + throw GUIHelpers::Error("ParameterizedItem::setRegisteredProperty() -> Error. Type of " + "previous and new variant does not coincide."); + } return setData(Qt::DisplayRole, value); } QString SessionItem::itemName() const { - if (isRegisteredTag(P_NAME)) { - return getRegisteredProperty(P_NAME).toString(); + if (isTag(P_NAME)) { + return getChildValue(P_NAME).toString(); } else { return displayName(); } @@ -349,10 +357,10 @@ QString SessionItem::itemName() const void SessionItem::setItemName(const QString &name) { - if (isRegisteredTag(P_NAME)) { - setRegisteredProperty(P_NAME, name); + if (isTag(P_NAME)) { + setChildValue(P_NAME, name); } else { - registerProperty(P_NAME, name); + addProperty(P_NAME, name); } } @@ -419,7 +427,7 @@ int SessionItem::childNumber() const return -1; } -bool SessionItem::hasChildItems() const +bool SessionItem::hasChildren() const { return !m_children.isEmpty(); } @@ -445,9 +453,9 @@ SessionItem *SessionItem::getChildByName(const QString &name) const return nullptr; } -QList<SessionItem *> SessionItem::getChildrenOfType(const QString &model_type) const +QVector<SessionItem *> SessionItem::getChildrenOfType(const QString &model_type) const { - QList<SessionItem *> result; + QVector<SessionItem *> result; for (auto child : m_children) { if (child->modelType() == model_type) result.append(child); @@ -455,16 +463,6 @@ QList<SessionItem *> SessionItem::getChildrenOfType(const QString &model_type) c return result; } -QList<SessionItem *> SessionItem::getUnregisteredChildren() const -{ - QList<SessionItem *> result; - for (auto child : m_children) { - if (!isRegisteredTag(child->itemName())) - result.append(child); - } - return result; -} - SessionItem *SessionItem::takeRow(int row) { @@ -475,21 +473,21 @@ SessionItem *SessionItem::takeRow(int row) return takeItem(items.indexOf(item), tag); } -bool SessionItem::acceptsAsChild(const QString &child_name) const +bool SessionItem::acceptsAsDefaultChild(const QString &child_name) const { return getTagInfo(defaultTag()).modelTypes.contains(child_name); } -QList<QString> SessionItem::acceptableChildItems() const +QVector<QString> SessionItem::acceptableDefaultChildTypes() const { - return getTagInfo(defaultTag()).modelTypes.toVector().toList(); + return getTagInfo(defaultTag()).modelTypes.toVector(); } //! Registers new property. If variant represents some valid modelType, appropriate //! item will be created. I -SessionItem *SessionItem::registerProperty(const QString &name, const QVariant &variant) +SessionItem *SessionItem::addProperty(const QString &name, const QVariant &variant) { - if (isRegisteredTag(name)) + if (isTag(name)) throw GUIHelpers::Error( "ParameterizedItem::registerProperty() -> Error. Already existing property " + name); @@ -502,14 +500,14 @@ SessionItem *SessionItem::registerProperty(const QString &name, const QVariant & return property; } -bool SessionItem::isRegisteredTag(const QString &name) const +bool SessionItem::isTag(const QString &name) const { return getTagInfo(name).isValid(); } -QVariant SessionItem::getRegisteredProperty(const QString &name) const +QVariant SessionItem::getChildValue(const QString &name) const { - if (!isRegisteredTag(name)) + if (!isTag(name)) throw GUIHelpers::Error( "ParameterizedItem::getRegisteredProperty() -> Error. Unknown property '" + name + "', item '" + modelType() + "'"); @@ -517,42 +515,17 @@ QVariant SessionItem::getRegisteredProperty(const QString &name) const return getItem(name)->value(); } -void SessionItem::setRegisteredProperty(const QString &name, const QVariant &variant) +void SessionItem::setChildValue(const QString &name, const QVariant &variant) { // check if variant of previous property coincides with new one - if (!isRegisteredTag(name)) + if (!isTag(name)) throw GUIHelpers::Error("Property not existing!"); - QVariant previous_variant = getRegisteredProperty(name); - if (GUIHelpers::getVariantType(previous_variant) != GUIHelpers::getVariantType(variant)) { - qDebug() << "ParameterizedItem::setRegisteredProperty() -> Error. Type of previous and new " - "variant does not coincide."; - qDebug() << "New variant" << variant << ", previous " << previous_variant; - throw GUIHelpers::Error("ParameterizedItem::setRegisteredProperty() -> Error. Type of " - "previous and new variant does not coincide."); - } - getItem(name)->setValue(variant); -} -void SessionItem::removeRegisteredProperty(const QString &name) -{ - if(isRegisteredTag(name)) { - qDebug() << "ParameterizedItem::removeRegisteredProperty()" << name; - if (SessionItem *para = takeItem(0, name)) { - delete para; -// if (m_model) { -// QModelIndex index = m_model->indexOfItem(para); -// m_model->removeRows(index.row(), 1, index.parent()); -// m_propertyItems.remove(name); -// } else { -// m_children.removeAll(m_propertyItems[name]); -// m_propertyItems.remove(name); -// } - } - } + getItem(name)->setValue(variant); } -SessionItem *SessionItem::registerGroupProperty(const QString &groupName, const QString &groupModel) +SessionItem *SessionItem::addGroupProperty(const QString &groupName, const QString &groupModel) { GroupProperty_t group_property = GroupPropertyRegistry::createGroupProperty(groupName, groupModel); @@ -565,15 +538,6 @@ SessionItem *SessionItem::registerGroupProperty(const QString &groupName, const return groupItem; } -bool SessionItem::isGroupProperty(const QString &name) const -{ - SessionTagInfo tagInfo = getTagInfo(name); - if (tagInfo.isValid()) { - return tagInfo.modelTypes.contains(Constants::GroupItemType); - } - return false; -} - SessionItem *SessionItem::setGroupProperty(const QString &name, const QString &value) const { qDebug() << "ParameterizedItem::setGroupProperty()" << name << value; @@ -694,13 +658,13 @@ int SessionItem::getCopyNumberOfChild(const SessionItem *p_item) const int count = 0; QString model_type = p_item->modelType(); // check child items: - if (hasChildItems()) { + if (hasChildren()) { for (auto p_child_item : m_children) { QString child_type = p_child_item->modelType(); if (p_child_item == p_item) { result = count; } - if (child_type == model_type && !p_child_item->isRegisteredTag(P_NAME)) { + if (child_type == model_type && !p_child_item->isTag(P_NAME)) { ++count; } } diff --git a/GUI/coregui/Models/SessionItem.h b/GUI/coregui/Models/SessionItem.h index 09222a49801..3df4e9418d4 100644 --- a/GUI/coregui/Models/SessionItem.h +++ b/GUI/coregui/Models/SessionItem.h @@ -87,29 +87,29 @@ public: - SessionItem *registerProperty(const QString &name, const QVariant &variant); - SessionItem *registerGroupProperty(const QString &groupName, const QString &groupModel); - - bool isRegisteredTag(const QString &name) const; - QVariant getRegisteredProperty(const QString &name) const; - void setRegisteredProperty(const QString &name, const QVariant &variant); - void removeRegisteredProperty(const QString &name); - bool isGroupProperty(const QString &name) const; + SessionItem *addProperty(const QString &name, const QVariant &variant); + SessionItem *addGroupProperty(const QString &groupName, const QString &groupModel); + + bool isTag(const QString &name) const; + + QVariant getChildValue(const QString &name) const; + void setChildValue(const QString &name, const QVariant &variant); + SessionItem *setGroupProperty(const QString &name, const QString &value = QString()) const; SessionItem *getGroupItem(const QString &name, const QString &type = QString()) const; virtual QString itemLabel() const; int rowOfChild(SessionItem *child) const; int childNumber() const; - bool hasChildItems() const; + bool hasChildren() const; QVector<SessionItem *> childItems() const; SessionItem *getChildOfType(const QString &type) const; SessionItem* getChildByName(const QString &name) const; - QList<SessionItem *> getChildrenOfType(const QString &model_type) const; - QList<SessionItem *> getUnregisteredChildren() const; + QVector<SessionItem *> getChildrenOfType(const QString &model_type) const; SessionItem *takeRow(int row); - bool acceptsAsChild(const QString &child_name) const; - QList<QString> acceptableChildItems() const; + + bool acceptsAsDefaultChild(const QString &child_name) const; + QVector<QString> acceptableDefaultChildTypes() const; diff --git a/GUI/coregui/Models/SessionModel.cpp b/GUI/coregui/Models/SessionModel.cpp index 211288bf743..37b1844cfc5 100644 --- a/GUI/coregui/Models/SessionModel.cpp +++ b/GUI/coregui/Models/SessionModel.cpp @@ -72,7 +72,7 @@ Qt::ItemFlags SessionModel::flags(const QModelIndex &index) const SessionItem *item = itemForIndex(index); // NEW make data editable as default if (index.column() == ITEM_VALUE) // NEW result_flags |= Qt::ItemIsEditable; // NEW - QList<QString> acceptable_child_items = getAcceptableChildItems(index); + QVector<QString> acceptable_child_items = getAcceptableChildItems(index); if (acceptable_child_items.contains(m_dragged_item_type)) { result_flags |= Qt::ItemIsDropEnabled; } @@ -225,7 +225,7 @@ bool SessionModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, return false; if (!parent.isValid()) return true; - QList<QString> acceptable_child_items = getAcceptableChildItems(parent); + QVector<QString> acceptable_child_items = getAcceptableChildItems(parent); QByteArray xml_data = qUncompress(data->data(SessionXML::MimeType)); QXmlStreamReader reader(xml_data); while (!reader.atEnd()) { @@ -322,11 +322,11 @@ SessionItem *SessionModel::insertNewItem(QString model_type, const QModelIndex & return new_item; } -QList<QString> SessionModel::getAcceptableChildItems(const QModelIndex &parent) const +QVector<QString> SessionModel::getAcceptableChildItems(const QModelIndex &parent) const { - QList<QString> result; + QVector<QString> result; if (SessionItem *parent_item = itemForIndex(parent)) { - result = parent_item->acceptableChildItems(); + result = parent_item->acceptableDefaultChildTypes(); } return result; } @@ -416,21 +416,21 @@ void SessionModel::writeTo(QXmlStreamWriter *writer, SessionItem *parent) //! Move given parameterized item to the new_parent at given row. If new_parent is not defined, //! use root_item as a new parent. SessionItem *SessionModel::moveParameterizedItem(SessionItem *item, SessionItem *new_parent, - int row, const QString &tag) + int row, const QString &tag) { qDebug() << ""; qDebug() << ""; qDebug() << "SessionModel::moveParameterizedItem() " << item << new_parent << row; - if (!new_parent) - new_parent = m_root_item; - const QString tagName = tag.isEmpty() ? new_parent->defaultTag() : tag; + if (!new_parent) + new_parent = m_root_item; + const QString tagName = tag.isEmpty() ? new_parent->defaultTag() : tag; if (new_parent) { - if (!new_parent->getTagInfo(tagName).modelTypes.empty() && - !new_parent->getTagInfo(tagName).modelTypes.contains(item->modelType())) + if (!new_parent->getTagInfo(tagName).modelTypes.empty() && + !new_parent->getTagInfo(tagName).modelTypes.contains(item->modelType())) return 0; -// if (!new_parent->acceptsAsChild(item->modelType())) -// return 0; +// if (!new_parent->acceptsAsChild(item->modelType())) +// return 0; } if (item->parent() == new_parent && indexOfItem(item).row() == row) { @@ -439,41 +439,41 @@ SessionItem *SessionModel::moveParameterizedItem(SessionItem *item, SessionItem return item; } -// QByteArray xml_data; -// QXmlStreamWriter writer(&xml_data); -// SessionWriter::writeItemAndChildItems(&writer, item); +// QByteArray xml_data; +// QXmlStreamWriter writer(&xml_data); +// SessionWriter::writeItemAndChildItems(&writer, item); -// QXmlStreamReader reader(xml_data); -// if (row == -1) -// row = new_parent->rowCount(); - SessionItem *stuff = item->parent()->takeRow(item->parent()->rowOfChild(item)); - if(!new_parent->insertItem(row, stuff, tagName)) { - SessionTagInfo info = new_parent->getTagInfo(tagName); - if (info.max == info.childCount && info.childCount == 1) { - SessionItem *old = new_parent->takeItem(0, tagName); - new_parent->insertItem(row, stuff, tagName); - m_root_item->insertItem(-1, old); - } - m_root_item->insertItem(-1, stuff); - } +// QXmlStreamReader reader(xml_data); +// if (row == -1) +// row = new_parent->rowCount(); + SessionItem *stuff = item->parent()->takeRow(item->parent()->rowOfChild(item)); + if(!new_parent->insertItem(row, stuff, tagName)) { + SessionTagInfo info = new_parent->getTagInfo(tagName); + if (info.max == info.childCount && info.childCount == 1) { + SessionItem *old = new_parent->takeItem(0, tagName); + new_parent->insertItem(row, stuff, tagName); + m_root_item->insertItem(-1, old); + } + m_root_item->insertItem(-1, stuff); + } -// qDebug() << " SessionModel::moveParameterizedItem() >>> Beginning to insert " -// "indexOfItem(new_parent)" << indexOfItem(new_parent); -// beginInsertRows(indexOfItem(new_parent), row, row); -// SessionReader::readItems(&reader, new_parent, row); -// endInsertRows(); +// qDebug() << " SessionModel::moveParameterizedItem() >>> Beginning to insert " +// "indexOfItem(new_parent)" << indexOfItem(new_parent); +// beginInsertRows(indexOfItem(new_parent), row, row); +// SessionReader::readItems(&reader, new_parent, row); +// endInsertRows(); -// SessionItem *newItem = new_parent->childAt(row); +// SessionItem *newItem = new_parent->childAt(row); -// qDebug() << " "; -// qDebug() << " SessionModel::moveParameterizedItem() >>> Now deleting indexOfItem(item).row()" -// << indexOfItem(item).row(); +// qDebug() << " "; +// qDebug() << " SessionModel::moveParameterizedItem() >>> Now deleting indexOfItem(item).row()" +// << indexOfItem(item).row(); -// removeRows(indexOfItem(item).row(), 1, indexOfItem(item->parent())); +// removeRows(indexOfItem(item).row(), 1, indexOfItem(item->parent())); -// cleanItem(indexOfItem(new_parent), row, row); +// cleanItem(indexOfItem(new_parent), row, row); - return stuff; + return stuff; } //! Copy given item to the new_parent at given raw. Item indended for copying can belong to @@ -482,7 +482,7 @@ SessionItem *SessionModel::copyParameterizedItem(const SessionItem *item_to_copy SessionItem *new_parent, int row) { if (new_parent) { - if (!new_parent->acceptsAsChild(item_to_copy->modelType())) + if (!new_parent->acceptsAsDefaultChild(item_to_copy->modelType())) return 0; } else { new_parent = m_root_item; diff --git a/GUI/coregui/Models/SessionModel.h b/GUI/coregui/Models/SessionModel.h index 36986cdc3e8..88cea5bb6b1 100644 --- a/GUI/coregui/Models/SessionModel.h +++ b/GUI/coregui/Models/SessionModel.h @@ -78,7 +78,7 @@ public: QString getModelName() const; void setModelName(const QString &name); - QList<QString> getAcceptableChildItems(const QModelIndex &parent) const; + QVector<QString> getAcceptableChildItems(const QModelIndex &parent) const; void clear(); void load(const QString &filename = QString()); @@ -94,8 +94,8 @@ public: void writeTo(QXmlStreamWriter *writer, SessionItem *parent = 0); SessionItem *moveParameterizedItem(SessionItem *item, - SessionItem *new_parent = 0, int row = -1, - const QString &tag = QString()); + SessionItem *new_parent = 0, int row = -1, + const QString &tag = QString()); SessionItem *copyParameterizedItem(const SessionItem *item_to_copy, SessionItem *new_parent = 0, int row = -1); diff --git a/GUI/coregui/Models/SphericalDetectorItem.cpp b/GUI/coregui/Models/SphericalDetectorItem.cpp index bc2651ef110..520cd30c120 100644 --- a/GUI/coregui/Models/SphericalDetectorItem.cpp +++ b/GUI/coregui/Models/SphericalDetectorItem.cpp @@ -28,17 +28,17 @@ const QString SphericalDetectorItem::P_RESOLUTION_FUNCTION = "Type"; SphericalDetectorItem::SphericalDetectorItem() : SessionItem(Constants::SphericalDetectorType) { - registerGroupProperty(P_PHI_AXIS, Constants::BasicAxisType); + addGroupProperty(P_PHI_AXIS, Constants::BasicAxisType); getGroupItem(P_PHI_AXIS)->getItem(BasicAxisItem::P_TITLE)->setVisible(false); - getGroupItem(P_PHI_AXIS)->setRegisteredProperty(BasicAxisItem::P_MIN, -1.0); - getGroupItem(P_PHI_AXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, 1.0); + getGroupItem(P_PHI_AXIS)->setChildValue(BasicAxisItem::P_MIN, -1.0); + getGroupItem(P_PHI_AXIS)->setChildValue(BasicAxisItem::P_MAX, 1.0); - registerGroupProperty(P_ALPHA_AXIS, Constants::BasicAxisType); + addGroupProperty(P_ALPHA_AXIS, Constants::BasicAxisType); getGroupItem(P_ALPHA_AXIS)->getItem(BasicAxisItem::P_TITLE)->setVisible(false); - getGroupItem(P_ALPHA_AXIS)->setRegisteredProperty(BasicAxisItem::P_MIN, 0.0); - getGroupItem(P_ALPHA_AXIS)->setRegisteredProperty(BasicAxisItem::P_MAX, 2.0); + getGroupItem(P_ALPHA_AXIS)->setChildValue(BasicAxisItem::P_MIN, 0.0); + getGroupItem(P_ALPHA_AXIS)->setChildValue(BasicAxisItem::P_MAX, 2.0); - registerGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionGroup); + addGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionGroup); setGroupProperty(P_RESOLUTION_FUNCTION, Constants::ResolutionFunctionNoneType); } @@ -52,20 +52,20 @@ std::unique_ptr<IDetector2D> SphericalDetectorItem::createDetector() const auto x_axis = dynamic_cast<BasicAxisItem *>( getGroupItem(SphericalDetectorItem::P_PHI_AXIS)); Q_ASSERT(x_axis); - int n_x = x_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); + int n_x = x_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); double x_min - = Units::deg2rad(x_axis->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble()); + = Units::deg2rad(x_axis->getChildValue(BasicAxisItem::P_MIN).toDouble()); double x_max - = Units::deg2rad(x_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble()); + = Units::deg2rad(x_axis->getChildValue(BasicAxisItem::P_MAX).toDouble()); auto y_axis = dynamic_cast<BasicAxisItem *>( getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS)); Q_ASSERT(y_axis); - int n_y = y_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); + int n_y = y_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); double y_min - = Units::deg2rad(y_axis->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble()); + = Units::deg2rad(y_axis->getChildValue(BasicAxisItem::P_MIN).toDouble()); double y_max - = Units::deg2rad(y_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble()); + = Units::deg2rad(y_axis->getChildValue(BasicAxisItem::P_MAX).toDouble()); result->setDetectorParameters(n_x, x_min, x_max, n_y, y_min, y_max); diff --git a/GUI/coregui/Models/TestItem.cpp b/GUI/coregui/Models/TestItem.cpp index 898c0a89812..0668e04cad0 100644 --- a/GUI/coregui/Models/TestItem.cpp +++ b/GUI/coregui/Models/TestItem.cpp @@ -26,10 +26,10 @@ const QString TestItem::P_VECTOR = "Vector"; TestItem::TestItem() : SessionItem(QString("TestItem")) { - registerGroupProperty(P_DISTRIBUTION, Constants::DistributionExtendedGroup); - registerProperty(P_VALUE, 99.0); + addGroupProperty(P_DISTRIBUTION, Constants::DistributionExtendedGroup); + addProperty(P_VALUE, 99.0); ComboProperty types; types << "property 1" << "property 2" << "property 3"; - registerProperty(P_COMBO, types.getVariant()); - registerGroupProperty(P_VECTOR, Constants::VectorType); + addProperty(P_COMBO, types.getVariant()); + addGroupProperty(P_VECTOR, Constants::VectorType); } diff --git a/GUI/coregui/Models/TransformFromDomain.cpp b/GUI/coregui/Models/TransformFromDomain.cpp index f4b7005a547..4ca1bb56a68 100644 --- a/GUI/coregui/Models/TransformFromDomain.cpp +++ b/GUI/coregui/Models/TransformFromDomain.cpp @@ -83,13 +83,13 @@ void setDistribution(SessionItem *item, ParameterDistribution par_distr, void TransformFromDomain::setItemFromSample(SessionItem *item, const InterferenceFunctionRadialParaCrystal *sample) { - item->setRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_PEAK_DISTANCE, + item->setChildValue(InterferenceFunctionRadialParaCrystalItem::P_PEAK_DISTANCE, sample->getPeakDistance()); - item->setRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_DAMPING_LENGTH, + item->setChildValue(InterferenceFunctionRadialParaCrystalItem::P_DAMPING_LENGTH, sample->getDampingLength()); - item->setRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_DOMAIN_SIZE, + item->setChildValue(InterferenceFunctionRadialParaCrystalItem::P_DOMAIN_SIZE, sample->getDomainSize()); - item->setRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_KAPPA, + item->setChildValue(InterferenceFunctionRadialParaCrystalItem::P_KAPPA, sample->getKappa()); const IFTDistribution1D *ipdf = sample->getProbabilityDistribution(); @@ -105,13 +105,13 @@ void TransformFromDomain::setItemFromSample(SessionItem *item, Lattice2DParameters lattice_params = sample->getLatticeParameters(); set2DLatticeParameters(item, lattice_params, lattice_item); - item->setRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_DAMPING_LENGTH, + item->setChildValue(InterferenceFunction2DParaCrystalItem::P_DAMPING_LENGTH, sample->getDampingLength()); - item->setRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE1, + item->setChildValue(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE1, sample->getDomainSizes()[0]); - item->setRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE2, + item->setChildValue(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE2, sample->getDomainSizes()[1]); - item->setRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION, + item->setChildValue(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION, sample->getIntegrationOverXi()); std::vector<const IFTDistribution2D *> pdfs = sample->getProbabilityDistributions(); @@ -128,9 +128,9 @@ void TransformFromDomain::setItemFromSample(SessionItem *item, const InterferenceFunction1DLattice *sample) { Lattice1DParameters lattice_params = sample->getLatticeParameters(); - item->setRegisteredProperty(InterferenceFunction1DLatticeItem::P_LENGTH, + item->setChildValue(InterferenceFunction1DLatticeItem::P_LENGTH, lattice_params.m_length); - item->setRegisteredProperty(InterferenceFunction1DLatticeItem::P_ROTATION_ANGLE, + item->setChildValue(InterferenceFunction1DLatticeItem::P_ROTATION_ANGLE, Units::rad2deg(lattice_params.m_xi)); const IFTDecayFunction1D *pdf = sample->getDecayFunction(); @@ -155,7 +155,7 @@ void TransformFromDomain::setItemFromSample(SessionItem *item, void TransformFromDomain::setItemFromSample(SessionItem *layerItem, const Layer *layer, const LayerInterface *top_interface) { - layerItem->setRegisteredProperty(LayerItem::P_THICKNESS, layer->getThickness()); + layerItem->setChildValue(LayerItem::P_THICKNESS, layer->getThickness()); layerItem->setGroupProperty(LayerItem::P_ROUGHNESS, Constants::LayerZeroRoughnessType); if (top_interface) { @@ -170,9 +170,9 @@ void TransformFromDomain::setItemFromSample(SessionItem *layerItem, const Layer void TransformFromDomain::setItemFromSample(SessionItem *item, const LayerRoughness *sample) { - item->setRegisteredProperty(LayerBasicRoughnessItem::P_SIGMA, sample->getSigma()); - item->setRegisteredProperty(LayerBasicRoughnessItem::P_HURST, sample->getHurstParameter()); - item->setRegisteredProperty(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH, + item->setChildValue(LayerBasicRoughnessItem::P_SIGMA, sample->getSigma()); + item->setChildValue(LayerBasicRoughnessItem::P_HURST, sample->getHurstParameter()); + item->setChildValue(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH, sample->getLatteralCorrLength()); } @@ -180,16 +180,16 @@ void TransformFromDomain::setItemFromSample(SessionItem *item, const LayerRoughn void TransformFromDomain::setItemFromSample(SessionItem *item, const ParticleDistribution *sample) { - item->setRegisteredProperty(ParticleItem::P_ABUNDANCE, sample->getAbundance()); + item->setChildValue(ParticleItem::P_ABUNDANCE, sample->getAbundance()); ParameterDistribution par_distr = sample->getParameterDistribution(); QString main_distr_par_name = QString::fromStdString(par_distr.getMainParameterName()); ComboProperty combo_property - = item->getRegisteredProperty(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER) + = item->getChildValue(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER) .value<ComboProperty>(); combo_property.setCachedValue(main_distr_par_name); combo_property.setCacheContainsGUIFlag(false); - item->setRegisteredProperty(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER, + item->setChildValue(ParticleDistributionItem::P_DISTRIBUTED_PARAMETER, combo_property.getVariant()); QString group_name = ParticleDistributionItem::P_DISTRIBUTION; @@ -302,16 +302,16 @@ void TransformFromDomain::setItemFromSample(SphericalDetectorItem *detectorItem, BasicAxisItem *phiAxisItem = dynamic_cast<BasicAxisItem *>( detectorItem->getGroupItem(SphericalDetectorItem::P_PHI_AXIS)); Q_ASSERT(phiAxisItem); - phiAxisItem->setRegisteredProperty(BasicAxisItem::P_NBINS, (int)phi_axis.getSize()); - phiAxisItem->setRegisteredProperty(BasicAxisItem::P_MIN, Units::rad2deg(phi_axis.getMin())); - phiAxisItem->setRegisteredProperty(BasicAxisItem::P_MAX, Units::rad2deg(phi_axis.getMax())); + phiAxisItem->setChildValue(BasicAxisItem::P_NBINS, (int)phi_axis.getSize()); + phiAxisItem->setChildValue(BasicAxisItem::P_MIN, Units::rad2deg(phi_axis.getMin())); + phiAxisItem->setChildValue(BasicAxisItem::P_MAX, Units::rad2deg(phi_axis.getMax())); BasicAxisItem *alphaAxisItem = dynamic_cast<BasicAxisItem *>( detectorItem->getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS)); Q_ASSERT(alphaAxisItem); - alphaAxisItem->setRegisteredProperty(BasicAxisItem::P_NBINS, (int)alpha_axis.getSize()); - alphaAxisItem->setRegisteredProperty(BasicAxisItem::P_MIN, Units::rad2deg(alpha_axis.getMin())); - alphaAxisItem->setRegisteredProperty(BasicAxisItem::P_MAX, Units::rad2deg(alpha_axis.getMax())); + alphaAxisItem->setChildValue(BasicAxisItem::P_NBINS, (int)alpha_axis.getSize()); + alphaAxisItem->setChildValue(BasicAxisItem::P_MIN, Units::rad2deg(alpha_axis.getMin())); + alphaAxisItem->setChildValue(BasicAxisItem::P_MAX, Units::rad2deg(alpha_axis.getMax())); // detector resolution if (const IDetectorResolution *p_resfunc = detector.getDetectorResolutionFunction()) { @@ -323,9 +323,9 @@ void TransformFromDomain::setItemFromSample(SphericalDetectorItem *detectorItem, SessionItem *item = detectorItem->setGroupProperty(SphericalDetectorItem::P_RESOLUTION_FUNCTION, Constants::ResolutionFunction2DGaussianType); - item->setRegisteredProperty(ResolutionFunction2DGaussianItem::P_SIGMA_X, + item->setChildValue(ResolutionFunction2DGaussianItem::P_SIGMA_X, Units::rad2deg(resfunc->getSigmaX())); - item->setRegisteredProperty(ResolutionFunction2DGaussianItem::P_SIGMA_Y, + item->setChildValue(ResolutionFunction2DGaussianItem::P_SIGMA_Y, Units::rad2deg(resfunc->getSigmaY())); } else { throw GUIHelpers::Error("TransformFromDomain::setItemFromSample(" @@ -350,69 +350,69 @@ void TransformFromDomain::setItemFromSample(RectangularDetectorItem *detectorIte BasicAxisItem *xAxisItem = dynamic_cast<BasicAxisItem *>( detectorItem->getGroupItem(RectangularDetectorItem::P_X_AXIS)); Q_ASSERT(xAxisItem); - xAxisItem->setRegisteredProperty(BasicAxisItem::P_NBINS, (int)detector.getNbinsX()); - xAxisItem->setRegisteredProperty(BasicAxisItem::P_MAX, detector.getWidth()); + xAxisItem->setChildValue(BasicAxisItem::P_NBINS, (int)detector.getNbinsX()); + xAxisItem->setChildValue(BasicAxisItem::P_MAX, detector.getWidth()); BasicAxisItem *yAxisItem = dynamic_cast<BasicAxisItem *>( detectorItem->getGroupItem(RectangularDetectorItem::P_Y_AXIS)); Q_ASSERT(yAxisItem); - yAxisItem->setRegisteredProperty(BasicAxisItem::P_NBINS, (int)detector.getNbinsY()); - yAxisItem->setRegisteredProperty(BasicAxisItem::P_MAX, detector.getHeight()); + yAxisItem->setChildValue(BasicAxisItem::P_NBINS, (int)detector.getNbinsY()); + yAxisItem->setChildValue(BasicAxisItem::P_MAX, detector.getHeight()); if(detector.getDetectorArrangment() == RectangularDetector::GENERIC) { detectorItem->setDetectorAlignment(Constants::ALIGNMENT_GENERIC); kvector_t normal = detector.getNormalVector(); - detectorItem->getGroupItem(RectangularDetectorItem::P_NORMAL)->setRegisteredProperty( + detectorItem->getGroupItem(RectangularDetectorItem::P_NORMAL)->setChildValue( VectorItem::P_X, normal.x()); - detectorItem->getGroupItem(RectangularDetectorItem::P_NORMAL)->setRegisteredProperty( + detectorItem->getGroupItem(RectangularDetectorItem::P_NORMAL)->setChildValue( VectorItem::P_Y, normal.y()); - detectorItem->getGroupItem(RectangularDetectorItem::P_NORMAL)->setRegisteredProperty( + detectorItem->getGroupItem(RectangularDetectorItem::P_NORMAL)->setChildValue( VectorItem::P_Z, normal.z()); kvector_t direction = detector.getDirectionVector(); - detectorItem->getGroupItem(RectangularDetectorItem::P_DIRECTION)->setRegisteredProperty( + detectorItem->getGroupItem(RectangularDetectorItem::P_DIRECTION)->setChildValue( VectorItem::P_X, direction.x()); - detectorItem->getGroupItem(RectangularDetectorItem::P_DIRECTION)->setRegisteredProperty( + detectorItem->getGroupItem(RectangularDetectorItem::P_DIRECTION)->setChildValue( VectorItem::P_Y, direction.y()); - detectorItem->getGroupItem(RectangularDetectorItem::P_DIRECTION)->setRegisteredProperty( + detectorItem->getGroupItem(RectangularDetectorItem::P_DIRECTION)->setChildValue( VectorItem::P_Z, direction.z()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_U0, detector.getU0()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_V0, detector.getV0()); + detectorItem->setChildValue(RectangularDetectorItem::P_U0, detector.getU0()); + detectorItem->setChildValue(RectangularDetectorItem::P_V0, detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_SAMPLE) { detectorItem->setDetectorAlignment(Constants::ALIGNMENT_TO_SAMPLE); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DISTANCE, + detectorItem->setChildValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_U0, detector.getU0()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_V0, detector.getV0()); + detectorItem->setChildValue(RectangularDetectorItem::P_U0, detector.getU0()); + detectorItem->setChildValue(RectangularDetectorItem::P_V0, detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM) { detectorItem->setDetectorAlignment(Constants::ALIGNMENT_TO_DIRECT_BEAM); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DISTANCE, + detectorItem->setChildValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DBEAM_U0, detector.getU0()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DBEAM_V0, detector.getV0()); + detectorItem->setChildValue(RectangularDetectorItem::P_DBEAM_U0, detector.getU0()); + detectorItem->setChildValue(RectangularDetectorItem::P_DBEAM_V0, detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM) { detectorItem->setDetectorAlignment(Constants::ALIGNMENT_TO_REFLECTED_BEAM); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DISTANCE, + detectorItem->setChildValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_U0, detector.getU0()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_V0, detector.getV0()); + detectorItem->setChildValue(RectangularDetectorItem::P_U0, detector.getU0()); + detectorItem->setChildValue(RectangularDetectorItem::P_V0, detector.getV0()); } else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM_DPOS) { detectorItem->setDetectorAlignment(Constants::ALIGNMENT_TO_REFLECTED_BEAM_DPOS); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DISTANCE, + detectorItem->setChildValue(RectangularDetectorItem::P_DISTANCE, detector.getDistance()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DBEAM_U0, + detectorItem->setChildValue(RectangularDetectorItem::P_DBEAM_U0, detector.getDirectBeamU0()); - detectorItem->setRegisteredProperty(RectangularDetectorItem::P_DBEAM_V0, + detectorItem->setChildValue(RectangularDetectorItem::P_DBEAM_V0, detector.getDirectBeamV0()); } else { @@ -431,9 +431,9 @@ void TransformFromDomain::setItemFromSample(RectangularDetectorItem *detectorIte SessionItem *item = detectorItem->setGroupProperty(RectangularDetectorItem::P_RESOLUTION_FUNCTION, Constants::ResolutionFunction2DGaussianType); - item->setRegisteredProperty(ResolutionFunction2DGaussianItem::P_SIGMA_X, + item->setChildValue(ResolutionFunction2DGaussianItem::P_SIGMA_X, resfunc->getSigmaX()); - item->setRegisteredProperty(ResolutionFunction2DGaussianItem::P_SIGMA_Y, + item->setChildValue(ResolutionFunction2DGaussianItem::P_SIGMA_Y, resfunc->getSigmaY()); } else { throw GUIHelpers::Error("TransformFromDomain::setItemFromSample(" @@ -465,22 +465,22 @@ void TransformFromDomain::setDetectorMasks(DetectorItem *detectorItem, const GIS const Geometry::IShape2D *shape = detectorMask->getMaskShape(i_mask, mask_value); if(const Geometry::Ellipse *ellipse = dynamic_cast<const Geometry::Ellipse *>(shape)) { EllipseItem *ellipseItem = new EllipseItem(); - ellipseItem->setRegisteredProperty(EllipseItem::P_XCENTER, Units::rad2deg(ellipse->getCenterX())); - ellipseItem->setRegisteredProperty(EllipseItem::P_YCENTER, Units::rad2deg(ellipse->getCenterY())); - ellipseItem->setRegisteredProperty(EllipseItem::P_XRADIUS, Units::rad2deg(ellipse->getRadiusX())); - ellipseItem->setRegisteredProperty(EllipseItem::P_YRADIUS, Units::rad2deg(ellipse->getRadiusY())); - ellipseItem->setRegisteredProperty(EllipseItem::P_ANGLE, Units::rad2deg(ellipse->getTheta())); - ellipseItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, mask_value); + ellipseItem->setChildValue(EllipseItem::P_XCENTER, Units::rad2deg(ellipse->getCenterX())); + ellipseItem->setChildValue(EllipseItem::P_YCENTER, Units::rad2deg(ellipse->getCenterY())); + ellipseItem->setChildValue(EllipseItem::P_XRADIUS, Units::rad2deg(ellipse->getRadiusX())); + ellipseItem->setChildValue(EllipseItem::P_YRADIUS, Units::rad2deg(ellipse->getRadiusY())); + ellipseItem->setChildValue(EllipseItem::P_ANGLE, Units::rad2deg(ellipse->getTheta())); + ellipseItem->setChildValue(MaskItem::P_MASK_VALUE, mask_value); containerItem->insertItem(0, ellipseItem); } else if(const Geometry::Rectangle *rectangle = dynamic_cast<const Geometry::Rectangle *>(shape)) { RectangleItem *rectangleItem = new RectangleItem(); - rectangleItem->setRegisteredProperty(RectangleItem::P_XLOW, Units::rad2deg(rectangle->getXlow())); - rectangleItem->setRegisteredProperty(RectangleItem::P_YLOW, Units::rad2deg(rectangle->getYlow())); - rectangleItem->setRegisteredProperty(RectangleItem::P_XUP, Units::rad2deg(rectangle->getXup())); - rectangleItem->setRegisteredProperty(RectangleItem::P_YUP, Units::rad2deg(rectangle->getYup())); - rectangleItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, mask_value); + rectangleItem->setChildValue(RectangleItem::P_XLOW, Units::rad2deg(rectangle->getXlow())); + rectangleItem->setChildValue(RectangleItem::P_YLOW, Units::rad2deg(rectangle->getYlow())); + rectangleItem->setChildValue(RectangleItem::P_XUP, Units::rad2deg(rectangle->getXup())); + rectangleItem->setChildValue(RectangleItem::P_YUP, Units::rad2deg(rectangle->getYup())); + rectangleItem->setChildValue(MaskItem::P_MASK_VALUE, mask_value); containerItem->insertItem(0, rectangleItem); } @@ -490,32 +490,32 @@ void TransformFromDomain::setDetectorMasks(DetectorItem *detectorItem, const GIS polygon->getPoints(xpos, ypos); for(size_t i_point=0; i_point<xpos.size(); ++i_point) { PolygonPointItem *pointItem = new PolygonPointItem(); - pointItem->setRegisteredProperty(PolygonPointItem::P_POSX, Units::rad2deg(xpos[i_point])); - pointItem->setRegisteredProperty(PolygonPointItem::P_POSY, Units::rad2deg(ypos[i_point])); + pointItem->setChildValue(PolygonPointItem::P_POSX, Units::rad2deg(xpos[i_point])); + pointItem->setChildValue(PolygonPointItem::P_POSY, Units::rad2deg(ypos[i_point])); polygonItem->insertItem(-1, pointItem); } - polygonItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, mask_value); - polygonItem->setRegisteredProperty(PolygonItem::P_ISCLOSED, true); + polygonItem->setChildValue(MaskItem::P_MASK_VALUE, mask_value); + polygonItem->setChildValue(PolygonItem::P_ISCLOSED, true); containerItem->insertItem(0, polygonItem); } else if(const Geometry::VerticalLine *vline = dynamic_cast<const Geometry::VerticalLine *>(shape)) { VerticalLineItem *lineItem = new VerticalLineItem(); - lineItem->setRegisteredProperty(VerticalLineItem::P_POSX, Units::rad2deg(vline->getXpos())); - lineItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, mask_value); + lineItem->setChildValue(VerticalLineItem::P_POSX, Units::rad2deg(vline->getXpos())); + lineItem->setChildValue(MaskItem::P_MASK_VALUE, mask_value); containerItem->insertItem(0, lineItem); } else if(const Geometry::HorizontalLine *hline = dynamic_cast<const Geometry::HorizontalLine *>(shape)) { HorizontalLineItem *lineItem = new HorizontalLineItem(); - lineItem->setRegisteredProperty(HorizontalLineItem::P_POSY, Units::rad2deg(hline->getYpos())); - lineItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, mask_value); + lineItem->setChildValue(HorizontalLineItem::P_POSY, Units::rad2deg(hline->getYpos())); + lineItem->setChildValue(MaskItem::P_MASK_VALUE, mask_value); containerItem->insertItem(0, lineItem); } else if(const Geometry::InfinitePlane *plane = dynamic_cast<const Geometry::InfinitePlane *>(shape)) { Q_UNUSED(plane); MaskAllItem *planeItem = new MaskAllItem(); - planeItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, mask_value); + planeItem->setChildValue(MaskItem::P_MASK_VALUE, mask_value); containerItem->insertItem(-1, planeItem); } else { @@ -565,33 +565,33 @@ void SetPDF1D(SessionItem *item, const IFTDistribution1D *ipdf, QString group_na if (const FTDistribution1DCauchy *pdf = dynamic_cast<const FTDistribution1DCauchy *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution1DCauchyType); - pdfItem->setRegisteredProperty(FTDistribution1DCauchyItem::P_CORR_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDistribution1DCauchyItem::P_CORR_LENGTH, pdf->getOmega()); } else if (const FTDistribution1DGauss *pdf = dynamic_cast<const FTDistribution1DGauss *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution1DGaussType); - pdfItem->setRegisteredProperty(FTDistribution1DGaussItem::P_CORR_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDistribution1DGaussItem::P_CORR_LENGTH, pdf->getOmega()); } else if (const FTDistribution1DGate *pdf = dynamic_cast<const FTDistribution1DGate *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution1DGateType); - pdfItem->setRegisteredProperty(FTDistribution1DGateItem::P_CORR_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDistribution1DGateItem::P_CORR_LENGTH, pdf->getOmega()); } else if (const FTDistribution1DTriangle *pdf = dynamic_cast<const FTDistribution1DTriangle *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution1DTriangleType); - pdfItem->setRegisteredProperty(FTDistribution1DTriangleItem::P_CORR_LENGTH, + pdfItem->setChildValue(FTDistribution1DTriangleItem::P_CORR_LENGTH, pdf->getOmega()); } else if (const FTDistribution1DCosine *pdf = dynamic_cast<const FTDistribution1DCosine *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution1DCosineType); - pdfItem->setRegisteredProperty(FTDistribution1DCosineItem::P_CORR_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDistribution1DCosineItem::P_CORR_LENGTH, pdf->getOmega()); } else if (const FTDistribution1DVoigt *pdf = dynamic_cast<const FTDistribution1DVoigt *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution1DVoigtType); - pdfItem->setRegisteredProperty(FTDistribution1DVoigtItem::P_CORR_LENGTH, pdf->getOmega()); - pdfItem->setRegisteredProperty(FTDistribution1DVoigtItem::P_ETA, pdf->getEta()); + pdfItem->setChildValue(FTDistribution1DVoigtItem::P_CORR_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDistribution1DVoigtItem::P_ETA, pdf->getEta()); } else { throw GUIHelpers::Error("TransformFromDomain::setPDF1D: -> Error"); } @@ -603,53 +603,53 @@ void setPDF2D(SessionItem *item, const IFTDistribution2D *pdf, QString group_nam = dynamic_cast<const FTDistribution2DCauchy *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution2DCauchyType); - pdfItem->setRegisteredProperty(FTDistribution2DCauchyItem::P_CORR_LENGTH_X, + pdfItem->setChildValue(FTDistribution2DCauchyItem::P_CORR_LENGTH_X, pdf_cauchy->getCoherenceLengthX()); - pdfItem->setRegisteredProperty(FTDistribution2DCauchyItem::P_CORR_LENGTH_Y, + pdfItem->setChildValue(FTDistribution2DCauchyItem::P_CORR_LENGTH_Y, pdf_cauchy->getCoherenceLengthY()); - pdfItem->setRegisteredProperty(FTDistribution2DCauchyItem::P_GAMMA, + pdfItem->setChildValue(FTDistribution2DCauchyItem::P_GAMMA, Units::rad2deg(pdf_cauchy->getGamma())); } else if (const FTDistribution2DGauss *pdf_gauss = dynamic_cast<const FTDistribution2DGauss *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution2DGaussType); - pdfItem->setRegisteredProperty(FTDistribution2DGaussItem::P_CORR_LENGTH_X, + pdfItem->setChildValue(FTDistribution2DGaussItem::P_CORR_LENGTH_X, pdf_gauss->getCoherenceLengthX()); - pdfItem->setRegisteredProperty(FTDistribution2DGaussItem::P_CORR_LENGTH_Y, + pdfItem->setChildValue(FTDistribution2DGaussItem::P_CORR_LENGTH_Y, pdf_gauss->getCoherenceLengthY()); - pdfItem->setRegisteredProperty(FTDistribution2DGaussItem::P_GAMMA, + pdfItem->setChildValue(FTDistribution2DGaussItem::P_GAMMA, Units::rad2deg(pdf_gauss->getGamma())); } else if (const FTDistribution2DGate *pdf_gate = dynamic_cast<const FTDistribution2DGate *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution2DGateType); - pdfItem->setRegisteredProperty(FTDistribution2DGateItem::P_CORR_LENGTH_X, + pdfItem->setChildValue(FTDistribution2DGateItem::P_CORR_LENGTH_X, pdf_gate->getCoherenceLengthX()); - pdfItem->setRegisteredProperty(FTDistribution2DGateItem::P_CORR_LENGTH_Y, + pdfItem->setChildValue(FTDistribution2DGateItem::P_CORR_LENGTH_Y, pdf_gate->getCoherenceLengthY()); - pdfItem->setRegisteredProperty(FTDistribution2DGateItem::P_GAMMA, + pdfItem->setChildValue(FTDistribution2DGateItem::P_GAMMA, Units::rad2deg(pdf_gate->getGamma())); } else if (const FTDistribution2DCone *pdf_cone = dynamic_cast<const FTDistribution2DCone *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution2DConeType); - pdfItem->setRegisteredProperty(FTDistribution2DConeItem::P_CORR_LENGTH_X, + pdfItem->setChildValue(FTDistribution2DConeItem::P_CORR_LENGTH_X, pdf_cone->getCoherenceLengthX()); - pdfItem->setRegisteredProperty(FTDistribution2DConeItem::P_CORR_LENGTH_Y, + pdfItem->setChildValue(FTDistribution2DConeItem::P_CORR_LENGTH_Y, pdf_cone->getCoherenceLengthY()); - pdfItem->setRegisteredProperty(FTDistribution2DConeItem::P_GAMMA, + pdfItem->setChildValue(FTDistribution2DConeItem::P_GAMMA, Units::rad2deg(pdf_cone->getGamma())); } else if (const FTDistribution2DVoigt *pdf_voigt = dynamic_cast<const FTDistribution2DVoigt *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDistribution2DVoigtType); - pdfItem->setRegisteredProperty(FTDistribution2DVoigtItem::P_CORR_LENGTH_X, + pdfItem->setChildValue(FTDistribution2DVoigtItem::P_CORR_LENGTH_X, pdf_voigt->getCoherenceLengthX()); - pdfItem->setRegisteredProperty(FTDistribution2DVoigtItem::P_CORR_LENGTH_Y, + pdfItem->setChildValue(FTDistribution2DVoigtItem::P_CORR_LENGTH_Y, pdf_voigt->getCoherenceLengthY()); - pdfItem->setRegisteredProperty(FTDistribution2DVoigtItem::P_GAMMA, + pdfItem->setChildValue(FTDistribution2DVoigtItem::P_GAMMA, Units::rad2deg(pdf_voigt->getGamma())); - pdfItem->setRegisteredProperty(FTDistribution2DVoigtItem::P_ETA, pdf_voigt->getEta()); + pdfItem->setChildValue(FTDistribution2DVoigtItem::P_ETA, pdf_voigt->getEta()); } else { throw GUIHelpers::Error("TransformFromDomain::setPDF2D: -> Error"); } @@ -660,24 +660,24 @@ void SetDecayFunction1D(SessionItem *item, const IFTDecayFunction1D *ipdf, QStri if (const FTDecayFunction1DCauchy *pdf = dynamic_cast<const FTDecayFunction1DCauchy *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction1DCauchyType); - pdfItem->setRegisteredProperty(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); } else if (const FTDecayFunction1DGauss *pdf = dynamic_cast<const FTDecayFunction1DGauss *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction1DGaussType); - pdfItem->setRegisteredProperty(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); } else if (const FTDecayFunction1DTriangle *pdf = dynamic_cast<const FTDecayFunction1DTriangle *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction1DTriangleType); - pdfItem->setRegisteredProperty(FTDecayFunction1DItem::P_DECAY_LENGTH, + pdfItem->setChildValue(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); } else if (const FTDecayFunction1DVoigt *pdf = dynamic_cast<const FTDecayFunction1DVoigt *>(ipdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction1DVoigtType); - pdfItem->setRegisteredProperty(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); - pdfItem->setRegisteredProperty(FTDecayFunction1DVoigtItem::P_ETA, pdf->getEta()); + pdfItem->setChildValue(FTDecayFunction1DItem::P_DECAY_LENGTH, pdf->getOmega()); + pdfItem->setChildValue(FTDecayFunction1DVoigtItem::P_ETA, pdf->getEta()); } else { throw GUIHelpers::Error("TransformFromDomain::SetDecayFunction1D: -> Error"); } @@ -689,33 +689,33 @@ void SetDecayFunction2D(SessionItem *item, const IFTDecayFunction2D *pdf, QStrin = dynamic_cast<const FTDecayFunction2DCauchy *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction2DCauchyType); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_DECAY_LENGTH_X, + pdfItem->setChildValue(FTDecayFunction2DItem::P_DECAY_LENGTH_X, pdf_cauchy->getDecayLengthX()); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_DECAY_LENGTH_Y, + pdfItem->setChildValue(FTDecayFunction2DItem::P_DECAY_LENGTH_Y, pdf_cauchy->getDecayLengthY()); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_GAMMA, + pdfItem->setChildValue(FTDecayFunction2DItem::P_GAMMA, Units::rad2deg(pdf_cauchy->getGamma())); } else if (const FTDecayFunction2DGauss *pdf_gauss = dynamic_cast<const FTDecayFunction2DGauss *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction2DGaussType); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_DECAY_LENGTH_X, + pdfItem->setChildValue(FTDecayFunction2DItem::P_DECAY_LENGTH_X, pdf_gauss->getDecayLengthX()); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_DECAY_LENGTH_Y, + pdfItem->setChildValue(FTDecayFunction2DItem::P_DECAY_LENGTH_Y, pdf_gauss->getDecayLengthY()); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_GAMMA, + pdfItem->setChildValue(FTDecayFunction2DItem::P_GAMMA, Units::rad2deg(pdf_gauss->getGamma())); } else if (const FTDecayFunction2DVoigt *pdf_voigt = dynamic_cast<const FTDecayFunction2DVoigt *>(pdf)) { SessionItem *pdfItem = item->setGroupProperty(group_name, Constants::FTDecayFunction2DVoigtType); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_DECAY_LENGTH_X, + pdfItem->setChildValue(FTDecayFunction2DItem::P_DECAY_LENGTH_X, pdf_voigt->getDecayLengthX()); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_DECAY_LENGTH_Y, + pdfItem->setChildValue(FTDecayFunction2DItem::P_DECAY_LENGTH_Y, pdf_voigt->getDecayLengthY()); - pdfItem->setRegisteredProperty(FTDecayFunction2DItem::P_GAMMA, + pdfItem->setChildValue(FTDecayFunction2DItem::P_GAMMA, Units::rad2deg(pdf_voigt->getGamma())); - pdfItem->setRegisteredProperty(FTDecayFunction2DVoigtItem::P_ETA, pdf_voigt->getEta()); + pdfItem->setChildValue(FTDecayFunction2DVoigtItem::P_ETA, pdf_voigt->getEta()); } else { throw GUIHelpers::Error("TransformFromDomain::SetDecayFunction2D: -> Error"); } @@ -728,25 +728,25 @@ void set2DLatticeParameters(SessionItem *item, Lattice2DParameters lattice_param lattice_params.m_angle)) { lattice_item = item->setGroupProperty(InterferenceFunction2DLatticeItem::P_LATTICE_TYPE, Constants::SquareLatticeType); - lattice_item->setRegisteredProperty(SquareLatticeTypeItem::P_LATTICE_LENGTH, + lattice_item->setChildValue(SquareLatticeTypeItem::P_LATTICE_LENGTH, lattice_params.m_length_1); } else if (TransformFromDomain::isHexagonalLattice( lattice_params.m_length_1, lattice_params.m_length_2, lattice_params.m_angle)) { lattice_item = item->setGroupProperty(InterferenceFunction2DLatticeItem::P_LATTICE_TYPE, Constants::HexagonalLatticeType); - lattice_item->setRegisteredProperty(HexagonalLatticeTypeItem::P_LATTICE_LENGTH, + lattice_item->setChildValue(HexagonalLatticeTypeItem::P_LATTICE_LENGTH, lattice_params.m_length_1); } else { lattice_item = item->setGroupProperty(InterferenceFunction2DLatticeItem::P_LATTICE_TYPE, Constants::BasicLatticeType); - lattice_item->setRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_LENGTH1, + lattice_item->setChildValue(BasicLatticeTypeItem::P_LATTICE_LENGTH1, lattice_params.m_length_1); - lattice_item->setRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_LENGTH2, + lattice_item->setChildValue(BasicLatticeTypeItem::P_LATTICE_LENGTH2, lattice_params.m_length_2); - lattice_item->setRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_ANGLE, + lattice_item->setChildValue(BasicLatticeTypeItem::P_LATTICE_ANGLE, Units::rad2deg(lattice_params.m_angle)); } - item->setRegisteredProperty(InterferenceFunction2DLatticeItem::P_ROTATION_ANGLE, + item->setChildValue(InterferenceFunction2DLatticeItem::P_ROTATION_ANGLE, Units::rad2deg(lattice_params.m_xi)); } @@ -757,36 +757,36 @@ void setDistribution(SessionItem *item, ParameterDistribution par_distr, SessionItem *pdfItem = 0; if (const DistributionGate *distr = dynamic_cast<const DistributionGate *>(p_distribution)) { pdfItem = item->setGroupProperty(group_name, Constants::DistributionGateType); - pdfItem->setRegisteredProperty(DistributionGateItem::P_MIN, factor*distr->getMin()); - pdfItem->setRegisteredProperty(DistributionGateItem::P_MAX, factor*distr->getMax()); + pdfItem->setChildValue(DistributionGateItem::P_MIN, factor*distr->getMin()); + pdfItem->setChildValue(DistributionGateItem::P_MAX, factor*distr->getMax()); } else if (const DistributionLorentz *distr = dynamic_cast<const DistributionLorentz *>(p_distribution)) { pdfItem = item->setGroupProperty(group_name, Constants::DistributionLorentzType); - pdfItem->setRegisteredProperty(DistributionLorentzItem::P_MEAN, factor*distr->getMean()); - pdfItem->setRegisteredProperty(DistributionLorentzItem::P_HWHM, factor*distr->getHWHM()); + pdfItem->setChildValue(DistributionLorentzItem::P_MEAN, factor*distr->getMean()); + pdfItem->setChildValue(DistributionLorentzItem::P_HWHM, factor*distr->getHWHM()); } else if (const DistributionGaussian *distr = dynamic_cast<const DistributionGaussian *>(p_distribution)) { pdfItem = item->setGroupProperty(group_name, Constants::DistributionGaussianType); - pdfItem->setRegisteredProperty(DistributionGaussianItem::P_MEAN, factor*distr->getMean()); - pdfItem->setRegisteredProperty(DistributionGaussianItem::P_STD_DEV, factor*distr->getStdDev()); + pdfItem->setChildValue(DistributionGaussianItem::P_MEAN, factor*distr->getMean()); + pdfItem->setChildValue(DistributionGaussianItem::P_STD_DEV, factor*distr->getStdDev()); } else if (const DistributionLogNormal *distr = dynamic_cast<const DistributionLogNormal *>(p_distribution)) { pdfItem = item->setGroupProperty(group_name, Constants::DistributionLogNormalType); - pdfItem->setRegisteredProperty(DistributionLogNormalItem::P_MEDIAN, factor*distr->getMedian()); - pdfItem->setRegisteredProperty(DistributionLogNormalItem::P_SCALE_PAR, + pdfItem->setChildValue(DistributionLogNormalItem::P_MEDIAN, factor*distr->getMedian()); + pdfItem->setChildValue(DistributionLogNormalItem::P_SCALE_PAR, distr->getScalePar()); } else if (const DistributionCosine *distr = dynamic_cast<const DistributionCosine *>(p_distribution)) { pdfItem = item->setGroupProperty(group_name, Constants::DistributionCosineType); - pdfItem->setRegisteredProperty(DistributionCosineItem::P_MEAN, factor*distr->getMean()); - pdfItem->setRegisteredProperty(DistributionCosineItem::P_SIGMA, factor*distr->getSigma()); + pdfItem->setChildValue(DistributionCosineItem::P_MEAN, factor*distr->getMean()); + pdfItem->setChildValue(DistributionCosineItem::P_SIGMA, factor*distr->getSigma()); } else { throw GUIHelpers::Error("TransformFromDomain::setDistribution: -> unknown distribution"); } if (pdfItem) { - pdfItem->setRegisteredProperty(DistributionItem::P_NUMBER_OF_SAMPLES, + pdfItem->setChildValue(DistributionItem::P_NUMBER_OF_SAMPLES, (int)par_distr.getNbrSamples()); - pdfItem->setRegisteredProperty(DistributionItem::P_SIGMA_FACTOR, + pdfItem->setChildValue(DistributionItem::P_SIGMA_FACTOR, par_distr.getSigmaFactor()); } } diff --git a/GUI/coregui/Models/TransformToDomain.cpp b/GUI/coregui/Models/TransformToDomain.cpp index ef7c47990ff..ca5fbc4764a 100644 --- a/GUI/coregui/Models/TransformToDomain.cpp +++ b/GUI/coregui/Models/TransformToDomain.cpp @@ -60,10 +60,10 @@ std::unique_ptr<IMaterial> TransformToDomain::createDomainMaterial(const Session MaterialProperty material_property; if (item.modelType() == Constants::ParticleType) { material_property - = item.getRegisteredProperty(ParticleItem::P_MATERIAL).value<MaterialProperty>(); + = item.getChildValue(ParticleItem::P_MATERIAL).value<MaterialProperty>(); } else if (item.modelType() == Constants::LayerType) { material_property - = item.getRegisteredProperty(LayerItem::P_MATERIAL).value<MaterialProperty>(); + = item.getChildValue(LayerItem::P_MATERIAL).value<MaterialProperty>(); } if (!material_property.isDefined()) throw GUIHelpers::Error( @@ -76,7 +76,7 @@ std::unique_ptr<MultiLayer> TransformToDomain::createMultiLayer(const SessionIte { auto P_multilayer = GUIHelpers::make_unique<MultiLayer>(); auto cross_corr_length - = item.getRegisteredProperty(MultiLayerItem::P_CROSS_CORR_LENGTH).toDouble(); + = item.getChildValue(MultiLayerItem::P_CROSS_CORR_LENGTH).toDouble(); if (cross_corr_length > 0) P_multilayer->setCrossCorrLength(cross_corr_length); return P_multilayer; @@ -85,7 +85,7 @@ std::unique_ptr<MultiLayer> TransformToDomain::createMultiLayer(const SessionIte std::unique_ptr<Layer> TransformToDomain::createLayer(const SessionItem &item) { auto P_layer = GUIHelpers::make_unique<Layer>(); - auto thickness = item.getRegisteredProperty(LayerItem::P_THICKNESS).toDouble(); + auto thickness = item.getChildValue(LayerItem::P_THICKNESS).toDouble(); P_layer->setThickness(thickness); auto P_material = createDomainMaterial(item); P_layer->setMaterial(*P_material); @@ -99,9 +99,9 @@ TransformToDomain::createLayerRoughness(const SessionItem &roughnessItem) return nullptr; } else if (roughnessItem.modelType() == Constants::LayerBasicRoughnessType) { return GUIHelpers::make_unique<LayerRoughness>( - roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_SIGMA).toDouble(), - roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_HURST).toDouble(), - roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH) + roughnessItem.getChildValue(LayerBasicRoughnessItem::P_SIGMA).toDouble(), + roughnessItem.getChildValue(LayerBasicRoughnessItem::P_HURST).toDouble(), + roughnessItem.getChildValue(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH) .toDouble()); } else { throw GUIHelpers::Error("TransformToDomain::createLayerRoughness() -> Error."); @@ -112,7 +112,7 @@ std::unique_ptr<ParticleLayout> TransformToDomain::createParticleLayout(const SessionItem &item) { auto P_layout = GUIHelpers::make_unique<ParticleLayout>(); - auto prop = item.getRegisteredProperty(ParticleLayoutItem::P_APPROX).value<ComboProperty>(); + auto prop = item.getChildValue(ParticleLayoutItem::P_APPROX).value<ComboProperty>(); QString approximation = prop.getValue(); if (approximation == QString("Decoupling Approximation")) { P_layout->setApproximation(ILayout::DA); @@ -120,7 +120,7 @@ TransformToDomain::createParticleLayout(const SessionItem &item) P_layout->setApproximation(ILayout::SSCA); } auto total_density - = item.getRegisteredProperty(ParticleLayoutItem::P_TOTAL_DENSITY).value<double>(); + = item.getChildValue(ParticleLayoutItem::P_TOTAL_DENSITY).value<double>(); P_layout->setTotalParticleSurfaceDensity(total_density); return P_layout; } @@ -163,15 +163,15 @@ TransformToDomain::createInterferenceFunction(const SessionItem &item) std::unique_ptr<IInterferenceFunction> P_result{}; if (item.modelType() == Constants::InterferenceFunctionRadialParaCrystalType) { double peak_distance - = item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_PEAK_DISTANCE) + = item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_PEAK_DISTANCE) .toDouble(); double damping_length - = item.getRegisteredProperty( + = item.getChildValue( InterferenceFunctionRadialParaCrystalItem::P_DAMPING_LENGTH).toDouble(); double domain_size - = item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_DOMAIN_SIZE) + = item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_DOMAIN_SIZE) .toDouble(); - double kappa = item.getRegisteredProperty( + double kappa = item.getChildValue( InterferenceFunctionRadialParaCrystalItem::P_KAPPA).toDouble(); auto P_iff = GUIHelpers::make_unique<InterferenceFunctionRadialParaCrystal>(peak_distance, damping_length); @@ -190,20 +190,20 @@ TransformToDomain::createInterferenceFunction(const SessionItem &item) Q_ASSERT(latticeItem); double length_1 {0.0}, length_2 {0.0}, alpha_lattice {0.0}; if (latticeItem->modelType() == Constants::BasicLatticeType) { - length_1 = latticeItem->getRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_LENGTH1) + length_1 = latticeItem->getChildValue(BasicLatticeTypeItem::P_LATTICE_LENGTH1) .toDouble(); - length_2 = latticeItem->getRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_LENGTH2) + length_2 = latticeItem->getChildValue(BasicLatticeTypeItem::P_LATTICE_LENGTH2) .toDouble(); alpha_lattice = Units::deg2rad( - latticeItem->getRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_ANGLE) + latticeItem->getChildValue(BasicLatticeTypeItem::P_LATTICE_ANGLE) .toDouble()); } else if (latticeItem->modelType() == Constants::SquareLatticeType) { - length_1 = latticeItem->getRegisteredProperty(SquareLatticeTypeItem::P_LATTICE_LENGTH) + length_1 = latticeItem->getChildValue(SquareLatticeTypeItem::P_LATTICE_LENGTH) .toDouble(); length_2 = length_1; alpha_lattice = Units::PI / 2.0; } else if (latticeItem->modelType() == Constants::HexagonalLatticeType) { - length_1 = latticeItem->getRegisteredProperty( + length_1 = latticeItem->getChildValue( HexagonalLatticeTypeItem::P_LATTICE_LENGTH).toDouble(); length_2 = length_1; alpha_lattice = 2 * Units::PI / 3.0; @@ -214,17 +214,17 @@ TransformToDomain::createInterferenceFunction(const SessionItem &item) auto P_iff = GUIHelpers::make_unique<InterferenceFunction2DParaCrystal>( length_1, length_2, alpha_lattice, Units::deg2rad( - item.getRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_ROTATION_ANGLE) + item.getChildValue(InterferenceFunction2DParaCrystalItem::P_ROTATION_ANGLE) .toDouble()), - item.getRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_DAMPING_LENGTH) + item.getChildValue(InterferenceFunction2DParaCrystalItem::P_DAMPING_LENGTH) .toDouble()); P_iff->setDomainSizes( - item.getRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE1) + item.getChildValue(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE1) .toDouble(), - item.getRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE2) + item.getChildValue(InterferenceFunction2DParaCrystalItem::P_DOMAIN_SIZE2) .toDouble()); P_iff->setIntegrationOverXi( - item.getRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION) + item.getChildValue(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION) .toBool()); auto pdf1Item = item.getGroupItem(InterferenceFunction2DParaCrystalItem::P_PDF1); @@ -243,9 +243,9 @@ TransformToDomain::createInterferenceFunction(const SessionItem &item) P_result = std::move(P_iff); } else if (item.modelType() == Constants::InterferenceFunction1DLatticeType) { double length = - item.getRegisteredProperty(InterferenceFunction1DLatticeItem::P_LENGTH).toDouble(); + item.getChildValue(InterferenceFunction1DLatticeItem::P_LENGTH).toDouble(); double angle = Units::deg2rad( - item.getRegisteredProperty(InterferenceFunction1DLatticeItem::P_ROTATION_ANGLE) + item.getChildValue(InterferenceFunction1DLatticeItem::P_ROTATION_ANGLE) .toDouble()); auto P_iff = GUIHelpers::make_unique<InterferenceFunction1DLattice>(length, angle); auto pdfItem = item.getGroupItem(InterferenceFunction1DLatticeItem::P_DECAY_FUNCTION); @@ -261,20 +261,20 @@ TransformToDomain::createInterferenceFunction(const SessionItem &item) double length_1 {0.0}, length_2 {0.0}, angle {0.0}; if (latticeItem->modelType() == Constants::BasicLatticeType) { - length_1 = latticeItem->getRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_LENGTH1) + length_1 = latticeItem->getChildValue(BasicLatticeTypeItem::P_LATTICE_LENGTH1) .toDouble(); - length_2 = latticeItem->getRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_LENGTH2) + length_2 = latticeItem->getChildValue(BasicLatticeTypeItem::P_LATTICE_LENGTH2) .toDouble(); angle = Units::deg2rad( - latticeItem->getRegisteredProperty(BasicLatticeTypeItem::P_LATTICE_ANGLE) + latticeItem->getChildValue(BasicLatticeTypeItem::P_LATTICE_ANGLE) .toDouble()); } else if (latticeItem->modelType() == Constants::SquareLatticeType) { - length_1 = latticeItem->getRegisteredProperty(SquareLatticeTypeItem::P_LATTICE_LENGTH) + length_1 = latticeItem->getChildValue(SquareLatticeTypeItem::P_LATTICE_LENGTH) .toDouble(); length_2 = length_1; angle = Units::PI / 2.0; } else if (latticeItem->modelType() == Constants::HexagonalLatticeType) { - length_1 = latticeItem->getRegisteredProperty( + length_1 = latticeItem->getChildValue( HexagonalLatticeTypeItem::P_LATTICE_LENGTH).toDouble(); length_2 = length_1; angle = 2 * Units::PI / 3.0; @@ -282,7 +282,7 @@ TransformToDomain::createInterferenceFunction(const SessionItem &item) throw GUIHelpers::Error("TransformToDomain::createInterferenceFunction() -> Error"); } double xi = Units::deg2rad( - item.getRegisteredProperty(InterferenceFunction2DLatticeItem::P_ROTATION_ANGLE) + item.getChildValue(InterferenceFunction2DLatticeItem::P_ROTATION_ANGLE) .toDouble()); auto P_iff = GUIHelpers::make_unique<InterferenceFunction2DLattice>(length_1, length_2, angle, xi); @@ -393,7 +393,7 @@ void TransformToDomain::addMasksToSimulation(const SessionItem &detector_item, for(int i_row = maskContainerItem->childItems().size(); i_row>0; --i_row) { if(auto maskItem = dynamic_cast<MaskItem *>(maskContainerItem->childItems().at(i_row-1))) { std::unique_ptr<Geometry::IShape2D > shape(maskItem->createShape(scale)); - bool mask_value = maskItem->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); + bool mask_value = maskItem->getChildValue(MaskItem::P_MASK_VALUE).toBool(); simulation->addMask(*shape, mask_value); } } @@ -426,9 +426,9 @@ void TransformToDomain::setTransformationInfo(IParticle *result, const SessionIt void TransformToDomain::setPositionInfo(IParticle *result, const SessionItem &item) { SessionItem *pos_item = item.getGroupItem(ParticleItem::P_POSITION); - double pos_x = pos_item->getRegisteredProperty(VectorItem::P_X).toDouble(); - double pos_y = pos_item->getRegisteredProperty(VectorItem::P_Y).toDouble(); - double pos_z = pos_item->getRegisteredProperty(VectorItem::P_Z).toDouble(); + double pos_x = pos_item->getChildValue(VectorItem::P_X).toDouble(); + double pos_y = pos_item->getChildValue(VectorItem::P_Y).toDouble(); + double pos_z = pos_item->getChildValue(VectorItem::P_Z).toDouble(); result->setPosition(pos_x, pos_y, pos_z); } diff --git a/GUI/coregui/Models/TransformationItem.cpp b/GUI/coregui/Models/TransformationItem.cpp index 455e0b408ed..17f0b9109f7 100644 --- a/GUI/coregui/Models/TransformationItem.cpp +++ b/GUI/coregui/Models/TransformationItem.cpp @@ -24,5 +24,5 @@ const QString TransformationItem::P_ROT = "Rotation type"; TransformationItem::TransformationItem() : SessionGraphicsItem(Constants::TransformationType) { - registerGroupProperty(P_ROT, Constants::RotationGroup ); + addGroupProperty(P_ROT, Constants::RotationGroup ); } diff --git a/GUI/coregui/Models/VectorItem.cpp b/GUI/coregui/Models/VectorItem.cpp index 20596fc5a0c..d6629c2964f 100644 --- a/GUI/coregui/Models/VectorItem.cpp +++ b/GUI/coregui/Models/VectorItem.cpp @@ -22,22 +22,22 @@ const QString VectorItem::P_Z = "Z"; VectorItem::VectorItem() : SessionItem(Constants::VectorType) { - registerProperty(P_X, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_Y, 0.0)->setLimits(AttLimits::limitless()); - registerProperty(P_Z, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_X, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_Y, 0.0)->setLimits(AttLimits::limitless()); + addProperty(P_Z, 0.0)->setLimits(AttLimits::limitless()); } QString VectorItem::itemLabel() const { - return QString("(%1, %2, %3)").arg(getRegisteredProperty(P_X).toDouble()) - .arg(getRegisteredProperty(P_Y).toDouble()) - .arg(getRegisteredProperty(P_Z).toDouble()); + return QString("(%1, %2, %3)").arg(getChildValue(P_X).toDouble()) + .arg(getChildValue(P_Y).toDouble()) + .arg(getChildValue(P_Z).toDouble()); } kvector_t VectorItem::getVector() const { - return kvector_t(getRegisteredProperty(P_X).toDouble(), - getRegisteredProperty(P_Y).toDouble(), - getRegisteredProperty(P_Z).toDouble()); + return kvector_t(getChildValue(P_X).toDouble(), + getChildValue(P_Y).toDouble(), + getChildValue(P_Z).toDouble()); } diff --git a/GUI/coregui/Views/FitWidgets/FitParameterWidget.cpp b/GUI/coregui/Views/FitWidgets/FitParameterWidget.cpp index e1ee563cc16..4231d9bd571 100644 --- a/GUI/coregui/Views/FitWidgets/FitParameterWidget.cpp +++ b/GUI/coregui/Views/FitWidgets/FitParameterWidget.cpp @@ -253,7 +253,7 @@ void FitParameterWidget::onParameterSelectionChanged(const QItemSelection &selec QModelIndex newSelection = QModelIndex(); if (index.isValid() && index.parent().isValid()) { SessionItem *val = m_fitModel->itemForIndex(index); - QString link = val->getRegisteredProperty(FitParameterLinkItem::P_LINK).toString(); + QString link = val->getChildValue(FitParameterLinkItem::P_LINK).toString(); QStandardItem *t = m_selectorModel->getItemFromPath(link); newSelection = m_selectorModel->indexFromItem(t); } diff --git a/GUI/coregui/Views/FitWidgets/RunFitWidget.cpp b/GUI/coregui/Views/FitWidgets/RunFitWidget.cpp index a8b65f19715..a8d47433933 100644 --- a/GUI/coregui/Views/FitWidgets/RunFitWidget.cpp +++ b/GUI/coregui/Views/FitWidgets/RunFitWidget.cpp @@ -169,7 +169,7 @@ std::shared_ptr<FitSuite> RunFitWidget::init_test_fitsuite() SessionItem *parameter = m_fitModel->itemForIndex(child); for (int j = 0; j < m_fitModel->rowCount(child); j++) { SessionItem *link = m_fitModel->itemForIndex(m_fitModel->index(j,0,child)); - QString value = link->getRegisteredProperty(FitParameterLinkItem::P_LINK).toString(); + QString value = link->getChildValue(FitParameterLinkItem::P_LINK).toString(); value = value.replace("Position Offset/X", "PositionX"); value = value.replace("Position Offset/Y", "PositionY"); value = value.replace("Position Offset/Z", "PositionZ"); @@ -181,9 +181,9 @@ std::shared_ptr<FitSuite> RunFitWidget::init_test_fitsuite() std::string translated = "*" + value.toStdString(); std::cout << translated; std::cout.flush(); - double min = parameter->getRegisteredProperty(FitParameterItem::P_MIN).toDouble(); - double max = parameter->getRegisteredProperty(FitParameterItem::P_MAX).toDouble(); - double init = parameter->getRegisteredProperty(FitParameterItem::P_INIT).toDouble(); + double min = parameter->getChildValue(FitParameterItem::P_MIN).toDouble(); + double max = parameter->getChildValue(FitParameterItem::P_MAX).toDouble(); + double init = parameter->getChildValue(FitParameterItem::P_INIT).toDouble(); AttLimits limits; if (min==max && min < init) { limits = AttLimits::lowerLimited(min); diff --git a/GUI/coregui/Views/InfoWidgets/DistributionWidget.cpp b/GUI/coregui/Views/InfoWidgets/DistributionWidget.cpp index 7232ffa97d3..779c67e2d31 100644 --- a/GUI/coregui/Views/InfoWidgets/DistributionWidget.cpp +++ b/GUI/coregui/Views/InfoWidgets/DistributionWidget.cpp @@ -132,9 +132,9 @@ void DistributionWidget::plotItem() if (m_item->itemName() != Constants::DistributionNoneType && !exceptionThrown) { int numberOfSamples - = m_item->getRegisteredProperty(DistributionItem::P_NUMBER_OF_SAMPLES).toInt(); + = m_item->getChildValue(DistributionItem::P_NUMBER_OF_SAMPLES).toInt(); double sigmafactor - = m_item->getRegisteredProperty(DistributionItem::P_SIGMA_FACTOR).toDouble(); + = m_item->getChildValue(DistributionItem::P_SIGMA_FACTOR).toDouble(); QVector<double> xBar; QVector<double> x; @@ -173,7 +173,7 @@ void DistributionWidget::plotItem() } else if(!exceptionThrown) { QVector<double> xPos; QVector<double> yPos; - xPos.push_back(m_item->getRegisteredProperty(DistributionNoneItem::P_VALUE).toDouble()); + xPos.push_back(m_item->getChildValue(DistributionNoneItem::P_VALUE).toDouble()); yPos.push_back(1); QCPBars *bars = new QCPBars(m_plot->xAxis, m_plot->yAxis); bars->setWidth(gap_between_bars); diff --git a/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp b/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp index 4edeaa678ba..4bdf1ac6026 100644 --- a/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/DetectorMaskDelegate.cpp @@ -65,8 +65,8 @@ void DetectorMaskDelegate::createIntensityDataItem() m_tempIntensityDataModel->insertNewItem(Constants::IntensityDataType)); Q_ASSERT(m_intensityItem); - m_intensityItem->getItem(IntensityDataItem::P_PROJECTIONS_FLAG)->setEnabled(false); - m_intensityItem->setRegisteredProperty(IntensityDataItem::P_IS_INTERPOLATED, + m_intensityItem->getItem(IntensityDataItem::P_PROJECTIONS_FLAG)->setEnabled(false); + m_intensityItem->setChildValue(IntensityDataItem::P_IS_INTERPOLATED, false); // ComboProperty gradient @@ -79,11 +79,11 @@ void DetectorMaskDelegate::createIntensityDataItem() AmplitudeAxisItem *zAxisItem = dynamic_cast<AmplitudeAxisItem *>( m_intensityItem->getGroupItem(IntensityDataItem::P_ZAXIS)); - zAxisItem->setRegisteredProperty(BasicAxisItem::P_IS_VISIBLE, false); - zAxisItem->setRegisteredProperty(BasicAxisItem::P_MIN, 0.0); - zAxisItem->setRegisteredProperty(BasicAxisItem::P_MAX, 2.0); - zAxisItem->setRegisteredProperty(AmplitudeAxisItem::P_IS_LOGSCALE, false); - zAxisItem->setRegisteredProperty(AmplitudeAxisItem::P_LOCK_MIN_MAX, true); + zAxisItem->setChildValue(BasicAxisItem::P_IS_VISIBLE, false); + zAxisItem->setChildValue(BasicAxisItem::P_MIN, 0.0); + zAxisItem->setChildValue(BasicAxisItem::P_MAX, 2.0); + zAxisItem->setChildValue(AmplitudeAxisItem::P_IS_LOGSCALE, false); + zAxisItem->setChildValue(AmplitudeAxisItem::P_LOCK_MIN_MAX, true); m_intensityItem->setOutputData(createOutputData(m_detectorItem)); } @@ -115,20 +115,20 @@ DetectorMaskDelegate::createOutputData(DetectorItem *detectorItem) auto x_axis = dynamic_cast<BasicAxisItem *>( subDetector->getGroupItem(SphericalDetectorItem::P_PHI_AXIS)); Q_ASSERT(x_axis); - int n_x = x_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); + int n_x = x_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); double x_min - = x_axis->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + = x_axis->getChildValue(BasicAxisItem::P_MIN).toDouble(); double x_max - = x_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + = x_axis->getChildValue(BasicAxisItem::P_MAX).toDouble(); auto y_axis = dynamic_cast<BasicAxisItem *>( subDetector->getGroupItem(SphericalDetectorItem::P_ALPHA_AXIS)); Q_ASSERT(y_axis); - int n_y = y_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); + int n_y = y_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); double y_min - = y_axis->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + = y_axis->getChildValue(BasicAxisItem::P_MIN).toDouble(); double y_max - = y_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + = y_axis->getChildValue(BasicAxisItem::P_MAX).toDouble(); result->addAxis("x", n_x, x_min, x_max); result->addAxis("y", n_y, y_min, y_max); @@ -137,20 +137,20 @@ DetectorMaskDelegate::createOutputData(DetectorItem *detectorItem) auto x_axis = dynamic_cast<BasicAxisItem *>( subDetector->getGroupItem(RectangularDetectorItem::P_X_AXIS)); Q_ASSERT(x_axis); - int n_x = x_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); + int n_x = x_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); double x_min - = x_axis->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + = x_axis->getChildValue(BasicAxisItem::P_MIN).toDouble(); double x_max - = x_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + = x_axis->getChildValue(BasicAxisItem::P_MAX).toDouble(); auto y_axis = dynamic_cast<BasicAxisItem *>( subDetector->getGroupItem(RectangularDetectorItem::P_Y_AXIS)); Q_ASSERT(y_axis); - int n_y = y_axis->getRegisteredProperty(BasicAxisItem::P_NBINS).toInt(); + int n_y = y_axis->getChildValue(BasicAxisItem::P_NBINS).toInt(); double y_min - = y_axis->getRegisteredProperty(BasicAxisItem::P_MIN).toDouble(); + = y_axis->getChildValue(BasicAxisItem::P_MIN).toDouble(); double y_max - = y_axis->getRegisteredProperty(BasicAxisItem::P_MAX).toDouble(); + = y_axis->getChildValue(BasicAxisItem::P_MAX).toDouble(); result->addAxis("x", n_x, x_min, x_max); result->addAxis("y", n_y, y_min, y_max); diff --git a/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorWidget.cpp b/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorWidget.cpp index 053c25a5163..13d7cf29724 100644 --- a/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorWidget.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/RectangularDetectorWidget.cpp @@ -174,7 +174,7 @@ void RectangularDetectorWidget::init_alignment_editors() m_directionEditor->hide(); ComboProperty alignment - = m_detectorItem->getRegisteredProperty(RectangularDetectorItem::P_ALIGNMENT) + = m_detectorItem->getChildValue(RectangularDetectorItem::P_ALIGNMENT) .value<ComboProperty>(); diff --git a/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp b/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp index 4b73e7163c4..1b9ec9afa94 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp @@ -309,7 +309,7 @@ void ColorMapPlot::onPropertyChanged(const QString &property_name) m_customPlot->replot(); } else if (property_name == IntensityDataItem::P_PROJECTIONS_FLAG) { showLinesOverTheMap( - m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + m_item->getChildValue(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); } } @@ -370,7 +370,7 @@ void ColorMapPlot::onSubItemPropertyChanged(const QString &property_group, } else if (property_name == BasicAxisItem::P_IS_VISIBLE) { setColorScaleVisible(m_item->getGroupItem(IntensityDataItem::P_ZAXIS) - ->getRegisteredProperty(BasicAxisItem::P_IS_VISIBLE).toBool()); + ->getChildValue(BasicAxisItem::P_IS_VISIBLE).toBool()); } m_customPlot->replot(); } @@ -510,7 +510,7 @@ void ColorMapPlot::plotItem(IntensityDataItem *intensityItem) } setColorScaleVisible(intensityItem->getGroupItem(IntensityDataItem::P_ZAXIS) - ->getRegisteredProperty(BasicAxisItem::P_IS_VISIBLE).toBool()); + ->getChildValue(BasicAxisItem::P_IS_VISIBLE).toBool()); m_colorMap->setGradient(m_gradient_map[intensityItem->getGradient()]); diff --git a/GUI/coregui/Views/IntensityDataWidgets/IntensityDataPlotWidget.cpp b/GUI/coregui/Views/IntensityDataWidgets/IntensityDataPlotWidget.cpp index a5e98e5c836..794f5ce3872 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/IntensityDataPlotWidget.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/IntensityDataPlotWidget.cpp @@ -115,7 +115,7 @@ void IntensityDataPlotWidget::setItem(IntensityDataItem *item) [this](const QString &name) { if(name == IntensityDataItem::P_PROJECTIONS_FLAG) { - showProjections(m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + showProjections(m_item->getChildValue(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); } }); // connect(m_item, SIGNAL(propertyChanged(QString)), @@ -179,7 +179,7 @@ void IntensityDataPlotWidget::savePlot(const QString &dirname) { Q_ASSERT(m_item); - bool projections_flag = m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool(); + bool projections_flag = m_item->getChildValue(IntensityDataItem::P_PROJECTIONS_FLAG).toBool(); if(projections_flag) m_centralPlot->showLinesOverTheMap(false); @@ -217,13 +217,13 @@ void IntensityDataPlotWidget::showProjections(bool flag) void IntensityDataPlotWidget::onPropertyPanelAction(bool flag) { Q_ASSERT(m_item); - m_item->setRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG, flag); + m_item->setChildValue(IntensityDataItem::P_PROPERTY_PANEL_FLAG, flag); } void IntensityDataPlotWidget::onProjectionsAction(bool flag) { Q_ASSERT(m_item); - m_item->setRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG, flag); + m_item->setChildValue(IntensityDataItem::P_PROJECTIONS_FLAG, flag); } @@ -232,8 +232,8 @@ void IntensityDataPlotWidget::showContextMenu(const QPoint &point) Q_ASSERT(m_item); QMenu menu; - m_propertyPanelAction->setChecked(m_item->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); - m_projectionsAction->setChecked(m_item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + m_propertyPanelAction->setChecked(m_item->getChildValue(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); + m_projectionsAction->setChecked(m_item->getChildValue(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); menu.addAction(m_propertyPanelAction); menu.addAction(m_projectionsAction); @@ -269,7 +269,7 @@ void IntensityDataPlotWidget::setupContextMenuActions() void IntensityDataPlotWidget::updateItem(IntensityDataItem *item) { - showProjections(item->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); + showProjections(item->getChildValue(IntensityDataItem::P_PROJECTIONS_FLAG).toBool()); } //! sets sizes of top and bottom splitters to have correct sizes of vertical histogram (on the left) and color map diff --git a/GUI/coregui/Views/IntensityDataWidgets/IntensityDataWidget.cpp b/GUI/coregui/Views/IntensityDataWidgets/IntensityDataWidget.cpp index ec5b890a0e3..92a6be456f8 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/IntensityDataWidget.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/IntensityDataWidget.cpp @@ -78,8 +78,8 @@ void IntensityDataWidget::setItem(IntensityDataItem *item) void IntensityDataWidget::togglePropertyPanel() { if(m_currentItem) { - bool current_flag = m_currentItem->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool(); - m_currentItem->setRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG, !current_flag); + bool current_flag = m_currentItem->getChildValue(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool(); + m_currentItem->setChildValue(IntensityDataItem::P_PROPERTY_PANEL_FLAG, !current_flag); } } @@ -96,14 +96,14 @@ void IntensityDataWidget::setPropertyPanelVisible(bool visible) void IntensityDataWidget::updateItem(IntensityDataItem *item) { - setPropertyPanelVisible(item->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); + setPropertyPanelVisible(item->getChildValue(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); ModelMapper *mapper = new ModelMapper(this); mapper->setItem(item); mapper->setOnPropertyChange( [this](const QString &name) { if(name == IntensityDataItem::P_PROPERTY_PANEL_FLAG) { - setPropertyPanelVisible(m_currentItem->getRegisteredProperty(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); + setPropertyPanelVisible(m_currentItem->getChildValue(IntensityDataItem::P_PROPERTY_PANEL_FLAG).toBool()); } }); } @@ -111,8 +111,8 @@ void IntensityDataWidget::updateItem(IntensityDataItem *item) void IntensityDataWidget::toggleProjections() { if(m_currentItem) { - bool current_flag = m_currentItem->getRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG).toBool(); - m_currentItem->setRegisteredProperty(IntensityDataItem::P_PROJECTIONS_FLAG, !current_flag); + bool current_flag = m_currentItem->getChildValue(IntensityDataItem::P_PROJECTIONS_FLAG).toBool(); + m_currentItem->setChildValue(IntensityDataItem::P_PROJECTIONS_FLAG, !current_flag); } } diff --git a/GUI/coregui/Views/MaskWidgets/EllipseView.cpp b/GUI/coregui/Views/MaskWidgets/EllipseView.cpp index e84f33e8662..5592325cda4 100644 --- a/GUI/coregui/Views/MaskWidgets/EllipseView.cpp +++ b/GUI/coregui/Views/MaskWidgets/EllipseView.cpp @@ -43,14 +43,14 @@ EllipseView::EllipseView() void EllipseView::onChangedX() { m_block_on_property_change = true; - m_item->setRegisteredProperty(EllipseItem::P_XCENTER, fromSceneX(this->x())); + m_item->setChildValue(EllipseItem::P_XCENTER, fromSceneX(this->x())); m_block_on_property_change = false; } void EllipseView::onChangedY() { m_block_on_property_change = true; - m_item->setRegisteredProperty(EllipseItem::P_YCENTER, fromSceneY(this->y())); + m_item->setChildValue(EllipseItem::P_YCENTER, fromSceneY(this->y())); m_block_on_property_change = false; } @@ -102,7 +102,7 @@ void EllipseView::onSizeHandleElementRequest(bool going_to_resize) void EllipseView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { painter->setRenderHints(QPainter::Antialiasing); - bool mask_value = m_item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); + bool mask_value = m_item->getChildValue(MaskItem::P_MASK_VALUE).toBool(); painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); painter->drawEllipse(m_mask_rect); @@ -138,27 +138,27 @@ void EllipseView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPointF centerInScene = mapToScene(center); if(m_activeHandleElement->getHandleType() == SizeHandleElement::RESIZE) { - m_item->setRegisteredProperty(EllipseItem::P_XCENTER, fromSceneX(centerInScene.x())); - m_item->setRegisteredProperty(EllipseItem::P_YCENTER, fromSceneY(centerInScene.y())); + m_item->setChildValue(EllipseItem::P_XCENTER, fromSceneX(centerInScene.x())); + m_item->setChildValue(EllipseItem::P_YCENTER, fromSceneY(centerInScene.y())); - m_item->setRegisteredProperty(EllipseItem::P_XRADIUS, + m_item->setChildValue(EllipseItem::P_XRADIUS, (fromSceneX(centerInScene.x()+width/2.) - fromSceneX(centerInScene.x()-width/2.))/2.); - m_item->setRegisteredProperty(EllipseItem::P_YRADIUS, + m_item->setChildValue(EllipseItem::P_YRADIUS, (fromSceneY(centerInScene.y()-height/2.) - fromSceneY(centerInScene.y()+height/2.))/2.); } else if(m_activeHandleElement->getHandleType() == SizeHandleElement::RESIZE_HEIGHT) { - m_item->setRegisteredProperty(EllipseItem::P_YCENTER, fromSceneY(centerInScene.y())); - m_item->setRegisteredProperty(EllipseItem::P_YRADIUS, + m_item->setChildValue(EllipseItem::P_YCENTER, fromSceneY(centerInScene.y())); + m_item->setChildValue(EllipseItem::P_YRADIUS, (fromSceneY(centerInScene.y()-height/2.) - fromSceneY(centerInScene.y()+height/2.))/2.); } else if(m_activeHandleElement->getHandleType() == SizeHandleElement::RESIZE_WIDTH) { - m_item->setRegisteredProperty(EllipseItem::P_XCENTER, fromSceneX(centerInScene.x())); - m_item->setRegisteredProperty(EllipseItem::P_XRADIUS, + m_item->setChildValue(EllipseItem::P_XCENTER, fromSceneX(centerInScene.x())); + m_item->setChildValue(EllipseItem::P_XRADIUS, (fromSceneX(centerInScene.x()+width/2.) - fromSceneX(centerInScene.x()-width/2.))/2.); } diff --git a/GUI/coregui/Views/MaskWidgets/IMaskView.cpp b/GUI/coregui/Views/MaskWidgets/IMaskView.cpp index e7effa5f6ed..75d3f2292f9 100644 --- a/GUI/coregui/Views/MaskWidgets/IMaskView.cpp +++ b/GUI/coregui/Views/MaskWidgets/IMaskView.cpp @@ -106,12 +106,12 @@ void IMaskView::setSceneAdaptor(const ISceneAdaptor *adaptor) double IMaskView::par(const QString &property_name) const { - return m_item->getRegisteredProperty(property_name).toReal(); + return m_item->getChildValue(property_name).toReal(); } qreal IMaskView::toSceneX(const QString &property_name) const { - return toSceneX(m_item->getRegisteredProperty(property_name).toReal()); + return toSceneX(m_item->getChildValue(property_name).toReal()); } qreal IMaskView::toSceneX(qreal value) const @@ -123,7 +123,7 @@ qreal IMaskView::toSceneX(qreal value) const qreal IMaskView::toSceneY(const QString &property_name) const { - return toSceneY(m_item->getRegisteredProperty(property_name).toReal()); + return toSceneY(m_item->getChildValue(property_name).toReal()); } qreal IMaskView::toSceneY(qreal value) const diff --git a/GUI/coregui/Views/MaskWidgets/LineViews.cpp b/GUI/coregui/Views/MaskWidgets/LineViews.cpp index 8ca39d128eb..4ac22146c50 100644 --- a/GUI/coregui/Views/MaskWidgets/LineViews.cpp +++ b/GUI/coregui/Views/MaskWidgets/LineViews.cpp @@ -39,7 +39,7 @@ VerticalLineView::VerticalLineView() void VerticalLineView::onChangedX() { m_block_on_property_change = true; - m_item->setRegisteredProperty(VerticalLineItem::P_POSX, fromSceneX(this->x())); + m_item->setChildValue(VerticalLineItem::P_POSX, fromSceneX(this->x())); m_block_on_property_change = false; } @@ -64,7 +64,7 @@ void VerticalLineView::update_view() void VerticalLineView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { - bool mask_value = m_item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); + bool mask_value = m_item->getChildValue(MaskItem::P_MASK_VALUE).toBool(); painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); painter->drawRect(QRectF(-mask_visible_width/2., 0.0, mask_visible_width, @@ -105,7 +105,7 @@ HorizontalLineView::HorizontalLineView() void HorizontalLineView::onChangedY() { m_block_on_property_change = true; - m_item->setRegisteredProperty(HorizontalLineItem::P_POSY, fromSceneY(this->y())); + m_item->setChildValue(HorizontalLineItem::P_POSY, fromSceneY(this->y())); m_block_on_property_change = false; } @@ -130,7 +130,7 @@ void HorizontalLineView::update_view() void HorizontalLineView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { - bool mask_value = m_item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); + bool mask_value = m_item->getChildValue(MaskItem::P_MASK_VALUE).toBool(); painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); painter->drawRect(QRectF( 0.0, -mask_visible_width/2., m_bounding_rect.width(), diff --git a/GUI/coregui/Views/MaskWidgets/MaskEditorActions.cpp b/GUI/coregui/Views/MaskWidgets/MaskEditorActions.cpp index 4781e444b74..b51872aefed 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskEditorActions.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskEditorActions.cpp @@ -87,8 +87,8 @@ void MaskEditorActions::onToggleMaskValueAction() Q_ASSERT(m_selectionModel); foreach(QModelIndex itemIndex, m_selectionModel->selectedIndexes()) { if(SessionItem *item = m_maskModel->itemForIndex(itemIndex)) { - bool old_value = item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); - item->setRegisteredProperty(MaskItem::P_MASK_VALUE, !old_value); + bool old_value = item->getChildValue(MaskItem::P_MASK_VALUE).toBool(); + item->setChildValue(MaskItem::P_MASK_VALUE, !old_value); } } } diff --git a/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp b/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp index b3e0b2a285c..b52f7602a06 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskGraphicsScene.cpp @@ -583,7 +583,7 @@ void MaskGraphicsScene::processRectangleItem(QGraphicsSceneMouseEvent *event) if(!m_currentItem && line.length() > min_distance_to_create_rect) { m_currentItem = m_maskModel->insertNewItem(Constants::RectangleMaskType, m_maskContainerIndex, 0); - m_currentItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, + m_currentItem->setChildValue(MaskItem::P_MASK_VALUE, m_context.getMaskValue()); setItemName(m_currentItem); } @@ -601,10 +601,10 @@ void MaskGraphicsScene::processRectangleItem(QGraphicsSceneMouseEvent *event) // m_currentItem->setRegisteredProperty( // RectangleItem::P_HEIGHT, m_adaptor->fromSceneY(ymin) - m_adaptor->fromSceneY(ymax)); - m_currentItem->setRegisteredProperty(RectangleItem::P_XLOW, m_adaptor->fromSceneX(xmin)); - m_currentItem->setRegisteredProperty(RectangleItem::P_YLOW, m_adaptor->fromSceneY(ymax)); - m_currentItem->setRegisteredProperty(RectangleItem::P_XUP, m_adaptor->fromSceneX(xmax)); - m_currentItem->setRegisteredProperty(RectangleItem::P_YUP, m_adaptor->fromSceneY(ymin)); + m_currentItem->setChildValue(RectangleItem::P_XLOW, m_adaptor->fromSceneX(xmin)); + m_currentItem->setChildValue(RectangleItem::P_YLOW, m_adaptor->fromSceneY(ymax)); + m_currentItem->setChildValue(RectangleItem::P_XUP, m_adaptor->fromSceneX(xmax)); + m_currentItem->setChildValue(RectangleItem::P_YUP, m_adaptor->fromSceneY(ymin)); } } @@ -620,7 +620,7 @@ void MaskGraphicsScene::processEllipseItem(QGraphicsSceneMouseEvent *event) if(!m_currentItem && line.length() > min_distance_to_create_rect) { m_currentItem = m_maskModel->insertNewItem(Constants::EllipseMaskType, m_maskContainerIndex, 0); - m_currentItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, + m_currentItem->setChildValue(MaskItem::P_MASK_VALUE, m_context.getMaskValue()); setItemName(m_currentItem); } @@ -631,13 +631,13 @@ void MaskGraphicsScene::processEllipseItem(QGraphicsSceneMouseEvent *event) qreal ymin = std::min(click_pos.y(), mouse_pos.y()); qreal ymax = std::max(click_pos.y(), mouse_pos.y()); - m_currentItem->setRegisteredProperty(EllipseItem::P_XCENTER, + m_currentItem->setChildValue(EllipseItem::P_XCENTER, m_adaptor->fromSceneX(xmin + (xmax-xmin)/2.)); - m_currentItem->setRegisteredProperty(EllipseItem::P_YCENTER, + m_currentItem->setChildValue(EllipseItem::P_YCENTER, m_adaptor->fromSceneY(ymin + (ymax-ymin)/2.)); - m_currentItem->setRegisteredProperty( + m_currentItem->setChildValue( EllipseItem::P_XRADIUS, (m_adaptor->fromSceneX(xmax) - m_adaptor->fromSceneX(xmin))/2.); - m_currentItem->setRegisteredProperty( + m_currentItem->setChildValue( EllipseItem::P_YRADIUS, (m_adaptor->fromSceneY(ymin) - m_adaptor->fromSceneY(ymax))/2.); } @@ -651,7 +651,7 @@ void MaskGraphicsScene::processPolygonItem(QGraphicsSceneMouseEvent *event) setDrawingInProgress(true); m_currentItem = m_maskModel->insertNewItem(Constants::PolygonMaskType, m_maskContainerIndex, 0); - m_currentItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, m_context.getMaskValue()); + m_currentItem->setChildValue(MaskItem::P_MASK_VALUE, m_context.getMaskValue()); m_selectionModel->clearSelection(); m_selectionModel->select(m_maskModel->indexOfItem(m_currentItem), QItemSelectionModel::Select); setItemName(m_currentItem); @@ -670,8 +670,8 @@ void MaskGraphicsScene::processPolygonItem(QGraphicsSceneMouseEvent *event) m_maskModel->indexOfItem(m_currentItem)); QPointF click_pos = event->buttonDownScenePos(Qt::LeftButton); - point->setRegisteredProperty(PolygonPointItem::P_POSX, m_adaptor->fromSceneX(click_pos.x())); - point->setRegisteredProperty(PolygonPointItem::P_POSY, m_adaptor->fromSceneY(click_pos.y())); + point->setChildValue(PolygonPointItem::P_POSX, m_adaptor->fromSceneX(click_pos.x())); + point->setChildValue(PolygonPointItem::P_POSY, m_adaptor->fromSceneY(click_pos.y())); } void MaskGraphicsScene::processLineItem(QGraphicsSceneMouseEvent *event) @@ -688,7 +688,7 @@ void MaskGraphicsScene::processLineItem(QGraphicsSceneMouseEvent *event) m_selectionModel->clearSelection(); m_selectionModel->select(m_maskModel->indexOfItem(m_currentItem), QItemSelectionModel::Select); setItemName(m_currentItem); - m_currentItem->setRegisteredProperty(MaskItem::P_MASK_VALUE, + m_currentItem->setChildValue(MaskItem::P_MASK_VALUE, m_context.getMaskValue()); setDrawingInProgress(false); @@ -698,7 +698,7 @@ void MaskGraphicsScene::processVerticalLineItem(const QPointF &pos) { m_currentItem = m_maskModel->insertNewItem(Constants::VerticalLineMaskType, m_maskContainerIndex, 0); - m_currentItem->setRegisteredProperty(VerticalLineItem::P_POSX, + m_currentItem->setChildValue(VerticalLineItem::P_POSX, m_adaptor->fromSceneX(pos.x())); } @@ -706,7 +706,7 @@ void MaskGraphicsScene::processHorizontalLineItem(const QPointF &pos) { m_currentItem = m_maskModel->insertNewItem(Constants::HorizontalLineMaskType, m_maskContainerIndex, 0); - m_currentItem->setRegisteredProperty(HorizontalLineItem::P_POSY, + m_currentItem->setChildValue(HorizontalLineItem::P_POSY, m_adaptor->fromSceneY(pos.y())); } diff --git a/GUI/coregui/Views/MaskWidgets/MaskResultsPresenter.cpp b/GUI/coregui/Views/MaskWidgets/MaskResultsPresenter.cpp index 4961b9009da..f18d4b79784 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskResultsPresenter.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskResultsPresenter.cpp @@ -61,7 +61,7 @@ void MaskResultsPresenter::setShowMaskMode() if (OutputData<double> *maskedData = createMaskPresentation()) { backup_data(); m_intensityDataItem->setOutputData(maskedData); - m_intensityDataItem->setRegisteredProperty(IntensityDataItem::P_IS_INTERPOLATED, false); + m_intensityDataItem->setChildValue(IntensityDataItem::P_IS_INTERPOLATED, false); } else { m_dataBackup.reset(); } @@ -72,7 +72,7 @@ void MaskResultsPresenter::setOriginalMode() { if (m_dataBackup) { m_intensityDataItem->setOutputData(m_dataBackup->clone()); - m_intensityDataItem->setRegisteredProperty(IntensityDataItem::P_IS_INTERPOLATED, + m_intensityDataItem->setChildValue(IntensityDataItem::P_IS_INTERPOLATED, m_interpolation_flag_backup); } } @@ -80,7 +80,7 @@ void MaskResultsPresenter::setOriginalMode() void MaskResultsPresenter::backup_data() { m_interpolation_flag_backup - = m_intensityDataItem->getRegisteredProperty(IntensityDataItem::P_IS_INTERPOLATED).toBool(); + = m_intensityDataItem->getChildValue(IntensityDataItem::P_IS_INTERPOLATED).toBool(); m_dataBackup.reset(m_intensityDataItem->getOutputData()->clone()); } @@ -102,7 +102,7 @@ OutputData<double> *MaskResultsPresenter::createMaskPresentation() const std::unique_ptr<Geometry::IShape2D> shape = item->createShape(); if (shape) { detectorMask.addMask(*shape.get(), - item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool()); + item->getChildValue(MaskItem::P_MASK_VALUE).toBool()); } } } diff --git a/GUI/coregui/Views/MaskWidgets/PolygonPointView.cpp b/GUI/coregui/Views/MaskWidgets/PolygonPointView.cpp index f052de51026..60751b5881a 100644 --- a/GUI/coregui/Views/MaskWidgets/PolygonPointView.cpp +++ b/GUI/coregui/Views/MaskWidgets/PolygonPointView.cpp @@ -36,8 +36,8 @@ QRectF PolygonPointView::boundingRect() const void PolygonPointView::updateParameterizedItem(const QPointF &pos) { - m_item->setRegisteredProperty(PolygonPointItem::P_POSX, fromSceneX(pos.x())); - m_item->setRegisteredProperty(PolygonPointItem::P_POSY, fromSceneY(pos.y())); + m_item->setChildValue(PolygonPointItem::P_POSX, fromSceneX(pos.x())); + m_item->setChildValue(PolygonPointItem::P_POSY, fromSceneY(pos.y())); } void PolygonPointView::update_view() diff --git a/GUI/coregui/Views/MaskWidgets/PolygonView.cpp b/GUI/coregui/Views/MaskWidgets/PolygonView.cpp index 99344811152..2153e5c6b27 100644 --- a/GUI/coregui/Views/MaskWidgets/PolygonView.cpp +++ b/GUI/coregui/Views/MaskWidgets/PolygonView.cpp @@ -83,7 +83,7 @@ bool PolygonView::closePolygonIfNecessary() childItem->setAcceptHoverEvents(false); childItem->setCursor(Qt::SizeAllCursor); } - m_item->setRegisteredProperty(PolygonItem::P_ISCLOSED, true); + m_item->setChildValue(PolygonItem::P_ISCLOSED, true); update(); } return isClosedPolygon(); @@ -96,7 +96,7 @@ void PolygonView::onClosePolygonRequest(bool value) bool PolygonView::isClosedPolygon() { - return m_item->getRegisteredProperty(PolygonItem::P_ISCLOSED).toBool(); + return m_item->getChildValue(PolygonItem::P_ISCLOSED).toBool(); } void PolygonView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) @@ -104,7 +104,7 @@ void PolygonView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWi Q_ASSERT(m_item); painter->setRenderHints(QPainter::Antialiasing); - bool mask_value = m_item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); + bool mask_value = m_item->getChildValue(MaskItem::P_MASK_VALUE).toBool(); painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); @@ -158,8 +158,8 @@ void PolygonView::update_polygon() m_polygon.clear(); foreach (SessionItem *item, m_item->getChildrenOfType(Constants::PolygonPointType)) { - qreal px = toSceneX(item->getRegisteredProperty(PolygonPointItem::P_POSX).toReal()); - qreal py = toSceneY(item->getRegisteredProperty(PolygonPointItem::P_POSY).toReal()); + qreal px = toSceneX(item->getChildValue(PolygonPointItem::P_POSX).toReal()); + qreal py = toSceneY(item->getChildValue(PolygonPointItem::P_POSY).toReal()); m_polygon << QPointF(px, py); } diff --git a/GUI/coregui/Views/MaskWidgets/RectangleView.cpp b/GUI/coregui/Views/MaskWidgets/RectangleView.cpp index 9667c98d7e3..293551b39fe 100644 --- a/GUI/coregui/Views/MaskWidgets/RectangleView.cpp +++ b/GUI/coregui/Views/MaskWidgets/RectangleView.cpp @@ -44,8 +44,8 @@ void RectangleView::onChangedX() { m_block_on_property_change = true; // m_item->setRegisteredProperty(RectangleItem::P_POSX, fromSceneX(this->x())); - m_item->setRegisteredProperty(RectangleItem::P_XLOW, fromSceneX(this->x())); - m_item->setRegisteredProperty(RectangleItem::P_XUP, fromSceneX(this->x() + m_mask_rect.width())); + m_item->setChildValue(RectangleItem::P_XLOW, fromSceneX(this->x())); + m_item->setChildValue(RectangleItem::P_XUP, fromSceneX(this->x() + m_mask_rect.width())); m_block_on_property_change = false; } @@ -53,8 +53,8 @@ void RectangleView::onChangedY() { m_block_on_property_change = true; // m_item->setRegisteredProperty(RectangleItem::P_POSY, fromSceneY(this->y())); - m_item->setRegisteredProperty(RectangleItem::P_YLOW, fromSceneY(this->y() + m_mask_rect.height())); - m_item->setRegisteredProperty(RectangleItem::P_YUP, fromSceneY(this->y())); + m_item->setChildValue(RectangleItem::P_YLOW, fromSceneY(this->y() + m_mask_rect.height())); + m_item->setChildValue(RectangleItem::P_YUP, fromSceneY(this->y())); m_block_on_property_change = false; } @@ -103,7 +103,7 @@ void RectangleView::onSizeHandleElementRequest(bool going_to_resize) void RectangleView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { // painter->setRenderHints(QPainter::Antialiasing); - bool mask_value = m_item->getRegisteredProperty(MaskItem::P_MASK_VALUE).toBool(); + bool mask_value = m_item->getChildValue(MaskItem::P_MASK_VALUE).toBool(); painter->setBrush(MaskEditorHelper::getMaskBrush(mask_value)); painter->setPen(MaskEditorHelper::getMaskPen(mask_value)); painter->drawRect(m_mask_rect); @@ -139,10 +139,10 @@ void RectangleView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) // fromSceneX(xmax) - fromSceneX(xmin)); // m_item->setRegisteredProperty(RectangleItem::P_HEIGHT, // fromSceneY(ymin) - fromSceneY(ymax)); - m_item->setRegisteredProperty(RectangleItem::P_XLOW, fromSceneX(xmin)); - m_item->setRegisteredProperty(RectangleItem::P_YLOW, fromSceneY(ymax)); - m_item->setRegisteredProperty(RectangleItem::P_XUP, fromSceneX(xmax)); - m_item->setRegisteredProperty(RectangleItem::P_YUP, fromSceneY(ymin)); + m_item->setChildValue(RectangleItem::P_XLOW, fromSceneX(xmin)); + m_item->setChildValue(RectangleItem::P_YLOW, fromSceneY(ymax)); + m_item->setChildValue(RectangleItem::P_XUP, fromSceneX(xmax)); + m_item->setChildValue(RectangleItem::P_YUP, fromSceneY(ymin)); @@ -151,8 +151,8 @@ void RectangleView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) // m_item->setRegisteredProperty(RectangleItem::P_HEIGHT, // fromSceneY(ymin) - fromSceneY(ymax)); - m_item->setRegisteredProperty(RectangleItem::P_YLOW, fromSceneY(ymax)); - m_item->setRegisteredProperty(RectangleItem::P_YUP, fromSceneY(ymin)); + m_item->setChildValue(RectangleItem::P_YLOW, fromSceneY(ymax)); + m_item->setChildValue(RectangleItem::P_YUP, fromSceneY(ymin)); } else if(m_activeHandleElement->getHandleType() == SizeHandleElement::RESIZE_WIDTH) { @@ -160,8 +160,8 @@ void RectangleView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) // m_item->setRegisteredProperty(RectangleItem::P_WIDTH, // fromSceneX(xmax) - fromSceneX(xmin)); - m_item->setRegisteredProperty(RectangleItem::P_XLOW, fromSceneX(xmin)); - m_item->setRegisteredProperty(RectangleItem::P_XUP, fromSceneX(xmax)); + m_item->setChildValue(RectangleItem::P_XLOW, fromSceneX(xmin)); + m_item->setChildValue(RectangleItem::P_XUP, fromSceneX(xmax)); } update_view(); diff --git a/GUI/coregui/Views/MaterialEditor/MaterialEditorToolBar.cpp b/GUI/coregui/Views/MaterialEditor/MaterialEditorToolBar.cpp index ec5fca2f679..c33c6caedd8 100644 --- a/GUI/coregui/Views/MaterialEditor/MaterialEditorToolBar.cpp +++ b/GUI/coregui/Views/MaterialEditor/MaterialEditorToolBar.cpp @@ -94,7 +94,7 @@ void MaterialEditorToolBar::onCloneMaterialAction() QModelIndex selectedIndex = selected.front(); const MaterialItem *origMaterial =m_materialModel->getMaterial(selectedIndex); SessionItem *clonedMaterial = m_materialModel->copyParameterizedItem(origMaterial, 0); - clonedMaterial->setRegisteredProperty(MaterialItem::P_IDENTIFIER, QUuid::createUuid().toString()); + clonedMaterial->setChildValue(MaterialItem::P_IDENTIFIER, QUuid::createUuid().toString()); clonedMaterial->setItemName(origMaterial->itemName()+" (clone)"); } diff --git a/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp b/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp index cb10a6ab896..02f07a3f71e 100644 --- a/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp +++ b/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp @@ -178,7 +178,7 @@ void UniversalPropertyEditor::onPropertyChanged(const QString &property_name) QtVariantProperty *variant_property = m_item_to_propertyname_to_qtvariantproperty[m_item][property_name]; if(variant_property) { - QVariant property_value = m_item->getRegisteredProperty(property_name); + QVariant property_value = m_item->getChildValue(property_name); disconnect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); @@ -212,7 +212,7 @@ void UniversalPropertyEditor::onSubItemPropertyChanged(const QString &property_g if(subItem){ QtVariantProperty *variant_property = m_item_to_propertyname_to_qtvariantproperty[subItem][property_name]; if(variant_property) { - QVariant property_value = subItem->getRegisteredProperty(property_name); + QVariant property_value = subItem->getChildValue(property_name); disconnect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); @@ -343,7 +343,8 @@ void UniversalPropertyEditor::addSubProperties(QtProperty *item_property, subProperty->setEnabled(false); } - if (item->isGroupProperty(prop_name)) { + SessionTagInfo tagInfo = item->getTagInfo(prop_name); + if (tagInfo.modelTypes.contains(Constants::GroupItemType)) { SessionItem *subitem = item->getGroupItem(prop_name); if (subitem) { addSubProperties(subProperty, subitem); diff --git a/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp b/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp index 3732dbaabb2..31ea30a7f7e 100644 --- a/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp +++ b/GUI/coregui/Views/SampleDesigner/DesignerScene.cpp @@ -30,9 +30,9 @@ #include "SampleBuilderFactory.h" #include "GUIExamplesFactory.h" #include "ParticleItem.h" -#include "ParticleLayoutItem.h" -#include "ParticleCoreShellItem.h" -#include "ParticleCompositionItem.h" +#include "ParticleLayoutItem.h" +#include "ParticleCoreShellItem.h" +#include "ParticleCompositionItem.h" #include <QItemSelection> #include <QDebug> @@ -366,27 +366,27 @@ void DesignerScene::onEstablishedConnection(NodeEditorConnection *connection) // childView->getParameterizedItem()->setPort(input_port_index); qDebug() << parentView->getInputPortIndex(connection->getInputPort()); - QString tag; - if (connection->getParentView()->getParameterizedItem()->modelType() == Constants::ParticleLayoutType) { - if (connection->getInputPort()->getPortType() == NodeEditorPort::INTERFERENCE) - tag = ParticleLayoutItem::T_INTERFERENCE; - } - else if (connection->getParentView()->getParameterizedItem()->modelType() == Constants::ParticleCoreShellType) { - if (parentView->getInputPortIndex(connection->getInputPort()) == 0) - tag = ParticleCoreShellItem::T_CORE; - else if (parentView->getInputPortIndex(connection->getInputPort()) == 1) - tag = ParticleCoreShellItem::T_SHELL; - else if (connection->getInputPort()->getPortType() == NodeEditorPort::TRANSFORMATION) - tag = ParticleCoreShellItem::T_TRANSFORMATION; - - } else if (connection->getParentView()->getParameterizedItem()->modelType() == Constants::ParticleCompositionType) { - if (connection->getInputPort()->getPortType() == NodeEditorPort::TRANSFORMATION) - tag = ParticleCompositionItem::T_TRANSFORMATION; - } + QString tag; + if (connection->getParentView()->getParameterizedItem()->modelType() == Constants::ParticleLayoutType) { + if (connection->getInputPort()->getPortType() == NodeEditorPort::INTERFERENCE) + tag = ParticleLayoutItem::T_INTERFERENCE; + } + else if (connection->getParentView()->getParameterizedItem()->modelType() == Constants::ParticleCoreShellType) { + if (parentView->getInputPortIndex(connection->getInputPort()) == 0) + tag = ParticleCoreShellItem::T_CORE; + else if (parentView->getInputPortIndex(connection->getInputPort()) == 1) + tag = ParticleCoreShellItem::T_SHELL; + else if (connection->getInputPort()->getPortType() == NodeEditorPort::TRANSFORMATION) + tag = ParticleCoreShellItem::T_TRANSFORMATION; + + } else if (connection->getParentView()->getParameterizedItem()->modelType() == Constants::ParticleCompositionType) { + if (connection->getInputPort()->getPortType() == NodeEditorPort::TRANSFORMATION) + tag = ParticleCompositionItem::T_TRANSFORMATION; + } delete connection; // deleting just created connection because it will be recreated from the // model m_sampleModel->moveParameterizedItem(childView->getParameterizedItem(), - parentView->getParameterizedItem(), -1, tag); + parentView->getParameterizedItem(), -1, tag); } //! propagates break of connection between views on scene to the model @@ -446,9 +446,9 @@ void DesignerScene::dropEvent(QGraphicsSceneDragDropEvent *event) // propagating drop coordinates to SessionItem QRectF boundingRect = DesignerHelper::getDefaultBoundingRect(new_item->modelType()); - new_item->setRegisteredProperty(SessionGraphicsItem::P_XPOS, + new_item->setChildValue(SessionGraphicsItem::P_XPOS, event->scenePos().x() - boundingRect.width() / 2); - new_item->setRegisteredProperty(SessionGraphicsItem::P_YPOS, + new_item->setChildValue(SessionGraphicsItem::P_YPOS, event->scenePos().y() - boundingRect.height() / 2); } else if (GUIExamplesFactory::isValidExampleName(mimeData->getClassName())) { diff --git a/GUI/coregui/Views/SampleDesigner/ILayerView.cpp b/GUI/coregui/Views/SampleDesigner/ILayerView.cpp index 92f8b57b713..de759ecbc0f 100644 --- a/GUI/coregui/Views/SampleDesigner/ILayerView.cpp +++ b/GUI/coregui/Views/SampleDesigner/ILayerView.cpp @@ -50,7 +50,7 @@ void ILayerView::onPropertyChange(const QString &propertyName) Q_ASSERT(m_item); if (propertyName == LayerItem::P_THICKNESS) { m_rect.setHeight(DesignerHelper::nanometerToScreen( - m_item->getRegisteredProperty(LayerItem::P_THICKNESS).toDouble())); + m_item->getChildValue(LayerItem::P_THICKNESS).toDouble())); setPortCoordinates(); update(); emit heightChanged(); @@ -69,8 +69,8 @@ void ILayerView::onPropertyChange(const QString &propertyName) void ILayerView::updateColor() { - if(m_item && m_item->isRegisteredTag(LayerItem::P_MATERIAL)) { - QVariant v = m_item->getRegisteredProperty(LayerItem::P_MATERIAL); + if(m_item && m_item->isTag(LayerItem::P_MATERIAL)) { + QVariant v = m_item->getChildValue(LayerItem::P_MATERIAL); if (v.isValid()) { MaterialProperty mp = v.value<MaterialProperty>(); setColor(mp.getColor()); diff --git a/GUI/coregui/Views/SampleDesigner/IView.cpp b/GUI/coregui/Views/SampleDesigner/IView.cpp index 82928a3fd33..857ba092317 100644 --- a/GUI/coregui/Views/SampleDesigner/IView.cpp +++ b/GUI/coregui/Views/SampleDesigner/IView.cpp @@ -29,17 +29,17 @@ void IView::setParameterizedItem(SessionItem *item) { if (item) { m_item = item; - setX(m_item->getRegisteredProperty(SessionGraphicsItem::P_XPOS).toReal()); - setY(m_item->getRegisteredProperty(SessionGraphicsItem::P_YPOS).toReal()); + setX(m_item->getChildValue(SessionGraphicsItem::P_XPOS).toReal()); + setY(m_item->getChildValue(SessionGraphicsItem::P_YPOS).toReal()); ModelMapper *mapper = new ModelMapper(this); mapper->setItem(item); mapper->setOnPropertyChange( [this] (const QString &name) { if (name == SessionGraphicsItem::P_XPOS) { - setX(m_item->getRegisteredProperty(SessionGraphicsItem::P_XPOS).toReal()); + setX(m_item->getChildValue(SessionGraphicsItem::P_XPOS).toReal()); } else if (name == SessionGraphicsItem::P_YPOS) { - setY(m_item->getRegisteredProperty(SessionGraphicsItem::P_YPOS).toReal()); + setY(m_item->getChildValue(SessionGraphicsItem::P_YPOS).toReal()); } }); connect(m_item, SIGNAL(propertyChanged(const QString &)), this, @@ -58,11 +58,11 @@ void IView::addView(IView *childView, int row) void IView::onChangedX() { Q_ASSERT(m_item); - m_item->setRegisteredProperty(SessionGraphicsItem::P_XPOS, x()); + m_item->setChildValue(SessionGraphicsItem::P_XPOS, x()); } void IView::onChangedY() { Q_ASSERT(m_item); - m_item->setRegisteredProperty(SessionGraphicsItem::P_YPOS, y()); + m_item->setChildValue(SessionGraphicsItem::P_YPOS, y()); } diff --git a/GUI/coregui/Views/SampleDesigner/MultiLayerView.cpp b/GUI/coregui/Views/SampleDesigner/MultiLayerView.cpp index ffdf27a112b..791f3ce876b 100644 --- a/GUI/coregui/Views/SampleDesigner/MultiLayerView.cpp +++ b/GUI/coregui/Views/SampleDesigner/MultiLayerView.cpp @@ -269,7 +269,7 @@ const DesignerMimeData *MultiLayerView::checkDragEvent(QGraphicsSceneDragDropEve int row = getDropArea(event->pos()); if(mimeData->hasFormat("bornagain/widget") - && getParameterizedItem()->acceptsAsChild(mimeData->getClassName()) + && getParameterizedItem()->acceptsAsDefaultChild(mimeData->getClassName()) && row!=-1 ) { qDebug() << "MultiLayerView::checkDragEvent -> yes" << row << getDropAreaRectangle(row); diff --git a/GUI/coregui/Views/SampleView.cpp b/GUI/coregui/Views/SampleView.cpp index df4ac4a1cf3..de9cd48bd3f 100644 --- a/GUI/coregui/Views/SampleView.cpp +++ b/GUI/coregui/Views/SampleView.cpp @@ -211,11 +211,11 @@ void SampleView::showContextMenu(const QPoint &pnt) { QMenu menu; QMenu add_menu(QString("Add")); - QList<QString> addItemNames; + QVector<QString> addItemNames; QModelIndex parent_index = getTreeView()->indexAt(pnt); getTreeView()->setCurrentIndex(parent_index); if (!parent_index.isValid()) { - addItemNames = ItemFactory::getValidTopItemNames(); + addItemNames = ItemFactory::getValidTopItemNames().toVector(); } else { addItemNames = getSampleModel()->getAcceptableChildItems(parent_index); } diff --git a/Tests/UnitTests/TestGUI/GUICoreObjectCorrespondence.h b/Tests/UnitTests/TestGUI/GUICoreObjectCorrespondence.h index 7a84bb67cf1..d11e40084cb 100644 --- a/Tests/UnitTests/TestGUI/GUICoreObjectCorrespondence.h +++ b/Tests/UnitTests/TestGUI/GUICoreObjectCorrespondence.h @@ -22,7 +22,7 @@ inline void GUICoreObjectCorrespondence(const SessionItem& gui_object, for (auto name : core_parameter_names) { QString gui_name = QString::fromStdString(name); std::string message = "Parameter not found: " + name; - QVERIFY2( gui_object.isRegisteredTag(gui_name), message.c_str() ); + QVERIFY2( gui_object.isTag(gui_name), message.c_str() ); } } diff --git a/Tests/UnitTests/TestGUI/TestFTDistributionItems.h b/Tests/UnitTests/TestGUI/TestFTDistributionItems.h index 1efdaf28e6f..9eaec0b4c92 100644 --- a/Tests/UnitTests/TestGUI/TestFTDistributionItems.h +++ b/Tests/UnitTests/TestGUI/TestFTDistributionItems.h @@ -19,7 +19,7 @@ inline void TestFTDistributionItems::test_FTDistribution1DCauchy() { // to domain FTDistribution1DCauchyItem item; - item.setRegisteredProperty(FTDistribution1DItem::P_CORR_LENGTH, 2.0); + item.setChildValue(FTDistribution1DItem::P_CORR_LENGTH, 2.0); FTDistribution1DCauchy *pdf = dynamic_cast<FTDistribution1DCauchy *>(item.createFTDistribution()); QVERIFY(pdf->getOmega() == 2.0); delete pdf; @@ -27,8 +27,8 @@ inline void TestFTDistributionItems::test_FTDistribution1DCauchy() // from domain FTDistribution1DCauchy pdf2(3.0); FTDistribution1DCauchyItem item2; - item2.setRegisteredProperty(FTDistribution1DGaussItem::P_CORR_LENGTH, pdf2.getOmega()); - QVERIFY(item2.getRegisteredProperty(FTDistribution1DGaussItem::P_CORR_LENGTH) == 3.0); + item2.setChildValue(FTDistribution1DGaussItem::P_CORR_LENGTH, pdf2.getOmega()); + QVERIFY(item2.getChildValue(FTDistribution1DGaussItem::P_CORR_LENGTH) == 3.0); } #endif diff --git a/Tests/UnitTests/TestGUI/TestFormFactorItems.h b/Tests/UnitTests/TestGUI/TestFormFactorItems.h index b4f290b84eb..432f08acd02 100644 --- a/Tests/UnitTests/TestGUI/TestFormFactorItems.h +++ b/Tests/UnitTests/TestGUI/TestFormFactorItems.h @@ -21,10 +21,10 @@ inline void TestFormFactorItems::test_AnisoPyramidItem() { // to domain AnisoPyramidItem item; - item.setRegisteredProperty(AnisoPyramidItem::P_LENGTH, 20.0); - item.setRegisteredProperty(AnisoPyramidItem::P_WIDTH, 16.0); - item.setRegisteredProperty(AnisoPyramidItem::P_HEIGHT, 13.0); - item.setRegisteredProperty(AnisoPyramidItem::P_ALPHA, 60.0); + item.setChildValue(AnisoPyramidItem::P_LENGTH, 20.0); + item.setChildValue(AnisoPyramidItem::P_WIDTH, 16.0); + item.setChildValue(AnisoPyramidItem::P_HEIGHT, 13.0); + item.setChildValue(AnisoPyramidItem::P_ALPHA, 60.0); auto P_ff = item.createFormFactor(); FormFactorAnisoPyramid *p_ff = dynamic_cast<FormFactorAnisoPyramid *>(P_ff.get()); QVERIFY(p_ff); diff --git a/Tests/UnitTests/TestGUI/TestLayerRoughnessItems.h b/Tests/UnitTests/TestGUI/TestLayerRoughnessItems.h index 3d6edd87bc5..5b57580b747 100644 --- a/Tests/UnitTests/TestGUI/TestLayerRoughnessItems.h +++ b/Tests/UnitTests/TestGUI/TestLayerRoughnessItems.h @@ -18,14 +18,14 @@ private slots: inline void TestLayerRoughnessItems::test_LayerRoughnessToDomain() { LayerBasicRoughnessItem roughnessItem; - roughnessItem.setRegisteredProperty(LayerBasicRoughnessItem::P_SIGMA, 10.0); - roughnessItem.setRegisteredProperty(LayerBasicRoughnessItem::P_HURST, 20.0); - roughnessItem.setRegisteredProperty(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH, 30.0); + roughnessItem.setChildValue(LayerBasicRoughnessItem::P_SIGMA, 10.0); + roughnessItem.setChildValue(LayerBasicRoughnessItem::P_HURST, 20.0); + roughnessItem.setChildValue(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH, 30.0); auto P_roughness = TransformToDomain::createLayerRoughness(roughnessItem); - QCOMPARE(P_roughness->getSigma(), roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_SIGMA).toDouble()); - QCOMPARE(P_roughness->getHurstParameter(), roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_HURST).toDouble()); - QCOMPARE(P_roughness->getLatteralCorrLength(), roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH).toDouble()); + QCOMPARE(P_roughness->getSigma(), roughnessItem.getChildValue(LayerBasicRoughnessItem::P_SIGMA).toDouble()); + QCOMPARE(P_roughness->getHurstParameter(), roughnessItem.getChildValue(LayerBasicRoughnessItem::P_HURST).toDouble()); + QCOMPARE(P_roughness->getLatteralCorrLength(), roughnessItem.getChildValue(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH).toDouble()); LayerZeroRoughnessItem zeroRoughnessItem; QVERIFY(TransformToDomain::createLayerRoughness(zeroRoughnessItem) == nullptr); @@ -36,9 +36,9 @@ inline void TestLayerRoughnessItems::test_LayerRoughnessFromDomain() LayerRoughness roughness(10.0, 20.0, 30.0); LayerBasicRoughnessItem roughnessItem; TransformFromDomain::setItemFromSample(&roughnessItem, &roughness); - QCOMPARE(roughness.getSigma(), roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_SIGMA).toDouble()); - QCOMPARE(roughness.getHurstParameter(), roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_HURST).toDouble()); - QCOMPARE(roughness.getLatteralCorrLength(), roughnessItem.getRegisteredProperty(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH).toDouble()); + QCOMPARE(roughness.getSigma(), roughnessItem.getChildValue(LayerBasicRoughnessItem::P_SIGMA).toDouble()); + QCOMPARE(roughness.getHurstParameter(), roughnessItem.getChildValue(LayerBasicRoughnessItem::P_HURST).toDouble()); + QCOMPARE(roughness.getLatteralCorrLength(), roughnessItem.getChildValue(LayerBasicRoughnessItem::P_LATERAL_CORR_LENGTH).toDouble()); } diff --git a/Tests/UnitTests/TestGUI/TestMapper.h b/Tests/UnitTests/TestGUI/TestMapper.h index 0eb5f6fd1bf..599fc6991ef 100644 --- a/Tests/UnitTests/TestGUI/TestMapper.h +++ b/Tests/UnitTests/TestGUI/TestMapper.h @@ -58,11 +58,11 @@ inline void TestMapper::test_Inference2DRotationAngleToggle() layout->index(), -1, ParticleLayoutItem::T_INTERFERENCE); // rotation (xi) should be disabled if integration is on - inference->setRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION, true); + inference->setChildValue(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION, true); QVERIFY(inference->getItem(InterferenceFunction2DParaCrystalItem::P_ROTATION_ANGLE)->isEnabled() == false); // rotation (xi) should be enabled if integration is off - inference->setRegisteredProperty(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION, false); + inference->setChildValue(InterferenceFunction2DParaCrystalItem::P_XI_INTEGRATION, false); QVERIFY(!inference->getItem(InterferenceFunction2DParaCrystalItem::P_ROTATION_ANGLE)->isEnabled() == false); } @@ -76,16 +76,16 @@ inline void TestMapper::test_instrumentAlignmentPropertyVisibility() SessionItem *rectangular = detector->getGroupItem(DetectorItem::P_DETECTOR); - ComboProperty alignment = rectangular->getRegisteredProperty(RectangularDetectorItem::P_ALIGNMENT) + ComboProperty alignment = rectangular->getChildValue(RectangularDetectorItem::P_ALIGNMENT) .value<ComboProperty>(); // generic has some more items visible alignment.setValue(Constants::ALIGNMENT_GENERIC); - rectangular->setRegisteredProperty(RectangularDetectorItem::P_ALIGNMENT, QVariant::fromValue<ComboProperty>(alignment)); + rectangular->setChildValue(RectangularDetectorItem::P_ALIGNMENT, QVariant::fromValue<ComboProperty>(alignment)); QVERIFY(rectangular->getItem(RectangularDetectorItem::P_NORMAL)->isVisible()); // should be disabled if we switch alignment.setValue(Constants::ALIGNMENT_TO_REFLECTED_BEAM); - rectangular->setRegisteredProperty(RectangularDetectorItem::P_ALIGNMENT, QVariant::fromValue<ComboProperty>(alignment)); + rectangular->setChildValue(RectangularDetectorItem::P_ALIGNMENT, QVariant::fromValue<ComboProperty>(alignment)); QVERIFY(rectangular->getItem(RectangularDetectorItem::P_NORMAL)->isVisible() == false); } @@ -97,10 +97,10 @@ inline void TestMapper::test_removeMaskOnDetectorChange() SessionItem *detector = model.insertNewItem(Constants::DetectorType, instrument->index()); detector->setGroupProperty(DetectorItem::P_DETECTOR, Constants::RectangularDetectorType); model.insertNewItem(Constants::MaskContainerType, detector->index()); - QVERIFY(detector->getUnregisteredChildren().size() == 1); + QVERIFY(detector->getItems(DetectorItem::T_MASKS).size() == 1); // after change the mask container should be removed detector->setGroupProperty(DetectorItem::P_DETECTOR, Constants::SphericalDetectorType); - QVERIFY(detector->getUnregisteredChildren().size() == 0); + QVERIFY(detector->getItems(DetectorItem::T_MASKS).size() == 0); } diff --git a/Tests/UnitTests/TestGUI/TestParaCrystalItems.h b/Tests/UnitTests/TestGUI/TestParaCrystalItems.h index cbe5e2207ec..85a1502f511 100644 --- a/Tests/UnitTests/TestGUI/TestParaCrystalItems.h +++ b/Tests/UnitTests/TestGUI/TestParaCrystalItems.h @@ -21,14 +21,14 @@ inline void TestParaCrystalItems::test_Para1D_InitialState() QCOMPARE(item.itemName(), Constants::InterferenceFunctionRadialParaCrystalType); QCOMPARE(item.getChildrenOfType(Constants::GroupItemType).size(), 1); - QCOMPARE(item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_PEAK_DISTANCE).toDouble(), 20.0*Units::nanometer); - QCOMPARE(item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_DAMPING_LENGTH).toDouble(), 1000.0*Units::micrometer); - QCOMPARE(item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_DOMAIN_SIZE).toDouble(), 20.0*Units::micrometer); - QCOMPARE(item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_KAPPA).toDouble(), 0.0); + QCOMPARE(item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_PEAK_DISTANCE).toDouble(), 20.0*Units::nanometer); + QCOMPARE(item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_DAMPING_LENGTH).toDouble(), 1000.0*Units::micrometer); + QCOMPARE(item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_DOMAIN_SIZE).toDouble(), 20.0*Units::micrometer); + QCOMPARE(item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_KAPPA).toDouble(), 0.0); QCOMPARE(item.getGroupItem(InterferenceFunctionRadialParaCrystalItem::P_PDF)->modelType(), Constants::FTDistribution1DCauchyType); - GroupProperty_t group_property = item.getRegisteredProperty(InterferenceFunctionRadialParaCrystalItem::P_PDF).value<GroupProperty_t>(); + GroupProperty_t group_property = item.getChildValue(InterferenceFunctionRadialParaCrystalItem::P_PDF).value<GroupProperty_t>(); QCOMPARE(group_property->type(), GroupProperty::SELECTABLE); } diff --git a/Tests/UnitTests/TestGUI/TestParameterizedItem.h b/Tests/UnitTests/TestGUI/TestParameterizedItem.h index e808ed35080..ca71a1693be 100644 --- a/Tests/UnitTests/TestGUI/TestParameterizedItem.h +++ b/Tests/UnitTests/TestGUI/TestParameterizedItem.h @@ -25,37 +25,37 @@ inline void TestParameterizedItem::test_registerProperty() // QSignalSpy spy(&item, SIGNAL(propertyChanged(QString))); // access non-existing property - QCOMPARE(false, item.isRegisteredTag(property_name)); + QCOMPARE(false, item.isTag(property_name)); // QVERIFY_THROW(item.getRegisteredProperty(property_name), GUIHelpers::Error); // QVERIFY_THROW(item.setRegisteredProperty(property_name, value), GUIHelpers::Error); // registering new property - item.registerProperty(property_name, value); - QCOMPARE(true, item.isRegisteredTag(property_name)); + item.addProperty(property_name, value); + QCOMPARE(true, item.isTag(property_name)); // QCOMPARE(spy.count(), 1); // QList<QVariant> arguments = spy.takeFirst(); // QCOMPARE(arguments.size(), 1); // QCOMPARE(arguments.at(0).toString(), property_name); - QCOMPARE(item.getRegisteredProperty(property_name).toDouble(), value); + QCOMPARE(item.getChildValue(property_name).toDouble(), value); // QCOMPARE(spy.count(), 0); // setting property value double new_value(2.0); - item.setRegisteredProperty(property_name, new_value); + item.setChildValue(property_name, new_value); // QCOMPARE(spy.count(), 1); // arguments = spy.takeFirst(); // QCOMPARE(arguments.size(), 1); // QCOMPARE(arguments.at(0).toString(), property_name); - QCOMPARE(item.getRegisteredProperty(property_name).toDouble(), new_value); + QCOMPARE(item.getChildValue(property_name).toDouble(), new_value); // setting property value to wrong QVariant - QVERIFY_THROW(item.setRegisteredProperty(property_name, QString("aaa")), GUIHelpers::Error); + QVERIFY_THROW(item.setChildValue(property_name, QString("aaa")), GUIHelpers::Error); // attempt to register already existing property // QVERIFY_THROW(item.registerProperty(property_name, 1.0), GUIHelpers::Error); // remove registered property - item.removeRegisteredProperty(property_name); +// item.removeRegisteredProperty(property_name); // QCOMPARE(spy.count(), 1); // arguments = spy.takeFirst(); // QCOMPARE(arguments.size(), 1); -- GitLab