From: Mikhail PONIKAROV Date: Tue, 30 Dec 2014 12:02:51 +0000 (+0300) Subject: Merge branch 'Dev_0.6.1' of ssh://newgeom.redmine.opencascade.com:322/newgeom into... X-Git-Tag: V_0.7.0_rc1~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5453faccbabc730f9816c502460cd3ec37ef5621;hp=d150af3c6e788269822b07b3bf344a66b71b523f;p=modules%2Fshaper.git Merge branch 'Dev_0.6.1' of ssh://newgeom.redmine.opencascade.com:322/newgeom into Dev_0.6.1 --- diff --git a/src/GeomAPI/GeomAPI_Edge.cpp b/src/GeomAPI/GeomAPI_Edge.cpp index 06c733f3b..759b0b323 100644 --- a/src/GeomAPI/GeomAPI_Edge.cpp +++ b/src/GeomAPI/GeomAPI_Edge.cpp @@ -100,7 +100,7 @@ std::shared_ptr GeomAPI_Edge::circle() } -bool GeomAPI_Edge::isEqual(std::shared_ptr theEdge) +bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const { const TopoDS_Shape& aMyShape = const_cast(this)->impl(); const TopoDS_Shape& aInShape = theEdge->impl(); diff --git a/src/GeomAPI/GeomAPI_Edge.h b/src/GeomAPI/GeomAPI_Edge.h index 535522629..1c4802ecc 100644 --- a/src/GeomAPI/GeomAPI_Edge.h +++ b/src/GeomAPI/GeomAPI_Edge.h @@ -45,7 +45,7 @@ public: std::shared_ptr circle(); /// Returns true if the current edge is geometrically equal to the given edge - bool isEqual(std::shared_ptr theEdge); + bool isEqual(const std::shared_ptr theEdge) const; }; #endif diff --git a/src/GeomAPI/GeomAPI_Vertex.cpp b/src/GeomAPI/GeomAPI_Vertex.cpp index 3c9e0a0b2..d881d79b5 100644 --- a/src/GeomAPI/GeomAPI_Vertex.cpp +++ b/src/GeomAPI/GeomAPI_Vertex.cpp @@ -35,7 +35,7 @@ std::shared_ptr GeomAPI_Vertex::point() return std::shared_ptr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); } -bool GeomAPI_Vertex::isEqual(std::shared_ptr theVert) +bool GeomAPI_Vertex::isEqual(const std::shared_ptr theVert) const { const TopoDS_Shape& aMyShape = const_cast(this)->impl(); const TopoDS_Shape& aInShape = theVert->impl(); diff --git a/src/GeomAPI/GeomAPI_Vertex.h b/src/GeomAPI/GeomAPI_Vertex.h index fab2840b4..3b517a863 100644 --- a/src/GeomAPI/GeomAPI_Vertex.h +++ b/src/GeomAPI/GeomAPI_Vertex.h @@ -29,7 +29,7 @@ public: std::shared_ptr point(); /// Returns true if the current edge is geometrically equal to the given edge - bool isEqual(std::shared_ptr theVert); + bool isEqual(const std::shared_ptr theVert) const; }; #endif diff --git a/src/NewGeom/resources/LightApp.xml b/src/NewGeom/resources/LightApp.xml index 0a0aff47b..48bd30a2f 100644 --- a/src/NewGeom/resources/LightApp.xml +++ b/src/NewGeom/resources/LightApp.xml @@ -23,7 +23,7 @@ - +
diff --git a/src/NewGeom/resources/SalomeApp.xml b/src/NewGeom/resources/SalomeApp.xml index d4302060c..2b419bd45 100644 --- a/src/NewGeom/resources/SalomeApp.xml +++ b/src/NewGeom/resources/SalomeApp.xml @@ -27,7 +27,7 @@ - +
diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 77ef4f541..e8dce9b05 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -436,16 +436,26 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) { + XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); + XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + DataPtr aData = myCurrentSketch->data(); if ((!aData) || (!aData->isValid())) { // The sketch was aborted myCurrentSketch = CompositeFeaturePtr(); myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter); + + // Erase all sketcher objects + QStringList aSketchIds = sketchOperationIdList(); + QObjectPtrList aObjects = aDisplayer->displayedObjects(); + foreach (ObjectPtr aObj, aObjects) { + DataPtr aObjData = aObj->data(); + if ((!aObjData) || (!aObjData->isValid())) + aDisplayer->erase(aObj); + } return; } // Hide all sketcher sub-Objects - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) { FeaturePtr aFeature = myCurrentSketch->subFeature(i); std::list aResults = aFeature->results(); diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 22b76ad2e..a8f9dcad9 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -208,6 +208,23 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer) Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; + // Check that the visualized shape is the same and the redisplay is not necessary + // Redisplay of AIS object leads to this object selection compute and the selection + // in the browser is lost + // become + ResultPtr aResult = std::dynamic_pointer_cast(theObject); + if (aResult.get() != NULL) { + Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO); + if (!aShapePrs.IsNull()) { + std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); + const TopoDS_Shape& aShape = aShapePrs->Shape(); + std::shared_ptr anAISShapePtr(new GeomAPI_Shape()); + anAISShapePtr->setImpl(new TopoDS_Shape(aShape)); + + if (aShapePtr->isEqual(anAISShapePtr)) + return; + } + } aContext->Redisplay(aAISIO, false); if (isUpdateViewer) updateViewer(); @@ -299,7 +316,7 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes) //myUseExternalObjects = true; AIS_ListOfInteractive aPrsList; - displayedObjects(aContext, aPrsList); + ::displayedObjects(aContext, aPrsList); Handle(AIS_Trihedron) aTrihedron; AIS_ListIteratorOfListOfInteractive aLIt(aPrsList); @@ -339,7 +356,7 @@ void XGUI_Displayer::deactivateObjects() //aContext->NotUseDisplayedObjects(); AIS_ListOfInteractive aPrsList; - displayedObjects(aContext, aPrsList); + ::displayedObjects(aContext, aPrsList); AIS_ListIteratorOfListOfInteractive aLIt; //Handle(AIS_Trihedron) aTrihedron; diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 16f490e13..439d254e3 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -149,6 +149,9 @@ class XGUI_EXPORT XGUI_Displayer /// Returns number of displayed objects int objectsCount() const { return myResult2AISObjectMap.size(); } + QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); } + + /// Returns true if the given object can be shown in shaded mode bool canBeShaded(ObjectPtr theObject) const; protected: