[PartDesign] Add some dummy options for revolution
These options correspond to "up to face" and "2 angles". They are expected to do nothing right now. However there is also some experimental code for "up to face" in this commit, whose behavior is not confirmed.
This commit is contained in:
@@ -59,10 +59,13 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
|
||||
// bind property mirrors
|
||||
if (auto *rev = dynamic_cast<PartDesign::Revolution *>(vp->getObject())) {
|
||||
this->propAngle = &(rev->Angle);
|
||||
this->propAngle2 = &(rev->Angle2);
|
||||
this->propMidPlane = &(rev->Midplane);
|
||||
this->propReferenceAxis = &(rev->ReferenceAxis);
|
||||
this->propReversed = &(rev->Reversed);
|
||||
this->propUpToFace = &(rev->UpToFace);
|
||||
ui->revolveAngle->bind(rev->Angle);
|
||||
ui->revolveAngle2->bind(rev->Angle2);
|
||||
}
|
||||
else if (auto *rev = dynamic_cast<PartDesign::Groove *>(vp->getObject())) {
|
||||
this->propAngle = &(rev->Angle);
|
||||
@@ -75,18 +78,13 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
|
||||
throw Base::TypeError("The object is neither a Groove nor a Revolution.");
|
||||
}
|
||||
|
||||
ui->checkBoxMidplane->setChecked(propMidPlane->getValue());
|
||||
ui->checkBoxReversed->setChecked(propReversed->getValue());
|
||||
|
||||
ui->revolveAngle->setValue(propAngle->getValue());
|
||||
ui->revolveAngle->setMaximum(propAngle->getMaximum());
|
||||
ui->revolveAngle->setMinimum(propAngle->getMinimum());
|
||||
setupDialog();
|
||||
|
||||
blockUpdate = false;
|
||||
updateUI();
|
||||
connectSignals();
|
||||
|
||||
setFocus ();
|
||||
setFocus();
|
||||
|
||||
// show the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf ( vp->getObject () );
|
||||
@@ -103,6 +101,31 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
|
||||
}
|
||||
}
|
||||
|
||||
void TaskRevolutionParameters::setupDialog()
|
||||
{
|
||||
PartDesign::ProfileBased* pcFeat = static_cast<PartDesign::ProfileBased*>(vp->getObject());
|
||||
ui->checkBoxMidplane->setChecked(propMidPlane->getValue());
|
||||
ui->checkBoxReversed->setChecked(propReversed->getValue());
|
||||
|
||||
ui->revolveAngle->setValue(propAngle->getValue());
|
||||
ui->revolveAngle->setMaximum(propAngle->getMaximum());
|
||||
ui->revolveAngle->setMinimum(propAngle->getMinimum());
|
||||
|
||||
int index = 0;
|
||||
|
||||
// TODO: This should also be implemented for groove
|
||||
if (pcFeat->isDerivedFrom(PartDesign::Revolution::getClassTypeId())) {
|
||||
PartDesign::Revolution* rev = static_cast<PartDesign::Revolution*>(vp->getObject());
|
||||
ui->revolveAngle2->setValue(propAngle2->getValue());
|
||||
ui->revolveAngle2->setMaximum(propAngle2->getMaximum());
|
||||
ui->revolveAngle2->setMinimum(propAngle2->getMinimum());
|
||||
|
||||
index = rev->Type.getValue();
|
||||
}
|
||||
|
||||
translateModeList(index);
|
||||
}
|
||||
|
||||
void TaskRevolutionParameters::fillAxisCombo(bool forceRefill)
|
||||
{
|
||||
Base::StateLocker lock(blockUpdate, true);
|
||||
@@ -217,6 +240,18 @@ void TaskRevolutionParameters::onSelectionChanged(const Gui::SelectionChanges& m
|
||||
}
|
||||
}
|
||||
|
||||
void TaskRevolutionParameters::translateModeList(int index)
|
||||
{
|
||||
// Must correspond to values from PartDesign::Revolution::TypeEnums
|
||||
ui->changeMode->clear();
|
||||
ui->changeMode->addItem(tr("Dimension"));
|
||||
// ui->changeMode->addItem(tr("To last"));
|
||||
// ui->changeMode->addItem(tr("To first"));
|
||||
ui->changeMode->addItem(tr("Up to face"));
|
||||
ui->changeMode->addItem(tr("Two dimensions"));
|
||||
ui->changeMode->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
|
||||
void TaskRevolutionParameters::onAngleChanged(double len)
|
||||
{
|
||||
@@ -354,6 +389,9 @@ void TaskRevolutionParameters::changeEvent(QEvent *event)
|
||||
TaskBox::changeEvent(event);
|
||||
if (event->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(proxy);
|
||||
|
||||
// Translate mode items
|
||||
translateModeList(ui->changeMode->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user