From 6aad2cb97127ef5663ff507d8e84b1c277c05a16 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 18 Nov 2016 15:52:46 +0300 Subject: [PATCH] Fix for tests of Fields: the attribute number of components is removed since it is duplicate of number of component names --- src/CollectionAPI/CollectionAPI_Field.cpp | 12 ++---------- src/CollectionAPI/CollectionAPI_Field.h | 7 +------ src/CollectionPlugin/CollectionPlugin_Field.cpp | 1 - src/CollectionPlugin/CollectionPlugin_Field.h | 6 ------ src/CollectionPlugin/Test/TestField.py | 12 ++++-------- 5 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/CollectionAPI/CollectionAPI_Field.cpp b/src/CollectionAPI/CollectionAPI_Field.cpp index 4c8cd3264..98110e861 100644 --- a/src/CollectionAPI/CollectionAPI_Field.cpp +++ b/src/CollectionAPI/CollectionAPI_Field.cpp @@ -34,13 +34,6 @@ void CollectionAPI_Field::setSelection(const std::list& execute(); } -//================================================================================================= -void CollectionAPI_Field::setComponentsNum(const ModelHighAPI_Integer& theNum) -{ - fillAttribute(theNum, mycomponentsNum); - execute(); -} - //================================================================================================= void CollectionAPI_Field::setComponentsNames(const std::list& theNames) { @@ -78,7 +71,7 @@ void CollectionAPI_Field::addStep(const ModelHighAPI_Integer& theStepNum, \ const std::list >& theComponents) \ { \ myvalues->setSize(myselection->size() + 1, \ - mycomponentsNum->value(), mystepsNum->value()); \ + mycomponentsNames->size(), mystepsNum->value()); \ mystamps->setValue(theStepNum.intValue(), theStamp.intValue()); \ int aRowIndex = 0; \ std::list >::const_iterator \ @@ -110,7 +103,7 @@ void CollectionAPI_Field::dump(ModelHighAPI_Dumper& theDumper) const theDumper<value()<<", \"" <value()))<<"\", " - <value()<<", "; + <size()<<", "; theDumper<& thePart, std::shared_ptr aField(new CollectionAPI_Field(aFeature)); aField->setStepsNum(theStepsNum); aField->setValuesType(theComponentType); - aField->setComponentsNum(theComponentsNum); aField->setComponentsNames(theComponentNames); aField->setSelection(theSelectionList); diff --git a/src/CollectionAPI/CollectionAPI_Field.h b/src/CollectionAPI/CollectionAPI_Field.h index 8d38cb1ff..d7eef3ee5 100644 --- a/src/CollectionAPI/CollectionAPI_Field.h +++ b/src/CollectionAPI/CollectionAPI_Field.h @@ -33,11 +33,9 @@ public: COLLECTIONAPI_EXPORT virtual ~CollectionAPI_Field(); - INTERFACE_7(CollectionPlugin_Field::ID(), + INTERFACE_6(CollectionPlugin_Field::ID(), selection, CollectionPlugin_Field::SELECTED_ID(), ModelAPI_AttributeSelectionList, /** Field selection list*/, - componentsNum, CollectionPlugin_Field::COMPONENTS_NB_ID(), - ModelAPI_AttributeInteger, /** Number of components integer */, componentsNames, CollectionPlugin_Field::COMPONENTS_NAMES_ID(), ModelAPI_AttributeStringArray, /** Names of components list of strings */, valuesType, CollectionPlugin_Field::VALUES_TYPE_ID(), @@ -52,9 +50,6 @@ public: /// Set selected objects. COLLECTIONAPI_EXPORT void setSelection(const std::list& theFieldList); - /// Set number of components - COLLECTIONAPI_EXPORT - void setComponentsNum(const ModelHighAPI_Integer& theNum); /// Set names of components COLLECTIONAPI_EXPORT void setComponentsNames(const std::list& theNames); diff --git a/src/CollectionPlugin/CollectionPlugin_Field.cpp b/src/CollectionPlugin/CollectionPlugin_Field.cpp index 863b1c90a..c9228c405 100644 --- a/src/CollectionPlugin/CollectionPlugin_Field.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Field.cpp @@ -22,7 +22,6 @@ CollectionPlugin_Field::CollectionPlugin_Field() void CollectionPlugin_Field::initAttributes() { data()->addAttribute(SELECTED_ID(), ModelAPI_AttributeSelectionList::typeId()); - //data()->addAttribute(COMPONENTS_NB_ID(), ModelAPI_AttributeInteger::typeId()); data()->addAttribute(COMPONENTS_NAMES_ID(), ModelAPI_AttributeStringArray::typeId()); data()->addAttribute(VALUES_TYPE_ID(), ModelAPI_AttributeInteger::typeId()); data()->addAttribute(STEPS_NB_ID(), ModelAPI_AttributeInteger::typeId()); diff --git a/src/CollectionPlugin/CollectionPlugin_Field.h b/src/CollectionPlugin/CollectionPlugin_Field.h index 6e06a849b..2025c5b51 100644 --- a/src/CollectionPlugin/CollectionPlugin_Field.h +++ b/src/CollectionPlugin/CollectionPlugin_Field.h @@ -41,12 +41,6 @@ class CollectionPlugin_Field : public ModelAPI_Feature static const std::string MY_SELECTED_ID("selected"); return MY_SELECTED_ID; } - /// attribute name of components number - inline static const std::string& COMPONENTS_NB_ID() - { - static const std::string MY_COMPONENTS_NB_ID("components_nb"); - return MY_COMPONENTS_NB_ID; - } /// attribute name of componenets titles array inline static const std::string& COMPONENTS_NAMES_ID() { diff --git a/src/CollectionPlugin/Test/TestField.py b/src/CollectionPlugin/Test/TestField.py index 5a1a66aba..5bf10bdac 100644 --- a/src/CollectionPlugin/Test/TestField.py +++ b/src/CollectionPlugin/Test/TestField.py @@ -81,9 +81,8 @@ aSelectionListAttr.setSelectionType("vertex") aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1") -aField.integer("components_nb").setValue(2) # two components aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(2) +aComponentNames.setSize(2) # two components aComponentNames.setValue(0, "temperatue") aComponentNames.setValue(1, "porosity") aField.integer("type").setValue(2) # double @@ -111,9 +110,8 @@ aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3") -aField.integer("components_nb").setValue(1) # one component aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(1) +aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") aField.integer("type").setValue(3) # string aField.integer("steps_nb").setValue(2) # two steps @@ -140,9 +138,8 @@ aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3") -aField.integer("components_nb").setValue(1) # one component aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(1) +aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") aField.integer("type").setValue(1) # integer aField.integer("steps_nb").setValue(1) # one step @@ -167,9 +164,8 @@ aField = aSession.activeDocument().addFeature("Field") aSelectionListAttr = aField.selectionList("selected") aSelectionListAttr.setSelectionType("face") aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3") -aField.integer("components_nb").setValue(1) # one component aComponentNames = aField.stringArray("components_names") -aComponentNames.setSize(1) +aComponentNames.setSize(1) # one component aComponentNames.setValue(0, "description") aField.integer("type").setValue(0) # boolean aField.integer("steps_nb").setValue(1) # one step -- 2.39.2