From 24f0cd1c63eb84c378b3785995993a7e4147d952 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 11 Oct 2005 06:14:23 +0000 Subject: [PATCH] To disable picking of outside Gauss Points --- src/OBJECT/VISU_Actor.cxx | 22 +++++++----- src/OBJECT/VISU_Actor.h | 7 ++++ src/OBJECT/VISU_GaussPtsAct.cxx | 61 +++++++++++++++------------------ src/OBJECT/VISU_GaussPtsAct.h | 8 +++-- 4 files changed, 53 insertions(+), 45 deletions(-) diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 89407e70..d52ead3f 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -240,6 +240,13 @@ VISU_Actor return myPipeLine.GetPointer(); } +VISU_PipeLine* +VISU_Actor +::GetCurrentPL() +{ + return GetPipeLine(); +} + //---------------------------------------------------------------------------- void @@ -394,7 +401,7 @@ VISU_Actor if(myIsVTKMapping) return Superclass::GetInput(); - return myPipeLine->GetInput(); + return GetCurrentPL()->GetInput(); } //---------------------------------------------------------------------------- @@ -410,7 +417,7 @@ VISU_Actor if(myIsShrunk) anID = myShrinkFilter->GetNodeObjId(anID); - return myPipeLine->GetNodeObjID(anID); + return GetCurrentPL()->GetNodeObjID(anID); } vtkIdType @@ -420,7 +427,7 @@ VISU_Actor if(myIsVTKMapping) return theID; - return myPipeLine->GetNodeVTKID(theID); + return GetCurrentPL()->GetNodeVTKID(theID); } float* @@ -430,7 +437,7 @@ VISU_Actor if(myIsVTKMapping) return Superclass::GetNodeCoord(theObjID); - return myPipeLine->GetNodeCoord(theObjID); + return GetCurrentPL()->GetNodeCoord(theObjID); } @@ -447,7 +454,7 @@ VISU_Actor if(myIsShrunk) anID = myShrinkFilter->GetElemObjId(anID); - return myPipeLine->GetElemObjID(anID); + return GetCurrentPL()->GetElemObjID(anID); } vtkIdType @@ -457,7 +464,7 @@ VISU_Actor if(myIsVTKMapping) return theID; - return myPipeLine->GetElemVTKID(theID); + return GetCurrentPL()->GetElemVTKID(theID); } vtkCell* @@ -467,7 +474,7 @@ VISU_Actor if(myIsVTKMapping) return Superclass::GetElemCell(theObjID); - return myPipeLine->GetElemCell(theObjID); + return GetCurrentPL()->GetElemCell(theObjID); } @@ -485,7 +492,6 @@ VISU_Actor theIsHighlight); // myAnnotationActor->SetVisibility(0); - bool anIsChanged = false; if(theIsHighlight){ switch(mySelectionMode){ case CellSelection:{ diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index 466010d7..75cfea0f 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -195,6 +195,7 @@ class VTKOCC_EXPORT VISU_Actor : vtkDataSet* GetInput(); + //---------------------------------------------------------------------------- virtual vtkIdType GetNodeObjId(vtkIdType theID); @@ -219,6 +220,7 @@ class VTKOCC_EXPORT VISU_Actor : vtkCell* GetElemCell(vtkIdType theObjID); + //---------------------------------------------------------------------------- protected: VISU_Actor(); @@ -229,6 +231,11 @@ class VTKOCC_EXPORT VISU_Actor : void SetMapperInput(vtkDataSet* theDataSet); + virtual + VISU_PipeLine* + GetCurrentPL(); + + //---------------------------------------------------------------------------- bool myIsVTKMapping; VISU::Prs3d_i* myPrs3d; vtkSmartPointer myPipeLine; diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index a195e3a3..462f9b2e 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -103,7 +103,8 @@ VISU_GaussPtsAct myCellActor(vtkActor::New()), myScalarBarCtrl(VISU_ScalarBarCtrl::New()), myBarVisibility(true), - myPickingSettings(NULL) + myPickingSettings(NULL), + myCurrentPL(NULL) { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<GetMapper(); } float* @@ -210,11 +211,11 @@ VISU_GaussPtsAct return GetMapper()->GetInput(); } -VISU_OpenGLPointSpriteMapper* +VISU_PipeLine* VISU_GaussPtsAct -::GetPSMapper() -{ - return myDeviceActor->GetPSMapper(); +::GetCurrentPL() +{ + return myCurrentPL; } @@ -331,7 +332,7 @@ VISU_GaussPtsAct if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<SetPipeLine(GetGaussPointsPL()); - //vtkLODActor::SetMapper(GetMapper()); + myCurrentPL = myDeviceActor->GetPipeLine(); } void @@ -499,28 +500,10 @@ bool VISU_GaussPtsAct::PreHighlight(SVTK_Selector* theSelector, vtkIdType anObjId = GetNodeObjId( aVtkId ); if(myLastObjPointID != anObjId){ float* aNodeCoord = GetNodeCoord(anObjId); - - // To calculate display (2D) position of the annotation - float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.0}; - // - const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = - myGaussPointsPL->GetGaussPtsIDMapper(); - VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); - - VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId); - VISU::TCellID aCellID = aGaussPointID.first; - VISU::TLocalPntID aLocalPntID = aGaussPointID.second; - std::string aParentName = aParent->GetElemName(aCellID); - // vtkDataSet* aDataSet = GetInput(); vtkCellData* aCellData = aDataSet->GetCellData(); if(vtkDataArray *aScalarArray = aCellData->GetScalars()){ - float aVal = aScalarArray->GetTuple1(aVtkId); float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray); - //float aColor[3]; - //VISU_LookupTable* aLookupTable = myGaussPointsPL->GetMapperTable(); - //aLookupTable->GetColor(aVal,aColor); - // float aPyramidHeight = myPickingSettings->GetPyramidHeight(); aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); myCursorPyramid->Init(aPyramidHeight, @@ -528,11 +511,6 @@ bool VISU_GaussPtsAct::PreHighlight(SVTK_Selector* theSelector, aNodeCoord, myPreHighlightProperty.GetPointer()->GetColor()); } - - if(vtkDataArray *aVectorArray = aCellData->GetVectors()){ - float* aVal = aVectorArray->GetTuple3(aVtkId); - } - myLastObjPointID = anObjId; } myCursorPyramid->SetVisibility(true); @@ -685,13 +663,13 @@ void VISU_GaussPtsAct::highlight(bool theHighlight, myHighlightProperty.GetPointer()->GetColor()); myCursorPyramidSelected->SetVisibility(1); // - const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper= + const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = myGaussPointsPL->GetGaussPtsIDMapper(); - VISU::TNamedIDMapper* aParent=aGaussPtsIDMapper->GetParent(); + VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId); VISU::TCellID aCellID = aGaussPointID.first; - VISU::TLocalPntID aLocalPntID=aGaussPointID.second; + VISU::TLocalPntID aLocalPntID = aGaussPointID.second; aStr<<"\nParentCellID: "<GetElemName(aCellID); if(aParentName != "") { @@ -814,6 +792,7 @@ VISU_GaussPtsAct1 } } + //---------------------------------------------------------------------------- void VISU_GaussPtsAct1 @@ -862,6 +841,8 @@ VISU_GaussPtsAct1 myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL); myOutsideDeviceActor->SetVisibility(false); + + myCurrentPL = myDeviceActor->GetPipeLine(); } if(theWidget){ @@ -870,6 +851,8 @@ VISU_GaussPtsAct1 myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction()); myOutsideDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled()); + + myCurrentPL = myInsideDeviceActor->GetPipeLine(); } Superclass::SetImplicitFunctionWidget(theWidget); @@ -990,6 +973,16 @@ VISU_GaussPtsAct1 default: break; } + + switch(theEvent){ + case vtkCommand::EnableEvent: + myCurrentPL = myInsideDeviceActor->GetPipeLine(); + break; + case vtkCommand::DisableEvent: + myCurrentPL = myDeviceActor->GetPipeLine(); + break; + } + Superclass::OnInteractorEvent(theEvent); } @@ -1040,7 +1033,7 @@ VISU_GaussPtsAct2 if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){ myDeviceActor->SetPipeLine(aPipeLine); - myPipeLine = aPipeLine; + myCurrentPL = aPipeLine; } } diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 28291387..7ddc3f1c 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -99,9 +99,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor vtkDataSet* GetInput(); - VISU_OpenGLPointSpriteMapper* - GetPSMapper(); - //---------------------------------------------------------------------------- virtual void @@ -198,6 +195,10 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor void SetMapperInput(vtkDataSet* theDataSet); + virtual + VISU_PipeLine* + GetCurrentPL(); + //---------------------------------------------------------------------------- vtkSmartPointer myEventCallbackCommand; @@ -222,6 +223,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor VISU_ImplicitFunctionWidget* myWidget; + VISU_GaussPointsPL* myCurrentPL; vtkSmartPointer myGaussPointsPL; vtkIdType myLastObjPointID; -- 2.39.2