From 1160728f79c0125d3aa299e244074aff2a3a3ec6 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 27 May 2015 15:43:59 +0300 Subject: [PATCH] Make Point2D sketch controls can use parameters and expressions and updated immediately --- src/GeomData/GeomData_Point.cpp | 7 +++++++ src/GeomData/GeomData_Point.h | 2 +- src/GeomData/GeomData_Point2D.cpp | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/GeomData/GeomData_Point.cpp b/src/GeomData/GeomData_Point.cpp index e76498c00..ef48bfc28 100644 --- a/src/GeomData/GeomData_Point.cpp +++ b/src/GeomData/GeomData_Point.cpp @@ -8,6 +8,7 @@ #include #include #include +#include using namespace std; @@ -65,6 +66,12 @@ void GeomData_Point::setText(const std::string& theX, myTextArray->SetValue(1, aY); myTextArray->SetValue(2, aZ); owner()->data()->sendAttributeUpdated(this); + // Send it to evaluator to convert into the double and store in the attribute + static Events_ID anId = ModelAPI_AttributeEvalMessage::eventId(); + std::shared_ptr aMessage = + std::shared_ptr(new ModelAPI_AttributeEvalMessage(anId, this)); + aMessage->setAttribute(owner()->data()->attribute(id())); // to get shared pointer to this + Events_Loop::loop()->send(aMessage); } } diff --git a/src/GeomData/GeomData_Point.h b/src/GeomData/GeomData_Point.h index 8a0fb83aa..30ac5310f 100644 --- a/src/GeomData/GeomData_Point.h +++ b/src/GeomData/GeomData_Point.h @@ -52,7 +52,7 @@ class GeomData_Point : public GeomDataAPI_Point GEOMDATA_EXPORT virtual std::string textZ(); /// Allows to set expression (text) as invalid (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionInvalid(int, bool theFlag); + GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag); /// Returns true if text is invalid GEOMDATA_EXPORT virtual bool expressionInvalid(int); diff --git a/src/GeomData/GeomData_Point2D.cpp b/src/GeomData/GeomData_Point2D.cpp index bb1e6c519..9637c248e 100644 --- a/src/GeomData/GeomData_Point2D.cpp +++ b/src/GeomData/GeomData_Point2D.cpp @@ -8,6 +8,7 @@ #include #include #include +#include using namespace std; @@ -54,6 +55,12 @@ void GeomData_Point2D::setText(const std::string& theX, myTextArray->SetValue(0, aX); myTextArray->SetValue(1, aY); owner()->data()->sendAttributeUpdated(this); + // Send it to evaluator to convert into the double and store in the attribute + static Events_ID anId = ModelAPI_AttributeEvalMessage::eventId(); + std::shared_ptr aMessage = + std::shared_ptr(new ModelAPI_AttributeEvalMessage(anId, this)); + aMessage->setAttribute(owner()->data()->attribute(id())); // to get shared pointer to this + Events_Loop::loop()->send(aMessage); } } -- 2.39.2