]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Restore old planes selection definition
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 21 Jul 2014 14:44:51 +0000 (18:44 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 21 Jul 2014 14:44:51 +0000 (18:44 +0400)
12 files changed:
src/FeaturesPlugin/FeaturesPlugin_Extrusion.h
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/SketchPlugin/SketchPlugin_Arc.h
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/XGUI/XGUI_Displayer.cpp

index c83bead92edebeb6d6bcdcbbdbb03ea4f46c31a5..4e92bd7cba5450ff1ac62c8c05663eeb11993662 100644 (file)
@@ -20,19 +20,19 @@ public:
   /// attribute name of referenced face
   inline static const std::string& FACE_ID()
   {
-    static const std::string MY_FACE_ID("FeaturesPlugin_Extrusion::FACE_ID()");
+    static const std::string MY_FACE_ID("extrusion_face");
     return MY_FACE_ID;
   }
   /// attribute name of extrusion size
   inline static const std::string& SIZE_ID()
   {
-    static const std::string MY_SIZE_ID("FeaturesPlugin_Extrusion::SIZE_ID()");
+    static const std::string MY_SIZE_ID("extrusion_size");
     return MY_SIZE_ID;
   }
     /// attribute name of reverse direction
   inline static const std::string& REVERSE_ID()
   {
-    static const std::string MY_REVERSE_ID("FeaturesPlugin_Extrusion::REVERSE_ID()");
+    static const std::string MY_REVERSE_ID("extrusion_reverse");
     return MY_REVERSE_ID;
   }
 
index 84db77027aeee3f9e5f164e1289cabdfff897275..af017fbbaa54d542bd1b7d1d79a53c552ddeeda6 100644 (file)
@@ -50,9 +50,8 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
       if (aFeature) {
         if (myModule->workshop()->displayer()->isVisible(aFeature->firstResult()) ||
             aType == EVENT_OBJECT_CREATED) {
-          myModule->visualizePreview(aFeature, true, false);
-          //if (aType == EVENT_OBJECT_CREATED)
           myModule->activateFeature(aFeature, true);
+          // TODO myModule->visualizePreview(aFeature, true, false);
         }
       }
     }
index ad4d263244ddf2490650a00f9cd90b54a5b2ef55..757d759c3381b73e8952ccaf7421d916b257546f 100644 (file)
 #endif
 
 
-//const int SKETCH_PLANE_COLOR = Colors::COLOR_BROWN; /// the plane edge color
-const double SKETCH_WIDTH = 4.0; /// the plane edge width
-// face of the square-face displayed for selection of general plane
-const double PLANE_SIZE = 200;
-
-
 /*!Create and return new instance of XGUI_Module*/
 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(XGUI_Workshop* theWshop)
 {
@@ -229,21 +223,7 @@ void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
     std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
     std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
 
-    PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
-    if (aSketchOp) {
-      if ((!aSketchOp->hasSketchPlane()) && (aSelected.size() > 0)) {
-        Handle(AIS_InteractiveObject) aAIS = aSelected.front().interactive();
-        if ((aAIS == myXPlane->impl<Handle(AIS_InteractiveObject)>()) ||
-            (aAIS == myYPlane->impl<Handle(AIS_InteractiveObject)>()) ||
-            (aAIS == myZPlane->impl<Handle(AIS_InteractiveObject)>()) ) {
-
-          Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAIS);
-          aSketchOp->setSketchPlane(aAISShape->Shape());
-        }
-      } else 
-        aSketchOp->mouseReleased(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
-    } else
-      aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
+    aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
   }
 }
 
