]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'asozinov/subshape_color' into dish/CR35154--Edge_Thickness
authordish <dmitrii.shvydkoi@opencascade.com>
Tue, 11 Jun 2024 21:22:49 +0000 (21:22 +0000)
committerdish <dmitrii.shvydkoi@opencascade.com>
Tue, 11 Jun 2024 21:22:49 +0000 (21:22 +0000)
# Conflicts:
# src/Model/Model_Objects.cpp
# src/Model/Model_Objects.h
# src/Model/Model_ResultBody.cpp
# src/Model/Model_ResultPart.cpp
# src/Model/Model_ResultPart.h
# src/ModelAPI/ModelAPI_ResultPart.h
# src/ModelAPI/ModelAPI_Tools.cpp
# src/ModelAPI/ModelAPI_Tools.h
# src/ModelHighAPI/ModelHighAPI_Dumper.cpp
# src/PartSet/PartSet_Module.cpp
# src/XGUI/XGUI_Selection.h

22 files changed:
1  2 
src/GeomAPI/GeomAPI_AISObject.cpp
src/GeomAPI/GeomAPI_AISObject.h
src/Model/Model_Document.h
src/Model/Model_Objects.cpp
src/Model/Model_Objects.h
src/Model/Model_ResultBody.cpp
src/Model/Model_ResultBody.h
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h
src/ModelAPI/ModelAPI_Document.h
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_ResultPart.h
src/ModelAPI/ModelAPI_Tools.cpp
src/ModelAPI/ModelAPI_Tools.h
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ModelHighAPI/ModelHighAPI_Dumper.h
src/ModelHighAPI/ModelHighAPI_Selection.cpp
src/ModelHighAPI/ModelHighAPI_Selection.h
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

Simple merge
Simple merge
index e54310864bb41747e194f1e88a442bdf1bd8b70d,f8e40c76076aac92441d99c5273f1f23bad4b39a..7fe1e21ebdea0a976fdca7aaab6322768775625b
@@@ -146,15 -146,14 +146,22 @@@ class Model_Document : public ModelAPI_
    //! \returns index started from zero, or -1 if object is invisible or belongs to another document
    MODEL_EXPORT virtual const int index(std::shared_ptr<ModelAPI_Object> theObject,
                                         const bool theAllowFolder = false);
+   //! Returns the shape index in the result.
+   //! \param theResult result
+   //! \param theShape result subshape
+   //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result
+   MODEL_EXPORT virtual const int index(std::shared_ptr<ModelAPI_Result> theResult,
+     std::shared_ptr<GeomAPI_Shape> theShape,
+     const bool theAllowFolder = false);
  
 +  //! Returns the shape index in the result.
 +  //! \param theResult result
 +  //! \param theShape result subshape
 +  //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result
 +  MODEL_EXPORT virtual const int index(std::shared_ptr<ModelAPI_Result> theResult,
 +    std::shared_ptr<GeomAPI_Shape> theShape,
 +    const bool theAllowFolder = false);
 +
    //! Internal sub-document by ID
    MODEL_EXPORT virtual std::shared_ptr<Model_Document> subDoc(int theDocID);
  
index 48a01961fb2d6def5c4a2f9511feb5ae29185b62,7fc1ba3c1c0accfad6c76a3318fe4e07559b5be8..cd69e162341fc01ff35f700842429355072639d6
  #include <TDF_CopyLabel.hxx>
  #include <TDF_ListIteratorOfLabelList.hxx>
  
+ // relocate to other file
+ #include <TNaming_Builder.hxx>
+ #include <TNaming_NamedShape.hxx>
++// relocate to other file
++#include <TNaming_Builder.hxx>
++#include <TNaming_NamedShape.hxx>
++
 +#include <TNaming_Builder.hxx>
 +#include <TNaming_NamedShape.hxx>
 +
  #if OCC_VERSION_LARGE < 0x07080000
  #include <TDF_LabelMapHasher.hxx>
  // for TDF_Label map usage
  static Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper);
  static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2);
