Salome HOME
Fix for tests of Fields: the attribute number of components is removed since it is...
authormpv <mpv@opencascade.com>
Fri, 18 Nov 2016 12:52:46 +0000 (15:52 +0300)
committermpv <mpv@opencascade.com>
Fri, 18 Nov 2016 12:52:46 +0000 (15:52 +0300)
src/CollectionAPI/CollectionAPI_Field.cpp
src/CollectionAPI/CollectionAPI_Field.h
src/CollectionPlugin/CollectionPlugin_Field.cpp
src/CollectionPlugin/CollectionPlugin_Field.h
src/CollectionPlugin/Test/TestField.py

index 4c8cd32649eda3e8cf93b0d369d3ffa4ed387eb4..98110e8614372fb272e78498ad9f7d00b2f000c8 100644 (file)
@@ -34,13 +34,6 @@ void CollectionAPI_Field::setSelection(const std::list<ModelHighAPI_Selection>&
   execute();
 }
 
-//=================================================================================================
-void CollectionAPI_Field::setComponentsNum(const ModelHighAPI_Integer& theNum)
-{
-  fillAttribute(theNum, mycomponentsNum);
-  execute();
-}
-
 //=================================================================================================
 void CollectionAPI_Field::setComponentsNames(const std::list<std::string>& theNames)
 {
@@ -78,7 +71,7 @@ void CollectionAPI_Field::addStep(const ModelHighAPI_Integer& theStepNum, \
   const std::list<std::list<type> >& 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<std::list<type> >::const_iterator \
@@ -110,7 +103,7 @@ void CollectionAPI_Field::dump(ModelHighAPI_Dumper& theDumper) const
 
   theDumper<<aBase<<" = model.addField("<<aDocName<<", "<<mystepsNum->value()<<", \""
     <<strByValueType(ModelAPI_AttributeTables::ValueType(myvaluesType->value()))<<"\", "
-    <<mycomponentsNum->value()<<", ";
+    <<mycomponentsNames->size()<<", ";
   theDumper<<mycomponentsNames<<", ";
   theDumper<<myselection<<")"<<std::endl;
   // set values step by step
@@ -156,7 +149,6 @@ FieldPtr addField(const std::shared_ptr<ModelAPI_Document>& thePart,
   std::shared_ptr<CollectionAPI_Field> aField(new CollectionAPI_Field(aFeature));
   aField->setStepsNum(theStepsNum);
   aField->setValuesType(theComponentType);
-  aField->setComponentsNum(theComponentsNum);
   aField->setComponentsNames(theComponentNames);
   aField->setSelection(theSelectionList);
 
index 8d38cb1ffdd2e3673acfdba435225bf9e5c6b40a..d7eef3ee58e4596a1cc5a0517f1c26dd931fae7a 100644 (file)
@@ -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<ModelHighAPI_Selection>& theFieldList);
-  /// Set number of components
-  COLLECTIONAPI_EXPORT
-  void setComponentsNum(const ModelHighAPI_Integer& theNum);
   /// Set names of components
   COLLECTIONAPI_EXPORT
   void setComponentsNames(const std::list<std::string>& theNames);
index 863b1c90a1527ce5a740e96f3873536c9aec0f6b..c9228c405b40b1c915ae187997e72da0165c048b 100644 (file)
@@ -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());
index 6e06a849b59502f034eca03f37002b12b9b0ff35..2025c5b51508aad3fbd193710bbe2e236120c8d7 100644 (file)
@@ -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()
   {
index 5a1a66aba182835484e39c4f80456e1e1e394773..5bf10bdacc3a4cda80eb05ffe06b6e999839dd43 100644 (file)
@@ -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