#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_EventReentrantMessage.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
if(!aFlyOutAttr->isInitialized())
compute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+
+ static Events_ID anId = ModelAPI_EventReentrantMessage::eventId();
+ std::shared_ptr<ModelAPI_EventReentrantMessage> aMessage(
+ new ModelAPI_EventReentrantMessage(anId, this));
+ Events_Loop::loop()->send(aMessage);
}
AISObjectPtr SketchPlugin_ConstraintAngle::getAISObject(AISObjectPtr thePrevious)
return anAIS;
}
+// LCOV_EXCL_START
+std::string SketchPlugin_ConstraintAngle::processEvent(
+ const std::shared_ptr<Events_Message>& theMessage)
+{
+ std::string aFilledAttributeName;
+
+ std::shared_ptr<ModelAPI_EventReentrantMessage> aReentrantMessage =
+ std::dynamic_pointer_cast<ModelAPI_EventReentrantMessage>(theMessage);
+ if (aReentrantMessage.get()) {
+ aFilledAttributeName = ENTITY_A();
+ refattr(ENTITY_A())->setObject(aReentrantMessage->selectedObject());
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(SELECTED_FIRST_POINT_ID()))
+ ->setValue(aReentrantMessage->clickedPoint());
+ }
+ return aFilledAttributeName;
+}
+// LCOV_EXCL_STOP
+
void SketchPlugin_ConstraintAngle::attributeChanged(const std::string& theID)
{
if (myFlyoutUpdate)
#define SketchPlugin_ConstraintAngle_H_
#include "SketchPlugin.h"
-#include <SketchPlugin_Sketch.h>
+#include "SketchPlugin_Sketch.h"
#include "SketchPlugin_ConstraintBase.h"
+#include <ModelAPI_IReentrant.h>
+
/** \class SketchPlugin_ConstraintAngle
* \ingroup Plugins
* \brief Feature for creation of a new constraint fix angle between two lines
* This constraint has two attributes:
* SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
*/
-class SketchPlugin_ConstraintAngle : public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintAngle : public SketchPlugin_ConstraintBase,
+ public ModelAPI_IReentrant
{
public:
/// Angle constraint kind
/// Returns the AIS preview
SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+ /// Apply information of the message to current object.
+ /// It fills selected point and the first object.
+ virtual std::string processEvent(const std::shared_ptr<Events_Message>& theMessage);
+
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintAngle();