Sketcher: encapsulate Sketch::SolveTime and RecalculateInitialSolutionWhileMovingPoint members
This commit is contained in:
committed by
abdullahtahiriyo
parent
84a8bb5741
commit
b6729a41d7
@@ -104,6 +104,8 @@ public:
|
||||
inline bool hasRedundancies(void) const { return !Redundant.empty(); }
|
||||
inline const std::vector<int> &getRedundant(void) const { return Redundant; }
|
||||
|
||||
inline float getSolveTime() const { return SolveTime; }
|
||||
|
||||
inline bool hasMalformedConstraints(void) const { return malformedConstraints; }
|
||||
public:
|
||||
std::set < std::pair< int, Sketcher::PointPos>> getDependencyGroup(int geoId, PointPos pos) const;
|
||||
@@ -132,6 +134,16 @@ public:
|
||||
*/
|
||||
int movePoint(int geoId, PointPos pos, Base::Vector3d toPoint, bool relative=false);
|
||||
|
||||
/**
|
||||
* Sets whether the initial solution should be recalculated while dragging after a certain distance from the previous drag point
|
||||
* for smoother dragging operation.
|
||||
*/
|
||||
bool getRecalculateInitialSolutionWhileMovingPoint() const
|
||||
{return RecalculateInitialSolutionWhileMovingPoint;}
|
||||
|
||||
void setRecalculateInitialSolutionWhileMovingPoint(bool recalculateInitialSolutionWhileMovingPoint)
|
||||
{RecalculateInitialSolutionWhileMovingPoint = recalculateInitialSolutionWhileMovingPoint;}
|
||||
|
||||
/// add dedicated geometry
|
||||
//@{
|
||||
/// add a point
|
||||
@@ -378,6 +390,7 @@ public:
|
||||
BSpline = 9
|
||||
};
|
||||
|
||||
protected:
|
||||
float SolveTime;
|
||||
bool RecalculateInitialSolutionWhileMovingPoint;
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ int SketchObject::solve(bool updateGeoAfterSolving/*=true*/)
|
||||
Base::Console().Error("Sketch %s has malformed constraints!\n",this->getNameInDocument());
|
||||
}
|
||||
|
||||
lastSolveTime=solvedSketch.SolveTime;
|
||||
lastSolveTime=solvedSketch.getSolveTime();
|
||||
|
||||
if (err == 0 && updateGeoAfterSolving) {
|
||||
// set the newly solved geometry
|
||||
|
||||
@@ -1276,9 +1276,9 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
if (getSketchObject()->getSolvedSketch().movePoint(GeoId, PosId, vec, false) == 0) {
|
||||
setPositionText(Base::Vector2d(x,y));
|
||||
draw(true,false);
|
||||
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().SolveTime));
|
||||
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().getSolveTime()));
|
||||
} else {
|
||||
signalSolved(QString::fromLatin1("Unsolved (%1 sec)").arg(getSketchObject()->getSolvedSketch().SolveTime));
|
||||
signalSolved(QString::fromLatin1("Unsolved (%1 sec)").arg(getSketchObject()->getSolvedSketch().getSolveTime()));
|
||||
//Base::Console().Log("Error solving:%d\n",ret);
|
||||
}
|
||||
}
|
||||
@@ -1317,9 +1317,9 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
if (getSketchObject()->getSolvedSketch().movePoint(edit->DragCurve, Sketcher::none, vec, relative) == 0) {
|
||||
setPositionText(Base::Vector2d(x,y));
|
||||
draw(true,false);
|
||||
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().SolveTime));
|
||||
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(getSketchObject()->getSolvedSketch().getSolveTime()));
|
||||
} else {
|
||||
signalSolved(QString::fromLatin1("Unsolved (%1 sec)").arg(getSketchObject()->getSolvedSketch().SolveTime));
|
||||
signalSolved(QString::fromLatin1("Unsolved (%1 sec)").arg(getSketchObject()->getSolvedSketch().getSolveTime()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -6255,7 +6255,7 @@ bool ViewProviderSketch::setEdit(int ModNum)
|
||||
// Enable solver initial solution update while dragging.
|
||||
ParameterGrp::handle hGrp2 = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||
|
||||
getSketchObject()->getSolvedSketch().RecalculateInitialSolutionWhileMovingPoint = hGrp2->GetBool("RecalculateInitialSolutionWhileDragging",true);
|
||||
getSketchObject()->getSolvedSketch().setRecalculateInitialSolutionWhileMovingPoint(hGrp2->GetBool("RecalculateInitialSolutionWhileDragging",true));
|
||||
|
||||
|
||||
// intercept del key press from main app
|
||||
|
||||
Reference in New Issue
Block a user