Salome HOME
Regression: do not rotate viewer if sketch plane is selected from a face of a shape
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 15 Oct 2015 08:40:20 +0000 (11:40 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 15 Oct 2015 08:40:20 +0000 (11:40 +0300)
src/GeomAPI/GeomAPI_AISObject.cpp
src/GeomAPI/GeomAPI_AISObject.h
src/PartSet/PartSet_WidgetSketchLabel.cpp

index bd8892987095df14e38c193c0814f0d4835b9cb1..198a1892631ded1ab512bfaaf282d6f7b9473160 100644 (file)
@@ -83,6 +83,22 @@ void GeomAPI_AISObject::createShape(std::shared_ptr<GeomAPI_Shape> theShape)
   }
 }
 
+std::shared_ptr<GeomAPI_Shape> GeomAPI_AISObject::getShape() const
+{
+  std::shared_ptr<GeomAPI_Shape> aResult;
+
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
+    if (aShapeAIS) {
+      std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
+      aResult->setImpl(new TopoDS_Shape(aShapeAIS->Shape()));
+      return aResult;
+    }
+  }
+  return std::shared_ptr<GeomAPI_Shape>();
+}
+
 void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
                                        std::shared_ptr<GeomAPI_Pnt> theEndPoint,
                                        std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
index a3c0c23cefa13115b2d735c0fb480725b6cbb500..c649ba93862dbb829cb3b7c4ef67b5fed18dfca1 100644 (file)
@@ -36,6 +36,9 @@ class GeomAPI_AISObject : public GeomAPI_Interface
   GEOMAPI_EXPORT 
   void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
 
+  /// Reyirns shape used for the presentation creation (can be NULL)
+  GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> getShape() const;
+
   /** \brief Creates AIS_LengthDimension object
    *  \param[in] theStartPoint  first point for dimension
    *  \param[in] theEndPoint    second point for dimension
index e28724ddc37d179bc79105bfd74af476d9c6ac96..e4d837508393b61e84a9698ccc3d6e45bfb7b28b 100644 (file)
@@ -159,7 +159,11 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs
       aXYZ.Reverse();
     }*/
 
-    myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
+    // Rotate view if the sketcher plane is selected only from preview planes
+    // Preview planes are created only if there is no any shape
+    if (myYZPlane.get()) {
+      myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
+    }
   }
   // 3. Clear text in the label
   myLabel->setText("");
@@ -288,8 +292,6 @@ void PartSet_WidgetSketchLabel::activateCustom()
 
   connect(workshop()->selector(), SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
   activateFilters(true);
-
-  //VSV aDisp->updateViewer();
 }
 
 void PartSet_WidgetSketchLabel::deactivate()