@@@ -832,82 -824,85 +842,150 @@@ Handle(TDF_Attribute) Model_Objects::ge
    aMain = ModelAPI_Tools::mainBody(aMain);
  
    int anIndex = index(theResult, theShape);
 -  Handle(TDataStd_IntegerArray) anColor;
 -
 -  if (anIndex != -1)
 -  {
 -    TDF_Label aResultLabel;
 -    if (aMain.get())
 -      aResultLabel = resultLabel(theResult->data(), index(aMain));
 -    else
 -      aResultLabel = resultLabel(theResult->data(), index(theResult));
 -
 -    TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, anIndex).FindChild(TAG_FEATURE_ARGUMENTS);
 -    anAttributeLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anColor);
 +  if (anIndex == -1) {
 +    return opencascade::handle<TDF_Attribute>(nullptr);
    }
 -  return anColor;
 +
 +  TDF_Label aResultLabel;
 +  if (aMain.get())
 +    aResultLabel = resultLabel(theResult->data(), index(aMain));
 +  else
 +    aResultLabel = resultLabel(theResult->data(), index(theResult));
 +
 +  TDF_Label anAttributeLabel = subShapeLabel(aResultLabel, anIndex).FindChild(TAG_FEATURE_ARGUMENTS);
 +
 +  Handle(TDF_Attribute) anAttr;
-   anAttributeLabel.FindAttribute(theID, anAttr);
++  anAttributeLabel.FindAttribute(theID, anAttr); // ? TDataStd_IntegerArray::GetID() or TDataStd_Integer::GetID()
 +  return anAttr;
  }
  
