Salome HOME
Regression of Offset dialog: result shape not published
[modules/geom.git] / src / MeasureGUI / MeasureGUI_ShapeStatisticsDlg.cxx
index 681c0bab5e453c872988efd93d0866768aa9c297..7cf7b9792d8b06df89356321035e924c281bd61c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2015-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -65,9 +65,9 @@
 // class    : MeasureGUI_ShapeStatisticsDlg()
 //===========================================================================
 MeasureGUI_ShapeStatisticsDlg::MeasureGUI_ShapeStatisticsDlg( QWidget* parent, TopoDS_Shape aShape, TopAbs_ShapeEnum aSubShapeType )
-  : GEOMBase_Helper( SUIT_Session::session()->activeApplication()->desktop() ),
-    QDialog( parent ),
-    myHistogram ( 0 )
+: GEOMBase_Helper( SUIT_Session::session()->activeApplication()->desktop() ),
+  QDialog( parent ),
+  myHistogram ( 0 )
 {
   myShapes.push_back( aShape );
 
@@ -106,9 +106,9 @@ MeasureGUI_ShapeStatisticsDlg::MeasureGUI_ShapeStatisticsDlg( QWidget* parent, T
   myCBTypes = new QtxComboBox( this );
   myCBTypes->setCleared( true );
   if ( aSubShapeType != TopAbs_SHAPE ) {
-    fillTypes( aSubShapeType == TopAbs_EDGE, 
-              aSubShapeType == TopAbs_FACE, 
-              aSubShapeType == TopAbs_SOLID );
+    fillTypes( aSubShapeType == TopAbs_EDGE,
+               aSubShapeType == TopAbs_FACE,
+               aSubShapeType == TopAbs_SOLID );
     myCBTypes->setEnabled( false );
   }
 
@@ -137,7 +137,7 @@ MeasureGUI_ShapeStatisticsDlg::MeasureGUI_ShapeStatisticsDlg( QWidget* parent, T
   QLabel* maxLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_MAX" ), this );
   myMax = new QLineEdit( this );
   myMax->setValidator( aValid );
-  
+
   QPushButton* buttonCompute = new QPushButton( tr( "GEOM_SHAPE_STATISTICS_COMPUTE" ), this );
   connect( buttonCompute, SIGNAL( clicked() ), this, SLOT( clickOnCompute() ) );
 
@@ -209,10 +209,10 @@ GEOM::GEOM_IOperations_ptr MeasureGUI_ShapeStatisticsDlg::createOperation()
   return getGeomEngine()->GetIGroupOperations(getStudyId());
 }
 
-#define RETURN_WITH_MSG(a, b) \
-  if (!(a)) { \
-    theMessage += (b); \
-    return false; \
+#define RETURN_WITH_MSG(a, b)                   \
+  if (!(a)) {                                   \
+    theMessage += (b);                          \
+    return false;                               \
   }
 
 //================================================================
@@ -334,9 +334,9 @@ TopAbs_ShapeEnum MeasureGUI_ShapeStatisticsDlg::currentType()
 bool MeasureGUI_ShapeStatisticsDlg::isValid(QString& theMessage)
 {
   if ( myScalarRangeBox->isChecked() ) {
-    RETURN_WITH_MSG( !myMin->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MIN_ERROR") )
-    RETURN_WITH_MSG( !myMax->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MAX_ERROR") )
-    RETURN_WITH_MSG( myMin->text().toDouble() <= myMax->text().toDouble(), tr("GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR") )
+    RETURN_WITH_MSG( !myMin->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MIN_ERROR") );
+    RETURN_WITH_MSG( !myMax->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MAX_ERROR") );
+    RETURN_WITH_MSG( myMin->text().toDouble() <= myMax->text().toDouble(), tr("GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR") );
   }
   return true;
 }
@@ -360,7 +360,7 @@ void MeasureGUI_ShapeStatisticsDlg::clickOnPlot()
     aRange.max = -1.0; // flag that range is empty
   }
 
-  GEOMUtils::Distribution aShapesDistr = 
+  GEOMUtils::Distribution aShapesDistr =
     GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange );
 
   QList<double> xVals, yVals;
@@ -445,7 +445,7 @@ void MeasureGUI_ShapeStatisticsDlg::clickOnCreateGroups()
 
 //=================================================================================
 // function : execute(ObjectList& objects)
-// purpose  : 
+// purpose  :
 //=================================================================================
 bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects)
 {
@@ -472,9 +472,9 @@ bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects)
   int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
   QString aTypePrefix = myCBTypes->currentText().replace(' ', '_');
   QString objIOR, aMin, aMax, aGroupName;
-  SalomeApp_Study* study = getStudy();
+  //SalomeApp_Study* study = getStudy();
 
-  GEOMUtils::Distribution aShapesDistr = 
+  GEOMUtils::Distribution aShapesDistr =
     GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange );
 
   int nbGroups = 0;
@@ -489,7 +489,7 @@ bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects)
       int ii = 0;
       std::list<long>::const_iterator id_it;
       for ( id_it = idList.begin(); id_it != idList.end(); id_it++ ) {
-       aNewList[ii++] = *id_it;
+        aNewList[ii++] = *id_it;
       }
 
       // Create an empty group
@@ -497,12 +497,12 @@ bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects)
       aGroup = anOper->CreateGroup( myMainObj.get(), currentType() );
 
       if (CORBA::is_nil(aGroup) || !anOper->IsDone())
-       return false;
+        return false;
 
       // Add sub-shapes into group
       anOper->UnionIDs(aGroup, aNewList);
       if (!anOper->IsDone())
-       return false;
+        return false;
 
       // publish group
       aMin = DlgRef::PrintDoubleValue( (*it).min, aPrecision );