Salome HOME
refs #1463: errors in text labels on 2 bathymetries
authorasl <asl@opencascade.com>
Mon, 4 Dec 2017 13:12:35 +0000 (16:12 +0300)
committerasl <asl@opencascade.com>
Mon, 4 Dec 2017 13:12:35 +0000 (16:12 +0300)
src/HYDROGUI/HYDROGUI_BathymetryOp.cxx
src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx
src/HYDROGUI/HYDROGUI_ShapeBathymetry.h

index 2ea789668fdf5819dfed1121888772041006f704..b0d6eff7baaaeefb08c8d1d20685e69296fd706b 100644 (file)
@@ -141,7 +141,7 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
   case BathymetryTextId:
     {
       foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
-        bath->GetShape()->TextLabels( isActivate );
+        bath->GetShape()->TextLabels( isActivate, bath==baths.last() );
       //commit();
       if( isActivate )
         connect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
@@ -238,7 +238,7 @@ void HYDROGUI_BathymetryOp::onSelectionChanged()
   if( myMode==BathymetryTextId )
   {
     foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
-      bath->GetShape()->TextLabels( true );
+      bath->GetShape()->TextLabels( true, bath==baths.last() );
   }
 
   qApp->restoreOverrideCursor();
index b7ce559447122e799271f76496d8427fc08daa61..7f8c604f30cc8921bb0e4761bb0f7734bcc23b48 100644 (file)
@@ -265,6 +265,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 +277,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() );
       }
     }
@@ -338,7 +340,7 @@ void HYDROGUI_ShapeBathymetry::Build()
   buildShape();
 }
 
-void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn )
+void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn, bool isUpdateCurrentViewer )
 {
   if( getAISObjects().isEmpty() )
     return;
@@ -353,7 +355,8 @@ void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn )
 
   //getContext()->ClearSelected();
   prs->SetTextLabels( selection );
-  getContext()->RecomputePrsOnly( prs );
+  getContext()->RecomputePrsOnly( prs, Standard_False, Standard_False );
   //prs->Redisplay();
-  getContext()->UpdateCurrentViewer();
+  if( isUpdateCurrentViewer )
+    getContext()->UpdateCurrentViewer();
 }
index e6ee5130cf709a9881d33f3673951ef93602fd6d..e88d09119c760c748b641aa51b257b52310565c4 100644 (file)
@@ -49,7 +49,7 @@ public:
   // Default re-scale (by all points)
   void RescaleDefault();
 
-  void TextLabels( bool isOn );
+  void TextLabels( bool isOn, bool isUpdateCurrentViewer=true );
 
   virtual void display( const bool theIsUpdateViewer = true );
   virtual void erase( const bool theIsUpdateViewer = true );