-// 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 <PlaneGCSSolver_PointWrapper.h>
+#include <PlaneGCSSolver_Tools.h>
-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<EntityWrapperPtr>::iterator aSubsIt = mySubEntities.begin();
- for (; aSubsIt != mySubEntities.end(); ++aSubsIt)
- (*aSubsIt)->setGroup(theGroup);
- std::list<ParameterWrapperPtr>::iterator aPIt = myParameters.begin();
- for (; aPIt != myParameters.end(); ++aPIt)
- (*aPIt)->setGroup(theGroup);
-}
-
-bool PlaneGCSSolver_PointWrapper::isUsed(AttributePtr theAttribute) const
-{
- return isBase(theAttribute);
-}
+#include <GeomDataAPI_Point2D.h>
-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<ParameterWrapperPtr>& anOtherParams = theOther->parameters();
- if (myParameters.size() != anOtherParams.size())
- return false;
- std::list<ParameterWrapperPtr>::const_iterator aMyIt = myParameters.begin();
- std::list<ParameterWrapperPtr>::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<ParameterWrapperPtr> aMyParams = parameters();
- std::list<ParameterWrapperPtr> anOtherParams = theOther->parameters();
- std::list<ParameterWrapperPtr>::const_iterator aMyParIt = aMyParams.begin();
- std::list<ParameterWrapperPtr>::const_iterator anOtherParIt = anOtherParams.begin();
- for (; aMyParIt != aMyParams.end() && anOtherParIt != anOtherParams.end();
- ++aMyParIt, ++anOtherParIt)
- isUpdated = (*aMyParIt)->update(*anOtherParIt);
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
+ if (aPoint2D) {
+ isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->x(), *(myPoint->x)) || isUpdated;
+ isUpdated = PlaneGCSSolver_Tools::updateValue(aPoint2D->y(), *(myPoint->y)) || isUpdated;
+ }
return isUpdated;
}