From 9ba8edaae389f7a2d38821b03245f8c44314938f Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Sat, 19 Sep 2020 16:36:00 +0200 Subject: [PATCH] some tests on bathy selection... --- src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx | 55 ++++++++++--------- .../HYDROGUI_BathymetrySelectionOp.cxx | 5 +- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx b/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx index a7ade032..0c9a9587 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx @@ -205,7 +205,7 @@ void HYDROGUI_BathymetryPrs::ComputeSelection( const Handle(SelectMgr_Selection) case 1: { DEBTRACE("Subset of points detection"); - AIS_PointCloud::ComputeSelection( theSelection, SM_SubsetOfPoints ); + AIS_PointCloud::ComputeSelection( theSelection, SM_SubsetOfPoints ); // SM_Points ? break; } default: @@ -265,49 +265,54 @@ void HYDROGUI_BathymetryPrs::AddPoint( const Handle(Graphic3d_ArrayOfPoints)& th const Handle(SelectMgr_EntityOwner)& theOwner ) { DEBTRACE("AddPoint"); - Handle(HYDROGUI_BathymetryPointOwner) anOwner = Handle(HYDROGUI_BathymetryPointOwner)::DownCast( theOwner ); + Handle(AIS_PointCloudOwner) anOwner = Handle(AIS_PointCloudOwner)::DownCast( theOwner ); if( anOwner.IsNull() ) return; - gp_Pnt p = GetPoint( anOwner->GetIndex() ); - thePoints->AddVertex( p ); +// gp_Pnt p = GetPoint( anOwner->GetIndex() ); +// thePoints->AddVertex( p ); } void HYDROGUI_BathymetryPrs::HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM, const Handle(Prs3d_Drawer)& theColor, const Handle(SelectMgr_EntityOwner)& theOwner ) { - DEBTRACE("HilightOwnerWithColor"); - Handle(Prs3d_Presentation) aHilightPrs = GetHilightPresentation( thePM ); - aHilightPrs->SetZLayer( Graphic3d_ZLayerId_Topmost ); - aHilightPrs->Clear(); - Handle(Graphic3d_ArrayOfPoints) points = new Graphic3d_ArrayOfPoints( 1 ); - AddPoint( points, theOwner ); - - Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aHilightPrs ); - Handle(Graphic3d_AspectMarker3d) anAspect = new Graphic3d_AspectMarker3d( Aspect_TOM_X, Quantity_NOC_WHITE, 1.0 ); - aGroup->SetGroupPrimitivesAspect( anAspect ); - aGroup->AddPrimitiveArray( points ); - - if( thePM->IsImmediateModeOn() ) - thePM->AddToImmediateList( aHilightPrs ); + DEBTRACE("HilightOwnerWithColor"); // appel si AIS_PointCloud::ComputeSelection( theSelection, SM_Points); + Handle(AIS_PointCloudOwner) anOwner = Handle(AIS_PointCloudOwner)::DownCast( theOwner ); + if (anOwner.IsNull()) + return; + DEBTRACE("---"); // jamais appelé : on n'a pas de AIS_PointCloudOwner + +// Handle(Prs3d_Presentation) aHilightPrs = GetHilightPresentation( thePM ); +// aHilightPrs->SetZLayer( Graphic3d_ZLayerId_Topmost ); +// aHilightPrs->Clear(); +// Handle(Graphic3d_ArrayOfPoints) points = new Graphic3d_ArrayOfPoints( 1 ); +// AddPoint( points, theOwner ); +// +// Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aHilightPrs ); +// Handle(Graphic3d_AspectMarker3d) anAspect = new Graphic3d_AspectMarker3d( Aspect_TOM_X, Quantity_NOC_WHITE, 1.0 ); +// aGroup->SetGroupPrimitivesAspect( anAspect ); +// aGroup->AddPrimitiveArray( points ); +// +// if( thePM->IsImmediateModeOn() ) +// thePM->AddToImmediateList( aHilightPrs ); } void HYDROGUI_BathymetryPrs::HilightSelected( const Handle(PrsMgr_PresentationManager3d)& thePM, const SelectMgr_SequenceOfOwner& theOwners ) { - DEBTRACE("HilightSelected " << theOwners.Size()); + DEBTRACE("HilightSelected " << theOwners.Size()); // appel si AIS_PointCloud::ComputeSelection( theSelection, SM_SubsetOfPoints ); + //AIS_PointCloud::HilightSelected(thePM, theOwners); // Non, fige la machine ! if (theOwners.Size() == 0) return; Handle(SelectMgr_EntityOwner) owner = theOwners.First(); Handle(AIS_PointCloudOwner) anOwner = Handle(AIS_PointCloudOwner)::DownCast( owner ); if (anOwner.IsNull()) return; - Handle(TColStd_HPackedMapOfInteger) thePointsH = anOwner->SelectedPoints(); - TColStd_PackedMapOfInteger thePoints = thePointsH->Map(); - DEBTRACE("thePoints.Extent() :" << thePoints.Extent()); - Handle(TColStd_HPackedMapOfInteger) thePointsDH = anOwner->DetectedPoints(); - TColStd_PackedMapOfInteger thePointsD = thePointsDH->Map(); - DEBTRACE("thePointsD.Extent() :" << thePointsD.Extent()); + DEBTRACE("immediateMode: " << thePM->IsImmediateModeOn()); // semble sans effet + const Handle(TColStd_HPackedMapOfInteger)& aSMap = anOwner->SelectedPoints(); + DEBTRACE("selectedPoints.Extent() :" << aSMap->Map().Extent()); + const Handle(TColStd_HPackedMapOfInteger)& aDMap = anOwner->DetectedPoints(); + DEBTRACE("detectedPoints.Extent() :" << aDMap->Map().Extent()); // Handle(Prs3d_Presentation) aSelectPrs = GetSelectPresentation( thePM ); diff --git a/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx b/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx index b9a7d1a6..577eb7a1 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx @@ -115,7 +115,10 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) ctx->Deactivate(bath); //ctx->Activate( bath, aSelectionMode, Standard_True ); ctx->SetSelectionModeActive (bath, aSelectionMode, Standard_True, AIS_SelectionModesConcurrency_Multiple, Standard_False); - bath->SetAutoHilight( Standard_False ); + bath->SetAutoHilight( Standard_False ); // True bloque le passage dans hilightSelected... +// DEBTRACE("immediateMode: " << ctx->MainPrsMgr()->IsImmediateModeOn()); +// if (!ctx->MainPrsMgr()->IsImmediateModeOn()) +// ctx->MainPrsMgr()->BeginImmediateDraw(); } ctx->UpdateCurrentViewer(); } -- 2.39.2