From: azv Date: Tue, 22 Dec 2015 13:39:29 +0000 (+0300) Subject: Fix compilation errors in solvers. X-Git-Tag: V_2.1.0~107 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d95ba0074e9a9b7006c856fde45d58615edbfb11;p=modules%2Fshaper.git Fix compilation errors in solvers. Make SolveSpace solver default. --- diff --git a/src/Config/plugins.xml b/src/Config/plugins.xml index 9b0e0cf5f..77422df32 100644 --- a/src/Config/plugins.xml +++ b/src/Config/plugins.xml @@ -11,8 +11,8 @@ - - + + diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp index f74db8d2e..135eebd94 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp @@ -263,6 +263,7 @@ std::list PlaneGCSSolver_Builder::createConstraint( const EntityID& theSketchID, const SketchSolver_ConstraintType& theType, const double& theValue, + const bool theFullValue, const EntityWrapperPtr& thePoint1, const EntityWrapperPtr& thePoint2, const std::list& theTrsfEnt) const @@ -284,6 +285,7 @@ std::list PlaneGCSSolver_Builder::createConstraint( aResult->setEntities(aConstrAttrList); if (anAngleParam) aResult->setValueParameter(anAngleParam); + aResult->setIsFullValue(theFullValue); return std::list(1, aResult); } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.h index ef511e3ea..fe959858b 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.h @@ -65,6 +65,7 @@ public: /// \param theSketchID [in] sketch the constraint belongs to /// \param theType [in] type of constraint /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation) if applicable + /// \param theFullValue [in] indicates theValue shows full translation delta/rotation angle or delta/angle between neighbor entities /// \param thePoint1 [in] center for multi-rotation or start point for multi-translation /// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation) /// \param theTrsfEnt [in] list of transformed entities @@ -74,6 +75,7 @@ public: const EntityID& theSketchID, const SketchSolver_ConstraintType& theType, const double& theValue, + const bool theFullValue, const EntityWrapperPtr& thePoint1, const EntityWrapperPtr& thePoint2, const std::list& theTrsfEnt) const; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index 71f6d87b3..2d95d783d 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -59,9 +59,13 @@ SketchSolver_SolveStatus PlaneGCSSolver_Solver::solve() if (aResult == GCS::Success) { myEquationSystem.applySolution(); aStatus = STATUS_OK; - } else { - myEquationSystem.undoSolution(); + } else aStatus = STATUS_FAILED; - } + return aStatus; } + +void PlaneGCSSolver_Solver::undo() +{ + myEquationSystem.undoSolution(); +} diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h index 605a97794..ea31e1443 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h @@ -48,6 +48,13 @@ public: */ virtual SketchSolver_SolveStatus solve(); + /// \brief Prepare for solving. Store initial values of parameters for undo + virtual void prepare() + { /* do nothing */ } + + /// \brief Revert solution to initial values + virtual void undo(); + private: GCS::VEC_pD myParameters; ///< list of unknowns std::set myConstraints; ///< list of constraints already processed by the system diff --git a/src/SketchSolver/SketchSolver_Builder.h b/src/SketchSolver/SketchSolver_Builder.h index 159595015..e7e6f5cf0 100644 --- a/src/SketchSolver/SketchSolver_Builder.h +++ b/src/SketchSolver/SketchSolver_Builder.h @@ -65,6 +65,7 @@ public: /// \param theSketchID [in] sketch the constraint belongs to /// \param theType [in] type of constraint /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation) if applicable + /// \param theFullValue [in] indicates theValue shows full translation delta/rotation angle or delta/angle between neighbor entities /// \param thePoint1 [in] center for multi-rotation or start point for multi-translation /// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation) /// \param theTrsfEnt [in] list of transformed entities @@ -74,7 +75,7 @@ public: const EntityID& theSketchID, const SketchSolver_ConstraintType& theType, const double& theValue, - const bool& theFullValue, + const bool theFullValue, const EntityWrapperPtr& thePoint1, const EntityWrapperPtr& thePoint2, const std::list& theTrsfEnt) const = 0; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp index 9b1105e24..21bd5f536 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp @@ -134,7 +134,7 @@ std::list SolveSpaceSolver_Builder::createConstraint( const EntityID& theSketchID, const SketchSolver_ConstraintType& theType, const double& theValue, - const bool& theFullValue, + const bool theFullValue, const EntityWrapperPtr& thePoint1, const EntityWrapperPtr& thePoint2, const std::list& theTrsfEnt) const diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h index 2f8e61be9..d71a5662d 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.h @@ -63,6 +63,7 @@ public: /// \param theSketchID [in] sketch the constraint belongs to /// \param theType [in] type of constraint /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation) if applicable + /// \param theFullValue [in] indicates theValue shows full translation delta/rotation angle or delta/angle between neighbor entities /// \param thePoint1 [in] center for multi-rotation or start point for multi-translation /// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation) /// \param theTrsfEnt [in] list of transformed entities @@ -72,7 +73,7 @@ public: const EntityID& theSketchID, const SketchSolver_ConstraintType& theType, const double& theValue, - const bool& theFullValue, + const bool theFullValue, const EntityWrapperPtr& thePoint1, const EntityWrapperPtr& thePoint2, const std::list& theTrsfEnt) const;