From: Jérôme Date: Thu, 3 Dec 2020 13:24:42 +0000 (+0100) Subject: #20429 Fix issues X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6e1c46973b9a36b063e4deff0201ff828af4fb8e;p=modules%2Fshaper.git #20429 Fix issues --- diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp index 9bf0ae406..a0067e55d 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp @@ -24,8 +24,9 @@ #include #include -std::list getBasicProperties(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject) +//================================================================================================= +std::list getBasicProperties(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theObject) { FeaturePtr aPointCoodFeat = thePart->addFeature(FeaturesPlugin_GeometryCalculation::ID()); @@ -37,7 +38,7 @@ std::list getBasicProperties(const std::shared_ptr& AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( aPointCoodFeat->attribute(FeaturesPlugin_GeometryCalculation::RESULT_VALUES_ID())); - for ( int i : {0, 1, 2}) + for (int i : {0, 1, 2}) res.push_back( aResult->value(i)); return res; diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h index abed69276..8b912eaa7 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h @@ -31,7 +31,7 @@ class ModelHighAPI_Selection; /// \ingroup CPPHighAPI /// \brief get the basic properties (lenght, Surface area, volume) FEATURESAPI_EXPORT -std::list getBasicProperties(const std::shared_ptr& thePart, - const ModelHighAPI_Selection& theObject); +std::list getBasicProperties(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theObject); #endif // FeaturesAPI_GeometryCalculation_H_ \ No newline at end of file diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index ab56bb256..83df4b493 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -24,7 +24,6 @@ INCLUDE(UseQtExt) # additional include directories INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GeomDataAPI ${PROJECT_SOURCE_DIR}/src/Locale - ${PROJECT_SOURCE_DIR}/src/PrimitivesPlugin ${QT_INCLUDES}) # additional preprocessor / compiler flags @@ -157,7 +156,7 @@ SET(XML_RESOURCES fillet_widget.xml fillet1d_widget.xml measurement_widget.xml - GeometryCalculation_widget.xml + geometry_calculation_widget.xml fusion_faces_widget.xml chamfer_widget.xml copy_widget.xml diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp index c16bc78a3..fb74e5f8a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp @@ -29,18 +29,18 @@ #include #include -#include -#include #include #include #include +//================================================================================================= FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() { } +//================================================================================================= void FeaturesPlugin_GeometryCalculation::initAttributes() { // attribute for point selected @@ -51,15 +51,16 @@ void FeaturesPlugin_GeometryCalculation::initAttributes() data()->addAttribute(VOLUME_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId()); - data()->realArray(RESULT_VALUES_ID())->setSize(3); } +//================================================================================================= void FeaturesPlugin_GeometryCalculation::execute() { } +//================================================================================================= void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& theID) { if (theID == OBJECT_SELECTED_ID()) { @@ -77,18 +78,18 @@ void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& the if (!aShape && aSelection->context()) aShape = aSelection->context()->shape(); } - if (aShape){ + if (aShape) { double aTolerance = 0.0001; double aLength; double aSurfArea; double aVolume; std::string aError; - if( !GetBasicProperties( aShape, + if (!GetBasicProperties(aShape, aTolerance, aLength, aSurfArea, aVolume, - aError) ) + aError)) setError("Error in Geometry calculation :" + aError); streamL << std::setprecision(14) << aLength; @@ -99,9 +100,9 @@ void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& the aValues->setValue(2, aVolume); } - string(LENGHT_ID() )->setValue( "Lenght = " + streamL.str() ); - string(AREA_ID() )->setValue( "Area = " + streamA.str() ); - string(VOLUME_ID() )->setValue( "Volume = " + streamV.str() ); + string(LENGHT_ID())->setValue("Lenght = " + streamL.str()); + string(AREA_ID())->setValue("Area = " + streamA.str()); + string(VOLUME_ID())->setValue("Volume = " + streamV.str()); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h index a41e85365..0eaeaa134 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h @@ -33,7 +33,7 @@ class FeaturesPlugin_GeometryCalculation : public ModelAPI_Feature { public: - inline static const std::string& ID() + inline static const std::string& ID() { static const std::string MY_ID("GeometryCalculation"); return MY_ID; @@ -73,7 +73,7 @@ public: return MY_VOLUME_ID; } - /// Attribute name for values of result. + /// Attribute name for values of result. inline static const std::string& RESULT_VALUES_ID() { static const std::string MY_RESULT_VALUES_ID("result_values"); diff --git a/src/FeaturesPlugin/GeometryCalculation_widget.xml b/src/FeaturesPlugin/GeometryCalculation_widget.xml deleted file mode 100644 index 4b5913dc5..000000000 --- a/src/FeaturesPlugin/GeometryCalculation_widget.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - -