From: pkv Date: Tue, 4 Oct 2005 14:05:10 +0000 (+0000) Subject: synchonization of highlight between two views X-Git-Tag: BR-D5-38-2003_D2005-12-10~68 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=61f03db3a715eb4f3a09fb6ade25d4f5e57248fd;p=modules%2Fvisu.git synchonization of highlight between two views --- diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index f8583ce5..668696cf 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -81,7 +81,9 @@ static int MYDEBUG = 0; static int MYDEBUG1 = 0; static int MYDEBUG2 = 0; #endif - +//modified by NIZNHY-PKV Tue Oct 4 16:00:12 2005f +static float s_Radius=0; +//modified by NIZNHY-PKV Tue Oct 4 16:00:15 2005t //---------------------------------------------------------------- vtkStandardNewMacro( VISU_OutsideCursorSettings ); vtkStandardNewMacro( VISU_PickingSettings ); @@ -661,6 +663,7 @@ VISU_GaussPtsAct } // vtkIdType aVtkId = myPointPicker->GetPointId(); + printf(" * Highlight() aVtkId=%d\n", aVtkId); if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) && hasIO()) { vtkIdType anObjId = GetNodeObjId( aVtkId ); if(anObjId >= 0){ @@ -696,6 +699,9 @@ VISU_GaussPtsAct if(vtkDataArray* aScalarArray = aCellData->GetScalars()){ float aVal = aScalarArray->GetTuple1(aVtkId); float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray); + //modified by NIZNHY-PKV Tue Oct 4 16:00:45 2005f + s_Radius=aRadius; + //modified by NIZNHY-PKV Tue Oct 4 16:00:47 2005t mySphereSourceSelected->SetRadius(aRadius); // if(theSelector->HasIndex(myIO)){ @@ -853,7 +859,46 @@ VISU_GaussPtsAct //mySphereActor->SetVisibility(aSphereVisibility); return bRet; } - +//================================================================== +// function : highlight +// purpose : +//================================================================== +void VISU_GaussPtsAct::highlight(bool theHighlight, + SVTK_Selector* theSelector) +{ + Superclass::highlight(theHighlight, theSelector); + // + TColStd_IndexedMapOfInteger aMapIndex; + theSelector->GetIndex( getIO(), aMapIndex ); + int aNbOfParts = aMapIndex.Extent(); + if (!aNbOfParts){ + mySphereActorSelected->SetVisibility(0); + } + else if (aNbOfParts==1){ + int anObjId = aMapIndex(1); + vtkIdType aVtkId; + float* aNodeCoord = GetNodeCoord(anObjId); + printf(" *highlight() anObjId=%d { %f, %f, %f }\n", + anObjId, aNodeCoord[0], aNodeCoord[1], aNodeCoord[2]); + mySphereSourceSelected->SetCenter(aNodeCoord); + //mySphereSourceSelected->SetRadius(s_Radius); + // + + aVtkId=myGaussPointsPL->GetElemVTKID(anObjId); + printf(" aVtkId=%d\n", aVtkId); + vtkDataSet* aDataSet = GetInput(); + vtkCellData* aCellData = aDataSet->GetCellData(); + if(vtkDataArray* aScalarArray = aCellData->GetScalars()){ + float aVal = aScalarArray->GetTuple1(aVtkId); + float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray); + mySphereSourceSelected->SetRadius(aRadius); + // + GetScalarBarCtrl()->SetMarkValue(aVal); + } + + mySphereActorSelected->SetVisibility(1); + } +} //---------------------------------------------------------------- void VISU_GaussPtsAct diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 8456a26f..330f9b03 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -257,8 +257,13 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor void SetPickingSettings(VISU_PickingSettings* thePickingSettings); + void UpdatePickingSettings(); + + virtual void - UpdatePickingSettings(); + highlight(bool theHighlight, + SVTK_Selector* theSelector); + protected: //---------------------------------------------------------------------------- diff --git a/src/PIPELINE/SALOME_ExtractGeometry.cxx b/src/PIPELINE/SALOME_ExtractGeometry.cxx index 5f7d30ec..896fcea7 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.cxx +++ b/src/PIPELINE/SALOME_ExtractGeometry.cxx @@ -99,7 +99,58 @@ SALOME_ExtractGeometry { return myStoreMapping; } +//modified by NIZNHY-PKV Tue Oct 4 16:52:22 2005f +//---------------------------------------------------------------------------- +vtkIdType +SALOME_ExtractGeometry +::GetElemVTKId(int theObjID) +{ + if (myElemVTK2ObjIds.empty()) + return theObjID; + + int i, aNb; + vtkIdType anObjId, aVTKId=-1; + // + aNb=myElemVTK2ObjIds.size(); + for (i=0; iGetElemVTKID(theID); + vtkIdType anID = myExtractGeometry->GetElemVTKId(theID); + return myIDMapper->GetElemVTKID(anID); + + //return myIDMapper->GetElemVTKID(theID); } vtkCell*