}
//********************************************************************
-bool ModuleBase_ResultPrs::hasSubShapeVisible(const TopoDS_Shape& theShape)
+bool ModuleBase_ResultPrs::hasSubShapeVisible(
+ const NCollection_List<TopoDS_Shape>& theShapesToSkip)
{
- int aNbOfHiddenSubShapes = myHiddenSubShapes.Size();
-
- if (!myHiddenSubShapes.Contains(theShape))
- aNbOfHiddenSubShapes++; // the shape to be hidden later
-
- //const TopoDS_Shape aCurrentShape = Shape();
- NCollection_List<TopoDS_Shape> aHiddenSubShapes = myHiddenSubShapes;
- aHiddenSubShapes.Append(theShape);
-
TopoDS_Compound aCompound;
BRep_Builder aBuilder;
aBuilder.MakeCompound (aCompound);
- collectSubShapes(aBuilder, aCompound, myOriginalShape, aHiddenSubShapes);
+ collectSubShapes(aBuilder, aCompound, myOriginalShape, theShapesToSkip);
return !BOPTools_AlgoTools3D::IsEmptyShape(aCompound);
}
Standard_EXPORT bool setSubShapeHidden(const NCollection_List<TopoDS_Shape>& theShapes);
/// Returns true if there are no hidden sub shapes or original shape has at least one not hidden
- /// \param theShapeToSkip the shape should be interpreted as additional hidden in the presentation
+ /// \param theShapesToSkip container of shape to be hidden in the presentation (faces)
/// \return boolean value
- Standard_EXPORT bool hasSubShapeVisible(const TopoDS_Shape& theShapeToSkip);
+ Standard_EXPORT bool hasSubShapeVisible(const NCollection_List<TopoDS_Shape>& theShapesToSkip);
/// Set transparency of hidden sub shapes: if value is 1, shapes are entirely hidden
/// \param theTransparency transparency value
ModuleBase_ISelection::Viewer);
bool isModified = false;
static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+
+ std::map<ObjectPtr, NCollection_List<TopoDS_Shape> > anObjectToShapes;
+ std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
for (int i = 0; i < aSelected.size(); i++) {
ModuleBase_ViewerPrsPtr aPrs = aSelected[i];
ObjectPtr anObject = aPrs->object();
myLastItemIndex++;
isModified = true;
- if (aResultPrs->hasSubShapeVisible(ModuleBase_Tools::getSelectedShape(aPrs)) ||
- useTransparency()) // redisplay
+ if (anObjectToShapes.find(anObject) != anObjectToShapes.end())
+ anObjectToShapes.at(anObject).Append(ModuleBase_Tools::getSelectedShape(aPrs));
+ else {
+ NCollection_List<TopoDS_Shape> aListOfShapes;
+ aListOfShapes.Append(ModuleBase_Tools::getSelectedShape(aPrs));
+ anObjectToShapes[anObject] = aListOfShapes;
+ anObjectToPrs[anObject] = aResultPrs;
+ }
+ }
+ for (std::map<ObjectPtr, NCollection_List<TopoDS_Shape> >::const_iterator anIt = anObjectToShapes.begin();
+ anIt != anObjectToShapes.end(); anIt++) {
+ ObjectPtr anObject = anIt->first;
+ if (!anObject.get() || anObjectToPrs.find(anObject) == anObjectToPrs.end())
+ continue;
+ Handle(ModuleBase_ResultPrs) aResultPrs = anObjectToPrs.at(anObject);
+
+ if (aResultPrs->hasSubShapeVisible(anIt->second) || useTransparency()) // redisplay
ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
else { // erase object because it is entirely hidden
anObject->setDisplayed(false);
{
bool isModified = false;
static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ std::map<ObjectPtr, NCollection_List<TopoDS_Shape> > anObjectToShapes;
+ std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
+
for (QMap<int, ModuleBase_ViewerPrsPtr>::const_iterator anIt = myItems.begin();
anIt != myItems.end(); anIt++) {
ModuleBase_ViewerPrsPtr aPrs = anIt.value();
if (aResultPrs.IsNull())
continue;
- if (!aResultPrs->hasSubShapeVisible(ModuleBase_Tools::getSelectedShape(aPrs))) {
+ if (anObjectToShapes.find(anObject) != anObjectToShapes.end())
+ anObjectToShapes.at(anObject).Append(ModuleBase_Tools::getSelectedShape(aPrs));
+ else {
+ NCollection_List<TopoDS_Shape> aListOfShapes;
+ aListOfShapes.Append(ModuleBase_Tools::getSelectedShape(aPrs));
+ anObjectToShapes[anObject] = aListOfShapes;
+ anObjectToPrs[anObject] = aResultPrs;
+ }
+ }
+ for (std::map<ObjectPtr, NCollection_List<TopoDS_Shape> >::const_iterator anIt = anObjectToShapes.begin();
+ anIt != anObjectToShapes.end(); anIt++) {
+ ObjectPtr anObject = anIt->first;
+ if (!anObject.get() || anObjectToPrs.find(anObject) == anObjectToPrs.end())
+ continue;
+ Handle(ModuleBase_ResultPrs) aResultPrs = anObjectToPrs.at(anObject);
+
+ if (!aResultPrs->hasSubShapeVisible(anIt->second)) {
// erase object because it is entirely hidden
anObject->setDisplayed(false);
myHiddenObjects.insert(anObject);
int anAnswer = QMessageBox::question(
desktop(), tr("Show object"),
tr("'%1'\n are hidden by %2:\nRemove objects from the panel to be displayed?")
- .arg(aHiddenObjectNames.join(',')).arg(facesPanel()->windowTitle(),
- QMessageBox::Yes | QMessageBox::No, QMessageBox::No));
+ .arg(aHiddenObjectNames.join(',')).arg(facesPanel()->windowTitle()),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
bool aToBeDisplayed = anAnswer == QMessageBox::Yes;
if (aToBeDisplayed)