From 72cbef5fd473239ab823ea9f99b7221479829c71 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 4 Dec 2019 15:23:31 +0300 Subject: [PATCH] =?utf8?q?Task=20#3059=20implementation:=205.1.1=20When=20?= =?utf8?q?=E2=80=9Cmove=20to=20the=20end=E2=80=9D=20of=20a=20group,=20prop?= =?utf8?q?ose=20to=20the=20user=20a=20new=20group=20update=20mode.=20Copy?= =?utf8?q?=20of=20the=20visualization=20attributes=20to=20the=20divided=20?= =?utf8?q?groups.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../CollectionPlugin_Group.cpp | 15 ++------- .../FeaturesPlugin_BooleanCommon.h | 2 +- .../FeaturesPlugin_BooleanCut.h | 2 +- .../FeaturesPlugin_BooleanFill.h | 2 +- .../FeaturesPlugin_BooleanFuse.h | 2 +- .../FeaturesPlugin_BooleanSmash.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Chamfer.h | 2 +- .../FeaturesPlugin_CompositeBoolean.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Extrusion.h | 2 +- .../FeaturesPlugin_ExtrusionCut.h | 2 +- .../FeaturesPlugin_ExtrusionFuse.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Fillet.h | 2 +- .../FeaturesPlugin_Measurement.h | 2 +- .../FeaturesPlugin_MultiRotation.h | 2 +- .../FeaturesPlugin_MultiTranslation.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Partition.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Pipe.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Placement.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Recover.h | 2 +- .../FeaturesPlugin_RemoveSubShapes.h | 2 +- .../FeaturesPlugin_Revolution.h | 2 +- .../FeaturesPlugin_RevolutionCut.h | 2 +- .../FeaturesPlugin_RevolutionFuse.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Rotation.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Scale.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Symmetry.h | 2 +- .../FeaturesPlugin_Translation.h | 2 +- src/FeaturesPlugin/FeaturesPlugin_Union.h | 2 +- src/ModelAPI/ModelAPI_Tools.cpp | 31 +++++++++++++++++++ src/ModelAPI/ModelAPI_Tools.h | 7 +++++ 30 files changed, 68 insertions(+), 39 deletions(-) diff --git a/src/CollectionPlugin/CollectionPlugin_Group.cpp b/src/CollectionPlugin/CollectionPlugin_Group.cpp index c2110a64e..57a2804e3 100644 --- a/src/CollectionPlugin/CollectionPlugin_Group.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Group.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include CollectionPlugin_Group::CollectionPlugin_Group() @@ -108,6 +109,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) AttributeSelectionListPtr aNewList = aNew->selectionList(LIST_ID()); aNewList->setSelectionType(aList->selectionType()); aNewList->append(anOldAttr->contextObject(), anOldAttr->value()); + aNew->execute(); aResults.push_front(aNew); // to keep the order } aResults.push_back(data()->owner()); @@ -123,18 +125,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) int aResSuf = aSuffix - 1; std::string aResName = findName(firstResult()->data()->name(), aResSuf, aResNames); aFeat->firstResult()->data()->setName(aResName); - // set the same color of result as in origin - if (firstResult()->data()->attribute(ModelAPI_Result::COLOR_ID()).get()) { - AttributeIntArrayPtr aSourceColor = - firstResult()->data()->intArray(ModelAPI_Result::COLOR_ID()); - if (aSourceColor.get() && aSourceColor->size()) { - AttributeIntArrayPtr aDestColor = - aFeat->firstResult()->data()->intArray(ModelAPI_Result::COLOR_ID()); - aDestColor->setSize(aSourceColor->size()); - for(int a = 0; a < aSourceColor->size(); a++) - aDestColor->setValue(a, aSourceColor->value(a)); - } - } + ModelAPI_Tools::copyVisualizationAttrs(firstResult(), aFeat->firstResult()); } } // remove also filters if split performed diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h index 31bb1335d..c4c39566c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h @@ -83,7 +83,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h index 76ffe70b1..c49a47666 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h @@ -49,7 +49,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h index 386cb6ec6..3e8d145e1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h @@ -46,7 +46,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h index a16c8781a..db8c2d01d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h @@ -88,7 +88,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h index ed611c0ae..ffdc4999b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h @@ -62,7 +62,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); public: diff --git a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h index cad7204e9..eea23daf7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h @@ -103,7 +103,7 @@ public: return MY_ANGLE_ID; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index 3c5681de0..13a043468 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -46,7 +46,7 @@ public: return MY_OBJECTS_ID; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean(); protected: diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h index 7a80cc587..1f657b30a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h @@ -133,7 +133,7 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); protected: diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h index 98707995e..674793701 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h @@ -46,7 +46,7 @@ public: return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h index a2daea88a..9ac227643 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h @@ -46,7 +46,7 @@ class FeaturesPlugin_ExtrusionFuse : public FeaturesPlugin_ExtrusionBoolean return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); private: diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h index 1b0cb782f..ac7be4493 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h @@ -95,7 +95,7 @@ public: return START_RADIUS_ID(); } - /// Creates a new part document if needed. + /// Performs the fillet algorithm and stores it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.h b/src/FeaturesPlugin/FeaturesPlugin_Measurement.h index e84668d7d..06e20746f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.h @@ -173,7 +173,7 @@ public: return MY_RESULT_VALUES_ID; } - /// Creates a new part document if needed + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h index f7dc3dc8d..4b3cb965d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h @@ -110,7 +110,7 @@ class FeaturesPlugin_MultiRotation : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h index 9571ed3d2..6f817ce41 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h @@ -104,7 +104,7 @@ class FeaturesPlugin_MultiTranslation : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.h b/src/FeaturesPlugin/FeaturesPlugin_Partition.h index aee69380b..b358831d0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.h @@ -53,7 +53,7 @@ public: return MY_KIND; } - /// Creates a new part document if needed + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h index 078ae9f3c..0ab1a9b6f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h @@ -109,7 +109,7 @@ public: return MY_KIND; } - /// Creates a new part document if needed + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.h b/src/FeaturesPlugin/FeaturesPlugin_Placement.h index 9e1e4db74..d09a0e3fb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.h @@ -86,7 +86,7 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.h b/src/FeaturesPlugin/FeaturesPlugin_Recover.h index 8f2377445..d611bfaf7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.h @@ -88,7 +88,7 @@ class FeaturesPlugin_Recover : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h index 15e51f32b..bfc04d0a8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h @@ -97,7 +97,7 @@ public: /// \param[in] theID identifier of changed attribute. FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); private: diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h index 820ae3471..9fd8ea09c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h @@ -125,7 +125,7 @@ public: return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h index 5a255735a..12ed6b42e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h @@ -46,7 +46,7 @@ public: return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h index 81042b2b2..061b4564c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h @@ -46,7 +46,7 @@ class FeaturesPlugin_RevolutionFuse : public FeaturesPlugin_RevolutionBoolean return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h index c6b80c35a..e16601271 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h @@ -109,7 +109,7 @@ class FeaturesPlugin_Rotation : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.h b/src/FeaturesPlugin/FeaturesPlugin_Scale.h index 873ae6075..a679a0cf8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.h @@ -110,7 +110,7 @@ class FeaturesPlugin_Scale : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h index fb4b47da8..f91f29a2a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h @@ -113,7 +113,7 @@ class FeaturesPlugin_Symmetry : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.h b/src/FeaturesPlugin/FeaturesPlugin_Translation.h index 257c681e0..3437c5be6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.h @@ -130,7 +130,7 @@ class FeaturesPlugin_Translation : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.h b/src/FeaturesPlugin/FeaturesPlugin_Union.h index 797a5573f..9ec3e4322 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.h @@ -50,7 +50,7 @@ public: return MY_KIND; } - /// Creates a new part document if needed + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 29bbb8fe0..1c32b318e 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -834,4 +834,35 @@ double getTransparency(const std::shared_ptr& theResult) } // LCOV_EXCL_STOP +void copyVisualizationAttrs( + std::shared_ptr& theSource, std::shared_ptr& theDest) +{ + // color + AttributeIntArrayPtr aSourceColor = theSource->data()->intArray(ModelAPI_Result::COLOR_ID()); + if (aSourceColor.get() && aSourceColor->isInitialized() && aSourceColor->size()) { + AttributeIntArrayPtr aDestColor = theDest->data()->intArray(ModelAPI_Result::COLOR_ID()); + if (aDestColor.get()) { + aDestColor->setSize(aSourceColor->size()); + for(int a = 0; a < aSourceColor->size(); a++) + aDestColor->setValue(a, aSourceColor->value(a)); + } + } + // deflection + AttributeDoublePtr aSourceDefl = theSource->data()->real(ModelAPI_Result::DEFLECTION_ID()); + if (aSourceDefl.get() && aSourceDefl->isInitialized()) { + AttributeDoublePtr aDestDefl = theDest->data()->real(ModelAPI_Result::DEFLECTION_ID()); + if (aDestDefl.get()) { + aDestDefl->setValue(aSourceDefl->value()); + } + } + // transparency + AttributeDoublePtr aSourceTransp = theSource->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + if (aSourceTransp.get() && aSourceTransp->isInitialized()) { + AttributeDoublePtr aDestTransp = theDest->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); + if (aDestTransp.get()) { + aDestTransp->setValue(aSourceTransp->value()); + } + } +} + } // namespace ModelAPI_Tools diff --git a/src/ModelAPI/ModelAPI_Tools.h b/src/ModelAPI/ModelAPI_Tools.h index 83fbdb888..574f63829 100644 --- a/src/ModelAPI/ModelAPI_Tools.h +++ b/src/ModelAPI/ModelAPI_Tools.h @@ -229,6 +229,13 @@ MODELAPI_EXPORT void getColor(const std::shared_ptr& theResult, */ MODELAPI_EXPORT double getTransparency(const std::shared_ptr& theResult); +/*! Copies all visualization attributes from one result to another. +* \param theSource a result that contains the copied attributes +* \param theDest a destination result that takes the visualization attributes +*/ +MODELAPI_EXPORT void copyVisualizationAttrs(std::shared_ptr& theSource, + std::shared_ptr& theDest); + } #endif -- 2.30.2