-// 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
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
#include <FeaturesPlugin_Tools.h>
-static const std::string SCALE_VERSION_1("v9.5");
+static const std::string SYMMETRY_VERSION_1("v9.5");
//=================================================================================================
FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry()
if (!aSelection->isInitialized()) {
// new feature, not read from file
- data()->setVersion(SCALE_VERSION_1);
+ data()->setVersion(SYMMETRY_VERSION_1);
}
}
void FeaturesPlugin_Symmetry::buildResult(
const std::shared_ptr<GeomAlgoAPI_MakeShapeList>& theAlgo,
const std::list<std::shared_ptr<GeomAPI_Shape> >& theOriginalShapes,
- std::shared_ptr<GeomAPI_Shape> theTargetShape, int& theResultIndex)
+ std::shared_ptr<GeomAPI_Shape> theTargetShape, int& theResultIndex,
+ const ResultPtr& theTextureSource)
{
// Store and name the result.
ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(),
- theAlgo, theTargetShape, "Symmetried");
+ ModelAPI_Tools::loadModifiedShapes(aResultBody, theOriginalShapes, ListOfShape(),
+ theAlgo, theTargetShape, "Symmetried");
+ // Copy image data, if any
+ ModelAPI_Tools::copyImageAttribute(theTextureSource, aResultBody);
setResult(aResultBody, theResultIndex++);
}
}
bool isKeepOriginal = boolean(KEEP_ORIGINAL_RESULT())->value();
- bool isKeepSubShapes = data()->version() == SCALE_VERSION_1;
+ bool isKeepSubShapes = data()->version() == SYMMETRY_VERSION_1;
// Getting objects.
GeomAPI_ShapeHierarchy anObjects;
std::list<ResultPtr> aParts;
+ ResultPtr aTextureSource;
AttributeSelectionListPtr anObjSelList = selectionList(OBJECTS_LIST_ID());
if (!FeaturesPlugin_Tools::shapesFromSelectionList(
- anObjSelList, isKeepSubShapes, anObjects, aParts))
+ anObjSelList, isKeepSubShapes, anObjects, aParts, aTextureSource))
return;
std::string anError;
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt)
- buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex);
+ buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex, aTextureSource);
// Remove the rest results if there were produced in the previous pass.
removeResults(aResultIndex);