From 387ed1448ff2645d3756e6d90258f41b3d7cc720 Mon Sep 17 00:00:00 2001 From: rkv Date: Mon, 20 Nov 2006 14:22:44 +0000 Subject: [PATCH] RKV: Added a flag IsThrough for selection also invisible elements --- src/SVTK/SVTK_RectPicker.cxx | 35 ++++++++++++++++++++++++++++------- src/SVTK/SVTK_RectPicker.h | 6 ++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/SVTK/SVTK_RectPicker.cxx b/src/SVTK/SVTK_RectPicker.cxx index 9aaad409e..bf99c7b61 100644 --- a/src/SVTK/SVTK_RectPicker.cxx +++ b/src/SVTK/SVTK_RectPicker.cxx @@ -91,13 +91,21 @@ namespace //---------------------------------------------------------------------------- +/* RKV void + SelectVisiblePoints(int theSelection[4], + vtkRenderer *theRenderer, + vtkDataSet *theInput, + SVTK_RectPicker::TVectorIds& theVisibleIds, + SVTK_RectPicker::TVectorIds& theInVisibleIds, + vtkFloatingPointType theTolerance) */ void SelectVisiblePoints(int theSelection[4], vtkRenderer *theRenderer, vtkDataSet *theInput, SVTK_RectPicker::TVectorIds& theVisibleIds, SVTK_RectPicker::TVectorIds& theInVisibleIds, - vtkFloatingPointType theTolerance) + vtkFloatingPointType theTolerance, + bool isThrough) // RKV { theVisibleIds.clear(); theInVisibleIds.clear(); @@ -119,8 +127,14 @@ namespace GetCompositePerspectiveTransformMatrix(1,0,1)); // We grab the z-buffer for the selection region all at once and probe the resulting array. - float *aZPtr = theRenderer->GetRenderWindow()-> - GetZbufferData(theSelection[0], theSelection[1], theSelection[2], theSelection[3]); +// RKV float *aZPtr = theRenderer->GetRenderWindow()-> +// RKV GetZbufferData(theSelection[0], theSelection[1], theSelection[2], theSelection[3]); + // RKV : Begin + float *aZPtr = 0; + if (!isThrough) // Use Z-Buffer if only visible points should be taken + aZPtr = theRenderer->GetRenderWindow()-> + GetZbufferData(theSelection[0], theSelection[1], theSelection[2], theSelection[3]); + // RKV : End //cout<<"theSelection = {"<= theSelection[1] && aDX[1] <= theSelection[3]) { //cout<<"aPntId "< TIdsSet; TIdsSet aVisibleIds(aVisiblePntIds.begin(),aVisiblePntIds.end()); @@ -330,6 +348,7 @@ SVTK_RectPicker { this->Tolerance = 0.005; this->PickPoints = 1; + this->myIsThrough = false; // RKV : The old behaviour by default } SVTK_RectPicker @@ -450,7 +469,8 @@ SVTK_RectPicker aMapper->GetInput(), aVisibleIds, anInVisibleIds, - this->Tolerance); +// RKV this->Tolerance); + this->Tolerance, IsThrough()); // RKV if ( aVisibleIds.empty() ) { myPointIdsMap.erase(myPointIdsMap.find(anActor)); } @@ -460,7 +480,8 @@ SVTK_RectPicker theRenderer, aMapper->GetInput(), aVectorIds, - this->Tolerance); +// RKV this->Tolerance); + this->Tolerance, IsThrough()); // RKV if ( aVectorIds.empty() ) { myCellIdsMap.erase(myCellIdsMap.find(anActor)); } diff --git a/src/SVTK/SVTK_RectPicker.h b/src/SVTK/SVTK_RectPicker.h index 3a6576edb..59e152eab 100644 --- a/src/SVTK/SVTK_RectPicker.h +++ b/src/SVTK/SVTK_RectPicker.h @@ -93,6 +93,9 @@ class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker const TVectorIdsMap& GetCellIdsMap() const; + bool IsThrough() { return myIsThrough;} // RKV + void SetIsThrough(bool val) { myIsThrough = val;} // RKV + protected: SVTK_RectPicker(); ~SVTK_RectPicker(); @@ -112,6 +115,9 @@ class SVTK_EXPORT SVTK_RectPicker : public vtkAbstractPropPicker TVectorIdsMap myPointIdsMap; TVectorIdsMap myCellIdsMap; + bool myIsThrough; // RKV : Will the picker take all elements throuth selected + // volume inclung invizible elements + private: virtual int -- 2.39.2