+ void Model_Objects::getColoredShapes(const std::shared_ptr<ModelAPI_Result> theResult,
+   std::map<std::shared_ptr<GeomAPI_Shape>, std::vector<int>>& theColoredShapes)
+ {
+   ResultBodyPtr aMainBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
+   aMainBody = ModelAPI_Tools::mainBody(aMainBody);
+   TDF_Label aShapesLabel;
+   if (aMainBody.get())
+     aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(aMainBody)));
+   else
+     aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(theResult)));
+   for (TDF_ChildIterator aChilds(aShapesLabel); aChilds.More(); aChilds.Next())
+   {
+     TDF_Label aCurSubShape = aChilds.Value();
+     Handle(TNaming_NamedShape) aNamedShape;
+     aCurSubShape.FindAttribute(TNaming_NamedShape::GetID(), aNamedShape);
+     if (aNamedShape.IsNull())
+       continue;
+     std::shared_ptr<GeomAPI_Shape> aSub(new GeomAPI_Shape);
+     aSub->setImpl(new TopoDS_Shape(aNamedShape->Get()));
+     Handle(TDataStd_IntegerArray) aColorAttr;
+     std::vector<int> aColor;
+     aCurSubShape.FindChild(TAG_FEATURE_ARGUMENTS).FindAttribute(TDataStd_IntegerArray::GetID(), aColorAttr);
+     if (aColorAttr.IsNull())
+       continue;
+     for (int anIndex = aColorAttr->Lower(); anIndex <= aColorAttr->Upper(); ++anIndex)
+       aColor.push_back(aColorAttr->Value(anIndex));
+     if (aColor.size() != 3)
+       continue;
+     theColoredShapes[aSub] = aColor;
+   }
+ }
+ void Model_Objects::removeShapeColors(const std::shared_ptr<ModelAPI_Result> theResult)
+ {
+   ResultBodyPtr aMainBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
+   aMainBody = ModelAPI_Tools::mainBody(aMainBody);
+   TDF_Label aShapesLabel;
+   if (aMainBody.get())
+     aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(aMainBody)));
+   else
+   {
+     ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theResult);
+     if (!aResPart.get())
+       return;
+     aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(aResPart)));
+   }
+   for (TDF_ChildIterator aChilds(aShapesLabel); aChilds.More(); aChilds.Next())
+   {
+     TDF_Label aCurSubShape = aChilds.Value();
+     Handle(TNaming_NamedShape) aNamedShape;
+     aCurSubShape.FindAttribute(TNaming_NamedShape::GetID(), aNamedShape);
+     if (aNamedShape.IsNull())
+       continue;
+     aCurSubShape.FindChild(TAG_FEATURE_ARGUMENTS).ForgetAttribute(TDataStd_IntegerArray::GetID());
+   }
+ }
++TDF_Label Model_Objects::shapesFromResult(TDF_Label theResult) const
++{
++  return theResult.Father().FindChild(TAG_RESULT_SHAPES);
++}
++
 +void Model_Objects::getSubShapesWithEdgeThickness(
 +  const std::shared_ptr<ModelAPI_Result> theResult,
 +  std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes
 +) const {
 +  ResultBodyPtr aMainBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
 +  aMainBody = ModelAPI_Tools::mainBody(aMainBody);
 +  TDF_Label aShapesLabel;
 +  if (aMainBody.get())
 +    aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(aMainBody)));
 +  else
 +    aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(theResult)));
 +
 +  for (TDF_ChildIterator aChilds(aShapesLabel); aChilds.More(); aChilds.Next())
 +  {
 +    TDF_Label aCurSubShape = aChilds.Value();
 +    Handle(TNaming_NamedShape) aNamedShape;
 +    aCurSubShape.FindAttribute(TNaming_NamedShape::GetID(), aNamedShape);
 +    if (aNamedShape.IsNull())
 +      continue;
 +
 +    std::shared_ptr<GeomAPI_Shape> aSub(new GeomAPI_Shape);
 +    aSub->setImpl(new TopoDS_Shape(aNamedShape->Get()));
 +
 +    Handle(TDataStd_Integer) aEdgeThicknessAttr;
 +    aCurSubShape.FindChild(TAG_FEATURE_ARGUMENTS).FindAttribute(TDataStd_Integer::GetID(), aEdgeThicknessAttr);
 +    if (aEdgeThicknessAttr.IsNull())
 +      continue;
 +
 +    oShapes[aSub] = aEdgeThicknessAttr->Get();
 +  }
 +}
 +
 +void Model_Objects::removeSubShapeEdgeThickness(const std::shared_ptr<ModelAPI_Result> theResult) const
 +{
 +  ResultBodyPtr aMainBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
 +  aMainBody = ModelAPI_Tools::mainBody(aMainBody);
 +
 +  TDF_Label aShapesLabel;
 +  if (aMainBody.get())
 +    aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(aMainBody)));
 +  else
 +  {
 +    ResultPartPtr aResPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theResult);
 +    if (!aResPart.get())
 +      return;
 +    aShapesLabel = shapesFromResult(resultLabel(theResult->data(), index(aResPart)));
 +  }
 +  for (TDF_ChildIterator aChilds(aShapesLabel); aChilds.More(); aChilds.Next())
 +  {
 +    TDF_Label aCurSubShape = aChilds.Value();
 +    Handle(TNaming_NamedShape) aNamedShape;
 +    aCurSubShape.FindAttribute(TNaming_NamedShape::GetID(), aNamedShape);
 +    if (aNamedShape.IsNull())
 +      continue;
 +
 +    aCurSubShape.FindChild(TAG_FEATURE_ARGUMENTS).ForgetAttribute(TDataStd_Integer::GetID());
 +  }
 +}
 +
  static std::wstring composeName(const std::string& theFeatureKind, const int theIndex)
  {
    std::stringstream aNameStream;
index b0ce8b4fe798f772fe143979ca2a225a261e3ff2,364a3dddd3e66f6d7209a5b9334728c478667ca6..42ec31c5622055bdf1b0512198b08d4920c05cfe
@@@ -199,12 -199,12 +199,18 @@@ class Model_Object
      std::shared_ptr<ModelAPI_Result> theResult,
      std::shared_ptr<GeomAPI_Shape> theShape);
  
 +  void getSubShapesWithEdgeThickness(
 +    const std::shared_ptr<ModelAPI_Result> theResult,
 +    std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes
 +  ) const;
 +
 +  void removeSubShapeEdgeThickness(const std::shared_ptr<ModelAPI_Result> theResult) const;
