return (myArray.IsNull() || !myArray->IsValid()) ? 0 : myArray->Length();
}
-void Model_AttributeIntArray::setSize(const int theSize)
+void Model_AttributeIntArray::setSize(const int theSize, bool sendUpdated)
{
if (myArray.IsNull() || !myArray->IsValid()) { // create array if it is not done yet
if (theSize != 0) { // if size is zero, nothing to do (null array means there is no array)
myArray = TDataStd_IntegerArray::Set(myLab, 0, theSize - 1);
- owner()->data()->sendAttributeUpdated(this);
+ if (sendUpdated)
+ owner()->data()->sendAttributeUpdated(this);
}
} else { // reset the old array
if (theSize) {
if (theSize != myArray->Length()) { // old data is not kept, a new array is created
Handle(TColStd_HArray1OfInteger) aNewArray = new TColStd_HArray1OfInteger(0, theSize - 1);
myArray->ChangeArray(aNewArray);
- owner()->data()->sendAttributeUpdated(this);
+ if (sendUpdated)
+ owner()->data()->sendAttributeUpdated(this);
}
} else { // size is zero => array must be erased
if (!myArray.IsNull()) {
myArray.Nullify();
myLab.ForgetAttribute(TDataStd_IntegerArray::GetID());
- owner()->data()->sendAttributeUpdated(this);
+ if (sendUpdated)
+ owner()->data()->sendAttributeUpdated(this);
}
}
}
MODEL_EXPORT virtual int size();
/// Sets the new size of the array. The previous data is erased.
- MODEL_EXPORT virtual void setSize(const int theSize);
+ MODEL_EXPORT virtual void setSize(const int theSize,
+ bool sendUpdated = true);
/// Defines the value of the array by index [0; size-1]
MODEL_EXPORT virtual void setValue(const int theIndex,
MODELAPI_EXPORT virtual int size() = 0;
/// Sets the new size of the array. The previous data is erased.
- MODELAPI_EXPORT virtual void setSize(const int theSize) = 0;
+ MODELAPI_EXPORT virtual void setSize(const int theSize,
+ bool sendUpdated = true) = 0;
/// Defines the value of the array by index [0; size-1]
MODELAPI_EXPORT virtual void setValue(const int theIndex,
if (ModelAPI_Session::get()->isOperation()) {
AttributeIntArrayPtr aColorAttr = theObject->data()->intArray(ModelAPI_Result::COLOR_ID());
if (aColorAttr.get()) {
- aColorAttr->setSize(3);
+ aColorAttr->setSize(3, false);
// Set the color attribute in order do not use default colors in the presentation object
for (int i = 0; i < 3; i++)
aColorAttr->setValue(i, aColor[i], false);