Salome HOME
Updates for stability of application
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
index 4073b30b435838c86319ab4286eb1c3e558488b9..7e5deb50ed54333a332d96c841dd1b68a05a78d0 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <set>
 
+const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity
+
 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
 {
   myWorkshop = theWorkshop;
@@ -53,7 +55,7 @@ void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
 }*/
 
 
-std::list<XGUI_ViewerPrs> XGUI_Displayer::GetSelected()
+std::list<XGUI_ViewerPrs> XGUI_Displayer::GetSelected(const int theShapeTypeToSkip)
 {
   std::set<boost::shared_ptr<ModelAPI_Feature> > aPrsFeatures;
   std::list<XGUI_ViewerPrs> aPresentations;
@@ -62,6 +64,8 @@ std::list<XGUI_ViewerPrs> XGUI_Displayer::GetSelected()
   for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
     Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
     TopoDS_Shape aShape = aContext->SelectedShape();
+    if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
+      continue;
 
     boost::shared_ptr<ModelAPI_Feature> aFeature = GetFeature(anIO);
     if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
@@ -72,7 +76,7 @@ std::list<XGUI_ViewerPrs> XGUI_Displayer::GetSelected()
   return aPresentations;
 }
 
-std::list<XGUI_ViewerPrs> XGUI_Displayer::GetHighlighted()
+std::list<XGUI_ViewerPrs> XGUI_Displayer::GetHighlighted(const int theShapeTypeToSkip)
 {
   std::set<boost::shared_ptr<ModelAPI_Feature> > aPrsFeatures;
   std::list<XGUI_ViewerPrs> aPresentations;
@@ -81,6 +85,8 @@ std::list<XGUI_ViewerPrs> XGUI_Displayer::GetHighlighted()
   for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
     Handle(AIS_InteractiveObject) anIO = aContext->DetectedInteractive();
     TopoDS_Shape aShape = aContext->DetectedShape();
+    if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
+      continue;
 
     boost::shared_ptr<ModelAPI_Feature> aFeature = GetFeature(anIO);
     if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
@@ -119,6 +125,9 @@ void XGUI_Displayer::Redisplay(boost::shared_ptr<ModelAPI_Feature> theFeature,
   if (!aContext->HasOpenedContext()) {
     aContext->ClearCurrents(false);
     aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
+    // set mouse sensitivity
+    //aContext->SetSensitivityMode(StdSelect_SM_WINDOW);
+    //aContext->SetPixelTolerance(MOUSE_SENSITIVITY_IN_PIXEL);
   }
   // display or redisplay presentation
   Handle(AIS_Shape) anAIS;