+   //! Get colored shapes from result
+   void getColoredShapes(const std::shared_ptr<ModelAPI_Result> theResult,
+     std::map<std::shared_ptr<GeomAPI_Shape>, std::vector<int>>& theColoredShapes);
+   //! Forget subshape colors
+   void removeShapeColors(const std::shared_ptr<ModelAPI_Result> theResult);
  
    //! Sets the owner of this manager
    void setOwner(DocumentPtr theDoc);
index c3915e4283957e5aca0f7aba3f438361f7c592ac,6dc5538ef5046103f857671c1b94c66f44f3bfe2..8c2a2af58ec5c79b58c9e641e80d9952bfae6857
@@@ -253,51 -255,8 +255,94 @@@ void Model_ResultBody::updateConcealmen
    }
  }
  
- void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector<int>& color) {
 +void Model_ResultBody::setSubShapeEdgeThickness(
 +  const std::shared_ptr<ModelAPI_Result> theResult,
 +  const std::shared_ptr<GeomAPI_Shape> theSubShape,
 +  int theEdgeThickness
 +)
 +{
 +  TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
 +  TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
 +  if (!shape()->isSubShape(theSubShape))
 +    return;
 +
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +  document()->storeShape(data(), theResult, theSubShape);
 +
 +  Handle(TDataStd_Integer) aThickness = new TDataStd_Integer();
 +  aThickness->Set(theEdgeThickness);
 +  anObjects->setAttribute(aThickness, theResult, theSubShape);
 +}
 +
 +int Model_ResultBody::getSubShapeEdgeThickness(const std::shared_ptr<ModelAPI_Result> theResult, const std::shared_ptr<GeomAPI_Shape> theSubShape) const
 +{
 +  TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
 +  TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
 +  if (!shape()->isSubShape(theSubShape))
 +    return -1;
 +
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +  auto anAttr = Handle(TDataStd_Integer)::DownCast(anObjects->getAttribute(TDataStd_Integer::GetID(), theResult, theSubShape));
 +  if (anAttr.IsNull())
 +    return;
 +
 +  return anAttr->Get();
 +}
 +
 +void Model_ResultBody::getSubShapesWithEdgeThickness(
 +  const std::shared_ptr<ModelAPI_Result> theResult,
 +  std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes
 +) const
 +{
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +  anObjects->getSubShapesWithEdgeThickness(theResult, oShapes);
 +}
 +
++void Model_ResultBody::setSubShapeEdgeThickness(
++  const std::shared_ptr<ModelAPI_Result> theResult,
++  const std::shared_ptr<GeomAPI_Shape> theSubShape,
++  int theEdgeThickness
++)
++{
++  TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
++  TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
++  if (!shape()->isSubShape(theSubShape))
++    return;
++
++  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
++  document()->storeShape(data(), theResult, theSubShape);
++
++  Handle(TDataStd_Integer) aThickness = new TDataStd_Integer();
++  aThickness->Set(theEdgeThickness);
++  anObjects->setAttribute(aThickness, theResult, theSubShape);
++}
++
++int Model_ResultBody::getSubShapeEdgeThickness(const std::shared_ptr<ModelAPI_Result> theResult, const std::shared_ptr<GeomAPI_Shape> theSubShape) const
++{
++  TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
++  TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
++  if (!shape()->isSubShape(theSubShape))
++    return -1;
++
++  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
++  auto anAttr = Handle(TDataStd_Integer)::DownCast(anObjects->getAttribute(TDataStd_Integer::GetID(), theResult, theSubShape));
++  if (anAttr.IsNull())
++    return;
 +
++  return anAttr->Get();
++}
++
++void Model_ResultBody::getSubShapesWithEdgeThickness(
++  const std::shared_ptr<ModelAPI_Result> theResult,
++  std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes
++) const
++{
++  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
++  anObjects->getSubShapesWithEdgeThickness(theResult, oShapes);
++}
++
+ void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector<int>& color)
+ {
    if (myColorsShape.find(theName) == myColorsShape.end())
      myColorsShape[ theName ] =  color;
  }
