Skip to content

Commit

Permalink
Surface: in Extend::onChanged call the function of its direct parent …
Browse files Browse the repository at this point in the history
…class Part::Spline
  • Loading branch information
wwmayer committed Jul 3, 2020
1 parent 6e5bd7b commit a9440d5
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions src/Mod/Surface/App/FeatureExtend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,6 @@ const App::PropertyFloatConstraint::Constraints ToleranceRange = {0.0,10.0,0.01}
const App::PropertyFloatConstraint::Constraints ExtendRange = {-0.5,10.0,0.01};
PROPERTY_SOURCE(Surface::Extend, Part::Spline)

void Surface::Extend::onChanged(const App::Property* prop)
{
// using a mutex and lock to protect a recursive calling when setting the new values
if (!lockOnChangeMutex.try_lock()) return;
lockOnChangeMutex.unlock();
std::lock_guard<std::mutex> lock(lockOnChangeMutex);

if ( ExtendUSymetric.getValue() )
{
if (prop->getName() == ExtendUNeg.getName()
|| prop->getName() == ExtendUPos.getName())
{
auto changedValue = dynamic_cast<const App::PropertyFloat*>(prop);
if (changedValue)
{
ExtendUNeg.setValue(changedValue->getValue());
ExtendUPos.setValue(changedValue->getValue());
}
}
}
if (ExtendVSymetric.getValue())
{
if (prop->getName() == ExtendVNeg.getName()
|| prop->getName() == ExtendVPos.getName())
{
auto changedValue = dynamic_cast<const App::PropertyFloat*>(prop);
if (changedValue)
{
ExtendVNeg.setValue(changedValue->getValue());
ExtendVPos.setValue(changedValue->getValue());
}
}
}
Part::Feature::onChanged(prop);
}

Extend::Extend()
{
ADD_PROPERTY(Face,(0));
Expand Down Expand Up @@ -190,6 +154,42 @@ App::DocumentObjectExecReturn *Extend::execute(void)
return StdReturn;
}

void Extend::onChanged(const App::Property* prop)
{
// using a mutex and lock to protect a recursive calling when setting the new values
if (!lockOnChangeMutex.try_lock()) return;
lockOnChangeMutex.unlock();
std::lock_guard<std::mutex> lock(lockOnChangeMutex);

if ( ExtendUSymetric.getValue() )
{
if (prop->getName() == ExtendUNeg.getName()
|| prop->getName() == ExtendUPos.getName())
{
auto changedValue = dynamic_cast<const App::PropertyFloat*>(prop);
if (changedValue)
{
ExtendUNeg.setValue(changedValue->getValue());
ExtendUPos.setValue(changedValue->getValue());
}
}
}
if (ExtendVSymetric.getValue())
{
if (prop->getName() == ExtendVNeg.getName()
|| prop->getName() == ExtendVPos.getName())
{
auto changedValue = dynamic_cast<const App::PropertyFloat*>(prop);
if (changedValue)
{
ExtendVNeg.setValue(changedValue->getValue());
ExtendVPos.setValue(changedValue->getValue());
}
}
}
Part::Spline::onChanged(prop);
}

void Extend::handleChangedPropertyName(Base::XMLReader &reader,
const char * TypeName,
const char *PropName)
Expand Down

0 comments on commit a9440d5

Please sign in to comment.