@@ -281,7 +261,7 @@ void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent)
 
 void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ)
 {
-  erasePlanes();
+  //erasePlanes();
   myWorkshop->viewer()->setViewProjection(theX, theY, theZ);
   myWorkshop->actionsMgr()->update();
 
@@ -364,7 +344,10 @@ void PartSet_Module::onCloseLocalContext()
 
 void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
 {
-  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
+  ModelAPI_EventCreator::get()->sendUpdated(theFeature, 
+    Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+
+/*  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
   // TODO visualizePreview(theFeature, isDisplay, false);
   if (!isDisplay) {
     ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
@@ -377,15 +360,15 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
 
       std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
                                             aLast = aList.end();
-      for (; anIt != aLast; anIt++)
-        visualizePreview((*anIt), false, false);
-      aDisplayer->updateViewer();
+      //TODO for (; anIt != aLast; anIt++)
+      //  visualizePreview((*anIt), false, false);
+      //aDisplayer->updateViewer();
     }
   }
 
   if (theMode == PartSet_OperationSketchBase::FM_Activation ||
       theMode == PartSet_OperationSketchBase::FM_Deactivation)
-    activateFeature(theFeature, true);
+    activateFeature(theFeature, true);*/
 }
 
 ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdId,
@@ -473,54 +456,8 @@ void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
   Events_Loop::loop()->send(aMessage);
 }
 
-boost::shared_ptr<GeomAPI_Shape> getPlane(double theX, double theY, double theZ)
-{
-  boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
-  boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
-  return GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
-}
-
-void PartSet_Module::showPlanes()
-{
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-  // Show selection planes
-  if (!myXPlane) {
-    boost::shared_ptr<GeomAPI_Shape> aPlaneX = getPlane(1, 0, 0);
-    myXPlane = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
-    myXPlane->createShape(aPlaneX);
-    myXPlane->setColor(Colors::COLOR_RED);
-    myXPlane->setWidth(SKETCH_WIDTH);
-  }
-  if (!myYPlane) {
-    boost::shared_ptr<GeomAPI_Shape> aPlaneY = getPlane(0, 1, 0);
-    myYPlane = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
-    myYPlane->createShape(aPlaneY);
-    myYPlane->setColor(Colors::COLOR_GREEN);
-    myYPlane->setWidth(SKETCH_WIDTH);
-  }
-  if (!myZPlane) {
-    boost::shared_ptr<GeomAPI_Shape> aPlaneZ = getPlane(0, 0, 1);
-    myZPlane = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
-    myZPlane->createShape(aPlaneZ);
-    myZPlane->setColor(Colors::COLOR_BLUE);
-    myZPlane->setWidth(SKETCH_WIDTH);
-  }
-  aDisplayer->display(myXPlane, false);
-  aDisplayer->display(myYPlane, false);
-  aDisplayer->display(myZPlane, false);
-  aDisplayer->updateViewer();
-}
-
-void PartSet_Module::erasePlanes()
-{
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-  aDisplayer->erase(myXPlane, false);
-  aDisplayer->erase(myYPlane, false);
-  aDisplayer->erase(myZPlane, false);
-  aDisplayer->updateViewer();
-}
 
-void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
+/*void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
                                       const bool isUpdateViewer)
 {
   ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
@@ -547,19 +484,16 @@ void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
 
   if (isUpdateViewer)
     aDisplayer->updateViewer();
-}
+}*/
 
 void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateViewer)
 {
   ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
-    PartSet_OperationSketch* aOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
-    if (!aOp) {
-      XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-      aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature),
-                                         isUpdateViewer);
-    }
+    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature),
+                                        isUpdateViewer);
   }
 }
 
@@ -588,7 +522,7 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
       boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
     if (!aSPFeature)
       continue;
-    visualizePreview((*anIt), true, false);
+    //visualizePreview((*anIt), true, false);
     aDisplayer->activateInLocalContext((*anIt)->firstResult(), aModes, false);
   }
   aDisplayer->updateViewer();
index 49a41a9ecffd583e736c8a1d420a5c94edbba0db..ac90ea98a02730215a7fc137396dd72d61729d9a 100644 (file)
@@ -56,8 +56,8 @@ public:
   /// \param theFeature the feature instance to be displayed
   /// \param isDisplay the state whether the presentation should be displayed or erased
   /// \param isUpdateViewer the flag whether the viewer should be updated
-  void visualizePreview(FeaturePtr theFeature, bool isDisplay,
-                        const bool isUpdateViewer = true);
+  //void visualizePreview(FeaturePtr theFeature, bool isDisplay,
+  //                      const bool isUpdateViewer = true);
 
   /// Activates the feature in the displayer
   /// \param theFeature the feature instance to be displayed
@@ -157,20 +157,11 @@ protected:
   //! Edits the feature
   void editFeature(FeaturePtr theFeature);
 
-
-  //! Shopws working planes in viewer 3d
-  void showPlanes();
-  void erasePlanes();
-
 private:
   XGUI_Workshop* myWorkshop;
   PartSet_Listener* myListener;
 
   std::map<std::string, std::string> myFeaturesInFiles;
-
-  boost::shared_ptr<GeomAPI_AISObject> myXPlane;
-  boost::shared_ptr<GeomAPI_AISObject> myYPlane;
-  boost::shared_ptr<GeomAPI_AISObject> myZPlane;
 };
 
 #endif
index 44cf5e5a3d2f954c159cbf90a11a818313437784..859dbc93f96e371f65dfc31bb312556f9fc5d81f 100644 (file)
@@ -146,11 +146,11 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
     }
   }
   ObjectPtr aFeature;
