From: vsv Date: Mon, 3 Jun 2019 14:13:34 +0000 (+0300) Subject: Update constraints symbols according to current sketch plane X-Git-Tag: VEDF2019Lot4~114^2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9a32ae7ead8579a9ffae9ad356d6ce5b2ba4955a;p=modules%2Fshaper.git Update constraints symbols according to current sketch plane --- diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 3c66f35f4..aea6f47f1 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -344,9 +344,6 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs } } } - if (aModule) - aModule->onViewTransformed(); - if (myOpenTransaction) { SessionPtr aMgr = ModelAPI_Session::get(); aMgr->finishOperation(); @@ -366,6 +363,9 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs myWorkshop->selectionActivate()->updateSelectionFilters(); myWorkshop->selectionActivate()->updateSelectionModes(); + if (aModule) + aModule->onViewTransformed(); + // 6. Update sketcher actions XGUI_ActionsMgr* anActMgr = aWorkshop->actionsMgr(); diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index 056d5ab95..90e5d1b0e 100644 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -55,7 +55,7 @@ bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aObj1 = diff --git a/src/SketcherPrs/SketcherPrs_Equal.cpp b/src/SketcherPrs/SketcherPrs_Equal.cpp index 959f8ca86..72a07d071 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.cpp +++ b/src/SketcherPrs/SketcherPrs_Equal.cpp @@ -55,7 +55,7 @@ bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aObj1 = diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index 2f4ca10a3..942bd909e 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -51,7 +51,7 @@ bool SketcherPrs_HVDirection::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; // Set point of the symbol diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index 224d72f3c..67326f156 100644 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -57,7 +57,7 @@ bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aPointObject; diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 299a48885..eb3b12c49 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -74,7 +74,7 @@ bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; // Get axis of mirror diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index 973a972b2..254c562b1 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -55,7 +55,7 @@ bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aObj1 = diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp index b74681884..314c74cb2 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp @@ -58,7 +58,7 @@ bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aObj1 = diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 9ecca54e4..d552f06f1 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -80,7 +80,7 @@ bool SketcherPrs_Rigid::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); @@ -99,7 +99,7 @@ bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, bool withColor) c // The constraint attached to a point std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - std::shared_ptr aPoint = myPlane->to3D(aPnt->x(), aPnt->y() + theStep); + std::shared_ptr aPoint = plane()->to3D(aPnt->x(), aPnt->y() + theStep); myPntArray->AddVertex(aPoint->impl()); } return true; diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 03d1e26f7..48f851972 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -120,7 +120,7 @@ std::map SketcherPrs_SymbolPrs::myIconsM SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, SketchPlugin_Sketch* theSketcher) : AIS_InteractiveObject(), myConstraint(theConstraint), - myPlane(theSketcher->coordinatePlane()), myIsCustomColor(false), + myIsCustomColor(false), mySketcher(theSketcher) { SetAutoHilight(Standard_False); diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index ba91cd8f8..ad5a5ddde 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -70,7 +70,7 @@ public: const Handle(SelectMgr_EntityOwner)& theOwner); /// Returns sketcher plane - Standard_EXPORT std::shared_ptr plane() const { return myPlane; } + Standard_EXPORT std::shared_ptr plane() const { return mySketcher->coordinatePlane(); } /// Returns feature object Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; } @@ -146,10 +146,7 @@ protected: ModelAPI_Feature* myConstraint; /// Sketcher feature - ModelAPI_CompositeFeature* mySketcher; - - /// Plane of the current sketcher - std::shared_ptr myPlane; + SketchPlugin_Sketch* mySketcher; /// Aspect for entities drawing Handle(Graphic3d_AspectMarker3d) myAspect; diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index 183256a0a..b979cc321 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -62,7 +62,7 @@ bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; ObjectPtr aObj1 = diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 4441f3934..53be1f2fe 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -86,7 +86,7 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, bool withColor) const { - if (!IsReadyToDisplay(myConstraint, myPlane)) + if (!IsReadyToDisplay(myConstraint, plane())) return false; std::shared_ptr aData = myConstraint->data(); @@ -144,12 +144,12 @@ void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& the if (aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized()) { // Add start point - std::shared_ptr aPnt = myPlane->to3D(aStart->x(), aStart->y()); + std::shared_ptr aPnt = plane()->to3D(aStart->x(), aStart->y()); Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); StdPrs_Point::Add(thePrs, aPoint, myDrawer); // Add end point - aPnt = myPlane->to3D(aEnd->x(), aEnd->y()); + aPnt = plane()->to3D(aEnd->x(), aEnd->y()); aPoint = new Geom_CartesianPoint(aPnt->impl()); StdPrs_Point::Add(thePrs, aPoint, myDrawer); } @@ -159,7 +159,7 @@ void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& the GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID()); if (aCenter.get() && aCenter->isInitialized()) { // Show center of rotation - std::shared_ptr aPnt = myPlane->to3D(aCenter->x(), aCenter->y()); + std::shared_ptr aPnt = plane()->to3D(aCenter->x(), aCenter->y()); Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); StdPrs_Point::Add(thePrs, aPoint, myDrawer); }