Simple merge
index 91fdda8b54749b0799b3296ee38652590345f59b,5f46da1783162885fdcd4b2fc8e8cde178c99d68..e44fb02ab67f54889b5eec2897a56b4c4062f324
@@@ -46,7 -45,7 +47,8 @@@
  #include <TNaming_Tool.hxx>
  #include <TNaming_NamedShape.hxx>
  #include <TDataStd_Name.hxx>
 +#include <TDataStd_Integer.hxx>
+ #include <TDataStd_IntegerArray.hxx>
  #include <TopoDS_Compound.hxx>
  #include <BRep_Builder.hxx>
  #include <TopExp_Explorer.hxx>
@@@ -434,48 -439,57 +443,99 @@@ std::shared_ptr<GeomAPI_Shape> Model_Re
    return aResult;
  }
  
 +void Model_ResultPart::setSubShapeEdgeThickness(const std::shared_ptr<GeomAPI_Shape>& theSubShape, int theThickness)
 +{
 +  TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
 +  TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
 +  if (!shape()->isSubShape(theSubShape))
 +    return;
 +
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +
 +  document()->storeShape(data(), original(), theSubShape);
 +  Handle(TDataStd_Integer) aThickness = new TDataStd_Integer();
 +  aThickness->Set(theThickness);
 +  anObjects->setAttribute(aThickness, original(), theSubShape);
 +}
 +
 +int Model_ResultPart::getSubShapeEdgeThickness(const std::shared_ptr<GeomAPI_Shape>& theSubShape) const
 +{
 +  TopoDS_Shape aShape = shape()->impl<TopoDS_Shape>();
 +  TopoDS_Shape aSubShape = theSubShape->impl<TopoDS_Shape>();
 +  if (!shape()->isSubShape(theSubShape))
 +    return;
 +
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +  Handle(TDataStd_Integer) anAttr = Handle(TDataStd_Integer)::DownCast(anObjects->getAttribute(TDataStd_Integer::GetID(), original(), theSubShape));
 +  if (anAttr.IsNull())
 +    return;
 +
 +  return anAttr->Get();
 +}
 +
 +void Model_ResultPart::getSubShapesWithEdgeThickness(std::map<std::shared_ptr<GeomAPI_Shape>, int>& oShapes)
 +{
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +  anObjects->getSubShapesWithEdgeThickness(original(), oShapes);
 +}
 +
 +void Model_ResultPart::removeSubShapeEdgeThickness()
 +{
 +  Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
 +  anObjects->removeSubShapeEdgeThickness(original());
 +}
 +
