X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FPlaneGCSSolver%2FPlaneGCSSolver_PointWrapper.cpp;h=d90d1258d0428c97ae3700ee33a487a105b25c95;hb=77ce6d35ac8d2f0fdaecb4f23e0870bf74e36103;hp=a1e66e5871c1e58650a0f87a9b3a7cbc9918023d;hpb=29f1c8ff3eb53f7ba5dd54ead45d3e55775e5968;p=modules%2Fshaper.git diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp index a1e66e587..d90d1258d 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.cpp @@ -1,61 +1,40 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PlaneGCSSolver_PointWrapper.cpp -// Created: 14 Dec 2015 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2024 CEA, EDF +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #include +#include -PlaneGCSSolver_PointWrapper::PlaneGCSSolver_PointWrapper( - const AttributePtr theAttribute, const GCSPointPtr thePoint) - : myPoint(thePoint), - myID(EID_UNKNOWN) -{ - myBaseAttribute = theAttribute; -} - -void PlaneGCSSolver_PointWrapper::setGroup(const GroupID& theGroup) -{ - myGroup = theGroup; - std::list::iterator aSubsIt = mySubEntities.begin(); - for (; aSubsIt != mySubEntities.end(); ++aSubsIt) - (*aSubsIt)->setGroup(theGroup); - std::list::iterator aPIt = myParameters.begin(); - for (; aPIt != myParameters.end(); ++aPIt) - (*aPIt)->setGroup(theGroup); -} - -bool PlaneGCSSolver_PointWrapper::isUsed(AttributePtr theAttribute) const -{ - return isBase(theAttribute); -} +#include -bool PlaneGCSSolver_PointWrapper::isEqual(const EntityWrapperPtr& theOther) +PlaneGCSSolver_PointWrapper::PlaneGCSSolver_PointWrapper(const GCSPointPtr thePoint) + : myPoint(thePoint) { - if (type() != theOther->type()) - return false; - - // Verify equality of parameters - const std::list& anOtherParams = theOther->parameters(); - if (myParameters.size() != anOtherParams.size()) - return false; - std::list::const_iterator aMyIt = myParameters.begin(); - std::list::const_iterator anOtherIt = anOtherParams.begin(); - for (; aMyIt != myParameters.end(); ++aMyIt, ++anOtherIt) - if (!(*aMyIt)->isEqual(*anOtherIt)) - return false; - return true; } -bool PlaneGCSSolver_PointWrapper::update(const EntityWrapperPtr& theOther) +bool PlaneGCSSolver_PointWrapper::update(AttributePtr theAttribute) { bool isUpdated = false; - std::list aMyParams = parameters(); - std::list anOtherParams = theOther->parameters(); - std::list::const_iterator aMyParIt = aMyParams.begin(); - std::list::const_iterator anOtherParIt = anOtherParams.begin(); - for (; aMyParIt != aMyParams.end() && anOtherParIt != anOtherParams.end(); - ++aMyParIt, ++anOtherParIt) - isUpdated = (*aMyParIt)->update(*anOtherParIt); + std::shared_ptr aPoint2D = + std::dynamic_pointer_cast(theAttribute); + if (aPoint2D) { + isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->x(), *(myPoint->x)) || isUpdated; + isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->y(), *(myPoint->y)) || isUpdated; + } return isUpdated; }