// accessible from the attributes
bool myIsInitialized;
bool myIsArgument;
+ bool myIsImmutable;
+
public:
/// Returns the type of this class of attributes, not static method
return myIsArgument;
}
+ /// Immutable argument can not be changed programaticaly (e.g. by constraint)
+ /// By default it is false.
+ /// Returns the previous state of the attribute's immutability.
+ MODELAPI_EXPORT bool setImmutable(const bool theFlag)
+ {
+ bool aResult = myIsImmutable;
+ myIsImmutable = theFlag;
+ return aResult;
+ }
+
+ /// Returns true if can not be changed programaticaly
+ MODELAPI_EXPORT bool isImmutable()
+ {
+ return myIsImmutable;
+ }
+
protected:
/// Objects are created for features automatically
ModelAPI_Attribute()
{
myIsInitialized = false;
myIsArgument = true;
+ myIsImmutable = false;
}
};
boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(attributeID()));
-
+
ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this;
bool isBlocked = that->blockSignals(true);
+ bool isImmutable = aPoint->setImmutable(true);
+#ifdef _DEBUG
+ std::string _attr_name = myAttributeID;
+ double _X = myXSpin->value();
+ double _Y = myYSpin->value();
+#endif
aPoint->setValue(myXSpin->value(), myYSpin->value());
updateObject(myFeature);
+ aPoint->setImmutable(isImmutable);
that->blockSignals(isBlocked);
return true;
boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(attributeID()));
+#ifdef _DEBUG
+ std::string _attr_name = myAttributeID;
+ double _X = aPoint->x();
+ double _Y = aPoint->y();
+#endif
bool isBlocked = this->blockSignals(true);
myXSpin->setValue(aPoint->x());
myYSpin->setValue(aPoint->y());