]> SALOME platform Git repositories - modules/shaper.git/blob - src/CollectionPlugin/CollectionPlugin_Field.cpp
Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[modules/shaper.git] / src / CollectionPlugin / CollectionPlugin_Field.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        CollectionPlugin_Field.cpp
4 // Created:     08 Oct 2014
5 // Author:      Sergey BELASH
6
7 #include "CollectionPlugin_Field.h"
8
9 #include <ModelAPI_Data.h>
10 #include <ModelAPI_Document.h>
11 #include <ModelAPI_AttributeStringArray.h>
12 #include <ModelAPI_AttributeSelectionList.h>
13 #include <ModelAPI_AttributeIntArray.h>
14 #include <ModelAPI_AttributeTables.h>
15 #include <ModelAPI_ResultField.h>
16 #include <ModelAPI_Session.h>
17 #include <ModelAPI_Validator.h>
18
19 CollectionPlugin_Field::CollectionPlugin_Field()
20 {
21 }
22
23 void CollectionPlugin_Field::initAttributes()
24 {
25   data()->addAttribute(SELECTED_ID(), ModelAPI_AttributeSelectionList::typeId());
26   // for the whole part result it is not obligatory
27   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SELECTED_ID());
28
29   data()->addAttribute(COMPONENTS_NAMES_ID(), ModelAPI_AttributeStringArray::typeId());
30   data()->addAttribute(STAMPS_ID(), ModelAPI_AttributeIntArray::typeId());
31   data()->addAttribute(VALUES_ID(), ModelAPI_AttributeTables::typeId());
32 }
33
34 void CollectionPlugin_Field::execute()
35 {
36   if (results().empty() || firstResult()->isDisabled()) { // just create result if not exists
37     ResultPtr aField = document()->createField(data());
38     setResult(aField);
39   }
40 }