From: pkv Date: Wed, 5 Oct 2005 11:36:52 +0000 (+0000) Subject: Connect Picking dialog to the functionalities X-Git-Tag: BR-D5-38-2003_D2005-12-10~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d6d0cb7520a3a8c0f40d5152524667977934e64a;p=modules%2Fvisu.git Connect Picking dialog to the functionalities --- diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 2f53679f..b085c154 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -550,12 +550,15 @@ VISU_GaussPtsAct // To calculate display (2D) position of the annotation float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.0}; - myTextActor->Init(aWorldCoord,10.0); + myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition()); + myTextActor->SetWorldPoint(aWorldCoord); + // // To prepare the annotation text std::ostringstream aStr; aStr<<"Global ID: "<GetGaussPtsIDMapper(); + const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = + myGaussPointsPL->GetGaussPtsIDMapper(); VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId); @@ -581,8 +584,10 @@ VISU_GaussPtsAct VISU_LookupTable* aLookupTable = myGaussPointsPL->GetMapperTable(); aLookupTable->GetColor(aVal,aColor); mySphereActor->GetProperty()->SetColor(aColor); - - myCursorPyramid->Init(myGaussPointsPL->GetMaxPointSize(), + // + float aPyramidHeight=myPickingSettings->GetPyramidHeight(); + aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); + myCursorPyramid->Init(aPyramidHeight, aRadius, aNodeCoord, aColor); @@ -632,7 +637,7 @@ VISU_GaussPtsAct myCellActor->SetVisibility(0); // vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer(); - vtkRenderWindowInteractor* anIteractor = theInteractorStyle->GetInteractor(); + vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor(); // Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode; mySelectionMode = aSelectionMode; @@ -680,16 +685,22 @@ VISU_GaussPtsAct theSelector->AddIObject(this); } // + // FlyTo float* aNodeCoord = GetNodeCoord(anObjId); - float aDollyWas = anIteractor->GetDolly(); - anIteractor->SetDolly(0.0); - anIteractor->FlyTo(aRenderer,aNodeCoord); + float aDollyWas = anInteractor->GetDolly(); + int aNumberOfFlyFramesWas=anInteractor->GetNumberOfFlyFrames(); + + anInteractor->SetDolly(0.); + anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber()); + anInteractor->FlyTo(aRenderer,aNodeCoord); aRenderer->ResetCameraClippingRange(); - anIteractor->SetDolly(aDollyWas); + anInteractor->SetDolly(aDollyWas); + anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas); // // To calculate display (2D) position of the annotation float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.}; - myTextActor->Init(aWorldCoord,10); + myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition()); + myTextActor->SetWorldPoint(aWorldCoord); // // Selected mySphereSourceSelected->SetCenter(aNodeCoord); @@ -741,8 +752,6 @@ VISU_GaussPtsAct GetScalarBarCtrl()->Update(); } } - //myTextActor->SetVisibility(aTextVisibility); - //mySphereActor->SetVisibility(aSphereVisibility); return bRet; } @@ -761,6 +770,8 @@ VISU_GaussPtsAct int aNbOfParts = aMapIndex.Extent(); if(!aNbOfParts){ mySphereActorSelected->SetVisibility(0); + GetScalarBarCtrl()->SetIsMarked(false); + GetScalarBarCtrl()->Update(); }else if(aNbOfParts == 1){ int anObjId = aMapIndex(1); vtkIdType aVtkId = GetNodeVTKID(anObjId); @@ -774,7 +785,9 @@ VISU_GaussPtsAct float aVal = aScalarArray->GetTuple1(aVtkId); float aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray); mySphereSourceSelected->SetRadius(aRadius); + GetScalarBarCtrl()->SetIsMarked(true); GetScalarBarCtrl()->SetMarkValue(aVal); + GetScalarBarCtrl()->Update(); } mySphereActorSelected->SetVisibility(1); } @@ -1168,4 +1181,3 @@ VISU_GaussPtsAct2 } Superclass::OnInteractorEvent(theEvent); } - diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index cea0f514..7d6038c5 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -39,7 +39,7 @@ #include #include #include - +#include #include "utilities.h" #ifdef _DEBUG_ @@ -266,33 +266,109 @@ VISU_CursorPyramid myActors[5]->SetOrientation(180., 0. ,0.); } - -//============================================================================ +//================================================================== vtkStandardNewMacro(VISU_GPTextActor); - -//---------------------------------------------------------------------------- -void -VISU_GPTextActor -::Init(const float theWorldPoint[4], - const float theDistance) +//================================================================== +// function : +// purpose : +//================================================================== +VISU_GPTextActor::VISU_GPTextActor() +{ + myModePosition=0;// 0 -centered below the point + // 1 -top left corner of the 3D view window + // + for(int i=0; i<4; i++) { + myWorldPoint[i] = 0.; + } + myDistance=10.; + GetTextProperty()->SetFontSize(12); + GetTextProperty()->ShadowOn(); +} +//================================================================== +// function : SetDistance +// purpose : +//================================================================== +void VISU_GPTextActor::SetDistance(const float theDistance) +{ + myDistance=theDistance; +} +//================================================================== +// function : GetDistance +// purpose : +//================================================================== +float VISU_GPTextActor::GetDistance()const +{ + return myDistance; +} +//================================================================== +// function : SetModePosition +// purpose : +//================================================================== +void VISU_GPTextActor::SetModePosition(const int theMode) { - for(int i = 0; i < 4; i++) + myModePosition=theMode; +} +//================================================================== +// function : GetModePosition +// purpose : +//================================================================== +int VISU_GPTextActor::GetModePosition()const +{ + return myModePosition; +} +//================================================================== +// function : SetWorldPoint +// purpose : +//================================================================== +void VISU_GPTextActor::SetWorldPoint(const float theWorldPoint[4]) +{ + for(int i = 0; i < 4; i++) { myWorldPoint[i] = theWorldPoint[i]; + } } - -int -VISU_GPTextActor -::RenderOpaqueGeometry(vtkViewport *theViewport) +//================================================================== +// function : GetWorldPoint +// purpose : +//================================================================== +const float* VISU_GPTextActor::GetWorldPoint()const { - float aSelectionPoint[3]; - theViewport->SetWorldPoint(myWorldPoint); - theViewport->WorldToDisplay(); - theViewport->GetDisplayPoint(aSelectionPoint); - - aSelectionPoint[0] += myDistance; - aSelectionPoint[1] += myDistance; - - SetPosition(aSelectionPoint); + return myWorldPoint; +} +//================================================================== +// function : RenderOpaqueGeometry +// purpose : +//================================================================== +int VISU_GPTextActor::RenderOpaqueGeometry(vtkViewport *theViewport) +{ + int iScaledText=GetScaledText(); + int iAlignmentPoint=GetAlignmentPoint(); + float * pPosition2=GetPosition2(); + vtkTextProperty *pTextProperty=GetTextProperty(); + // + if (myModePosition==0){ + float aSelectionPoint[3]; + // + theViewport->SetWorldPoint(myWorldPoint); + theViewport->WorldToDisplay(); + theViewport->GetDisplayPoint(aSelectionPoint); + + aSelectionPoint[1] -= myDistance; + pTextProperty->SetJustificationToCentered(); + pTextProperty->SetVerticalJustificationToTop(); + SetAlignmentPoint(-1);/// + SetPosition(aSelectionPoint); + } + else if (myModePosition==1) { + pTextProperty->SetJustificationToLeft(); + pTextProperty->SetVerticalJustificationToTop(); + ScaledTextOff (); + SetPosition2 (1., 1.); + SetAlignmentPoint(6); + SetPosition(0., 0.); + } Superclass::RenderOpaqueGeometry(theViewport); + // + SetAlignmentPoint(iAlignmentPoint); + SetPosition2(pPosition2); + SetScaledText(iScaledText); } - diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.h b/src/OBJECT/VISU_GaussPtsDeviceActor.h index bfc657de..33ace523 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.h +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.h @@ -138,31 +138,37 @@ protected: vtkSmartPointer myActors[6]; }; - //============================================================================ #include -class VISU_GPTextActor : public vtkTextActor +class VISU_GPTextActor : public vtkTextActor { public: vtkTypeMacro(VISU_GPTextActor,vtkTextActor); - static - VISU_GPTextActor* - New(); + static VISU_GPTextActor* New(); - void - Init(const float theWorldPoint[4], - const float theDistance); + void SetWorldPoint(const float theWorldPoint[4]); + + const float* GetWorldPoint()const; + + void SetModePosition(const int theMode); + + int GetModePosition()const; + + void SetDistance(const float theDistance); + + float GetDistance()const; + + virtual int RenderOpaqueGeometry(vtkViewport *theViewport); - virtual - int - RenderOpaqueGeometry(vtkViewport *theViewport); - protected: + VISU_GPTextActor(); + +protected: + int myModePosition; float myWorldPoint[4]; float myDistance; }; - #endif //VISU_GAUSS_PTS_DEVICE_ACTOR_H