]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Bugs on OCC library.
authornds <natalia.donis@opencascade.com>
Wed, 28 May 2014 06:48:54 +0000 (10:48 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 28 May 2014 06:48:54 +0000 (10:48 +0400)
The selected extracted objects are not cleared in the local selection.

src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_OperationSketchLine.h
src/PartSet/PartSet_TestOCC.cpp [new file with mode: 0644]
src/PartSet/PartSet_TestOCC.h [new file with mode: 0644]
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h

index 7e4e35034339559c403e7ef4276fbc66e64cf2e0..9ccf4e46b3b6ab0eb2153da3030e748e95045b95 100644 (file)
@@ -11,6 +11,7 @@ SET(PROJECT_HEADERS
        PartSet_OperationSketchBase.h
        PartSet_OperationSketch.h
        PartSet_OperationSketchLine.h
+       PartSet_TestOCC.h
        PartSet_Tools.h
 )
 
@@ -21,6 +22,7 @@ SET(PROJECT_SOURCES
        PartSet_OperationSketchBase.cpp
        PartSet_OperationSketch.cpp
        PartSet_OperationSketchLine.cpp
+       PartSet_TestOCC.cpp
        PartSet_Tools.cpp
 )
 
index 355142a31449d3cf0eff57d1dad009b7f04e57f9..63eefc0d0a406ef164a4e938daa62db9df60f979 100644 (file)
@@ -47,7 +47,8 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
       if (myModule->workshop()->displayer()->IsVisible(aFeature) ||
           aType == EVENT_FEATURE_CREATED) {
         myModule->visualizePreview(aFeature, true, false);
-        myModule->activateFeature(aFeature, true);
+        if (aType == EVENT_FEATURE_CREATED)
+          myModule->activateFeature(aFeature, true);
       }
     }
     myModule->workshop()->displayer()->UpdateViewer();
index 94ef5f9268a75228a36eef6becd5cfd2295d0e24..7cd1460300b283fee7df42cfcf54eee08ab3aaa3 100644 (file)
@@ -5,6 +5,7 @@
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_OperationDescription.h>
 #include <PartSet_Listener.h>
+#include <PartSet_TestOCC.h>
 
 #include <ModuleBase_Operation.h>
 
@@ -39,7 +40,6 @@
 #include <QDebug>
 #endif
 
-
 /*!Create and return new instance of XGUI_Module*/
 extern "C" PARTSET_EXPORT XGUI_Module* createModule(XGUI_Workshop* theWshop)
 {
@@ -109,6 +109,12 @@ std::string PartSet_Module::featureFile(const std::string& theFeatureId)
  */
 void PartSet_Module::onFeatureTriggered()
 {
+  //PartSet_TestOCC::testSelection_OCC(myWorkshop->viewer()->AISContext(),
+  //                                   myWorkshop->viewer()->activeView());
+
+  //PartSet_TestOCC::testErase_OCC(myWorkshop->viewer()->AISContext(),
+  //                               myWorkshop->viewer()->activeView());
+
   QAction* aCmd = dynamic_cast<QAction*>(sender());
   //Do nothing on uncheck
   if(aCmd->isCheckable() && !aCmd->isChecked())
@@ -202,6 +208,8 @@ void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ)
 {
   myWorkshop->viewer()->setViewProjection(theX, theY, theZ);
   myWorkshop->actionsMgr()->update();
+
+  //PartSet_TestOCC::testSelection(myWorkshop);
 }
 
 void PartSet_Module::onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature)
index 0a581c178674dce6930742965edf7f1e23c712fa..46b9a05411bad19924e4420dea5a8c7eedfbbe39 100644 (file)
@@ -28,7 +28,7 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
 }
 
 boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
-                                      boost::shared_ptr<ModelAPI_Feature> theFeature) const
+                                      boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   boost::shared_ptr<SketchPlugin_Feature> aFeature = 
                               boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