+ void Model_ResultPart::setSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
+   const std::vector<int>& theColor)
+ {
+   TopoDS_Shape aShape = this->shape()->impl<TopoDS_Shape>();
+   TopoDS_Shape aSubShape = theShape->impl<TopoDS_Shape>();
+   if (!this->shape()->isSubShape(theShape))
+     return;
+   Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
+   document()->storeShape(data(), original(), theShape);
+   Handle(TDataStd_IntegerArray) aColor = new TDataStd_IntegerArray();
+   aColor->Init(0, 2);
+   aColor->SetValue(0, theColor[0]);
+   aColor->SetValue(1, theColor[1]);
+   aColor->SetValue(2, theColor[2]);
+   anObjects->setAttribute(aColor, original(), theShape);
+ }
+ void Model_ResultPart::getSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
+   std::vector<int>& theColor)
+ {
+   TopoDS_Shape aShape = this->shape()->impl<TopoDS_Shape>();
+   TopoDS_Shape aSubShape = theShape->impl<TopoDS_Shape>();
+   if (!this->shape()->isSubShape(theShape))
+     return;
+   Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
+   Handle(TDataStd_IntegerArray) anAttr = Handle(TDataStd_IntegerArray)::DownCast(
+     anObjects->getAttribute(TDataStd_IntegerArray::GetID(), original(), theShape));
+   if (anAttr.IsNull())
+     return;
+   for (int anIndex = anAttr->Lower(); anIndex <= anAttr->Upper(); ++anIndex)
+     theColor.push_back(anAttr->Value(anIndex));
+   if (theColor.size() != 3)
+     theColor.clear();
+ }
+ void Model_ResultPart::getColoredShapes(std::map<std::shared_ptr<GeomAPI_Shape>,
+   std::vector<int>>&theColoredShapes)
+ {
+   Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
+   anObjects->getColoredShapes(original(), theColoredShapes);
+ }
+ void Model_ResultPart::removeShapeColors()
+ {
+   Model_Objects* anObjects = std::dynamic_pointer_cast<Model_Document>(document())->objects();
+   anObjects->removeShapeColors(original());
+ }
  std::shared_ptr<GeomAPI_Shape> Model_ResultPart::selectionValue(const int theIndex)
  {
    std::shared_ptr<GeomAPI_Shape> aResult;
index 7c1d2551ff6a6068897dbcd9676052aa2a0fca1e,2ba7d9ac9c427efadcc0c51e2878203edf67fe75..38a0cfc1dbd893630661aa51d0fcc49cff15af62
@@@ -77,16 -78,21 +78,30 @@@ class Model_ResultPart : public ModelAP
    MODEL_EXPORT virtual bool updateInPart(const int theIndex);
    /// Returns the shape by the name in the part
    MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
-     const std::wstring& theName, const std::string& theType, int& theIndex);
+     const std::wstring& theName, const std::string& theType, int& theIndex);  /// Set color on subshape
+   MODEL_EXPORT virtual void setSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
+     const std::vector<int>& theColor);
+   /// Get color on subshape
+   MODEL_EXPORT virtual void getSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
+     std::vector<int>& theColor);
+   /// Get colored shapes from result
+   MODEL_EXPORT virtual void getColoredShapes(std::map<std::shared_ptr<GeomAPI_Shape>,
+     std::vector<int>>&theColoredShapes);
+   /// Forget subshape colors
+   MODEL_EXPORT virtual void removeShapeColors();
 +
 +  MODEL_EXPORT virtual void setSubShapeEdgeThickness(const std::shared_ptr<GeomAPI_Shape>& theSubShape, int theThickness);
 +
 +  MODEL_EXPORT virtual int getSubShapeEdgeThickness(const std::shared_ptr<GeomAPI_Shape>& theSubShape) const;
 +
 +  MODEL_EXPORT virtual void getSubShapesWithEdgeThickness(std::map<std::shared_ptr<GeomAPI_Shape>, int>& oSubShapes);
 +
 +  MODEL_EXPORT virtual void removeSubShapeEdgeThickness();
 +
    /// Updates the selection inside of the part as a geometrical selection
    MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName);
    /// Updates the shape-result of the part (called on Part feature execution)
index f07b86c5d064e02bef6efa8c0f878ae6a3115ca0,64f638942c6ffd98d6fbade2927ac07b72f1f063..da907084d867f657f44ec6d89f24dcffb25c0d23
@@@ -108,15 -109,14 +109,22 @@@ public
    //! \returns index started from zero, or -1 if object is invisible or belongs to another document
    virtual const int index(std::shared_ptr<ModelAPI_Object> theObject,
                            const bool theAllowFolder = false) = 0;
+   //! Returns the shape index in the result.
+   //! \param theResult result
+   //! \param theShape result subshape
+   //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result
+   virtual const int index(std::shared_ptr<ModelAPI_Result> theResult,
+     std::shared_ptr<GeomAPI_Shape> theShape,
+     const bool theAllowFolder = false) = 0;
  
 +  //! Returns the shape index in the result.
 +  //! \param theResult result
 +  //! \param theShape result subshape
 +  //! \returns index started from zero, or -1 if shape is not stored or is not a subshape of the result
 +  virtual const int index(std::shared_ptr<ModelAPI_Result> theResult,
 +    std::shared_ptr<GeomAPI_Shape> theShape,
 +    const bool theAllowFolder = false) = 0;
 +
    //! Returns the number of objects in the group of objects
    //! \param theGroupID group of objects
    //! \param theAllowFolder take into account grouping feature by folders
