Toponaming: Tests, cleanup, and fix axis drawing

This commit is contained in:
bgbsww
2024-07-18 21:13:14 -04:00
parent 77f181a307
commit 9f2210313d
7 changed files with 285 additions and 190 deletions

View File

@@ -2884,41 +2884,38 @@ void ViewProviderSketch::drawEditMarkers(const std::vector<Base::Vector2d>& Edit
editCoinManager->drawEditMarkers(EditMarkers, augmentationlevel);
}
void ViewProviderSketch::updateData(const App::Property* prop)
{
void ViewProviderSketch::updateData(const App::Property* prop) {
ViewProvider2DObject::updateData(prop);
// In the case of an undo/redo transaction, updateData is triggered by
// SketchObject::onUndoRedoFinished() in the solve() In the case of an internal transaction,
// touching the geometry results in a call to updateData.
if (isInEditMode() && !getSketchObject()->getDocument()->isPerformingTransaction()
&& !getSketchObject()->isPerformingInternalTransaction()
&& (prop == &(getSketchObject()->Geometry) || prop == &(getSketchObject()->Constraints))) {
if (prop != &getSketchObject()->Constraints)
signalElementsChanged();
}
// At this point, we do not need to solve the Sketch
// If we are adding geometry an update can be triggered before the sketch is actually
// solved. Because a solve is mandatory to any addition (at least to update the DoF of the
// solver), only when the solver geometry is the same in number than the sketch geometry an
// update should trigger a redraw. This reduces even more the number of redraws per
// insertion of geometry
void ViewProviderSketch::slotSolverUpdate()
{
if (!isInEditMode() )
return;
// solver information is also updated when no matching geometry, so that if a solving fails
// this failed solving info is presented to the user
UpdateSolverInformation();// just update the solver window with the last SketchObject
// solving information
// At this point, we do not need to solve the Sketch
// If we are adding geometry an update can be triggered before the sketch is actually
// solved. Because a solve is mandatory to any addition (at least to update the DoF of the
// solver), only when the solver geometry is the same in number than the sketch geometry an
// update should trigger a redraw. This reduces even more the number of redraws per
// insertion of geometry
if (getSketchObject()->getExternalGeometryCount()
+ getSketchObject()->getHighestCurveIndex() + 1
== getSolvedSketch().getGeometrySize()) {
Gui::MDIView* mdi = Gui::Application::Instance->editDocument()->getActiveView();
if (mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId()))
draw(false, true);
// solver information is also updated when no matching geometry, so that if a solving fails
// this failed solving info is presented to the user
UpdateSolverInformation();// just update the solver window with the last SketchObject
// solving information
signalConstraintsChanged();
}
if (getSketchObject()->getExternalGeometryCount()
+ getSketchObject()->getHighestCurveIndex() + 1
== getSolvedSketch().getGeometrySize()) {
Gui::MDIView* mdi = Gui::Application::Instance->editDocument()->getActiveView();
if (mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId()))
draw(false, true);
if (prop != &getSketchObject()->Constraints)
signalElementsChanged();
signalConstraintsChanged();
}
}
@@ -3124,6 +3121,15 @@ bool ViewProviderSketch::setEdit(int ModNum)
getSketchObject()->validateExternalLinks();
}
//NOLINTBEGIN
connectUndoDocument = getDocument()->signalUndoDocument.connect(
std::bind(&ViewProviderSketch::slotUndoDocument, this, sp::_1));
connectRedoDocument = getDocument()->signalRedoDocument.connect(
std::bind(&ViewProviderSketch::slotRedoDocument, this, sp::_1));
connectSolverUpdate = getSketchObject()
->signalSolverUpdate.connect(boost::bind(&ViewProviderSketch::slotSolverUpdate, this));
//NOLINTEND
// There are geometry extensions introduced by the solver and geometry extensions introduced by
// the viewprovider.
// 1. It is important that the solver has geometry with updated extensions.
@@ -3139,13 +3145,6 @@ bool ViewProviderSketch::setEdit(int ModNum)
// a draw(true) via ViewProvider::UpdateData.
getSketchObject()->solve(true);
//NOLINTBEGIN
connectUndoDocument = getDocument()->signalUndoDocument.connect(
std::bind(&ViewProviderSketch::slotUndoDocument, this, sp::_1));
connectRedoDocument = getDocument()->signalRedoDocument.connect(
std::bind(&ViewProviderSketch::slotRedoDocument, this, sp::_1));
//NOLINTEND
// Enable solver initial solution update while dragging.
getSketchObject()->setRecalculateInitialSolutionWhileMovingPoint(
viewProviderParameters.recalculateInitialSolutionWhileDragging);
@@ -3355,6 +3354,7 @@ void ViewProviderSketch::unsetEdit(int ModNum)
connectUndoDocument.disconnect();
connectRedoDocument.disconnect();
connectSolverUpdate.disconnect();
// when pressing ESC make sure to close the dialog
Gui::Control().closeDialog();