+//********************************************************************
+void ModuleBase_ResultPrs::SetColor (const Quantity_Color& theColor)
+{
+ ViewerData_AISShape::SetColor(theColor);
+ myHiddenSubShapesDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
+}
+
+//********************************************************************
+bool ModuleBase_ResultPrs::setSubShapeHidden(const NCollection_List<TopoDS_Shape>& theShapes)
+{
+ bool isModified = false;
+
+ TopoDS_Compound aCompound;
+ BRep_Builder aBBuilder;
+ aBBuilder.MakeCompound (aCompound);
+ // restore hidden shapes if there are not the shapes in parameter container
+ NCollection_List<TopoDS_Shape> aVisibleSubShapes;
+ for (NCollection_List<TopoDS_Shape>::Iterator aHiddenIt(myHiddenSubShapes); aHiddenIt.More();
+ aHiddenIt.Next()) {
+ if (!theShapes.Contains(aHiddenIt.Value()))
+ aVisibleSubShapes.Append(aHiddenIt.Value());
+ else
+ aBBuilder.Add (aCompound, aHiddenIt.Value());
+ }
+ isModified = !aVisibleSubShapes.IsEmpty();
+ for (NCollection_List<TopoDS_Shape>::Iterator aVisibleIt(aVisibleSubShapes); aVisibleIt.More();
+ aVisibleIt.Next())
+ myHiddenSubShapes.Remove(aVisibleIt.Value());
+
+ // append hidden shapes into internal container if there are not these shapes
+ for (NCollection_List<TopoDS_Shape>::Iterator aShapeIt(theShapes); aShapeIt.More();
+ aShapeIt.Next())
+ {
+ if (aShapeIt.Value().ShapeType() != TopAbs_FACE) // only face shape can be hidden
+ continue;
+
+ if (!myHiddenSubShapes.Contains(aShapeIt.Value())) {
+ myHiddenSubShapes.Append(aShapeIt.Value());
+ aBBuilder.Add (aCompound, aShapeIt.Value());
+ isModified = true;
+ }
+ }
+ myHiddenCompound = aCompound;
+ return isModified;
+}
+
+//********************************************************************
+bool ModuleBase_ResultPrs::hasSubShapeVisible(const TopoDS_Shape& theShape)
+{
+ int aNbOfHiddenSubShapes = myHiddenSubShapes.Size();
+
+ if (!myHiddenSubShapes.Contains(theShape))
+ aNbOfHiddenSubShapes++; // the shape to be hidden later
+
+ TopExp_Explorer anExp(myOriginalShape, TopAbs_FACE);
+ bool aHasVisibleShape = false;
+ for(TopExp_Explorer anExp(myOriginalShape, TopAbs_FACE); anExp.More() && !aHasVisibleShape;
+ anExp.Next())
+ {
+ aNbOfHiddenSubShapes--;
+ if (aNbOfHiddenSubShapes < 0)
+ aHasVisibleShape = true;
+ }
+ return aHasVisibleShape;
+}
+
+//********************************************************************
+bool ModuleBase_ResultPrs::setHiddenSubShapeTransparency(double theTransparency)
+{
+ if (theTransparency > 1 || theTransparency < 0)
+ return false;
+
+ myTransparency = theTransparency;
+ myHiddenSubShapesDrawer->ShadingAspect()->SetTransparency (theTransparency, myCurrentFacingModel);
+ return true;
+}
+
+//********************************************************************