index f4d01b3a086417f50f4d7802779a9aa61210d8e0..4da9b950332a2e00ea86e667bdc8d0c99fde2caf 100644 (file)
@@ -43,7 +43,7 @@ public:
 
   /// Returns the feature preview shape
   /// \param theFeature the feature object to obtain the preview
-  boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+  static boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature);
 
   /// Returns the map of the operation previews including the nested feature previews
   /// \return the map of feature to the feature preview
index 6b78f03691fb2e8aaaefd3f2ba98ef12510a0b05..d0c08e2865a923167bce06b6dfac85eb97d6dada 100644 (file)
@@ -75,6 +75,14 @@ public:
 
   virtual void keyReleased(std::string theName, QKeyEvent* theEvent);
 
+  /// \brief Save the point to the line.
+  /// \param theFeature the line feature
+  /// \param theX the horizontal coordinate
+  /// \param theY the vertical coordinate
+  /// \param theAttribute the start or end attribute of the line
+  static void setLinePoint(boost::shared_ptr<ModelAPI_Feature>, double theX, double theY,
+                           const std::string& theAttribute);
+
 protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
@@ -106,6 +114,7 @@ protected:
   /// \param theX the horizontal coordnate of the point
   /// \param theY the vertical coordnate of the point
   void setConstraints(double theX, double theY);
+
 protected:
   /// \brief Get the line point 2d coordinates.
   /// \param theFeature the line feature
@@ -122,13 +131,6 @@ protected:
                                                        double theX, double theY);
 
   /// \brief Save the point to the line.
-  /// \param theFeature the line feature
-  /// \param theX the horizontal coordinate
-  /// \param theY the vertical coordinate
-  /// \param theAttribute the start or end attribute of the line
-  void setLinePoint(boost::shared_ptr<ModelAPI_Feature>, double theX, double theY,
-                    const std::string& theAttribute);
-  /// \brief Save the point to the line.
   /// \param thePoint the 3D point in the viewer
   /// \param theAttribute the start or end attribute of the line
   void setLinePoint(const gp_Pnt& thePoint, Handle(V3d_View) theView, const std::string& theAttribute);
