Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ShapeBathymetry.cxx
index a647763c0666739308df12281e3cc216078a9e92..b3d390141093fd35b134e305d1bd9d1d8c234022 100644 (file)
@@ -93,19 +93,7 @@ QList<Handle(AIS_InteractiveObject)> HYDROGUI_ShapeBathymetry::createShape() con
 
   return shapes;
 }
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_ViewerSelector.hxx>
-#include <SelectMgr_SensitiveEntitySet.hxx>
-#include <BVH_PrimitiveSet.hxx>
-#include <BVH_QueueBuilder.hxx>
 
-class BVHB_dummy: public BVH_QueueBuilder<double,3>
-{
-  BVHB_dummy();
-  ~BVHB_dummy();
-public:
-  int* getNbThreads() {return &this->myNumOfThreads;}
-};
 void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale)& theColorScale )
 {
   if (!myCoords || getAISObjects().isEmpty())
@@ -123,33 +111,8 @@ void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale
     myColors->SetValue( i, aColor );
   }
   Handle(HYDROGUI_BathymetryPrs) aPntCloud = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObjects()[0] );
-  //const Handle(SelectMgr_Selection)& sel0 =  aPntCloud->Selection(0);
-  //const Handle(SelectMgr_SensitiveEntity)& sens = sel0->Sensitive();
   aPntCloud->SetPoints( myCoords, myColors );
   getContext()->RecomputePrsOnly( aPntCloud, Standard_True );
-  Handle(StdSelect_ViewerSelector3d) VS = getContext()->MainSelector();
-  Handle(SelectMgr_ViewerSelector) VSD = Handle(SelectMgr_ViewerSelector)::DownCast(VS);
-  //size_t VSDsize = sizeof(VSD);
-  size_t VSDsize1 = sizeof(SelectMgr_ViewerSelector);
-  size_t mapSensSize = sizeof(SelectMgr_MapOfObjectSensitives);
-  SelectMgr_MapOfObjectSensitives* mapS = (SelectMgr_MapOfObjectSensitives*)((char*)VSD.get() + (VSDsize1 - mapSensSize));
-  try 
-  {
-    mapS->Size();
-    NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet = mapS->ChangeFind (aPntCloud);
-    NCollection_Handle<BVH_Builder<double,3>> BVH_Builder = anEntitySet->Builder();
-    BVH_QueueBuilder<double,3>* BVH_QB = dynamic_cast<BVH_QueueBuilder<double,3>*>(BVH_Builder.get());
-    int* nbt = static_cast<BVHB_dummy*>(BVH_QB)->getNbThreads();
-    if (*nbt == 1)
-      *nbt = 4;
-  }
-  catch (...)
-  {
-
-  }
-
-  //getContext()->LocalSelector();
-  //aPntCloud->ComputeSelection(sel0, 0);
   getContext()->RecomputeSelectionOnly( aPntCloud );
 }
 
@@ -257,7 +220,9 @@ void HYDROGUI_ShapeBathymetry::RescaleByVisible( OCCViewer_ViewWindow* theWindow
   // For now "complete" is implemented
   Rescale( visible, visible.isEmpty() );
 
+#ifdef _DEBUG
   MESSAGE("Time after rescale:" << t1.elapsed());
+#endif
 }
 
 QVector<int> HYDROGUI_ShapeBathymetry::selected() const
@@ -265,6 +230,8 @@ QVector<int> HYDROGUI_ShapeBathymetry::selected() const
   QVector<int> selected;
   selected.reserve( myCoords->Size() );
 
+  Handle(AIS_InteractiveObject) obj = getAISObjects().first();
+
   Handle(AIS_InteractiveContext) c = getContext();
   if( !c.IsNull() )
   {
@@ -275,7 +242,7 @@ QVector<int> HYDROGUI_ShapeBathymetry::selected() const
       {
         Handle(HYDROGUI_BathymetryPointOwner) anOwner = 
           Handle(HYDROGUI_BathymetryPointOwner)::DownCast( lc->SelectedOwner() );
-        if( anOwner )
+        if( !anOwner.IsNull() && anOwner->Selectable()==obj )
           selected.append( anOwner->GetIndex() );
       }
     }
@@ -294,16 +261,16 @@ void HYDROGUI_ShapeBathymetry::RescaleBySelection()
 
 void HYDROGUI_ShapeBathymetry::Rescale( double theMin, double theMax )
 {
-  getContext()->ClearSelected();
+  getContext()->ClearSelected(true);
   myMin = qMin( theMin, theMax );
   myMax = qMax( theMin, theMax );
   setToUpdateColorScale( true );
 
   if( !getAISObjects().isEmpty() )
   {
-    getContext()->RecomputePrsOnly( getAISObjects()[0] );
+    getContext()->RecomputePrsOnly( getAISObjects()[0], true );
     //getAISObjects()[0]->Redisplay();
-  }
+}
 }
 
 void HYDROGUI_ShapeBathymetry::RescaleDefault()
@@ -338,7 +305,7 @@ void HYDROGUI_ShapeBathymetry::Build()
   buildShape();
 }
 
-void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn )
+void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn, bool isUpdateCurrentViewer )
 {
   if( getAISObjects().isEmpty() )
     return;
@@ -351,9 +318,11 @@ void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn )
   if( isOn )
     selection = selected();
 
-  getContext()->ClearSelected();
+
+  //getContext()->ClearSelected(true);
   prs->SetTextLabels( selection );
-  getContext()->RecomputePrsOnly( prs );
+  getContext()->RecomputePrsOnly( prs, Standard_False, Standard_False );
   //prs->Redisplay();
+  if( isUpdateCurrentViewer )
   getContext()->UpdateCurrentViewer();
 }