From: pkv Date: Mon, 10 Oct 2005 13:44:35 +0000 (+0000) Subject: fix for the Bug GVIEW10181 X-Git-Tag: BR-D5-38-2003_D2005-12-10~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7739da5631cc6c9b003fb81dbd259cabdbe532f7;p=modules%2Fvisu.git fix for the Bug GVIEW10181 --- diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index a3f0cb33..a195e3a3 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -97,12 +97,8 @@ VISU_GaussPtsAct myGaussPointsPL(NULL), myLastObjPointID(-1), myTextActor(VISU_FramedTextActor::New()), - mySphereSource(vtkSphereSource::New()), - mySphereMapper(vtkPolyDataMapper::New()), - mySphereActor(vtkActor::New()), myCursorPyramid(VISU_CursorPyramid::New()), - mySphereSourceSelected(vtkSphereSource::New()), - mySphereActorSelected(vtkActor::New()), + myCursorPyramidSelected(VISU_CursorPyramid::New()), myCellSource(vtkUnstructuredGrid::New()), myCellActor(vtkActor::New()), myScalarBarCtrl(VISU_ScalarBarCtrl::New()), @@ -116,14 +112,8 @@ VISU_GaussPtsAct myDeviceActor->Delete(); myTextActor->Delete(); - mySphereSource->Delete(); - mySphereMapper->Delete(); - mySphereActor->Delete(); - myCursorPyramid->Delete(); - - mySphereSourceSelected->Delete(); - mySphereActorSelected->Delete(); + myCursorPyramidSelected->Delete(); myCellSource->Delete(); myCellActor->Delete(); @@ -137,20 +127,7 @@ VISU_GaussPtsAct myTextActor->SetVisibility(false); myTextActor->SetPickable(false); - - mySphereMapper->SetInput(mySphereSource->GetOutput()); - mySphereActor->SetMapper(mySphereMapper.GetPointer()); - mySphereActor->SetVisibility(false); - mySphereActor->SetPickable(false); - - vtkPolyDataMapper* aSphereMapperSelected = vtkPolyDataMapper::New(); - aSphereMapperSelected->SetInput(mySphereSourceSelected->GetOutput()); - - mySphereActorSelected->SetMapper(aSphereMapperSelected); - mySphereActorSelected->GetProperty()->SetColor(1.0,1.0,1.0); - mySphereActorSelected->SetVisibility(false); - mySphereActorSelected->SetPickable(false); - + // myCellSource->Allocate(); vtkDataSetMapper* aCellMapper = vtkDataSetMapper::New(); aCellMapper->SetInput(myCellSource.GetPointer()); @@ -253,11 +230,10 @@ VISU_GaussPtsAct myDeviceActor->AddToRender(theRenderer); theRenderer->AddActor(myTextActor.GetPointer()); - theRenderer->AddActor(mySphereActor.GetPointer()); - theRenderer->AddActor(mySphereActorSelected.GetPointer()); theRenderer->AddActor(myCellActor.GetPointer()); myCursorPyramid->AddToRender(theRenderer); + myCursorPyramidSelected->AddToRender(theRenderer); myScalarBarCtrl->AddToRender(theRenderer); } @@ -271,12 +247,11 @@ VISU_GaussPtsAct myDeviceActor->RemoveFromRender(theRenderer); - theRenderer->RemoveActor(mySphereActor.GetPointer()); theRenderer->RemoveActor(myTextActor.GetPointer()); - theRenderer->RemoveActor(mySphereActorSelected.GetPointer()); theRenderer->RemoveActor(myCellActor.GetPointer()); myCursorPyramid->RemoveFromRender(theRenderer); + myCursorPyramidSelected->RemoveFromRender(theRenderer); myScalarBarCtrl->RemoveFromRender(theRenderer); } @@ -392,7 +367,7 @@ VISU_GaussPtsAct ::SetBarVisibility(bool theMode) { myBarVisibility = theMode; - myScalarBarCtrl->SetBarVisibility(theMode); + myScalarBarCtrl->SetBarVisibility(theMode); } bool @@ -481,14 +456,14 @@ VISU_GaussPtsAct //---------------------------------------------------------------------------- -bool -VISU_GaussPtsAct -::PreHighlight(SVTK_Selector* theSelector, - vtkInteractorStyle* theInteractorStyle, - SVTK_SelectionEvent* theSelectionEvent, - bool theIsHighlight) +bool VISU_GaussPtsAct::PreHighlight(SVTK_Selector* theSelector, + vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight) { - mySphereActor->SetVisibility(false); + if (!myBarVisibility) { + return false; + } myCursorPyramid->SetVisibility(false); if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight) @@ -528,10 +503,6 @@ VISU_GaussPtsAct // To calculate display (2D) position of the annotation float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.0}; // - // To prepare the annotation text - std::ostringstream aStr; - aStr<<"Global ID: "<GetGaussPtsIDMapper(); VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); @@ -539,44 +510,31 @@ VISU_GaussPtsAct VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId); VISU::TCellID aCellID = aGaussPointID.first; VISU::TLocalPntID aLocalPntID = aGaussPointID.second; - aStr<<"\nParentCellID: "<GetElemName(aCellID); - if(aParentName != "") - aStr<<"\nParentCellName: '"<GetCellData(); if(vtkDataArray *aScalarArray = aCellData->GetScalars()){ float aVal = aScalarArray->GetTuple1(aVtkId); - aStr<<"\nScalar: "<SetCenter(aNodeCoord); float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray); - mySphereSource->SetRadius(aRadius); - - float aColor[3]; - VISU_LookupTable* aLookupTable = myGaussPointsPL->GetMapperTable(); - aLookupTable->GetColor(aVal,aColor); - mySphereActor->GetProperty()->SetColor(aColor); + //float aColor[3]; + //VISU_LookupTable* aLookupTable = myGaussPointsPL->GetMapperTable(); + //aLookupTable->GetColor(aVal,aColor); // float aPyramidHeight = myPickingSettings->GetPyramidHeight(); aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); myCursorPyramid->Init(aPyramidHeight, aRadius, aNodeCoord, - aColor); + myPreHighlightProperty.GetPointer()->GetColor()); } if(vtkDataArray *aVectorArray = aCellData->GetVectors()){ float* aVal = aVectorArray->GetTuple3(aVtkId); - aStr<<"\nVector: {"<SetVisibility(true); myCursorPyramid->SetVisibility(true); myIsPreselected = theIsHighlight; anIsChanged = true; @@ -594,6 +552,9 @@ bool VISU_GaussPtsAct::Highlight(SVTK_Selector* theSelector, SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight) { + if (!myBarVisibility) { + return false; + } vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer(); vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor(); // @@ -669,7 +630,8 @@ VISU_GaussPtsAct::highlight(bool theHighlight, Selection_Mode theSelectionMode) { myTextActor->SetVisibility(0); - mySphereActorSelected->SetVisibility(0); + myCursorPyramidSelected->SetVisibility(0); + myCursorPyramid->SetVisibility(0); myCellActor->SetVisibility(0); GetScalarBarCtrl()->SetIsMarked(false); GetScalarBarCtrl()->Update(); @@ -686,7 +648,7 @@ void VISU_GaussPtsAct::highlight(bool theHighlight, theSelector->GetIndex( getIO(), aMapIndex ); int aNbOfParts = aMapIndex.Extent(); // - if(aNbOfParts!=1) { + if(aNbOfParts!=1 || !myBarVisibility) { return; } // @@ -707,19 +669,22 @@ void VISU_GaussPtsAct::highlight(bool theHighlight, vtkDataArray* aScalarArray = aCellData->GetScalars(); vtkDataArray *aVectorArray = aCellData->GetVectors(); // - // mySphereSourceSelected if(aScalarArray){ aVal = aScalarArray->GetTuple1(aVtkId); aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray); // - mySphereSourceSelected->SetCenter(aNodeCoord); - mySphereSourceSelected->SetRadius(aRadius); - mySphereActorSelected->SetVisibility(1); - // ScalarBarCtrl GetScalarBarCtrl()->SetIsMarked(true); GetScalarBarCtrl()->SetMarkValue(aVal); GetScalarBarCtrl()->Update(); // + float aPyramidHeight = myPickingSettings->GetPyramidHeight(); + aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); + myCursorPyramidSelected->Init(aPyramidHeight, + aRadius, + aNodeCoord, + myHighlightProperty.GetPointer()->GetColor()); + myCursorPyramidSelected->SetVisibility(1); + // const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper= myGaussPointsPL->GetGaussPtsIDMapper(); VISU::TNamedIDMapper* aParent=aGaussPtsIDMapper->GetParent(); diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 1c5d7060..28291387 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -227,16 +227,10 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor vtkIdType myLastObjPointID; vtkSmartPointer myTextActor; - - vtkSmartPointer mySphereSource; - vtkSmartPointer mySphereMapper; - vtkSmartPointer mySphereActor; vtkSmartPointer myCursorPyramid; - - vtkSmartPointer mySphereSourceSelected; - vtkSmartPointer mySphereActorSelected; - + vtkSmartPointer myCursorPyramidSelected; + vtkSmartPointer myCellSource; vtkSmartPointer myCellActor;