+ // Fill lists of coordinates of points composing a feature
+ std::list<double> aX, aY;
+ std::list<double>::iterator aXIt, aYIt;
+ double aXCoord, aYCoord;
+ EntityWrapperPtr anEntity = myStorage->entity(aFeature);
+ std::list<EntityWrapperPtr> aSubs = anEntity->subEntities();
+ std::list<EntityWrapperPtr>::const_iterator aSIt = aSubs.begin();
+ for (; aSIt != aSubs.end(); ++aSIt) {
+ if ((*aSIt)->type() != ENTITY_POINT)
+ continue;
+ std::list<ParameterWrapperPtr> aParameters = (*aSIt)->parameters();
+ aXCoord = aParameters.front()->value();
+ aYCoord = aParameters.back()->value();
+ getRelative(aXCoord, aYCoord, aXCoord, aYCoord);
+ aX.push_back(aXCoord);
+ aY.push_back(aYCoord);
+ }
+
+ // Calculate positions of copied features
+ for (int i = 0; i < myNumberOfCopies && anObjIt != anObjectList.end(); ++i, ++anObjIt) {
+ aFeature = ModelAPI_Feature::feature(*anObjIt);
+ if (!aFeature)
+ continue;
+ anEntity = myStorage->entity(aFeature);
+
+ if (!anEntity || !myStorage->isEventsBlocked())
+ aFeature->data()->blockSendAttributeUpdated(true);
+
+ std::list<AttributePtr> aPoints;
+ if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
+ aPoints.push_back(aFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
+ aPoints.push_back(aFeature->attribute(SketchPlugin_Arc::START_ID()));
+ aPoints.push_back(aFeature->attribute(SketchPlugin_Arc::END_ID()));
+ } else if (aFeature->getKind() == SketchPlugin_Line::ID()) {
+ aPoints.push_back(aFeature->attribute(SketchPlugin_Line::START_ID()));
+ aPoints.push_back(aFeature->attribute(SketchPlugin_Line::END_ID()));
+ } else
+ aPoints = aFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
+
+ std::list<AttributePtr>::iterator aPtIt = aPoints.begin();
+ for (aXIt = aX.begin(), aYIt = aY.begin(); aPtIt != aPoints.end(); ++aXIt, ++aYIt, ++aPtIt) {
+ transformRelative(*aXIt, *aYIt);
+ getAbsolute(*aXIt, *aYIt, aXCoord, aYCoord);
+
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*aPtIt);
+ aPoint2D->setValue(aXCoord, aYCoord);
+ }
+
+ // update feature in the storage if it is used by another constraints
+ if (anEntity)
+ myStorage->update(aFeature);
+
+ if (!anEntity || !myStorage->isEventsBlocked())
+ aFeature->data()->blockSendAttributeUpdated(false);
+ }
+ }