diff --git a/src/PartSet/PartSet_TestOCC.cpp b/src/PartSet/PartSet_TestOCC.cpp
new file mode 100644 (file)
index 0000000..846973b
--- /dev/null
@@ -0,0 +1,213 @@
+// File:        PartSet_TestOCC.h
+// Created:     28 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#include <PartSet_TestOCC.h>
+
+#include <XGUI_Workshop.h>
+#include <XGUI_OperationMgr.h>
+#include <XGUI_Displayer.h>
+#include <XGUI_ViewerPrs.h>
+#include <XGUI_ViewerProxy.h>
+#include <PartSet_OperationSketchLine.h>
+
+#include <ModelAPI_Feature.h>
+
+#include <SketchPlugin_Line.h>
+#include <ModelAPI_Document.h>
+
+static double myTestDelta;
+static boost::shared_ptr<ModelAPI_Feature> myTestFeature;
+
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_Shape.hxx>
+#include <V3d_View.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+
+void PartSet_TestOCC::testSelection(XGUI_Workshop* theWorkshop)
+{
+  if (!myTestFeature) {
+    PartSet_TestOCC::createTestLine(theWorkshop);
+    PartSet_TestOCC::moveMouse(theWorkshop->viewer()->AISContext(),
+                               theWorkshop->viewer()->activeView());
+    PartSet_TestOCC::changeTestLine(theWorkshop);
+  }
+  Handle(AIS_InteractiveObject) anIO = theWorkshop->displayer()->GetAISObject(myTestFeature);
+  if (!anIO.IsNull()) {
+    theWorkshop->viewer()->AISContext()->MoveTo(0, 0, theWorkshop->viewer()->activeView());
+    theWorkshop->viewer()->AISContext()->Select(0, 0, 2500, 2500, theWorkshop->viewer()->activeView());
+  }
+}
+
+void PartSet_TestOCC::testSelection_OCC(Handle_AIS_InteractiveContext theContext,
+                                        Handle_V3d_View theView)
+{
+  // 1. Create shape
+  gp_Pnt aPnt1(100, 100, 0);
+  gp_Pnt aPnt2(150, 300, 0);
+  TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aPnt1, aPnt2).Edge();
+
+  // 2. Display shape and activate it in the local context
+  Handle(AIS_Shape) anAIS = new AIS_Shape(anEdge);
+  if (!theContext->HasOpenedContext()) {
+    theContext->ClearCurrents(false);
+    theContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
+  }
+  theContext->Display(anAIS, false);
+  theContext->Load(anAIS, -1, true/*allow decomposition*/);
+  theContext->Activate(anAIS, AIS_Shape::SelectionMode(TopAbs_VERTEX));
+  theContext->Activate(anAIS, AIS_Shape::SelectionMode(TopAbs_EDGE));
+
+  // 3. Change selection in the viewer
+  // emulate rectangle selection in the viewer
+  theContext->Select(0, 0, 2500, 2500, theView);
+
+  // 3. Change the shape of AIS presentation
+  gp_Pnt aPnt3(-100, -100, 0);
+  gp_Pnt aPnt4(200, 200, 0);
+  TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aPnt3, aPnt4).Edge();
+  anAIS->Set(anEdge2);
+  anAIS->Redisplay(Standard_True);
+  theContext->RecomputeSelectionOnly(anAIS);
+
+  // 4. Check the current viewer selection
+  Handle(AIS_InteractiveContext) aContext = theContext;
+  bool isFirstLinePoint = false;
+  bool isShapeSelected = false;
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+    TopoDS_Shape aShape = aContext->SelectedShape();
+    if (aShape.ShapeType() == TopAbs_VERTEX) {
+      const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
+      if (!aVertex.IsNull()) {
+        gp_Pnt aPoint = BRep_Tool::Pnt(aVertex);
+        double aD_1 = aPoint.Distance(aPnt1);
+        double aD_2 = aPoint.Distance(aPnt2);
+        isFirstLinePoint = aD_1 < Precision::Confusion() || aD_2 < Precision::Confusion();
+      }
+    }
+  }
+  if (isFirstLinePoint)
+    std::cout << "Error: The point of the first line should not be selected." << std::endl;
+}
+
+void PartSet_TestOCC::testErase_OCC(Handle_AIS_InteractiveContext theContext,
+                                    Handle_V3d_View theView)
+{
+  // 1. Create shape
+  gp_Pnt aPnt1(100, 100, 0);
+  gp_Pnt aPnt2(150, 300, 0);
+  TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aPnt1, aPnt2).Edge();
+
+  // 2. Display shape and activate it in the local context
+  Handle(AIS_Shape) anAIS = new AIS_Shape(anEdge);
+  if (!theContext->HasOpenedContext()) {
+    theContext->ClearCurrents(false);
+    theContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
+  }
+  theContext->Display(anAIS, false);
+  theContext->Load(anAIS, -1, true/*allow decomposition*/);
+  theContext->Activate(anAIS, AIS_Shape::SelectionMode(TopAbs_VERTEX));
+  theContext->Activate(anAIS, AIS_Shape::SelectionMode(TopAbs_EDGE));
+
+  // 3. Change selection in the viewer
+  // emulate rectangle selection in the viewer
+  theContext->Select(0, 0, 2500, 2500, theView);
+
+  theContext->Erase(anAIS);
+}
+
+void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop)
+{
+  myTestDelta = 80;
+
+  ModuleBase_Operation* anOperation = theWorkshop->operationMgr()->currentOperation();
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+    boost::shared_ptr<ModelAPI_Feature> aSketch;
+
+  if (aPreviewOp) {
+    // create a line
+    boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
+    boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(
+                                                   PartSet_OperationSketchLine::Type().c_str());
+    if (aFeature) // TODO: generate an error if feature was not created
+      aFeature->execute();
+
+    boost::shared_ptr<SketchPlugin_Feature> aSketch = 
+                        boost::dynamic_pointer_cast<SketchPlugin_Feature>(aPreviewOp->sketch());
+    aSketch->addSub(aFeature);
+
+    PartSet_OperationSketchLine::setLinePoint(aFeature, 100, 100, LINE_ATTR_START);
+    PartSet_OperationSketchLine::setLinePoint(aFeature, 150, 300, LINE_ATTR_END);
+
+    boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
+
+    XGUI_Displayer* aDisplayer = theWorkshop->displayer();
+    aDisplayer->Redisplay(aFeature, aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), false);
+    std::list<int> aModes;
+    aModes.push_back(TopAbs_VERTEX);
+    aModes.push_back(TopAbs_EDGE);
+    aDisplayer->ActivateInLocalContext(aFeature, aModes, true);
+
+    // change the line
+    /*double aDelta = -200;
+    for (int i = 0; i < 20; i++) {
+      aDelta = aDelta - i*2;
+      PartSet_OperationSketchLine::setLinePoint(aFeature, 100+aDelta, 200+aDelta, LINE_ATTR_START);
+      PartSet_OperationSketchLine::setLinePoint(aFeature, 300+aDelta, 500+aDelta, LINE_ATTR_END);
+      boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
+
+      theWorkshop->displayer()->Redisplay(aFeature, aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), true);
+
+      int aVal = 90;
+      for (int j = 0; j < 10000000; j++)
+        aVal = aVal/aVal+aVal*2;
+    }*/
+    //std::list<int> aModes;
+    //aModes.clear();
+    //aModes.push_back(TopAbs_VERTEX);
+    //aModes.push_back(TopAbs_EDGE);
+    //aDisplayer->ActivateInLocalContext(aFeature, aModes, true);
+    myTestFeature = aFeature;
+
+    std::list<XGUI_ViewerPrs> aPrs;
+    aPrs.push_back(XGUI_ViewerPrs(myTestFeature, TopoDS_Shape()));
+    aDisplayer->SetSelected(aPrs, true);
+  }
+}
+
+void PartSet_TestOCC::changeTestLine(XGUI_Workshop* theWorkshop)
+{
+  // change the line
+  if (!myTestFeature)
+    return;
+  boost::shared_ptr<ModelAPI_Feature> aFeature = myTestFeature;
+
+  myTestDelta = myTestDelta - 50;
+  double aDelta = myTestDelta;
+  PartSet_OperationSketchLine::setLinePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
+  PartSet_OperationSketchLine::setLinePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
+  boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchLine::preview(aFeature);
+
+  theWorkshop->displayer()->Redisplay(aFeature, aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), true);
+  //std::list<int> aModes;
+  //aModes.clear();
+  //aModes.push_back(TopAbs_VERTEX);
+  //aModes.push_back(TopAbs_EDGE);
+  //aDisplayer->ActivateInLocalContext(aFeature, aModes, true);
+
+  /*std::list<XGUI_ViewerPrs> aPrs;
+  aPrs.push_back(XGUI_ViewerPrs(myTestFeature, TopoDS_Shape()));
+  theWorkshop->displayer()->SetSelected(aPrs, true);*/
+
+  theWorkshop->displayer()->UpdateViewer();
+}
+
+void PartSet_TestOCC::moveMouse(Handle(AIS_InteractiveContext) theContext, Handle(V3d_View) theView)
+{
+  theContext->MoveTo(10, 10, theView);
+  theContext->Select();
+}
\ No newline at end of file
diff --git a/src/PartSet/PartSet_TestOCC.h b/src/PartSet/PartSet_TestOCC.h
new file mode 100644 (file)
index 0000000..5de140c
--- /dev/null
@@ -0,0 +1,55 @@
+// File:        PartSet_TestOCC.h
+// Created:     28 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#ifndef PartSet_TestOCC_H
+#define PartSet_TestOCC_H
+
+#include "PartSet.h"
+
+class XGUI_Workshop;
+class Handle_AIS_InteractiveContext;
+class Handle_V3d_View;
+
+/*!
+ \class PartSet_TestOCC
+ * \brief The operation to test OCC viewer work
+*/
+class PARTSET_EXPORT PartSet_TestOCC
+{
+public:
+  PartSet_TestOCC() {};
+
+  /// Creates a line feature, select it, modify the line. Check whether the highlight is correct.
+  /// \param the workshop to provide an access to the application information
+  static void testSelection(XGUI_Workshop* theWorkshop);
+
+  /// Creates row OCC presentation, activate in the local context, modify it and check selection
+  /// BUG: The result contains the selection from the first presentation
+  /// \param theContext a viewer interactive context
+  /// \param theContext a view
+  static void testSelection_OCC(Handle_AIS_InteractiveContext theContext,
+                                Handle_V3d_View theView);
+
+  /// Creates row OCC presentation, activate in the local context, select it, erase the presentation
+  /// BUG: The selected shape are in the viewer even after erase
+  /// \param theContext a viewer interactive context
+  /// \param theContext a view
+  static void testErase_OCC(Handle_AIS_InteractiveContext theContext,
+                            Handle_V3d_View theView);
+
+private:
+
+  /// Creates a temporary line
+  /// \param the workshop to get the operation manager and the displayer
+  static void createTestLine(XGUI_Workshop* theWorkshop);
+
+  /// Changes a temporary line
+  /// \param the workshop to get the operation manager and the displayer
+  static void changeTestLine(XGUI_Workshop* theWorkshop);
+
+  /// Emulates the mouse moving in the viewer
+  static void moveMouse(Handle_AIS_InteractiveContext theContext, Handle_V3d_View theView);
+};
+
+#endif
index 7e5deb50ed54333a332d96c841dd1b68a05a78d0..d81b6e59fd9a7129ba18ca76e80406769247ed01 100644 (file)
@@ -51,7 +51,7 @@ void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
 
   aContext->Display(anAIS, Standard_False);
   if (isUpdateViewer)
-    aContext->UpdateCurrentViewer();
+    UpdateViewer();
 }*/
 
 
@@ -114,7 +114,7 @@ void XGUI_Displayer::Erase(boost::shared_ptr<ModelAPI_Feature> theFeature,
   myFeature2AISObjectMap.erase(theFeature);
 
   if (isUpdateViewer)
-    aContext->UpdateCurrentViewer();
+    UpdateViewer();
 }
 
 void XGUI_Displayer::Redisplay(boost::shared_ptr<ModelAPI_Feature> theFeature,
@@ -140,13 +140,8 @@ void XGUI_Displayer::Redisplay(boost::shared_ptr<ModelAPI_Feature> theFeature,
       // after. Another workaround to thrown down the selection and reselecting the AIS.
       // If there was a problem here, try the first solution with close/open local context.
       anAIS->Set(theShape);
-      anAIS->Redisplay();
-
-      /*if (aContext->IsSelected(anAIS)) {
-        aContext->AddOrRemoveSelected(anAIS, false);
-        aContext->AddOrRemoveSelected(anAIS, false);
-        //aContext->SetSelected(anAIS, false);
-      }*/
+      anAIS->Redisplay(Standard_True);
+      aContext->RecomputeSelectionOnly(anAIS);
     }
   }
   else {
@@ -154,6 +149,8 @@ void XGUI_Displayer::Redisplay(boost::shared_ptr<ModelAPI_Feature> theFeature,
     myFeature2AISObjectMap[theFeature] = anAIS;
     aContext->Display(anAIS, false);
   }
+  if (isUpdateViewer)
+    UpdateViewer();
 }
 
 void XGUI_Displayer::ActivateInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