Simple merge
index 2b23383f98b3534f875cfab6ba1166dcf54b5e07,8dcd857237e356a8258db949f65668f854d1e303..294533fb7c08791bf8e4914e8ca1481a41b51033
@@@ -90,15 -89,21 +90,29 @@@ class ModelAPI_ResultPart : public Mode
    /// Returns the shape by the name in the part
    virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
      const std::wstring& theName, const std::string& theType, int& theIndex) = 0;
+   /// Set color on subshape
+   virtual void setSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
+     const std::vector<int>& theColor) = 0;
+   /// Get subshape color
+   virtual void getSubShapeColor(const std::shared_ptr<GeomAPI_Shape>& theShape,
+     std::vector<int>& theColor) = 0;
+   /// Get colored shapes from result
+   virtual void getColoredShapes(std::map<std::shared_ptr<GeomAPI_Shape>,
+     std::vector<int>>&theColoredShapes) = 0;
+   /// Forget subshape colors
+   virtual void removeShapeColors() = 0;
  
 +  virtual void setSubShapeEdgeThickness(const std::shared_ptr<GeomAPI_Shape>& theSubShape, int theThickness) = 0;
 +
 +  virtual int getSubShapeEdgeThickness(const std::shared_ptr<GeomAPI_Shape>& theSubShape) const = 0;
 +
 +  virtual void getSubShapesWithEdgeThickness(std::map<std::shared_ptr<GeomAPI_Shape>, int>& oSubShapes) = 0;
 +
 +  virtual void removeSubShapeEdgeThickness() = 0;
 +
    /// Updates the selection inside of the part as a geometrical selection
    virtual bool combineGeometrical(const int theIndex, std::wstring& theNewName) = 0;
  
Simple merge
Simple merge
index f6d07c88bba972c042f179945deacbaf1fdf2321,f7cd5b96cd23a30ec077ce5dfe4ed2887e2abbdf..1403aafb8481809e40a067196de9100f52f90e51
@@@ -1340,8 -1373,9 +1391,9 @@@ ModelHighAPI_Dumper& ModelHighAPI_Dumpe
      ModelAPI_Tools::allResults(theEntity, allRes);
      for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
        if(!myNames[*aRes].myIsDefault || !isDefaultColor(*aRes) ||
-          !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes) || isEdgeThicknessDefined(*aRes))
 -         !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes) ||
++         !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes) || isEdgeThicknessDefined(*aRes) ||
+         (isParentResult(*aRes) && hasColoredShape(*aRes, true)))
 -        aResultsWithNameOrColor.push_back(*aRes);
 +        aResultsWithNonDefaultAttr.push_back(*aRes);
      }
      // store just dumped entity to stack
      if (myEntitiesStack.empty() || myEntitiesStack.top().myEntity != theEntity)
index 0ed547e9562b572d78b3ce872be6dbc41da50fd6,825d5a2548b98fbd4a25338cb7797e9070bffe51..9836754a36274d5779698e83c5afed40bae6460b
@@@ -273,9 -273,13 +273,12 @@@ PartSet_Module::PartSet_Module(ModuleBa
    Config_PropManager::registerProp("Visualization", "axis_arrow_size",
      "Trihedron arrows constant size", Config_Prop::IntSpin, "10");
  
 -  Config_PropManager::registerProp("Shortcuts", "add_parameter_shortcut",
 -    "Add parameter in parameters manager dialog",
 -    Config_Prop::Shortcut, "Ctrl+A");
 -
 +  Config_PropManager::registerProp("Visualization", "result_subshape_with_edge_thickness",
 +    "Set edge thickness of subshape of result", Config_Prop::Boolean, "true");
 +
+   Config_PropManager::registerProp("Visualization", "color_subshape_result",
+     "Set color on subshape of result", Config_Prop::Boolean, "true");
    Config_PropManager::registerProp("Windows", "use_hide_faces_panel",
      "Use HideFaces panel in operations", Config_Prop::Boolean, "false");
  }
Simple merge
Simple merge
Simple merge