From: vsv Date: Thu, 15 Oct 2015 08:40:20 +0000 (+0300) Subject: Regression: do not rotate viewer if sketch plane is selected from a face of a shape X-Git-Tag: V_2.0.0_alfa1~91 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b2fc3132f3010bb1ebc54fff534cda6bb53e89b3;p=modules%2Fshaper.git Regression: do not rotate viewer if sketch plane is selected from a face of a shape --- diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index bd8892987..198a18926 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -83,6 +83,22 @@ void GeomAPI_AISObject::createShape(std::shared_ptr theShape) } } +std::shared_ptr GeomAPI_AISObject::getShape() const +{ + std::shared_ptr aResult; + + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull()) { + Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS); + if (aShapeAIS) { + std::shared_ptr aResult(new GeomAPI_Shape); + aResult->setImpl(new TopoDS_Shape(aShapeAIS->Shape())); + return aResult; + } + } + return std::shared_ptr(); +} + void GeomAPI_AISObject::createDistance(std::shared_ptr theStartPoint, std::shared_ptr theEndPoint, std::shared_ptr theFlyoutPoint, diff --git a/src/GeomAPI/GeomAPI_AISObject.h b/src/GeomAPI/GeomAPI_AISObject.h index a3c0c23ce..c649ba938 100644 --- a/src/GeomAPI/GeomAPI_AISObject.h +++ b/src/GeomAPI/GeomAPI_AISObject.h @@ -36,6 +36,9 @@ class GeomAPI_AISObject : public GeomAPI_Interface GEOMAPI_EXPORT void createShape(std::shared_ptr theShape); + /// Reyirns shape used for the presentation creation (can be NULL) + GEOMAPI_EXPORT std::shared_ptr getShape() const; + /** \brief Creates AIS_LengthDimension object * \param[in] theStartPoint first point for dimension * \param[in] theEndPoint second point for dimension diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index e28724ddc..e4d837508 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -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()