From b7aaa5099bbc759ce702b8e5daf818d9667f1ade Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me?= Date: Thu, 17 Dec 2020 20:59:49 +0100 Subject: [PATCH] Refactoring code and translation --- .../FeaturesAPI_GeometryCalculation.cpp | 2 +- .../FeaturesAPI_GeometryCalculation.h | 2 +- .../FeaturesPlugin_GeometryCalculation.cpp | 4 +-- .../FeaturesPlugin_GeometryCalculation.h | 8 ++--- src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts | 30 ++++++++++++++++++- .../doc/examples/basic_properties.py | 2 +- .../doc/geometryCalculationFeature.rst | 4 +-- .../geometry_calculation_widget.xml | 2 +- src/FeaturesPlugin/plugin-Features.xml | 2 +- src/GeomAlgoAPI/GeomAlgoAPI_BasicProperties.h | 2 +- 10 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp index a0067e55d..0a380678e 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.cpp @@ -39,7 +39,7 @@ std::list getBasicProperties(const std::shared_ptr& t aPointCoodFeat->attribute(FeaturesPlugin_GeometryCalculation::RESULT_VALUES_ID())); for (int i : {0, 1, 2}) - res.push_back( aResult->value(i)); + res.push_back(aResult->value(i)); return res; } diff --git a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h index 8b912eaa7..64e0f87c9 100644 --- a/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h +++ b/src/FeaturesAPI/FeaturesAPI_GeometryCalculation.h @@ -29,7 +29,7 @@ class ModelAPI_Document; class ModelHighAPI_Selection; /// \ingroup CPPHighAPI -/// \brief get the basic properties (lenght, Surface area, volume) +/// \brief get the basic properties (length, Surface area, volume) FEATURESAPI_EXPORT std::list getBasicProperties(const std::shared_ptr& thePart, const ModelHighAPI_Selection& theObject); diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp index fb74e5f8a..0b928f24a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp @@ -46,7 +46,7 @@ void FeaturesPlugin_GeometryCalculation::initAttributes() // attribute for point selected data()->addAttribute(OBJECT_SELECTED_ID(), ModelAPI_AttributeSelection::typeId()); // attributes for result message and values - data()->addAttribute(LENGHT_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(LENGTH_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(AREA_ID(), ModelAPI_AttributeString::typeId()); data()->addAttribute(VOLUME_ID(), ModelAPI_AttributeString::typeId()); @@ -100,7 +100,7 @@ void FeaturesPlugin_GeometryCalculation::attributeChanged(const std::string& the aValues->setValue(2, aVolume); } - string(LENGHT_ID())->setValue("Lenght = " + streamL.str()); + string(LENGTH_ID())->setValue("Length = " + 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 0eaeaa134..bd90966f8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h @@ -52,11 +52,11 @@ public: return MY_OBJECT_SELECTED_ID; } - /// Attribute name for lenght - inline static const std::string& LENGHT_ID() + /// Attribute name for length + inline static const std::string& LENGTH_ID() { - static const std::string MY_LENGHT_ID("lenght"); - return MY_LENGHT_ID; + static const std::string MY_LENGTH_ID("length"); + return MY_LENGTH_ID; } /// Attribute name for area diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index 6f821a2e2..2762a5519 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -115,6 +115,10 @@ Angular Copy Copie angulaire + + Geometry calculation + Calcul géométrique + Linear copy Copie linéaire @@ -4454,7 +4458,31 @@ Deuxième direction - + + + + GeometryCalculation + + Geometry calculation + Calcul géométrique + + + GeometryCalculation:Object + Objet + + + GeometryCalculation:Length + Longueur + + + GeometryCalculation:Area + Surface + + + GeometryCalculation:Volume + Volume + + Measurement diff --git a/src/FeaturesPlugin/doc/examples/basic_properties.py b/src/FeaturesPlugin/doc/examples/basic_properties.py index 68a1949e1..ab4284810 100644 --- a/src/FeaturesPlugin/doc/examples/basic_properties.py +++ b/src/FeaturesPlugin/doc/examples/basic_properties.py @@ -7,7 +7,7 @@ Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) properties = model.getBasicProperties(Part_1_doc,model.selection("SOLID", "Box_1_1")) -print(" lenght: ", properties[0]) +print(" length: ", properties[0]) print(" area: ", properties[1]) print(" volume: ", properties[2]) model.end() \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst index 4018f219d..1b0dea0bd 100644 --- a/src/FeaturesPlugin/doc/geometryCalculationFeature.rst +++ b/src/FeaturesPlugin/doc/geometryCalculationFeature.rst @@ -5,7 +5,7 @@ Geometry calculation The **Geometry calculation** feature displays basic properties of sub-elements of a geometrical object (shape). -The basic properties displayed in the property panel are lenght, area and volume. +The basic properties displayed in the property panel are length, area and volume. **Apply** button does not generate any result and has the same effect as **Cancel** for this feature. @@ -33,6 +33,6 @@ The basic properties displayed can be selected. :param part: The current part object. :param object: A shape in format *model.selection("type", shape)*. - :return: list containing lenght, area and volume. + :return: list containing length, area and volume. **See Also** a sample TUI Script of :ref:`tui_basic_properties` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/geometry_calculation_widget.xml b/src/FeaturesPlugin/geometry_calculation_widget.xml index da30ff176..73c6bcc07 100644 --- a/src/FeaturesPlugin/geometry_calculation_widget.xml +++ b/src/FeaturesPlugin/geometry_calculation_widget.xml @@ -7,7 +7,7 @@ geometrical_selection="true"> -