@@ -183,7 +180,7 @@ void XGUI_Displayer::ActivateInLocalContext(boost::shared_ptr<ModelAPI_Feature>
   }
 
   if (isUpdateViewer)
-    aContext->UpdateCurrentViewer();
+    UpdateViewer();
 }
 
 void XGUI_Displayer::StopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isStop,
@@ -213,7 +210,7 @@ void XGUI_Displayer::StopSelection(const std::list<XGUI_ViewerPrs>& theFeatures,
     }
   }
   if (isUpdateViewer)
-    aContext->UpdateCurrentViewer();
+    UpdateViewer();
 }
 
 void XGUI_Displayer::SetSelected(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isUpdateViewer)
@@ -241,7 +238,7 @@ void XGUI_Displayer::SetSelected(const std::list<XGUI_ViewerPrs>& theFeatures, c
   }
  
   if (isUpdateViewer)
-    aContext->UpdateCurrentViewer();
+    UpdateViewer();
 }
 
 void XGUI_Displayer::EraseAll(const bool isUpdateViewer)
@@ -261,7 +258,7 @@ void XGUI_Displayer::EraseAll(const bool isUpdateViewer)
   }
   myFeature2AISObjectMap.clear();
   if (isUpdateViewer)
-    ic->UpdateCurrentViewer();
+    UpdateViewer();
 }
 
 void XGUI_Displayer::EraseDeletedFeatures(const bool isUpdateViewer)
