]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Model/Model_Data.cpp
Salome HOME
Implementation of color as integer array attribute
[modules/shaper.git] / src / Model / Model_Data.cpp
index b103789432e6e29ae2f27d8d73dfe8883ca12298..b8aeabaffbba9e19dd2c04e33422da9bb9c59cea 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        Model_Data.hxx
 // Created:     21 Mar 2014
 // Author:      Mikhail PONIKAROV
@@ -13,6 +15,7 @@
 #include <Model_AttributeString.h>
 #include <Model_AttributeSelection.h>
 #include <Model_AttributeSelectionList.h>
+#include <Model_AttributeIntArray.h>
 #include <Model_Events.h>
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Result.h>
@@ -33,7 +36,7 @@
 // TDataStd_Name - name of the object
 // TDataStd_Integer - state of the object execution
 
-Model_Data::Model_Data()
+Model_Data::Model_Data() : mySendAttributeUpdated(true)
 {
 }
 
@@ -88,6 +91,8 @@ void Model_Data::addAttribute(const std::string& theID, const std::string theAtt
     anAttr = new Model_AttributeRefAttr(anAttrLab);
   } else if (theAttrType == ModelAPI_AttributeRefList::type()) {
     anAttr = new Model_AttributeRefList(anAttrLab);
+  } else if (theAttrType == ModelAPI_AttributeIntArray::type()) {
+    anAttr = new Model_AttributeIntArray(anAttrLab);
   } 
   // create also GeomData attributes here because only here the OCAF strucure is known
   else if (theAttrType == GeomData_Point::type()) {
@@ -128,6 +133,7 @@ GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeSelection, selection);
 GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeSelectionList, selectionList);
 GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeRefAttr, refattr);
 GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeRefList, reflist);
+GET_ATTRIBUTE_BY_ID(ModelAPI_AttributeIntArray, intArray);
 
 std::shared_ptr<ModelAPI_Attribute> Model_Data::attribute(const std::string& theID)
 {
@@ -195,12 +201,17 @@ void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr)
   if (theAttr->isArgument()) {
     static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
     ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
-    if (myObject) {
+    if (mySendAttributeUpdated && myObject) {
       myObject->attributeChanged(theAttr->id());
     }
   }
 }
 
+void Model_Data::blockSendAttributeUpdated(const bool theBlock)
+{
+  mySendAttributeUpdated = !theBlock;
+}
+
 void Model_Data::erase()
 {
   if (!myLab.IsNull())