X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSketchSolver%2FSketchSolver_Group.cpp;h=2b2df9856d5da54cad0fd6f12110bb9bf5b78244;hb=a74fbd0025bc36fc76b5559d960857f419446ecb;hp=2662f564de0453be83fbed8d288390117bf776cd;hpb=3112785d49cbff9374fe01fb172ae30d2b4d63c1;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 2662f564d..2b2df9856 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -164,10 +164,11 @@ static SolverConstraintPtr move(StoragePtr theStorage, int theSketchDOF, bool theEventsBlocked, Type theFeatureOrPoint, + const EntityWrapperPtr& theSolverEntity, const std::shared_ptr& theFrom, const std::shared_ptr& theTo) { - bool isEntityExists = (theStorage->entity(theFeatureOrPoint).get() != 0); + bool isEntityExists = (theSolverEntity.get() != 0); if (theSketchDOF == 0 && isEntityExists) { // avoid moving elements of fully constrained sketch theStorage->refresh(); @@ -196,18 +197,29 @@ bool SketchSolver_Group::moveFeature(FeaturePtr theFeature, const std::shared_ptr& theFrom, const std::shared_ptr& theTo) { - SolverConstraintPtr aConstraint = - move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, theFeature, theFrom, theTo); + EntityWrapperPtr anEntity = myStorage->entity(theFeature); + SolverConstraintPtr aConstraint = move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, + theFeature, anEntity, theFrom, theTo); setTemporary(aConstraint); return true; } bool SketchSolver_Group::movePoint(AttributePtr theAttribute, + const int thePointIndex, const std::shared_ptr& theFrom, const std::shared_ptr& theTo) { - SolverConstraintPtr aConstraint = - move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, theAttribute, theFrom, theTo); + EntityWrapperPtr anEntity = myStorage->entity(theAttribute); + SolverConstraintPtr aConstraint; + if (thePointIndex < 0) { + aConstraint = move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, + theAttribute, anEntity, theFrom, theTo); + } + else { + aConstraint = move(myStorage, mySketchSolver, myDOF, myIsEventsBlocked, + std::pair(theAttribute, thePointIndex), anEntity, + theFrom, theTo); + } setTemporary(aConstraint); return true; } @@ -323,8 +335,9 @@ bool SketchSolver_Group::resolveConstraints() } } - // show degrees of freedom only if the degenerated geometry appears - if (aResult == PlaneGCSSolver_Solver::STATUS_DEGENERATED) + // show degrees of freedom only if the degenerated geometry appears, + // or if DoF is not computed yet + if (aResult == PlaneGCSSolver_Solver::STATUS_DEGENERATED || myDOF < 0) computeDoF(); } @@ -497,7 +510,7 @@ bool SketchSolver_Group::areConstraintsValid() const return true; } -void SketchSolver_Group::underconstrainedFeatures(std::set& theFeatures) const +void SketchSolver_Group::underconstrainedFeatures(std::set& theFeatures) const { myStorage->getUnderconstrainedGeometry(theFeatures); }