-  if (!theSelected.empty()) {
+/* TODO if (!theSelected.empty()) {
     ModuleBase_ViewerPrs aPrs = theSelected.front();
     aFeature = aPrs.object();
-  } else
-    aFeature = feature(); // for the widget distance only
+  } else*/
+  aFeature = feature(); // for the widget distance only
 
   bool isApplyed = setWidgetValue(aFeature, aX, anY);
   if (isApplyed) {
index 88a0e156e94139b6cad956ec126a5493510195bd..8d2b7e5fcf994d60987d0aa801d6c5ea4c7384e2 100644 (file)
@@ -48,7 +48,7 @@ PartSet_OperationSketch::~PartSet_OperationSketch()
 {
 }
 
-std::list<int> PartSet_OperationSketch::getSelectionModes(FeaturePtr theFeature) const
+std::list<int> PartSet_OperationSketch::getSelectionModes(ObjectPtr theFeature) const
 {
   std::list<int> aModes;
   if (!hasSketchPlane())
@@ -95,6 +95,13 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie
     else
       myFeatures = theHighlighted;
 
+  } else {
+    if (!theHighlighted.empty()) {
+      ModuleBase_ViewerPrs aPrs = theHighlighted.front();
+      const TopoDS_Shape& aShape = aPrs.shape();
+      if (!aShape.IsNull())
+        setSketchPlane(aShape);
+    }
   }
 }
 
index 826baf39d1e885fb16d408d97fd0a13cfc555528..1cd920158bfa099b852c12d1ecfbbc40ccc6d99f 100644 (file)
@@ -37,7 +37,7 @@ public:
   /// Returns the operation local selection mode
   /// \param theFeature the feature object to get the selection mode
   /// \return the selection mode
-  virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
+  virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
 
   /// Initializes the operation with previously created feature. It is used in sequental operations
   virtual void initFeature(FeaturePtr theFeature);
index df87c1e3c2b616895a1ddcdaaa9acda36ba5fad4..66da16cfeef25f08ffdab09611acd1ec430b8eb3 100644 (file)
@@ -8,12 +8,13 @@
 #include "SketchPlugin.h"
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
+#include <GeomAPI_IPresentable.h>
 
 /**\class SketchPlugin_Arc
  * \ingroup DataModel
  * \brief Feature for creation of the new arc of circle in PartSet.
  */
-class SketchPlugin_Arc: public SketchPlugin_Feature
+class SketchPlugin_Arc: public SketchPlugin_Feature//, public GeomAPI_IPresentable
 {
 public:
   /// Arc feature kind
index 43c2c982acb95976e9aa555b4badfd9a173c9439..9d923654d49dde4c52a7fce087910754f4376608 100644 (file)
@@ -8,12 +8,13 @@
 #include "SketchPlugin.h"
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
+#include <GeomAPI_IPresentable.h>
 
 /**\class SketchPlugin_Circle
  * \ingroup DataModel
  * \brief Feature for creation of the new circle in PartSet.
  */
-class SketchPlugin_Circle: public SketchPlugin_Feature
+class SketchPlugin_Circle: public SketchPlugin_Feature//, public GeomAPI_IPresentable
 {
 public:
   /// Circle feature kind
index 1f0e100ac37bd6286dd20e2bd6e5dbf451262aa6..9cd5ccff43a88e807def5aab6a57d98b8ea335bc 100644 (file)
 
 using namespace std;
 
+const int SKETCH_PLANE_COLOR = Colors::COLOR_BROWN; /// the plane edge color
+const double SKETCH_WIDTH = 4.0; /// the plane edge width
+// face of the square-face displayed for selection of general plane
+const double PLANE_SIZE = 200;
+
+
 SketchPlugin_Sketch::SketchPlugin_Sketch()
 {
 }
@@ -119,3 +125,37 @@ boost::shared_ptr<GeomAPI_Pln> SketchPlugin_Sketch::plane()
 
   return boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir()));
 }
+
+void addPlane(double theX, double theY, double theZ, std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes)
+{
+  boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
+  boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
+  boost::shared_ptr<GeomAPI_Shape> aFace = 
+    GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
+  theShapes.push_back(aFace);
+}
+
+boost::shared_ptr<GeomAPI_AISObject> SketchPlugin_Sketch::
+  getAISObject(boost::shared_ptr<GeomAPI_AISObject> thePrevious)
+{
+  boost::shared_ptr<GeomDataAPI_Dir> aNorm = 
+    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+
+  if (!aNorm || (aNorm->x() == 0 && aNorm->y() == 0 && aNorm->z() == 0)) {
+    boost::shared_ptr<GeomAPI_AISObject> aAIS = thePrevious;
+    if (!aAIS) {
+      std::list<boost::shared_ptr<GeomAPI_Shape> > aFaces;
+
+      addPlane(1, 0, 0, aFaces); // YZ plane
+      addPlane(0, 1, 0, aFaces); // XZ plane
+      addPlane(0, 0, 1, aFaces); // XY plane
+      boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
+      aAIS = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
+      aAIS->createShape(aCompound);
+      aAIS->setColor(SKETCH_PLANE_COLOR);
+      aAIS->setWidth(SKETCH_WIDTH);
+    }
+    return aAIS;
+  }
+  return boost::shared_ptr<GeomAPI_AISObject>();
+}
index 4fd2a58eb636b0db623407a9b33b8bbe69f00cf9..8a1d22db4701ad7fa263979b921ebc1058e9b67b 100644 (file)
@@ -9,13 +9,14 @@
 #include <SketchPlugin_Feature.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Pln.h>
