-bool Model_Update::updateFeature(FeaturePtr theFeature)
-{
- // check it is already processed
- if (myUpdated.find(theFeature) != myUpdated.end())
- return myUpdated[theFeature];
- // check all features this feature depended on (recursive call of updateFeature)
- ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
- bool aMustbeUpdated = myInitial.find(theFeature) != myInitial.end();
- if (theFeature) { // only real feature contains references to other objects
- if (theFeature->data()->execState() != ModelAPI_StateDone)
- aMustbeUpdated = true;
+void Model_Update::updateArguments(FeaturePtr theFeature) {
+ // perform this method also for disabled features: to make "not done" state for
+ // featuers referenced to the active and modified features
+
+ static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
+
+ bool aJustUpdated = false;
+ ModelAPI_ExecState aState = theFeature->data()->execState();
+ if (aState == ModelAPI_StateInvalidArgument) // a chance to be corrected
+ aState = ModelAPI_StateMustBeUpdated;
+ // check the parameters state
+ // Double
+ std::list<AttributePtr> aDoubles =
+ theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId());
+ std::list<AttributePtr>::iterator aDoubleIter = aDoubles.begin();
+ for(; aDoubleIter != aDoubles.end(); aDoubleIter++) {
+ AttributeDoublePtr aDouble =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(*aDoubleIter);
+ if (aDouble.get() && !aDouble->text().empty()) {
+ if (myIsParamUpdated) {
+ ModelAPI_AttributeEvalMessage::send(aDouble, this);
+ }
+ if (aDouble->expressionInvalid()) {
+ aState = ModelAPI_StateInvalidArgument;
+ }
+ }
+ }
+ // Point
+ {
+ std::list<AttributePtr> anAttributes =
+ theFeature->data()->attributes(GeomDataAPI_Point::typeId());
+ std::list<AttributePtr>::iterator anIter = anAttributes.begin();
+ for(; anIter != anAttributes.end(); anIter++) {
+ AttributePointPtr aPointAttribute =
+ std::dynamic_pointer_cast<GeomDataAPI_Point>(*anIter);
+ if (aPointAttribute.get()) {
+ if (myIsParamUpdated) {
+ ModelAPI_AttributeEvalMessage::send(aPointAttribute, this);
+ }
+ if ((!aPointAttribute->textX().empty() && aPointAttribute->expressionInvalid(0)) ||
+ (!aPointAttribute->textY().empty() && aPointAttribute->expressionInvalid(1)) ||
+ (!aPointAttribute->textZ().empty() && aPointAttribute->expressionInvalid(2)))
+ aState = ModelAPI_StateInvalidArgument;
+ }
+ }
+ }
+ // Point2D
+ {
+ std::list<AttributePtr> anAttributes =
+ theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
+ std::list<AttributePtr>::iterator anIter = anAttributes.begin();
+ for(; anIter != anAttributes.end(); anIter++) {
+ AttributePoint2DPtr aPoint2DAttribute =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIter);
+ if (aPoint2DAttribute.get()) {
+ if (myIsParamUpdated) {
+ ModelAPI_AttributeEvalMessage::send(aPoint2DAttribute, this);
+ }
+ if ((!aPoint2DAttribute->textX().empty() && aPoint2DAttribute->expressionInvalid(0)) ||
+ (!aPoint2DAttribute->textY().empty() && aPoint2DAttribute->expressionInvalid(1)))
+ aState = ModelAPI_StateInvalidArgument;
+ }
+ }
+ }