Skip to content

Commit 3a41fbb

Browse files
committed
Merge branch 'upstream-objcryst' : Add PowderPattern::RemovePowderPatternComponent
2 parents e8d36ac + 1a35e23 commit 3a41fbb

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/ObjCryst/ObjCryst/PowderPattern.cpp

+37
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,43 @@ void PowderPattern::AddPowderPatternComponent(PowderPatternComponent &comp)
26042604
VFN_DEBUG_EXIT("PowderPattern::AddPowderPatternComponent():"<<comp.GetName(),5)
26052605
}
26062606

2607+
void PowderPattern::RemovePowderPatternComponent(PowderPatternComponent &comp)
2608+
{
2609+
VFN_DEBUG_ENTRY("PowderPattern::RemovePowderPatternComponent():"<<comp.GetName(),5)
2610+
if(comp.IsScalable())
2611+
{
2612+
// Remove one scale factor parameter
2613+
cout<<"PowderPattern::RemovePowderPatternComponent: removing 1 scale paramater"<<endl;
2614+
this->Print();
2615+
this->RemovePar(&this->GetPar(mScaleFactor.data()+mPowderPatternComponentRegistry.GetNb()-1));
2616+
this->Print();
2617+
}
2618+
2619+
this->RemoveSubRefObj(comp);
2620+
comp.DeRegisterClient(*this);
2621+
mClockPowderPatternCalc.Reset();
2622+
mClockIntegratedFactorsPrep.Reset();
2623+
mPowderPatternComponentRegistry.DeRegister(comp);
2624+
2625+
// Shift scale factors
2626+
unsigned int i=0;
2627+
for(unsigned int i=0;i<this->GetNbPowderPatternComponent();i++)
2628+
if(&comp == &this->GetPowderPatternComponent(i)) break;
2629+
for(unsigned int j=i;j<this->GetNbPowderPatternComponent()-1;j++) mScaleFactor(j) = mScaleFactor(j+1);
2630+
2631+
mClockScaleFactor.Click();
2632+
this->UpdateDisplay();
2633+
VFN_DEBUG_EXIT("PowderPattern::RemovePowderPatternComponent():"<<comp.GetName(),5)
2634+
}
2635+
2636+
void PowderPattern::RemovePowderPatternComponent(const int i)
2637+
{
2638+
VFN_DEBUG_ENTRY("PowderPattern::RemovePowderPatternComponent():"<<i,5)
2639+
this->RemovePowderPatternComponent(mPowderPatternComponentRegistry.GetObj(i));
2640+
VFN_DEBUG_EXIT("PowderPattern::RemovePowderPatternComponent():"<<i,5)
2641+
}
2642+
2643+
26072644
unsigned int PowderPattern::GetNbPowderPatternComponent()const
26082645
{
26092646
return mPowderPatternComponentRegistry.GetNb();

src/ObjCryst/ObjCryst/PowderPattern.h

+4
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,10 @@ class PowderPattern : public RefinableObj
591591
* are automatically changed to that of the PowderPattern object.
592592
*/
593593
void AddPowderPatternComponent(PowderPatternComponent &);
594+
/// Remove a powder pattern component
595+
void RemovePowderPatternComponent(PowderPatternComponent &);
596+
/// Remove a powder pattern component
597+
void RemovePowderPatternComponent(const int i);
594598
/// Number of components
595599
unsigned int GetNbPowderPatternComponent()const;
596600
/// Access to a component of the powder pattern

0 commit comments

Comments
 (0)