// 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: "<<anObjId;
- const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = myGaussPointsPL->GetGaussPtsIDMapper();
+ const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
+ myGaussPointsPL->GetGaussPtsIDMapper();
VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId);
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);
myCellActor->SetVisibility(0);
//
vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
- vtkRenderWindowInteractor* anIteractor = theInteractorStyle->GetInteractor();
+ vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
//
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
mySelectionMode = aSelectionMode;
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);
GetScalarBarCtrl()->Update();
}
}
- //myTextActor->SetVisibility(aTextVisibility);
- //mySphereActor->SetVisibility(aSphereVisibility);
return bRet;
}
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);
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);
}
}
Superclass::OnInteractorEvent(theEvent);
}
-
#include <vtkObjectFactory.h>
#include <vtkPolyData.h>
#include <vtkRenderer.h>
-
+#include <vtkTextProperty.h>
#include "utilities.h"
#ifdef _DEBUG_
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);
}
-
vtkSmartPointer<vtkActor> myActors[6];
};
-
//============================================================================
#include <vtkTextActor.h>
-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