#include <GCS.h>
-typedef std::map<GCS::Constraint*, SketchSolver_ConstraintType> ConstraintMap;
-
-/**
- * The main class that performs the high-level operations for connection to the PlaneGCS.
- */
+/// \brief The main class that performs the high-level operations for connection to the PlaneGCS.
class PlaneGCSSolver_Solver : public SketchSolver_ISolver
{
public:
void clear();
/// \brief Add constraint to the system of equations
- void addConstraint(GCSConstraintPtr theConstraint,
- const SketchSolver_ConstraintType theType);
+ void addConstraint(GCSConstraintPtr theConstraint);
/// \brief Remove constraint from the system of equations
- void removeConstraint(GCSConstraintPtr theConstraint);
+ void removeConstraint(ConstraintID theID);
/// \brief Initialize list of unknowns
void setParameters(const GCS::VEC_pD& theParams)
{ myParameters = theParams; }
- /// \brief Set list of IDs of tangent constraints
- ///
- /// Workaround to avoid incorrect report about redundant constraints
- /// if an arc is already smoothly connected to a line.
- void setTangent(const GCS::SET_I& theTangentIDs)
- { myTangent = theTangentIDs; }
-
- /** \brief Solve the set of equations
- * \return identifier whether solution succeeded
- */
- virtual SketchSolver_SolveStatus solve();
+ /// \brief Solve the set of equations
+ /// \return identifier whether solution succeeded
+ virtual SketchSolver_SolveStatus solve() override;
/// \brief Prepare for solving. Store initial values of parameters for undo
- virtual void prepare()
+ virtual void prepare() override
{ /* do nothing */ }
/// \brief Revert solution to initial values
- virtual void undo();
+ virtual void undo() override;
/// \brief Check the constraint is conflicted with others
- virtual bool isConflicting(const ConstraintID& theConstraint) const;
+ virtual bool isConflicting(const ConstraintID& theConstraint) const override;
/// \brief Degrees of freedom
- virtual int dof() const;
+ virtual int dof() const override;
private:
void collectConflicting();
- /// \brief Remove constraint from the system of equations
- void removeConstraint(GCS::Constraint* theConstraint);
-
- /// \brief Remove redundant tangent constraints and try to solve the system again
- GCS::SolveStatus solveWithoutTangent();
-
- /// \brief Check the entities under the tangent constraint are smoothly connected
- bool isTangentTruth(int theTagID) const;
- /// \brief Check the entities under the tangent constraint are smoothly connected
- bool isTangentTruth(GCS::Constraint* theTangent) const;
-
private:
GCS::VEC_pD myParameters; ///< list of unknowns
-
- /// list of constraints already processed by the system
- ConstraintMap myConstraints;
std::shared_ptr<GCS::System> myEquationSystem; ///< set of equations for solving in FreeGCS
GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints
/// specifies the conflicting constraints are already collected
bool myConfCollected;
- /// list of tangent IDs to check incorrect redundant constraints
- GCS::SET_I myTangent;
+ /// lists of parameters used in the Equal constraints (to avoid multiple equalities)
+ std::list<GCS::SET_pD> myEqualParameters;
+ /// lists of the Equal constraints
+ std::map<ConstraintID, std::set<GCSConstraintPtr> > myEqualConstraints;
};
#endif