-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
std::shared_ptr<GeomDataAPI_Point2DArray> anAttribute =
std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(theAttribute);
+ std::vector<PointWrapperPtr> aPointsArray = aWrapper->array();
+ std::vector<PointWrapperPtr>::iterator aPos = aPointsArray.begin();
if (aWrapper->size() != anAttribute->size()) {
- std::vector<PointWrapperPtr> aPointsArray = aWrapper->array();
while (anAttribute->size() > (int)aPointsArray.size()) {
// add points to the middle of array
- aPointsArray.insert(--aPointsArray.end(), createPoint(GeomPnt2dPtr(), myStorage));
+ GeomPnt2dPtr aValue;
+ for (; aPos != aPointsArray.end(); ++aPos) {
+ aValue = anAttribute->pnt(aPos - aPointsArray.begin());
+ if (aValue->distance(PlaneGCSSolver_Tools::point(*aPos)) > tolerance)
+ break;
+ }
+ int aShift = aPos - aPointsArray.begin();
+ aPointsArray.insert(aPos, createPoint(aValue, myStorage));
+ aPos = aPointsArray.begin() + aShift;
}
while (anAttribute->size() < (int)aPointsArray.size()) {
aWrapper->setArray(aPointsArray);
}
+ else {
+ // update coordinates of points
+ for (int anIndex = 0; aPos != aPointsArray.end(); ++aPos, ++anIndex) {
+ const GCSPointPtr& aGCSPoint = (*aPos)->point();
+ GeomPnt2dPtr aCoord = anAttribute->pnt(anIndex);
+ *aGCSPoint->x = aCoord->x();
+ *aGCSPoint->y = aCoord->y();
+ }
+ }
}
else if (theEntity->type() == ENTITY_SCALAR_ARRAY) {
std::shared_ptr<PlaneGCSSolver_ScalarArrayWrapper> aWrapper =
aParamsToRemove = PlaneGCSSolver_Tools::parameters(aWrapper);
std::shared_ptr<PlaneGCSSolver_ScalarArrayWrapper> aNewArray =
std::dynamic_pointer_cast<PlaneGCSSolver_ScalarArrayWrapper>(
- createAttribute(theAttribute));
+ createScalarArray(theAttribute, myStorage));
aWrapper->setArray(aNewArray->array());
isUpdated = true;
}