- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
- return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, theDx, theDy, theDz));
-}
+ std::shared_ptr<ModelAPI_Feature> aFeature = part->addFeature(FeaturesAPI_Translation::ID());
+ if (!keepSubResults)
+ aFeature->data()->setVersion("");
+
+ static const int VEC_SIZE = 3;
+
+ bool byAxis = axis.variantType() != ModelHighAPI_Selection::VT_Empty;
+ bool byVector = vector.size() == VEC_SIZE;
+ bool byPoints = startPoint.variantType() != ModelHighAPI_Selection::VT_Empty &&
+ endPoint.variantType() != ModelHighAPI_Selection::VT_Empty;
+
+ ModelHighAPI_Selection firstSel, secondSel;
+ ModelHighAPI_Double values[VEC_SIZE];
+ if (byAxis) {
+ firstSel = axis;
+ values[0] = distance;
+ }
+ else if (byVector) {
+ std::list<ModelHighAPI_Double>::const_iterator it = vector.begin();
+ for (ModelHighAPI_Double* vIt = values; it != vector.end(); ++vIt, ++it)
+ *vIt = *it;
+ }
+ else if (byPoints) {
+ firstSel = startPoint;
+ secondSel = endPoint;
+ }
+ else {
+ byVector = deprecated1.first.variantType() == ModelHighAPI_Selection::VT_Empty;
+ if (byVector) {
+ values[0] = deprecated1.second;
+ values[1] = deprecated2.second;
+ values[2] = deprecated3.second;
+ }
+ else {
+ firstSel = deprecated1.first;
+ secondSel = deprecated2.first;
+ values[0] = deprecated2.second;
+ if (secondSel.variantType() == ModelHighAPI_Selection::VT_Empty)
+ byAxis = true;
+ else
+ byPoints = true;
+ }
+ }