+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
+ if (aResult.get() == NULL)
+ continue;
+
+ isFoundResultType = theTypes.find(aResult->groupName()) != theTypes.end();
+ if (isFoundResultType)
+ break;
+ }
+ return isFoundResultType;
+}
+
+//**************************************************************
+bool XGUI_Workshop::canChangeColor() const
+{
+ QObjectPtrList aObjects = mySelector->selection()->selectedObjects();
+
+ std::set<std::string> aTypes;
+ aTypes.insert(ModelAPI_ResultGroup::group());
+ aTypes.insert(ModelAPI_ResultConstruction::group());
+ aTypes.insert(ModelAPI_ResultBody::group());
+ aTypes.insert(ModelAPI_ResultPart::group());
+
+ return hasResults(aObjects, aTypes);
+}
+
+void setColor(ResultPtr theResult, std::vector<int>& theColor)
+{
+ if (!theResult.get())
+ return;
+
+ AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
+ if (aColorAttr.get() != NULL) {
+ if (!aColorAttr->size()) {
+ aColorAttr->setSize(3);
+ }
+ aColorAttr->setValue(0, theColor[0]);
+ aColorAttr->setValue(1, theColor[1]);
+ aColorAttr->setValue(2, theColor[2]);
+ }
+}
+
+//**************************************************************
+void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects)
+{
+ AttributeIntArrayPtr aColorAttr;
+ // 1. find the current color of the object. This is a color of AIS presentation
+ // The objects are iterated until a first valid color is found
+ std::vector<int> aColor;
+ foreach(ObjectPtr anObject, theObjects) {
+ if (anObject->groupName() == ModelAPI_ResultPart::group()) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(anObject);
+ DocumentPtr aPartDoc = aPart->partDoc();
+ // the document should be checked on null, because in opened document if the part
+ // has not been activated yet, the part document is empty
+ if (!aPartDoc.get()) {
+ emit errorOccurred(QString::fromLatin1("Color can not be changed on a part with an empty document"));