Salome HOME
Meet coding standard (fix too long lines).
[modules/shaper.git] / src / XGUI / XGUI_Selection.cpp
index 9e29e8b1b08bf729dd70ae701143b374d9bef318..60fe5e30f296d254f0d42ec2b75136524b02b07e 100644 (file)
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_ObjectsBrowser.h"
 
+#ifndef HAVE_SALOME
+#include <AppElements_ViewCube.h>
+#endif
+
 #include "ModuleBase_BRepOwner.h"
 #include "ModuleBase_ResultPrs.h"
 #include "ModuleBase_ViewerPrs.h"
@@ -196,18 +200,33 @@ void XGUI_Selection::getSelectedInBrowser(QList<ModuleBase_ViewerPrsPtr>& thePre
 void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs,
                                       const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
-  thePrs->setOwner(theOwner);
   Handle(AIS_InteractiveObject) anIO =
                            Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+#ifndef HAVE_SALOME
+  Handle(AppElements_ViewCube) aCube = Handle(AppElements_ViewCube)::DownCast(anIO);
+  if (!aCube.IsNull())
+    return;
+#endif
+
+  thePrs->setOwner(theOwner);
   thePrs->setInteractive(anIO);
 
   // we should not check the appearance of this feature because there can be some selected shapes
   // for one feature
   Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
   if( !aBRO.IsNull() && aBRO->HasShape() ) {
+    TopoDS_Shape aShape = aBRO->Shape();
+    Handle(ModuleBase_ResultPrs) aPrsObj =
+      Handle(ModuleBase_ResultPrs)::DownCast(aBRO->Selectable());
+    if (!aPrsObj.IsNull()) {
+      if (aPrsObj->isSubstituted()) {
+        if (aPrsObj->Shape().IsSame(aShape))
+          aShape = aPrsObj->originalShape();
+      }
+    }
     // the located method is called in the context to obtain the shape by the SelectedShape()
     // method, so the shape is located by the same rules
-    TopoDS_Shape aShape = aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
+    aShape = aShape.Located(aBRO->Location() * aShape.Location());
 #ifdef BEFORE_TRIHEDRON_PATCH
 #ifndef DEBUG_DELIVERY
     if (aShape.IsNull())