From 2483cd6a99a93f22571a101839270ac2098cf325 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 13 Sep 2017 09:39:59 +0300 Subject: [PATCH] patch for bug of not-selectable bathymetry --- src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx | 32 +++++++++++++++++-------- src/HYDROGUI/HYDROGUI_BathymetryPrs.h | 2 ++ 2 files changed, 24 insertions(+), 10 deletions(-) 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; }; -- 2.39.2