From: asl Date: Wed, 13 Sep 2017 06:39:59 +0000 (+0300) Subject: patch for bug of not-selectable bathymetry X-Git-Tag: v2.1~66^2~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e120742bf34de9695c231a25437870c63d5156f5;p=modules%2Fhydro.git patch for bug of not-selectable bathymetry --- diff --git a/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx b/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx index 2bcc235d..e6e427b4 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx @@ -25,39 +25,45 @@ #include #include #include +#include const int BATH_HIGHLIGHT_MODE = 10; HYDROGUI_BathymetryPrs::HYDROGUI_BathymetryPrs() { SetHilightMode( BATH_HIGHLIGHT_MODE ); + SetAutoHilight( Standard_True ); } HYDROGUI_BathymetryPrs::~HYDROGUI_BathymetryPrs() { } -void HYDROGUI_BathymetryPrs::SetPoints( const Handle(TColgp_HArray1OfPnt)& theCoords, - const Handle(Quantity_HArray1OfColor)& theColors ) +void HYDROGUI_BathymetryPrs::UpdateBound() { + Handle(Graphic3d_ArrayOfPoints) points = GetPoints(); myBound.SetVoid(); - if( !theCoords.IsNull() ) + if( !points.IsNull() ) { - int aLower = theCoords->Lower(); - int anUpper = theCoords->Upper(); + int aLower = 1; + int anUpper = points->VertexNumber(); for( int i = aLower; i <= anUpper; i++ ) { + gp_Pnt p = points->Vertice( i ); if( i==aLower ) - myBound.Set( theCoords->Value( i ) ); + myBound.Set( p ); else - { - gp_Pnt aPnt = theCoords->Value( i ); - myBound.Update( aPnt.X(), aPnt.Y(), aPnt.Z() ); - } + myBound.Update( p.X(), p.Y(), p.Z() ); } } +} + +void HYDROGUI_BathymetryPrs::SetPoints( const Handle(TColgp_HArray1OfPnt)& theCoords, + const Handle(Quantity_HArray1OfColor)& theColors ) +{ AIS_PointCloud::SetPoints( theCoords, theColors ); + UpdateBound(); } void HYDROGUI_BathymetryPrs::Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, @@ -67,6 +73,9 @@ void HYDROGUI_BathymetryPrs::Compute( const Handle(PrsMgr_PresentationManager3d) if( theMode==BATH_HIGHLIGHT_MODE ) { thePresentation->Clear(); + if( myBound.IsVoid() ) + UpdateBound(); + if( myBound.IsVoid() || myBound.IsOpenXmin() || myBound.IsOpenXmax() || myBound.IsOpenYmin() || myBound.IsOpenYmax() || @@ -117,6 +126,9 @@ void HYDROGUI_BathymetryPrs::ComputeSelection( const Handle(SelectMgr_Selection) { if( theMode == 0 ) { + if( myBound.IsVoid() ) + UpdateBound(); + if( myBound.IsVoid() || myBound.IsOpenXmin() || myBound.IsOpenXmax() || myBound.IsOpenYmin() || myBound.IsOpenYmax() || diff --git a/src/HYDROGUI/HYDROGUI_BathymetryPrs.h b/src/HYDROGUI/HYDROGUI_BathymetryPrs.h index da9396d8..4f0124fc 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryPrs.h +++ b/src/HYDROGUI/HYDROGUI_BathymetryPrs.h @@ -38,6 +38,8 @@ protected: virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode ); + void UpdateBound(); + private: Bnd_Box myBound; };