- std::list<ResultPtr>::iterator aContext = aContextes.begin();
- for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
- anObjectsIt++, aContext++) {
-
- if (isPart) { // for part results just set transformation
- ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aContextRes);
- ResultPartPtr aResultPart = document()->copyPart(firstResult(), anOrigin);
- aResultPart->setTrsf(aContextRes, aTrsf);
- setResult(aResultPart);
- } else {
- std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- GeomAlgoAPI_Transform aTransformAlgo(aBaseShape, aTrsf);
-
- // Checking that the algorithm worked properly.
- if(!aTransformAlgo.isDone()) {
- static const std::string aFeatureError = "Transform algorithm failed";
- setError(aFeatureError);
- break;
- }
- if(aTransformAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Resulting shape is Null";
- setError(aShapeError);
- break;
- }
- if(!aTransformAlgo.isValid()) {
- std::string aFeatureError = "Warning: resulting shape is not valid";
- setError(aFeatureError);
- break;
- }
+ std::string anError;
+ for (std::list<ResultPtr>::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) {
+ // Applying transformation to each part.
+ ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
+ aResultPart->setTrsf(aContextRes, aTrsf);
+ setResult(aResultPart, aResultIndex++);
+ }
+
+ // Collect transformations for each object.
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList);
+
+ for(GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin();
+ anObjectsIt != anObjects.end(); anObjectsIt++) {
+ std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
+ std::shared_ptr<GeomAlgoAPI_Transform> aTransformAlgo(
+ new GeomAlgoAPI_Transform(aBaseShape, aTrsf));