@@ -289,7 +286,7 @@ void XGUI_Displayer::EraseDeletedFeatures(const bool isUpdateViewer)
   }
 
   if (isUpdateViewer)
-    aContext->UpdateCurrentViewer();
+    UpdateViewer();
 }
 
 void XGUI_Displayer::CloseLocalContexts(const bool isUpdateViewer)
@@ -297,7 +294,16 @@ void XGUI_Displayer::CloseLocalContexts(const bool isUpdateViewer)
   CloseAllContexts(true);
 }
 
-boost::shared_ptr<ModelAPI_Feature> XGUI_Displayer::GetFeature(Handle(AIS_InteractiveObject) theIO)
+Handle(AIS_InteractiveObject) XGUI_Displayer::GetAISObject(
+                                              boost::shared_ptr<ModelAPI_Feature> theFeature) const
+{
+  Handle(AIS_InteractiveObject) anIO;
+  if (myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end())
+    anIO = (myFeature2AISObjectMap.find(theFeature))->second;
+  return anIO;
+}
+
+boost::shared_ptr<ModelAPI_Feature> XGUI_Displayer::GetFeature(Handle(AIS_InteractiveObject) theIO) const
 {
   boost::shared_ptr<ModelAPI_Feature> aFeature;
   FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(),
@@ -317,7 +323,7 @@ void XGUI_Displayer::CloseAllContexts(const bool isUpdateViewer)
   if (!ic.IsNull()) {
     ic->CloseAllContexts(false);
     if (isUpdateViewer)
-      ic->UpdateCurrentViewer();
+      UpdateViewer();
   }
 }
 
index 4dc28389fe72f1c51ebcfdad13b442142625eb50..6606ebf06fcd0b91d3cd353299a3ed6709f51b4e 100644 (file)
@@ -116,11 +116,16 @@ public:
   /// Updates the viewer
   void UpdateViewer();
 
+  /// Searches the interactive object by feature
+  /// \param feature the feature or NULL if it not visualized
+  /// \return theIO an interactive object
+   Handle(AIS_InteractiveObject) GetAISObject(boost::shared_ptr<ModelAPI_Feature>) const;
+
 protected:
   /// Searches the feature by interactive object
   /// \param theIO an interactive object
   /// \return feature the feature or NULL if it not visualized
-  boost::shared_ptr<ModelAPI_Feature> GetFeature(Handle(AIS_InteractiveObject) theIO);
+  boost::shared_ptr<ModelAPI_Feature> GetFeature(Handle(AIS_InteractiveObject) theIO) const;
   /// Deactivate local selection
   /// \param isUpdateViewer the state wether the viewer should be updated immediatelly
   void CloseAllContexts(const bool isUpdateViewer);