[Sketcher] Clear out some TODOs and other comments

This commit is contained in:
Ajinkya Dahale
2023-03-10 22:25:42 +05:30
committed by abdullahtahiriyo
parent 02558f3793
commit d6060c79aa
2 changed files with 16 additions and 23 deletions

View File

@@ -934,7 +934,7 @@ CmdSketcherCreateBSplineByInterpolation::CmdSketcherCreateBSplineByInterpolation
sWhatsThis = "Sketcher_CreateBSplineByInterpolation";
sStatusTip = sToolTipText;
sPixmap = "Sketcher_CreateBSplineByInterpolation";
sAccel = "G, B, I"; // TODO: Finalize this. What about Periodic?
sAccel = "G, B, I";
eType = ForEdit;
}
@@ -964,7 +964,7 @@ CmdSketcherCreatePeriodicBSplineByInterpolation::CmdSketcherCreatePeriodicBSplin
sWhatsThis = "Sketcher_Create_Periodic_BSplineByInterpolation";
sStatusTip = sToolTipText;
sPixmap = "Sketcher_Create_Periodic_BSplineByInterpolation";
sAccel = "G, B, O"; // TODO: Finalize this. What about Periodic?
sAccel = "G, B, O";
eType = ForEdit;
}

View File

@@ -120,10 +120,6 @@ public:
return false;
}
//Gui::Command::commitCommand();
//static_cast<Sketcher::SketchObject *>(sketchgui->getObject())->solve();
// add auto constraints on knot
if (!sugConstr.back().empty()) {
createAutoConstraints(sugConstr.back(), knotGeoIds.back(), Sketcher::PointPos::start, false);
@@ -149,7 +145,6 @@ public:
Mode = STATUS_CLOSE;
if (ConstrMethod == 1) { // if periodic we do not need the last pole
// FIXME: Look at `interpolate` and check if we need to do this for knots. Periodic splines are as of writing not tested.
BSplineKnots.pop_back();
sugConstr.pop_back();
@@ -211,16 +206,19 @@ public:
// // The user may only want to exit the dialog.
// }
if (SoKeyboardEvent::M == key && pressed) {
// TODO: On pressing, say, M, modify the knot's multiplicity
if (BSplineMults.size() > 1) {
BSplineMults.back() = QInputDialog::getInt(
Gui::getMainWindow(),
QObject::tr("Set knot multiplicity"),
QObject::tr("NOTE 1: For construction by interpolation, the de facto maximum is currently 3.\n"
"NOTE 2: Under certain circumstances (details WIP), this value may be ignored.\n"
"Set knot multiplicity at the last point provided, between 1 and %1:")
.arg(QString::number(SplineDegree)),
BSplineMults.back(), 1, SplineDegree, 1);
QObject::tr(
"Set knot multiplicity at the last point provided, between 1 and %1:"
"Note that multiplicity may be ignored under certain circumstances."
"Please refer to documentation for details")
.arg(QString::number(SplineDegree)),
BSplineMults.back(),
1,
SplineDegree,
1);
}
// FIXME: Pressing Esc here also finishes the B-Spline creation.
// The user may only want to exit the dialog.
@@ -385,7 +383,6 @@ private:
bool finishCommand(Base::Vector2d position)
{
if (Mode==STATUS_CLOSE) {
// TODO: make modifications for construction by knots
unsetCursor();
resetPositionText();
@@ -398,6 +395,7 @@ private:
std::vector<std::stringstream> streams;
// Create subsets of points between C0 knots.
// The first point
streams.emplace_back();
streams.back() << "App.Vector(" << BSplineKnots.front().x << "," << BSplineKnots.front().y << "),";
@@ -412,10 +410,10 @@ private:
// The last point
streams.back() << "App.Vector(" << BSplineKnots.back().x << "," << BSplineKnots.back().y << "),";
std::vector<std::string> controlpointses; // Gollum gollum
// Note the plural of plurals. Each element is a separate sequence.
std::vector<std::string> controlpointses;
controlpointses.reserve(streams.size());
for (auto & stream: streams) {
// TODO: Use subset of points between C0 knots.
controlpointses.emplace_back(stream.str());
@@ -440,16 +438,13 @@ private:
int currentgeoid = getHighestCurveIndex();
try {
//Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add B-spline curve"));
try {
// TODO: Bypass this for when there are no C0 knots
// TODO: Bypass this for when there are no C0 knots
// Create B-spline in pieces between C0 knots
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_poles = []");
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_knots = []");
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_mults = []");
Gui::Command::runCommand(Gui::Command::Gui, "_bsps = []");
for (auto & controlpoints: controlpointses) {
for (auto & controlpoints: controlpointses) {
// TODO: variable degrees?
QString cmdstr = QString::fromLatin1("_bsps.append(Part.BSplineCurve())\n"
@@ -458,7 +453,7 @@ private:
.arg(QString::fromLatin1(controlpoints.c_str()))
.arg(QString::fromLatin1(ConstrMethod == 0 ?"False":"True"))
.arg(myDegree);
Gui::Command::runCommand(Gui::Command::Gui, cmdstr.toLatin1());
Gui::Command::runCommand(Gui::Command::Gui, cmdstr.toLatin1());
// Adjust internal knots here (raise multiplicity)
// How this contributes to the final B-spline
if (controlpoints == controlpointses.front()) {
@@ -466,7 +461,6 @@ private:
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_knots.extend(_bsps[-1].getKnots())");
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_mults.extend(_bsps[-1].getMultiplicities())");
}
else {
else {
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_poles.extend(_bsps[-1].getPoles()[1:])");
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_knots.extend([_finalbsp_knots[-1] + i for i in _bsps[-1].getKnots()[1:]])");
@@ -474,7 +468,6 @@ private:
Gui::Command::runCommand(Gui::Command::Gui, "_finalbsp_mults.extend(_bsps[-1].getMultiplicities()[1:])");
}
}
// {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", NULL};
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.BSplineCurve"