]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update constraints symbols according to current sketch plane
authorvsv <vsv@opencascade.com>
Mon, 3 Jun 2019 14:13:34 +0000 (17:13 +0300)
committervsv <vsv@opencascade.com>
Mon, 3 Jun 2019 14:13:34 +0000 (17:13 +0300)
13 files changed:
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/SketcherPrs/SketcherPrs_Collinear.cpp
src/SketcherPrs/SketcherPrs_Equal.cpp
src/SketcherPrs/SketcherPrs_HVDirection.cpp
src/SketcherPrs/SketcherPrs_Middle.cpp
src/SketcherPrs/SketcherPrs_Mirror.cpp
src/SketcherPrs/SketcherPrs_Parallel.cpp
src/SketcherPrs/SketcherPrs_Perpendicular.cpp
src/SketcherPrs/SketcherPrs_Rigid.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.h
src/SketcherPrs/SketcherPrs_Tangent.cpp
src/SketcherPrs/SketcherPrs_Transformation.cpp

index 3c66f35f4938612ed6bc9663ab4a5a7a489ef993..aea6f47f19d9ad689588426ad181a424111f6f96 100644 (file)
@@ -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();
 
index 056d5ab95c1d1cd2aa56afa965e6b180202658e7..90e5d1b0e89d80980b761c6e9174150c2a5ae3f3 100644 (file)
@@ -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 =
index 959f8ca862a77297b5bc3a12dececd24517a7027..72a07d0719dbc596f80e72afa8b7b4f47e227ed2 100644 (file)
@@ -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 =
index 2f4ca10a3ccf8564fbb7d05b471fffc3c6559a29..942bd909e82d5ee64ff52e8250742dcae3463f68 100644 (file)
@@ -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
index 224d72f3c59d5b965037c610d8c05bd3abdabbe8..67326f1561c3dc0d9a09686acac4b8f5aa0b4af7 100644 (file)
@@ -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;
 
index 299a4888595a20a13e615859f5b476b7d9e5bb5e..eb3b12c495857de7ebd0b9ce1fb232ba8fe1ab65 100644 (file)
@@ -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
index 973a972b2ec00fb70a49b9948cce383432ceac2a..254c562b1928d30ece2aa7a09baac83f2c7c6f5b 100644 (file)
@@ -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 =
index b746818845038050df64feef06b34237c2b3ca77..314c74cb283f94240d26868b9fb39ffceb17e4c2 100644 (file)
@@ -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 =
index 9ecca54e4a3caa20e6cda911e0b2cf70db6a1ceb..d552f06f16fee4b4a679068319ff6b5e1b4b6d63 100644 (file)
@@ -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<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(myConstraint,
                                                   SketchPlugin_Constraint::ENTITY_A());
-    std::shared_ptr<GeomAPI_Pnt> aPoint = myPlane->to3D(aPnt->x(), aPnt->y() + theStep);
+    std::shared_ptr<GeomAPI_Pnt> aPoint = plane()->to3D(aPnt->x(), aPnt->y() + theStep);
     myPntArray->AddVertex(aPoint->impl<gp_Pnt>());
   }
   return true;
index 03d1e26f7b65f3a0488c1f5f11287c58192c451c..48f851972d0438e6b72ad6c28201b8e2b8a32e8d 100644 (file)
@@ -120,7 +120,7 @@ std::map<const char*, Handle(Image_AlienPixMap)> 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);
index ba91cd8f86bea6e55e794801363eb2904876e4b0..ad5a5ddde07d61ca8acaacacad5ed4810a69d0b1 100644 (file)
@@ -70,7 +70,7 @@ public:
     const Handle(SelectMgr_EntityOwner)& theOwner);
 
   /// Returns sketcher plane
-  Standard_EXPORT std::shared_ptr<GeomAPI_Ax3> plane() const { return myPlane; }
+  Standard_EXPORT std::shared_ptr<GeomAPI_Ax3> 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<GeomAPI_Ax3> myPlane;
+  SketchPlugin_Sketch* mySketcher;
 
   /// Aspect for entities drawing
   Handle(Graphic3d_AspectMarker3d) myAspect;
index 183256a0a1f0f48b86c5933a69a2a60ce65fdaed..b979cc32164f4e0b28dc751f6182b2c02075711f 100644 (file)
@@ -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 =
index 4441f39349d94491dba4b7112facaa6a7151ffe6..53be1f2fe30673992c093ddbadd1b7c8bfebf3a9 100644 (file)
@@ -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<ModelAPI_Data> 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<GeomAPI_Pnt> aPnt = myPlane->to3D(aStart->x(), aStart->y());
+      std::shared_ptr<GeomAPI_Pnt> aPnt = plane()->to3D(aStart->x(), aStart->y());
       Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
       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<gp_Pnt>());
       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<GeomAPI_Pnt> aPnt = myPlane->to3D(aCenter->x(), aCenter->y());
+      std::shared_ptr<GeomAPI_Pnt> aPnt = plane()->to3D(aCenter->x(), aCenter->y());
       Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
       StdPrs_Point::Add(thePrs, aPoint, myDrawer);
     }