1 // Copyright (C) 2019-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <PlaneGCSSolver_PointArrayWrapper.h>
21 #include <PlaneGCSSolver_Tools.h>
23 #include <GeomDataAPI_Point2DArray.h>
25 #include <GeomAPI_Pnt2d.h>
27 PlaneGCSSolver_PointArrayWrapper::PlaneGCSSolver_PointArrayWrapper(
28 const std::vector<PointWrapperPtr>& thePoints)
33 bool PlaneGCSSolver_PointArrayWrapper::update(AttributePtr theAttribute)
35 bool isUpdated = false;
36 std::shared_ptr<GeomDataAPI_Point2DArray> aPointArray =
37 std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(theAttribute);
38 if (aPointArray && aPointArray->size() == (int)myPoints.size()) {
39 std::vector<PointWrapperPtr>::iterator aPIt = myPoints.begin();
40 for (int anIndex = 0; aPIt != myPoints.end(); ++aPIt, ++anIndex) {
41 GeomPnt2dPtr aPnt = aPointArray->pnt(anIndex);
43 const GCSPointPtr& aGCSPoint = (*aPIt)->point();
44 isUpdated = PlaneGCSSolver_Tools::updateValue(aPnt->x(), *(aGCSPoint->x)) || isUpdated;
45 isUpdated = PlaneGCSSolver_Tools::updateValue(aPnt->y(), *(aGCSPoint->y)) || isUpdated;