Salome HOME
Issue #2482: Process compsolids for hiding faces, do not process the same selected...
authorvsv <vsv@opencascade.com>
Tue, 22 May 2018 15:22:08 +0000 (18:22 +0300)
committervsv <vsv@opencascade.com>
Tue, 22 May 2018 15:22:08 +0000 (18:22 +0300)
src/ModuleBase/ModuleBase_ListView.cpp
src/ModuleBase/ModuleBase_ListView.h
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/XGUI/XGUI_FacesPanel.cpp

index 03a884d3a35448c2727b7e1329ba21908eb84224..d1dc0158ab1b8a47c0ffb3d98790bbdefda7cc82 100644 (file)
@@ -179,4 +179,10 @@ void ModuleBase_ListView::onListSelection()
   QList<QListWidgetItem*> aItems = myListControl->selectedItems();
   myCopyAction->setEnabled(!aItems.isEmpty());
   myDeleteAction->setEnabled(!aItems.isEmpty());
-}
\ No newline at end of file
+}
+
+//********************************************************************
+bool ModuleBase_ListView::hasItem(const QString& theTextValue) const
+{
+  return myListControl->findItems(theTextValue, Qt::MatchExactly).length() > 0;
+}
index 27c22622d3bd159efdbffcbc60f0cdd5669c1755..9fd0f578a7d09013169b0a2c8bf426dc7f473a6b 100644 (file)
@@ -56,6 +56,10 @@ public:
   /// \param theIndex an item internal index
   void addItem(const QString& theTextValue, const int theIndex);
 
+  /// Returns True if the control already contains an item with the given text
+  /// \param theTextValue tex of item to find
+  bool hasItem(const QString& theTextValue) const;
+
   /// Returns list of internal list view item indices
   /// \param theIndices an output container for indices
   void getSelectedIndices(std::set<int>& theIndices);
index 7c855b33b35913179e21035668499fe11acc5834..cb422bf9a684ddafbe5dcdf03dcc8c557d4d5d52 100755 (executable)
@@ -233,6 +233,7 @@ void ModuleBase_ResultPrs::collectSubShapes(BRep_Builder& theBuilder,
   const NCollection_List<TopoDS_Shape>& theHiddenSubShapes)
 {
   switch (theShape.ShapeType()) {
+    case TopAbs_COMPSOLID:
     case TopAbs_COMPOUND: {
       for (TopoDS_Iterator aChildIter (theShape); aChildIter.More(); aChildIter.Next())
         collectSubShapes(theBuilder, theCompound, aChildIter.Value(), theHiddenSubShapes);
index 01211ae75611a35ec61984507a104cf0dcddc314..729c967616e2513632f1ce408f9f5635e1ecb097 100644 (file)
@@ -232,9 +232,12 @@ void XGUI_FacesPanel::processSelection()
       aPrs->interactive());
     if (aResultPrs.IsNull())
       continue;
+    QString aItemName = generateName(aPrs);
+    if (myListView->hasItem(aItemName))
+      return;
 
     myItems.insert(myLastItemIndex, aPrs);
-    myListView->addItem(generateName(aPrs), myLastItemIndex);
+    myListView->addItem(aItemName, myLastItemIndex);
     myLastItemIndex++;
     isModified = true;