Salome HOME
Merge branch 'Dev_0.6.1' of ssh://newgeom.redmine.opencascade.com:322/newgeom into...
authorMikhail PONIKAROV <mpv@coldrex.nnov.opencascade.com>
Tue, 30 Dec 2014 12:02:51 +0000 (15:02 +0300)
committerMikhail PONIKAROV <mpv@coldrex.nnov.opencascade.com>
Tue, 30 Dec 2014 12:02:51 +0000 (15:02 +0300)
src/GeomAPI/GeomAPI_Edge.cpp
src/GeomAPI/GeomAPI_Edge.h
src/GeomAPI/GeomAPI_Vertex.cpp
src/GeomAPI/GeomAPI_Vertex.h
src/NewGeom/resources/LightApp.xml
src/NewGeom/resources/SalomeApp.xml
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h

index 06c733f3baa888eb9662eedf0fc27baa2cc549be..759b0b323cb2c90205d2fef862abfe9c3fbc9c97 100644 (file)
@@ -100,7 +100,7 @@ std::shared_ptr<GeomAPI_Circ> GeomAPI_Edge::circle()
 }
 
 
-bool GeomAPI_Edge::isEqual(std::shared_ptr<GeomAPI_Shape> theEdge)
+bool GeomAPI_Edge::isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const
 {
   const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
   const TopoDS_Shape& aInShape = theEdge->impl<TopoDS_Shape>();
index 53552262983695efa0144176558bc02e86ceb647..1c4802ecc687b10585a3ea5c8c761bec5c0b3057 100644 (file)
@@ -45,7 +45,7 @@ public:
   std::shared_ptr<GeomAPI_Circ> circle();
 
   /// Returns true if the current edge is geometrically equal to the given edge
-  bool isEqual(std::shared_ptr<GeomAPI_Shape> theEdge);
+  bool isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const;
 };
 
 #endif
index 3c9e0a0b23a48f1090be2bed1d1036009e121821..d881d79b5bf0ea0cbbb7106bc0d3507f9aa05384 100644 (file)
@@ -35,7 +35,7 @@ std::shared_ptr<GeomAPI_Pnt> GeomAPI_Vertex::point()
   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
 }
 
-bool GeomAPI_Vertex::isEqual(std::shared_ptr<GeomAPI_Shape> theVert)
+bool GeomAPI_Vertex::isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const
 {
   const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Vertex*>(this)->impl<TopoDS_Shape>();
   const TopoDS_Shape& aInShape = theVert->impl<TopoDS_Shape>();
index fab2840b4cb99ff9e91b01d1f899795e84c5f319..3b517a8632a0e61b4a894093058d6eadcfe247c7 100644 (file)
@@ -29,7 +29,7 @@ public:
   std::shared_ptr<GeomAPI_Pnt> point();
 
   /// Returns true if the current edge is geometrically equal to the given edge
-  bool isEqual(std::shared_ptr<GeomAPI_Shape> theVert);
+  bool isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const;
 };
 
 #endif
index 0a0aff47b011494893147c228675d53851c9ed65..48bd30a2fbe0e75a1667c14f65865e4163465bc2 100644 (file)
@@ -23,7 +23,7 @@
     <!-- Major module parameters -->
     <parameter name="name" value="NewGeom"/>
     <parameter name="icon" value="newgeom.png"/>
-    <parameter name="version" value="0.6.1"/>
+    <parameter name="version" value="0.7.0"/>
   </section>
   <section name="resources">
     <!-- Module resources -->
index d4302060c09f0b3e2e7cc5119aab88141cca94ca..2b419bd45490203289bf0b6c3bf482ece52400fa 100644 (file)
@@ -27,7 +27,7 @@
     <!-- Major module parameters -->
     <parameter name="name" value="NewGeom"/>
     <parameter name="icon" value="newgeom.png"/>
-    <parameter name="version" value="0.6.1"/>
+    <parameter name="version" value="0.7.0"/>
   </section>
   <section name="resources">
     <!-- Module resources -->
index 77ef4f541af21fa8689c3b5b21361b0035c2907f..e8dce9b054fda73c96867dd59382767aff957152 100644 (file)
@@ -436,16 +436,26 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
 
 void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
 {
+  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(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<XGUI_ModuleConnector*>(myModule->workshop());
-  XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
   for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
     FeaturePtr aFeature = myCurrentSketch->subFeature(i);
     std::list<ResultPtr> aResults = aFeature->results();
index 22b76ad2eafae3bb03d009aaf614b84982cedaba..a8f9dcad990baa4b7a0fe56252615dd0231c3458 100644 (file)
@@ -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<ModelAPI_Result>(theObject);
+    if (aResult.get() != NULL) {
+      Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
+      if (!aShapePrs.IsNull()) {
+        std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
+        const TopoDS_Shape& aShape = aShapePrs->Shape();
+        std::shared_ptr<GeomAPI_Shape> 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;
index 16f490e135db9342aacb7bad16c8b02d1777669d..439d254e31252b8f94aaa13afe1e20cf299c9866 100644 (file)
@@ -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: