Transform patterns can be created from multiple base features

The infrastructure/piping seems to have been in place for a long while.
Not tested for all variations of pattern transforms.
The major enabler was removing the `break`.
Some extra piping added to let the code at call-site decide if to select multiple features or not.
This commit is contained in:
Pierre LeMoine
2020-12-31 05:19:30 +01:00
committed by wmayer
parent ce7b57a08f
commit 7999536858
4 changed files with 14 additions and 7 deletions

View File

@@ -821,7 +821,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
Gui::Control().closeDialog();
Gui::Selection().clearSelection();
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(planes, status, accepter, worker, quitter));
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(planes, status, accepter, worker, true, quitter));
}
}
}
@@ -1151,7 +1151,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
Gui::Control().closeDialog();
Gui::Selection().clearSelection();
pickDlg = new PartDesignGui::TaskDlgFeaturePick(sketches, status, accepter, sketch_worker);
pickDlg = new PartDesignGui::TaskDlgFeaturePick(sketches, status, accepter, sketch_worker, true);
// Logically dead code because 'bNoSketchWasSelected' must be true
//if (!bNoSketchWasSelected && extReference)
// pickDlg->showExternal(true);
@@ -1979,7 +1979,7 @@ void prepareTransformed(PartDesign::Body *pcActiveBody, Gui::Command* cmd, const
Gui::Control().closeDialog();
Gui::Selection().clearSelection();
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(features, status, accepter, worker));
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(features, status, accepter, worker, false));
return;
} else if (features.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid features in this document"),

View File

@@ -286,7 +286,7 @@ void CmdPartDesignBody::activated(int iMsg)
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
if (!dlg) {
Gui::Selection().clearSelection();
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(planes, status, accepter, worker, quitter));
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(planes, status, accepter, worker, true, quitter));
}
}
}

View File

@@ -80,6 +80,7 @@ const QString TaskFeaturePick::getFeatureStatusString(const featureStatus st)
TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
const std::vector<featureStatus>& status,
bool singleFeatureSelect,
QWidget* parent)
: TaskBox(Gui::BitmapFactory().pixmap("edit-select-box"),
tr("Select feature"), true, parent)
@@ -100,6 +101,10 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(onDoubleClick(QListWidgetItem *)));
if (!singleFeatureSelect) {
ui->listWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
}
enum { axisBit=0, planeBit = 1};
// NOTE: generally there shouldn't be more then one origin
@@ -276,7 +281,6 @@ std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures()
result.push_back(obj);
}
break;
}
index++;
@@ -525,10 +529,11 @@ TaskDlgFeaturePick::TaskDlgFeaturePick( std::vector<App::DocumentObject*> &objec
const std::vector<TaskFeaturePick::featureStatus> &status,
boost::function<bool (std::vector<App::DocumentObject*>)> afunc,
boost::function<void (std::vector<App::DocumentObject*>)> wfunc,
bool singleFeatureSelect,
boost::function<void (void)> abortfunc /* = NULL */ )
: TaskDialog(), accepted(false)
{
pick = new TaskFeaturePick(objects, status);
pick = new TaskFeaturePick(objects, status, singleFeatureSelect);
Content.push_back(pick);
acceptFunction = afunc;

View File

@@ -58,6 +58,7 @@ public:
TaskFeaturePick(std::vector<App::DocumentObject*> &objects,
const std::vector<featureStatus> &status,
bool singleFeatureSelect,
QWidget *parent = 0);
~TaskFeaturePick();
@@ -107,7 +108,8 @@ public:
const std::vector<TaskFeaturePick::featureStatus> &status,
boost::function<bool (std::vector<App::DocumentObject*>)> acceptfunc,
boost::function<void (std::vector<App::DocumentObject*>)> workfunc,
boost::function<void (void)> abortfunc = 0 );
bool singleFeatureSelect,
boost::function<void (void)> abortfunc = 0);
~TaskDlgFeaturePick();
public: