Salome HOME
Copyright update 2021
[modules/geom.git] / src / EntityGUI / EntityGUI_SubShapeDlg.cxx
index 598d05de696a15242499b921f372e42b8046f7ea..b7cd8f46647a6f015e387cb0b84101da19796335 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -30,7 +30,9 @@
 #include <GeometryGUI.h>
 #include <GEOMBase.h>
 #include <GEOMUtils.hxx>
-#include <MeasureGUI_ShapeStatisticsDlg.h>
+#ifndef DISABLE_PLOT2DVIEWER
+  #include <MeasureGUI_ShapeStatisticsDlg.h>
+#endif
 
 #include <OCCViewer_ViewModel.h>
 #include <SVTK_ViewModel.h>
@@ -166,7 +168,9 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge
   myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
   myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
   myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp);
+#ifndef DISABLE_PLOT2DVIEWER
   myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp);
+#endif
 
   QGridLayout* filterLayout = new QGridLayout(myFilterGrp);
   filterLayout->addWidget(myLessFilterCheck,    0, 0);
@@ -176,7 +180,9 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge
   filterLayout->addWidget(myGreaterFilterCombo, 1, 1);
   filterLayout->addWidget(myGreaterFilterSpin,  1, 2);
   filterLayout->addWidget(myApplyFilterButton,  0, 3);
+#ifndef DISABLE_PLOT2DVIEWER
   filterLayout->addWidget(myPlotDistributionButton,  1, 3);
+#endif
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
@@ -253,7 +259,9 @@ void EntityGUI_SubShapeDlg::Init()
   connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
 
   connect(myApplyFilterButton, SIGNAL(clicked()),         this, SLOT(ClickOnOkFilter()));
+#ifndef DISABLE_PLOT2DVIEWER
   connect(myPlotDistributionButton, SIGNAL(clicked()),    this, SLOT(ClickOnPlot()));
+#endif
   connect(myLessFilterCheck,   SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
   connect(myGreaterFilterCheck,   SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
 
@@ -326,7 +334,7 @@ void EntityGUI_SubShapeDlg::ClickOnOk()
   }
 
   if (isOk)
-    isOk = onAccept();
+    isOk = onAccept( true, true, false );
 
   if (isOk)
     ClickOnCancel();
@@ -495,10 +503,12 @@ void EntityGUI_SubShapeDlg::SubShapeToggled()
                           GroupPoints->CheckButton1->isChecked() &&
                           shapeType() < GEOM::VERTEX);
 
+#ifndef DISABLE_PLOT2DVIEWER
   myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
                                        ( shapeType() == TopAbs_EDGE || 
                                          shapeType() == TopAbs_FACE ||
                                          shapeType() == TopAbs_SOLID ) );
+#endif
 
   activateSelection();
 }
@@ -683,7 +693,8 @@ int EntityGUI_SubShapeDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& th
         if (!appStudy) return 0;
         _PTR(Study) aStudy = appStudy->studyDS();
 
-        _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toLatin1().constData()));
+        _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
+        if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
         GEOM::GEOM_Object_var aGeomObj =
           GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
         TopoDS_Shape aShape;
@@ -800,7 +811,7 @@ void EntityGUI_SubShapeDlg::activateSelection()
 //=================================================================================
 GEOM::GEOM_IOperations_ptr EntityGUI_SubShapeDlg::createOperation()
 {
-  return getGeomEngine()->GetIShapesOperations(getStudyId());
+  return getGeomEngine()->GetIShapesOperations();
 }
 
 //=================================================================================
@@ -899,7 +910,7 @@ void EntityGUI_SubShapeDlg::ClickOnOkFilter()
   
   TopTools_IndexedMapOfShape aSubShapesMap;
   TopExp::MapShapes(myShape, aSubShapesMap);
-  SALOME_View* view = GEOM_Displayer::GetActiveView();
+  //SALOME_View* view = GEOM_Displayer::GetActiveView();
   getDisplayer()->Erase(myObject, false, false);
   CORBA::String_var aMainEntry = myObject->GetStudyEntry();
   QString anEntryBase = aMainEntry.in();
@@ -924,7 +935,7 @@ void EntityGUI_SubShapeDlg::ClickOnOkFilter()
          ( myLessFilterCheck->isChecked() && !myGreaterFilterCheck->isChecked() && isLess ) ||
          ( myGreaterFilterCheck->isChecked() && !myLessFilterCheck->isChecked() && isGreater ) ) {
       Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject();
-      io->setEntry( anEntry.toLatin1().constData() );
+      io->setEntry( anEntry.toUtf8().constData() );
       io->setName( myObject->GetName() );
       toSelect.Append(io);
     }
@@ -945,6 +956,7 @@ void EntityGUI_SubShapeDlg::ClickOnOkFilter()
   updateButtonState();
 }
 
+#ifndef DISABLE_PLOT2DVIEWER
 //=================================================================================
 // function : ClickOnPlot()
 // purpose  : opens "Shape Statistics" dialog box in order to plot sub-shapes distribution.
@@ -956,6 +968,7 @@ void EntityGUI_SubShapeDlg::ClickOnPlot()
     dlg->show();
   }
 }
+#endif
 
 //=================================================================================
 // function : MeasureToggled()