From: nds Date: Wed, 5 Jul 2017 10:02:15 +0000 (+0300) Subject: Dimensions move using ModelAPI_ObjectMovedMessage mechanism. Move by deltas is obsole... X-Git-Tag: V_2.9.0~23^2~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=893048d62e837075ea3253c89ce9ecdfbb7a0cf3;p=modules%2Fshaper.git Dimensions move using ModelAPI_ObjectMovedMessage mechanism. Move by deltas is obsolete, so removed. --- diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 9368211e0..0a425d8c2 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -23,6 +23,11 @@ #include +//#define DEBUG_OBJECT_MOVED_MESSAGE +#ifdef DEBUG_OBJECT_MOVED_MESSAGE +#include +#endif + ModelAPI_ObjectUpdatedMessage::ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender) : Events_MessageGroup(theID, theSender) @@ -363,21 +368,41 @@ void ModelAPI_ObjectMovedMessage::setMovedAttribute(const AttributePtr& theMoved void ModelAPI_ObjectMovedMessage::setOriginalPosition(double theX, double theY) { myOriginalPosition = std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setOriginalPosition: " << myOriginalPosition->x() << ", " + << myOriginalPosition->y() << std::endl; +#endif } void ModelAPI_ObjectMovedMessage::setOriginalPosition( const std::shared_ptr& thePoint) { myOriginalPosition = thePoint; +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setOriginalPosition: " << myOriginalPosition->x() << ", " + << myOriginalPosition->y() << std::endl; +#endif } void ModelAPI_ObjectMovedMessage::setCurrentPosition(double theX, double theY) { myCurrentPosition = std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " << myCurrentPosition->y() + << ", myCurrentPosition - myOriginalPosition: " + << myCurrentPosition->x() - myOriginalPosition->x() << ", " + << myCurrentPosition->y() - myOriginalPosition->y() << std::endl; +#endif } void ModelAPI_ObjectMovedMessage::setCurrentPosition( const std::shared_ptr& thePoint) { myCurrentPosition = thePoint; +#ifdef DEBUG_OBJECT_MOVED_MESSAGE + std::cout << "setCurrentPosition: " << myCurrentPosition->x() << ", " << myCurrentPosition->y() + << ", myCurrentPosition - myOriginalPosition: " + << myCurrentPosition->x() - myOriginalPosition->x() << ", " + << myCurrentPosition->y() - myOriginalPosition->y() << std::endl; +#endif } diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index 93004ec36..3c4d0604a 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -57,7 +57,8 @@ ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() { } -bool ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) +bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, double theSpinMaxValue, + double& outValue, QString& outText) { bool isValueAccepted = false; @@ -67,8 +68,8 @@ bool ModuleBase_WidgetEditor::editedValue(double& outValue, QString& outText) aLay->setContentsMargins(2, 2, 2, 2); ModuleBase_ParamSpinBox* anEditor = new ModuleBase_ParamSpinBox(myEditorDialog); - anEditor->setMinimum(0); - anEditor->setMaximum(DBL_MAX); + anEditor->setMinimum(theSpinMinValue); + anEditor->setMaximum(theSpinMaxValue); if (outText.isEmpty()) anEditor->setValue(outValue); else @@ -122,7 +123,7 @@ bool ModuleBase_WidgetEditor::showPopupEditor(const bool theSendSignals) if (mySpinBox->hasVariable()) aText = mySpinBox->text(); - isValueAccepted = editedValue(aValue, aText); + isValueAccepted = editedValue(mySpinBox->minimum(), mySpinBox->maximum(), aValue, aText); if (isValueAccepted) { if (aText.isEmpty()) { if (mySpinBox->hasVariable()) { diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.h b/src/ModuleBase/ModuleBase_WidgetEditor.h index 84fb045d6..c8177d56a 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetEditor.h @@ -73,10 +73,13 @@ Q_OBJECT private: /// Show editor + /// \param theSpinMinValue a minimal value of popup menu spin box + /// \param theSpinMaxValue a maximum value of popup menu spin box /// \param theOutValue a result value /// \param theOutText a result text /// \return true if the editor value is accepted - bool editedValue(double& theOutValue, QString& theOutText); + bool editedValue(double theSpinMinValue, double theSpinMaxValue, + double& theOutValue, QString& theOutText); private: ///< the current widget feature diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 6c5f2e884..d8b03f5a8 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -135,36 +135,6 @@ void SketchPlugin_Arc::execute() setResult(aResult, 1); } -void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if(!aData->isValid()) { - return; - } - - bool aWasBlocked = aData->blockSendAttributeUpdated(true); - - std::shared_ptr aCenter = std::dynamic_pointer_cast( - attribute(CENTER_ID())); - if(aCenter->isInitialized()) { - aCenter->move(theDeltaX, theDeltaY); - } - - std::shared_ptr aStart = std::dynamic_pointer_cast( - attribute(START_ID())); - if(aStart->isInitialized()) { - aStart->move(theDeltaX, theDeltaY); - } - - std::shared_ptr anEnd = std::dynamic_pointer_cast( - attribute(END_ID())); - if(anEnd->isInitialized()) { - anEnd->move(theDeltaX, theDeltaY); - } - - aData->blockSendAttributeUpdated(aWasBlocked); -} - bool SketchPlugin_Arc::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index 38c565b73..b9dd9ed8f 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -103,11 +103,6 @@ class SketchPlugin_Arc: public SketchPlugin_SketchEntity /// Creates an arc-shape SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Updates the "reversed" flag /// \param isReversed whether the arc will be reversed void setReversed(bool isReversed); diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index 77ea5d998..0975e57e4 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -96,20 +96,6 @@ void SketchPlugin_Circle::execute() setResult(aResult, 1); } -void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if(!aData->isValid()) { - return; - } - - std::shared_ptr aPoint = std::dynamic_pointer_cast( - aData->attribute(CENTER_ID())); - if(aPoint->isInitialized()) { - aPoint->move(theDeltaX, theDeltaY); - } -} - bool SketchPlugin_Circle::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index 6bc4050d8..ea95823d8 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -69,11 +69,6 @@ class SketchPlugin_Circle: public SketchPlugin_SketchEntity /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Use plugin manager for features creation SketchPlugin_Circle(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index 3d2440b15..14815ed66 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -269,20 +269,6 @@ void SketchPlugin_ConstraintAngle::updateConstraintValueByAngleValue() aValueAttr->setValue(anAngle); } -void SketchPlugin_ConstraintAngle::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - myFlyoutUpdate = true; - std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - aFlyoutAttr->setValue(aFlyoutAttr->x() + theDeltaX, aFlyoutAttr->y() + theDeltaY); - myFlyoutUpdate = false; -} - - bool SketchPlugin_ConstraintAngle::compute(const std::string& theAttributeId) { if (theAttributeId != SketchPlugin_Constraint::FLYOUT_VALUE_PNT()) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h index ce7e5f795..ba00fbc9d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h @@ -97,11 +97,6 @@ class SketchPlugin_ConstraintAngle : public SketchPlugin_ConstraintBase /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Calculate current value of the angle double calculateAngle(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp b/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp index 19037692f..0a499442b 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.cpp @@ -29,9 +29,3 @@ const void SketchPlugin_ConstraintBase::addSub(const FeaturePtr& theFeature) { } - -void SketchPlugin_ConstraintBase::move(const double theDeltaX, const double theDeltaY) -{ - -} - diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.h b/src/SketchPlugin/SketchPlugin_ConstraintBase.h index a30139b02..9c65757d6 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintBase.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.h @@ -64,10 +64,6 @@ class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomA * \param theFeature sub-feature */ SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); /// Customize presentation of the feature virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index b541a3bc1..9566988fd 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -92,60 +92,6 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi return anAIS; } -//************************************************************************************* -void SketchPlugin_ConstraintDistance::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - // Recalculate a shift of flyout point in terms of local coordinates - std::shared_ptr aDir(new GeomAPI_XY(theDeltaX, theDeltaY)); - std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aPointA = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); - std::shared_ptr aPointB = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); - - std::shared_ptr aStartPnt; - std::shared_ptr aEndPnt; - if (aPointA && aPointB) { - aStartPnt = aPointA->pnt()->xy(); - aEndPnt = aPointB->pnt()->xy(); - } else if (aPointA) { - FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(data(), - SketchPlugin_Constraint::ENTITY_B()); - if (!aLine) - return; - std::shared_ptr aPoint = aPointA->pnt(); - aStartPnt = aPoint->xy(); - aEndPnt = SketcherPrs_Tools::getProjectionPoint(aLine, aPoint)->xy(); - } else if (aPointB) { - FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(data(), - SketchPlugin_Constraint::ENTITY_A()); - if (!aLine) - return; - std::shared_ptr aPoint = aPointB->pnt(); - aStartPnt = SketcherPrs_Tools::getProjectionPoint(aLine, aPoint)->xy(); - aEndPnt = aPoint->xy(); - } else - return; - - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - double dX = aDir->dot(aLineDir->xy()); - double dY = -aDir->cross(aLineDir->xy()); - - std::shared_ptr aPoint = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - myFlyoutUpdate = true; - if (aPoint->isInitialized()) { - aPoint->setValue(aPoint->x() + dX, aPoint->y() + dY); - } else { - aPoint->setValue(dX, dY); - } - myFlyoutUpdate = false; -} - double SketchPlugin_ConstraintDistance::calculateCurrentDistance() { double aDistance = -1.; @@ -220,7 +166,6 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) } } } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { - myFlyoutUpdate = true; // Recalculate flyout point in local coordinates of the distance constraint: // the X coordinate is a length of projection of the flyout point on the // line binding two distanced points @@ -264,6 +209,7 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID) if (aEndPnt->distance(aStartPnt) < tolerance) return; + myFlyoutUpdate = true; std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index 3c433e974..e9e4b1501 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -78,11 +78,6 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); @@ -97,7 +92,7 @@ protected: /// Check the attributes related to distanced points/features are initialized bool areAttributesInitialized(); -private: +protected: bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point }; diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp index 4d9216477..accd996af 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp @@ -73,42 +73,6 @@ AISObjectPtr SketchPlugin_ConstraintDistanceHorizontal::getAISObject(AISObjectPt return anAIS; } -//************************************************************************************* -void SketchPlugin_ConstraintDistanceHorizontal::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - // Recalculate a shift of flyout point in terms of local coordinates - std::shared_ptr aDir(new GeomAPI_XY(theDeltaX, theDeltaY)); - std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aPointA = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); - std::shared_ptr aPointB = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); - - if (!aPointA || !aPointB) - return; - - std::shared_ptr aStartPnt = aPointA->pnt()->xy(); - std::shared_ptr aEndPnt = aPointB->pnt()->xy(); - - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - double dX = aDir->dot(aLineDir->xy()); - double dY = -aDir->cross(aLineDir->xy()); - - std::shared_ptr aPoint = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - myFlyoutUpdate = true; - if (aPoint->isInitialized()) { - aPoint->setValue(aPoint->x() + dX, aPoint->y() + dY); - } else { - aPoint->setValue(dX, dY); - } - myFlyoutUpdate = false; -} - double SketchPlugin_ConstraintDistanceHorizontal::calculateCurrentDistance() { std::shared_ptr aData = data(); @@ -133,7 +97,6 @@ void SketchPlugin_ConstraintDistanceHorizontal::attributeChanged(const std::stri aValueAttr->setValue(aDistance); } } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { - myFlyoutUpdate = true; // Recalculate flyout point in local coordinates of the distance constraint: // the X coordinate is a length of projection of the flyout point on the // line binding two distanced points @@ -152,15 +115,13 @@ void SketchPlugin_ConstraintDistanceHorizontal::attributeChanged(const std::stri std::shared_ptr aStartPnt = aPointA->pnt()->xy(); std::shared_ptr aEndPnt = aPointB->pnt()->xy(); - if (aEndPnt->distance(aStartPnt) < tolerance) return; - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); - - double X = aFlyoutDir->dot(aLineDir->xy()); - double Y = -aFlyoutDir->cross(aLineDir->xy()); + myFlyoutUpdate = true; + std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aEndPnt); + double X = aFlyoutDir->x(); // Dot on OX axis + double Y = aFlyoutDir->y(); // Cross to OX axis aFlyoutAttr->setValue(X, Y); myFlyoutUpdate = false; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h index 98ef11796..e8f6cb8eb 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h @@ -61,11 +61,6 @@ public: /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); @@ -76,9 +71,6 @@ public: protected: /// Returns the current distance between the feature attributes virtual double calculateCurrentDistance(); - -private: - bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp index 6691ee51b..e9f645a02 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp @@ -73,42 +73,6 @@ AISObjectPtr SketchPlugin_ConstraintDistanceVertical::getAISObject(AISObjectPtr return anAIS; } -//************************************************************************************* -void SketchPlugin_ConstraintDistanceVertical::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - // Recalculate a shift of flyout point in terms of local coordinates - std::shared_ptr aDir(new GeomAPI_XY(theDeltaX, theDeltaY)); - std::shared_ptr aPlane = SketchPlugin_Sketch::plane(sketch()); - std::shared_ptr aPointA = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_A(), aPlane); - std::shared_ptr aPointB = SketcherPrs_Tools::getFeaturePoint( - data(), SketchPlugin_Constraint::ENTITY_B(), aPlane); - - if (!aPointA || !aPointB) - return; - - std::shared_ptr aStartPnt = aPointA->pnt()->xy(); - std::shared_ptr aEndPnt = aPointB->pnt()->xy(); - - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - double dX = aDir->dot(aLineDir->xy()); - double dY = -aDir->cross(aLineDir->xy()); - - std::shared_ptr aPoint = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - myFlyoutUpdate = true; - if (aPoint->isInitialized()) { - aPoint->setValue(aPoint->x() + dX, aPoint->y() + dY); - } else { - aPoint->setValue(dX, dY); - } - myFlyoutUpdate = false; -} - double SketchPlugin_ConstraintDistanceVertical::calculateCurrentDistance() { std::shared_ptr aData = data(); @@ -133,7 +97,6 @@ void SketchPlugin_ConstraintDistanceVertical::attributeChanged(const std::string aValueAttr->setValue(aDistance); } } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { - myFlyoutUpdate = true; // Recalculate flyout point in local coordinates of the distance constraint: // the X coordinate is a length of projection of the flyout point on the // line binding two distanced points @@ -156,11 +119,10 @@ void SketchPlugin_ConstraintDistanceVertical::attributeChanged(const std::string if (aEndPnt->distance(aStartPnt) < tolerance) return; - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); - - double X = aFlyoutDir->dot(aLineDir->xy()); - double Y = -aFlyoutDir->cross(aLineDir->xy()); + std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aEndPnt); + myFlyoutUpdate = true; + double X = aFlyoutDir->y(); // Dot on OY axis + double Y = -aFlyoutDir->x(); // Cross to OY axis aFlyoutAttr->setValue(X, Y); myFlyoutUpdate = false; } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h index 784770061..2cdb36d7d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h @@ -61,11 +61,6 @@ public: /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); @@ -76,9 +71,6 @@ public: protected: /// Returns the current distance between the feature attributes virtual double calculateCurrentDistance(); - -private: - bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index 881eace02..765984cb6 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -166,37 +166,6 @@ AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePreviou return anAIS; } -void SketchPlugin_ConstraintLength::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - AttributeRefAttrPtr aLineAttr = std::dynamic_pointer_cast( - attribute(SketchPlugin_Constraint::ENTITY_A())); - if (!aLineAttr || !aLineAttr->isObject()) - return; - FeaturePtr aLine = ModelAPI_Feature::feature(aLineAttr->object()); - if (!aLine || aLine->getKind() != SketchPlugin_Line::ID()) - return; - - // Recalculate a shift of flyout point in terms of local coordinates - std::shared_ptr aDir(new GeomAPI_XY(theDeltaX, theDeltaY)); - std::shared_ptr aStartPnt = std::dynamic_pointer_cast( - aLine->attribute(SketchPlugin_Line::START_ID()))->pnt()->xy(); - std::shared_ptr aEndPnt = std::dynamic_pointer_cast( - aLine->attribute(SketchPlugin_Line::END_ID()))->pnt()->xy(); - std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); - double dX = aDir->dot(aLineDir->xy()); - double dY = -aDir->cross(aLineDir->xy()); - - myFlyoutUpdate = true; - std::shared_ptr aPoint = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - aPoint->setValue(aPoint->x() + dX, aPoint->y() + dY); - myFlyoutUpdate = false; -} - void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) { if (theID == SketchPlugin_Constraint::ENTITY_A()) { @@ -209,7 +178,6 @@ void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) { aValueAttr->setValue(aLength); } } else if (theID == SketchPlugin_Constraint::FLYOUT_VALUE_PNT() && !myFlyoutUpdate) { - myFlyoutUpdate = true; // Recalculate flyout point in local coordinates of the line: // the X coordinate is a length of projection of the flyout point on the line // the Y coordinate is a distance from the point to the line @@ -230,6 +198,7 @@ void SketchPlugin_ConstraintLength::attributeChanged(const std::string& theID) { std::shared_ptr aEndPnt = std::dynamic_pointer_cast( aLine->attribute(SketchPlugin_Line::END_ID()))->pnt()->xy(); + myFlyoutUpdate = true; std::shared_ptr aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt))); std::shared_ptr aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt); double X = aFlyoutDir->dot(aLineDir->xy()); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.h b/src/SketchPlugin/SketchPlugin_ConstraintLength.h index 042201613..50e9ebb9b 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@ -29,6 +29,7 @@ #include +class GeomAPI_Pnt2d; class GeomDataAPI_Point2D; /** \class SketchPlugin_ConstraintLength @@ -73,11 +74,6 @@ class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index 41be22e74..16c7b6032 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -173,19 +173,6 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou return anAIS; } -void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - myFlyoutUpdate = true; - std::shared_ptr aFlyoutAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - aFlyoutAttr->setValue(aFlyoutAttr->x() + theDeltaX, aFlyoutAttr->y() + theDeltaY); - myFlyoutUpdate = false; -} - void SketchPlugin_ConstraintRadius::attributeChanged(const std::string& theID) { if (theID == SketchPlugin_Constraint::ENTITY_A()) { std::shared_ptr aValueAttr = std::dynamic_pointer_cast< diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h index d4ad2f597..cdb83eccd 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h @@ -67,11 +67,6 @@ class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); diff --git a/src/SketchPlugin/SketchPlugin_Ellipse.cpp b/src/SketchPlugin/SketchPlugin_Ellipse.cpp index d9f61e165..b7ec05716 100644 --- a/src/SketchPlugin/SketchPlugin_Ellipse.cpp +++ b/src/SketchPlugin/SketchPlugin_Ellipse.cpp @@ -102,20 +102,6 @@ void SketchPlugin_Ellipse::execute() setResult(aResult, 1); } -void SketchPlugin_Ellipse::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if(!aData->isValid()) { - return; - } - - std::shared_ptr aPoint = std::dynamic_pointer_cast( - aData->attribute(CENTER_ID())); - if(aPoint->isInitialized()) { - aPoint->move(theDeltaX, theDeltaY); - } -} - bool SketchPlugin_Ellipse::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } diff --git a/src/SketchPlugin/SketchPlugin_Ellipse.h b/src/SketchPlugin/SketchPlugin_Ellipse.h index fc4b77c64..fe0873f08 100644 --- a/src/SketchPlugin/SketchPlugin_Ellipse.h +++ b/src/SketchPlugin/SketchPlugin_Ellipse.h @@ -86,11 +86,6 @@ class SketchPlugin_Ellipse: public SketchPlugin_SketchEntity /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Use plugin manager for features creation SketchPlugin_Ellipse(); diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index a780d5e10..a98238307 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -65,11 +65,6 @@ class SketchPlugin_Feature : public ModelAPI_Feature return true; } - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) = 0; - /// Construction result is allways recomuted on the fly SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp index a7ff0b68e..a391b22e6 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp @@ -52,10 +52,6 @@ void SketchPlugin_IntersectionPoint::execute() } } -void SketchPlugin_IntersectionPoint::move(double theDeltaX, double theDeltaY) -{ -} - void SketchPlugin_IntersectionPoint::attributeChanged(const std::string& theID) { if (theID == EXTERNAL_LINE_ID()) { diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h index b93e262a3..a25f1be36 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h @@ -57,11 +57,6 @@ public: /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object: for external point SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index 0e2d723d1..23cbe2666 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -92,21 +92,6 @@ void SketchPlugin_Line::execute() } } -void SketchPlugin_Line::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - std::shared_ptr aPoint1 = std::dynamic_pointer_cast - (aData->attribute(START_ID())); - aPoint1->move(theDeltaX, theDeltaY); - - std::shared_ptr aPoint2 = std::dynamic_pointer_cast - (aData->attribute(END_ID())); - aPoint2->move(theDeltaX, theDeltaY); -} - std::string SketchPlugin_Line::processEvent(const std::shared_ptr& theMessage) { std::string aFilledAttributeName; diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index 31e38a28a..d51c6608f 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -76,11 +76,6 @@ class SketchPlugin_Line : public SketchPlugin_SketchEntity, /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Apply information of the message to current object. It fills start attribute of /// the currrent feature by last attribute of the message feature, build coincidence /// if message has selected object diff --git a/src/SketchPlugin/SketchPlugin_MacroArc.h b/src/SketchPlugin/SketchPlugin_MacroArc.h index 023c1f76f..20b42c462 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArc.h +++ b/src/SketchPlugin/SketchPlugin_MacroArc.h @@ -200,13 +200,6 @@ class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity, /// Creates an arc-shape SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) - { - }; - /// Reimplemented from ModelAPI_Feature::isMacro(). SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.h b/src/SketchPlugin/SketchPlugin_MacroCircle.h index 9208dfdb1..621439c44 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.h +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.h @@ -170,12 +170,6 @@ class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity, /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) - {}; - /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}; diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipse.h b/src/SketchPlugin/SketchPlugin_MacroEllipse.h index d31d0d55f..0af9ee7bd 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipse.h +++ b/src/SketchPlugin/SketchPlugin_MacroEllipse.h @@ -124,12 +124,6 @@ class SketchPlugin_MacroEllipse: public SketchPlugin_SketchEntity, /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) - {} - /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true SKETCHPLUGIN_EXPORT virtual bool isMacro() const diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index 766d33936..252ecf181 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -62,17 +62,6 @@ void SketchPlugin_Point::execute() } } -void SketchPlugin_Point::move(double theDeltaX, double theDeltaY) -{ - std::shared_ptr aData = data(); - if (!aData->isValid()) - return; - - std::shared_ptr aPoint1 = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Point::COORD_ID())); - aPoint1->move(theDeltaX, theDeltaY); -} - bool SketchPlugin_Point::isFixed() { return data()->selection(EXTERNAL_ID())->context().get() != NULL; } diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index 7e7a4c673..ae23556e3 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -58,11 +58,6 @@ class SketchPlugin_Point : public SketchPlugin_SketchEntity /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object: for external point SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); diff --git a/src/SketchPlugin/SketchPlugin_Projection.cpp b/src/SketchPlugin/SketchPlugin_Projection.cpp index d6b565415..9b8f4e4b8 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.cpp +++ b/src/SketchPlugin/SketchPlugin_Projection.cpp @@ -90,11 +90,6 @@ void SketchPlugin_Projection::execute() computeProjection(EXTERNAL_FEATURE_ID()); } -void SketchPlugin_Projection::move(double theDeltaX, double theDeltaY) -{ - // feature cannot be moved -} - void SketchPlugin_Projection::attributeChanged(const std::string& theID) { if ((theID == EXTERNAL_FEATURE_ID() || theID == EXTERNAL_ID()) && !myIsComputing) { diff --git a/src/SketchPlugin/SketchPlugin_Projection.h b/src/SketchPlugin/SketchPlugin_Projection.h index c5c3e8378..26b4b960e 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.h +++ b/src/SketchPlugin/SketchPlugin_Projection.h @@ -75,11 +75,6 @@ public: /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object: for external point SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index 6b76be658..3e7328e77 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -104,13 +104,6 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature, public GeomAPI_ICu /// Request for initialization of data model of the feature: adding all attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) - { - } - /// Converts a 2D sketch space point into point in 3D space /// \param theX an X coordinate /// \param theY an Y coordinate diff --git a/src/SketchPlugin/SketchPlugin_Split.h b/src/SketchPlugin/SketchPlugin_Split.h index 4a37a3f0a..1c9ae40e5 100644 --- a/src/SketchPlugin/SketchPlugin_Split.h +++ b/src/SketchPlugin/SketchPlugin_Split.h @@ -128,9 +128,6 @@ class SketchPlugin_Split : public SketchPlugin_Feature, public GeomAPI_IPresenta /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature : Empty - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {}; - /// Apply information of the message to current object. It fills selected point and object virtual std::string processEvent(const std::shared_ptr& theMessage); diff --git a/src/SketchPlugin/SketchPlugin_Trim.h b/src/SketchPlugin/SketchPlugin_Trim.h index 9dd5015db..f03c5d59f 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.h +++ b/src/SketchPlugin/SketchPlugin_Trim.h @@ -103,9 +103,6 @@ class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentab /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); - /// Moves the feature : Empty - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {}; - /// Apply information of the message to current object. It fills selected point and object virtual std::string processEvent(const std::shared_ptr& theMessage); diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index d253916c9..506c8e46d 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -226,6 +226,17 @@ bool SketchSolver_Manager::moveFeature( if (!aGroup) return false; + std::shared_ptr aConstraint = + std::dynamic_pointer_cast(theMovedFeature); + if (aConstraint) + { + std::shared_ptr aPntAttr = std::dynamic_pointer_cast + (aConstraint->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); + aPntAttr->setValue(theTo); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + return true; + } + aGroup->blockEvents(true); return aGroup->moveFeature(theMovedFeature, theFrom, theTo); } @@ -240,6 +251,15 @@ bool SketchSolver_Manager::moveAttribute( const std::shared_ptr& theTo) { FeaturePtr anOwner = ModelAPI_Feature::feature(theMovedAttribute->owner()); + std::shared_ptr aConstraint = + std::dynamic_pointer_cast(anOwner); + if (aConstraint) + { + theMovedAttribute->setValue(theTo); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + return true; + } + std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(anOwner); SketchGroupPtr aGroup; diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index 5e5c60465..34fb6a6ee 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -42,6 +42,7 @@ #include +//#ifdef OCCT_28850_FIXED /// Creates an aspect to be shown in length/radius dimension presentations /// \return an instance of aspect @@ -103,6 +104,13 @@ SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theCo { SetDimensionAspect(createDimensionAspect()); myStyleListener = new SketcherPrs_DimensionStyleListener(); + +#ifdef OCCT_28850_FIXED + if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID()) + SetDirection(true, mySketcherPlane->dirX()->impl()); + else if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) + SetDirection(true, mySketcherPlane->dirY()->impl()); +#endif } SketcherPrs_LengthDimension::~SketcherPrs_LengthDimension()