+#include <GeomAPI_IPresentable.h>
 #include <list>
 
 /**\class SketchPlugin_Sketch
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
  */
-class SketchPlugin_Sketch: public SketchPlugin_Feature
+class SketchPlugin_Sketch: public SketchPlugin_Feature, public GeomAPI_IPresentable
 {
 public:
   /// Sketch feature kind
@@ -91,6 +92,10 @@ public:
 
   /// Returns the basis plane for the sketch
   boost::shared_ptr<GeomAPI_Pln> plane();
+
+  virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
+                            boost::shared_ptr<GeomAPI_AISObject> thePrevious);
+
 protected:
   /// Creates a plane and append it to the list
   /// \param theX the X normal value
index f124270b5b59bff430cb926cc1ab5aa602087cdd..ed92f3845cff22d8ee9102b37f0be743486da20c 100644 (file)
@@ -48,17 +48,17 @@ void XGUI_Displayer::display(ObjectPtr theObject, bool isUpdateViewer)
   } else {
     boost::shared_ptr<GeomAPI_AISObject> anAIS;
 
-    ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
-    if (aResult) {
-      boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
-      if (aShapePtr) {
-        anAIS = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
-        anAIS->createShape(aShapePtr);
-      }
+    GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+    if (aPrs) {
+      anAIS = aPrs->getAISObject(boost::shared_ptr<GeomAPI_AISObject>());
     } else {
-      GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
-      if (aPrs) {
-        anAIS = aPrs->getAISObject(boost::shared_ptr<GeomAPI_AISObject>());
+      ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+      if (aResult) {
+        boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
+        if (aShapePtr) {
+          anAIS = boost::shared_ptr<GeomAPI_AISObject>(new GeomAPI_AISObject());
+          anAIS->createShape(aShapePtr);
+        }
       }
     }
     if (anAIS)
@@ -131,23 +131,27 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
   if (!isVisible(theObject))
     return;
 
-  ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
-  if (aResult) {
-    boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
-    if (aShapePtr) {
-      boost::shared_ptr<GeomAPI_AISObject> aAISObj = getAISObject(theObject);
-      Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj->impl<Handle(AIS_InteractiveObject)>());
-      if (!aAISShape.IsNull()) {
-        aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
-        AISContext()->Redisplay(aAISShape, isUpdateViewer);
-      }
+  boost::shared_ptr<GeomAPI_AISObject> aAISObj = getAISObject(theObject);
+  GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+  if (aPrs) {
+    boost::shared_ptr<GeomAPI_AISObject> aAIS_Obj = aPrs->getAISObject(aAISObj);
+    if (aAISObj && !aAIS_Obj) {
+      erase(theObject, isUpdateViewer);
+      return;
     }
+    Handle(AIS_InteractiveObject) aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
+    AISContext()->Redisplay(aAISIO, isUpdateViewer);
   } else {
-    GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
-    if (aPrs) {
-      boost::shared_ptr<GeomAPI_AISObject> aAISObj = aPrs->getAISObject(getAISObject(theObject));
-      Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
-      AISContext()->Redisplay(aAISIO, isUpdateViewer);
+    ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if (aResult) {
+      boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModuleBase_Tools::shape(aResult);
+      if (aShapePtr) {
+        Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj->impl<Handle(AIS_InteractiveObject)>());
+        if (!aAISShape.IsNull()) {
+          aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
+          AISContext()->Redisplay(aAISShape, isUpdateViewer);
+        }
+      }
     }
   }
 }
@@ -161,6 +165,10 @@ void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult,
     aContext->ClearCurrents(false);
     aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
   }
+/*  std::list<int>::const_iterator anIt;
+  for (anIt = theModes.begin(); anIt != theModes.end(); anIt++)
+    aContext->ActivateStandardMode((TopAbs_ShapeEnum)(*anIt));
+    */
   // display or redisplay presentation
   Handle(AIS_InteractiveObject) anAIS;
   if (isVisible(theResult))