X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMeasureGUI%2FMeasureGUI_ShapeStatisticsDlg.cxx;h=347f2b8664df4080e773659fdf9f2be3e4d7ee88;hb=2d81fbabd2684a4346343667c5ac18c8f9192f51;hp=681c0bab5e453c872988efd93d0866768aa9c297;hpb=c0397f5b1af8f042d925fd1dd40ee07642b90da5;p=modules%2Fgeom.git diff --git a/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx index 681c0bab5..347f2b866 100644 --- a/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx @@ -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 @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -65,9 +64,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 +105,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 +136,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() ) ); @@ -206,13 +205,13 @@ MeasureGUI_ShapeStatisticsDlg::~MeasureGUI_ShapeStatisticsDlg() //================================================================================= GEOM::GEOM_IOperations_ptr MeasureGUI_ShapeStatisticsDlg::createOperation() { - return getGeomEngine()->GetIGroupOperations(getStudyId()); + return getGeomEngine()->GetIGroupOperations(); } -#define RETURN_WITH_MSG(a, b) \ - if (!(a)) { \ - theMessage += (b); \ - return false; \ +#define RETURN_WITH_MSG(a, b) \ + if (!(a)) { \ + theMessage += (b); \ + return false; \ } //================================================================ @@ -307,7 +306,7 @@ void MeasureGUI_ShapeStatisticsDlg::updateTypes( QList theShap myShapes.push_back( aShape ); GEOM::ListOfLong_var aSubShapes; - GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations(); if ( hasEdges != 0 ) hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_EDGE ) > 0; if ( hasFaces != 0 ) @@ -334,9 +333,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 +359,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 xVals, yVals; @@ -445,7 +444,7 @@ void MeasureGUI_ShapeStatisticsDlg::clickOnCreateGroups() //================================================================================= // function : execute(ObjectList& objects) -// purpose : +// purpose : //================================================================================= bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects) { @@ -472,9 +471,8 @@ 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(); - GEOMUtils::Distribution aShapesDistr = + GEOMUtils::Distribution aShapesDistr = GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange ); int nbGroups = 0; @@ -489,7 +487,7 @@ bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects) int ii = 0; std::list::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 +495,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 );